DocumentationBrowse
How grounding works
Grounding is retrieval that happens inside the completion call. You do not orchestrate it, and you cannot see it from the outside except through the report it leaves behind. This page is what actually runs, in order, on a default request.
Everything on this page is controlled by the docketrouter block on the request, documented field by field in Chat completions.
The pipeline, in order
- Query construction. Your last user message becomes the retrieval query, whitespace collapsed and truncated to 600 characters. If that message contains a line reading
QUESTIONfollowed by 20 to 1200 characters of text, only the text after it is used. That is the escape hatch for prepending a long record without drowning the query. - Rule and statute retrieval (
rules: true). Up to 6 excerpts are scored with BM25 against the query and injected verbatim, each capped at 1,600 characters, with its short cite and title. Rule numbers in your question are boosted: a query mentioningRule 12(b)(6),FRE 803orTRCP 166agets those tokens expanded before the search runs. These are quotable text, not summaries. - Case retrieval (
cases: true). The fused index is queried first, against the shards selected byjurisdiction. If it returns hits, the top 5 are used. If it returns nothing, fallback sources are tried, for a maximum of 4 combined. Cases are offered to the model as leads, with an explicit instruction to verify holdings before relying on them. - Prompt citation check (
verify: true). Up to 8 reporter citations found in your own prompt are extracted and checked. Results land insources.citationsand are also shown to the model, so it knows before answering whether a case you named is real. See Citation verification. - Case file (
case_file: true). Up to 6 chunks of your own documents are selected, screened and fenced. See Case files and injection. - Prompt assembly. The persona, the retrieved authorities, the related cases, the citation checks, the quarantined client file and any degradation notice are concatenated into one system prompt, in that order.
- Answer verification (
verify: true). After the model returns, up to 12 unique reporter citations in the answer are checked the same way, and a fabrication can trigger one rewrite.
Grounding happens before the request is checked against the callable-model allowlist, so a request naming a model that is off still pays the retrieval latency before returning 400. It also consumes a rate-limit token. Validate the model name in your own client if you route dynamically.
What is in the rules corpus
6,093 excerpts across federal rules, two state practice codes, selected US Code titles and selected Texas codes.
This is the corpus that gets injected verbatim. It is deliberately narrow and hand-selected rather than a scrape of everything: an excerpt only earns its place if a practitioner would quote it.
| Group | Sets | Excerpts |
|---|---|---|
| Federal rules | FRCP, FRE, FRAP (frcp, fre, frap) | 595 |
| Texas rules | TRCP, TRE, TRAP (trcp, tre, trap) | 1,413 |
| Other state practice | New York CPLR, California Code of Civil Procedure (cplr, ccp) | 107 |
| United States Code | Selected titles: securities, bankruptcy, UCMJ, antitrust, wiretap, arbitration, FSIA, admiralty, tribal, diplomatic, space, cultural property, extradition (usc…) | 1,712 |
| Texas codes | Civil Practice and Remedies, Business and Commerce, Property, Finance (tx…) | 140 |
The shape of one excerpt
{
"id": "frcp-12-1",
"set": "frcp",
"source": "Federal Rules of Civil Procedure", // absent on the US Code and Texas code sets
"cite": "Fed. R. Civ. P. 12",
"title": "Rule 12. Defenses and Objections…",
"url": "https://www.law.cornell.edu/rules/frcp/rule_12", // absent on some sets
"text": "(a) Time to Serve a Responsive Pleading. …", // capped at 1,600 characters
"score": 29.14 // BM25, not a probability
}source and url are present on the rule sets and the two out-of-state practice codes, and absent on the US Code and Texas code sets. If you render a citation link, guard for the missing URL rather than assuming it.
Rule retrieval is not filtered by jurisdiction. A federal question can surface a Texas rule and the other way round, because the scoring is textual. The model is told in its standing instructions to flag jurisdiction, and you should treat set as the authoritative signal for which body of law an excerpt came from.
Where the opinions come from
Case retrieval has a primary source and a fallback path, and they are not equivalent. Which one served your request is visible in the source field on each hit.
| Order | Source | Marker | Notes |
|---|---|---|---|
| 1 | The fused DocketRouter index | tx, statutes, scotus, local | Texas appellate opinions, Texas statutes, Supreme Court opinions and county local rules, selected per jurisdiction. Up to 5 hits. |
| 2 | Fallback sources | no source field | Used only when the fused index returns no hits, and only when the question looks like it wants cases. Up to 4 combined. |
{
"source": "scotus",
"name": "Murphy Brothers, Inc. v. Michetti Pipe Stringing, Inc.",
"citation": ["…"], // reporter cites when the index has them; can hold the case name instead
"court": "us-scotus",
"date": "1999-04-05",
"url": "", // empty for index hits, a source URL for fallback hits
"snippet": "Notably, Federal Rule of Civil Procedure 81(c) …"
}A hit in sources.cases means the opinion scored well against the query text. It does not mean the opinion supports the answer. The prompt says so to the model, and your interface should say so to the user.
Jurisdiction and index shards
docketrouter.jurisdiction selects which shards of the fused index are searched.
The value resolves in this order: the jurisdiction field on the request, then the setting on the key, then tx. An unrecognised value falls back to tx rather than erroring. The resolved value is echoed in docketrouter.jurisdiction and written to your usage row.
| Value | Shards searched | Effect |
|---|---|---|
tx | tx, statutes, scotus, local | The default. Includes the Texas appellate opinion shard. |
fed | scotus, statutes, local | Drops the Texas opinion shard, so Supreme Court authority dominates. |
ca | statutes, scotus, local | Same shard set as fed today. |
ny | statutes, scotus, local | Same shard set as fed today. |
There is no California or New York opinion shard in the fused index, so ca and ny currently select the same shards as fed. The statutes and local shards are Texas statutes and Texas county local rules regardless of the value you send. California and New York practitioners are served today by the CCP and CPLR excerpts in the rules corpus, not by a state opinion index.
The parameter is real and it does change results. It is just narrower than the four values imply, and that is worth knowing before you build a jurisdiction picker on top of it.
# jurisdiction: "tx" # jurisdiction: "fed" statutes Tex. Civ. Prac. & Rem. Code § 90.007 statutes Tex. Civ. Prac. & Rem. Code § 90.007 scotus League of United Latin Am. Citizens… scotus League of United Latin Am. Citizens… tx Zamarripa v. … ← dropped local Galveston County local rules local Galveston County local rules statutes Tex. Civ. Prac. & Rem. Code § 90.007 statutes Tex. Civ. Prac. & Rem. Code § 90.007 scotus Murray v. Carrier ← added
What the model actually receives
One system prompt, assembled in a fixed order. Your own system messages are not dropped, but they are moved: they are appended at the end under a heading telling the model they take precedence over the style guidance above them.
You are DocketRouter, a legal research assistant for U.S. practitioners. Rules of engagement: - Ground every rule or procedure statement in the RETRIEVED AUTHORITIES below when they are on point… - Never invent a case, citation, quotation, or holding. Citation checks below mean: FOUND = … - Flag jurisdiction: federal rules are federal; state practice may differ. - This is research assistance, not legal advice… RETRIEVED AUTHORITIES (Federal Rules, verbatim excerpts): --- Fed. R. Civ. P. 12. Rule 12. Defenses and Objections… (a) Time to Serve a Responsive Pleading. … RELATED CASES (verify holdings before relying): - Murphy Brothers, Inc. v. Michetti Pipe Stringing, Inc., … (us-scotus 1999) - Notably, … CITATION VERIFICATION: - 556 U.S. 662: FOUND → Ashcroft v. Iqbal (2009) CLIENT FILE (the customer's own documents, private to this account; treat as facts of record, not law): [quarantine preamble] ----- BEGIN UNTRUSTED DOCUMENT D1 (smith-v-jones-tolling.txt) ----- … ----- END UNTRUSTED DOCUMENT D1 ----- RETRIEVAL DEGRADED: … ← only when retrieval came back empty or the index was down TASK INSTRUCTIONS (take precedence over style guidance above): [your system messages, verbatim]
The authorities heading reads Federal Rules, but the corpus and the index are both broader than that: the excerpts can be Texas or New York or California practice rules, US Code or Texas codes, and the case hits can be Supreme Court opinions, Texas statutes or county local rules. The skeleton above is abridged; read set on each excerpt and source on each case for the authoritative answer.
- System messages are repositioned, not removed. If you rely on a system message being the first thing the model reads, that assumption does not hold here.
- Prompt tokens grow. A one-sentence question can arrive as roughly 2,900 prompt tokens once six rule excerpts and three opinions are attached. Input tokens are the cheap ones, which is why the trade is worth making, but your cost model should expect it.
- The citation-check block is the anti-fabrication lever on the input side. When you name a case in your prompt, the model is told whether it exists before it starts writing.
Turning it off
docketrouter.juice: false makes this a plain gateway.
Nothing is retrieved, no citations are checked in either direction, your messages go to the model untouched, and both sources and verification come back null. It is the right setting for a raw-versus-grounded comparison and for non-legal traffic on the same key. It is the wrong setting for anything a lawyer will read.
curl https://docketrouter.ai/api/v1/chat/completions \
-H "Authorization: Bearer dr-…" -H "content-type: application/json" \
-d '{ "model": "deepseek/deepseek-v4-flash", "max_tokens": 1200,
"messages": [{ "role": "user", "content": "…" }],
"docketrouter": { "juice": false } }'Individual stages can be turned off instead: rules, cases, verify and revise are independent booleans. Turning off verify also turns off revise, because there is nothing to trigger it. The raw versus grounded recipe shows the comparison worth running before you commit.
Something here wrong or missing? Mail hello@docketrouter.ai with the request_id and we will fix the docs or the API, whichever is broken.