Back to Blog
Reference SystemsTechnical Note

Building Legal Research Around CourtListener Sources

Blackletter retrieves CourtListener opinions before drafting a research memo, keeping source records separate from the generated text.

November 12, 20253 min read
Legal ResearchCourtListenerCitationsSource Retrieval

Blackletter searches CourtListener for US court opinions and drafts research memos from retrieved text. It is an independent reference system, not a legal-advice service.

Let the reader see the sources first

The search route returns case names, snippets, citations, dates, and source links without calling a model. Analysis retrieves text for selected opinions before preparing the draft. A search result alone does not establish that the opinion text is available.

The client example below made search and analysis requests together. Source cards could appear while the memo was still arriving, and both requests shared an abort signal for cancellation.

Frontend example starting separate CourtListener search and analysis requests with one shared abort signal.
Two requests sharing a cancellation signal.

Give each opinion room in the prompt

Court opinions vary in length. The context builder normalized whitespace and divided a character budget across the selected records, retaining the case ID, title, citation, and URL beside each passage.

Context builder example dividing a character budget between opinion records with a minimum per-case allocation.
Per-case trimming with source metadata retained.

The 1,500-character minimum in this example could exceed the total target when many cases were supplied. Truncation markers also added characters. The function apportioned text; it was not an exact token-budget check.

Numbered references identify the sources supplied to the model. They are separate from the legal citations in the CourtListener records, and they do not verify that a generated statement follows from the opinion. Blackletter also does not determine whether an opinion remains good law.

The individual case-summary route returns a text-unavailable response when it cannot retrieve enough opinion text. That prevents a missing document from becoming an invitation to draft from model memory.

Check usage before another paid request

The gate below counted requests in a fixed window and checked recorded monthly spend before analysis. Without Redis, the function returned without enforcing either check. Its spend lookup also did not reserve the cost of requests already in flight, so the configured threshold was not a guaranteed billing ceiling.

Redis request and spend check example that returns without enforcement when no Redis client is configured.
Gate example with an unconfigured-Redis bypass.

October 13, 2026 update: the public build sends sources and draft text through one stream. Its configured safety gate rejects requests when Redis is unavailable. The examples above show a separate-request design with a permissive gate.

Have a similar project?

Talk to Me