Chapter 5 · section 6 of 7
In production
The deployed index is a Vectorize index named howard-laws, 1,024 dimensions, cosine, with one namespace per state. A namespace is a partition of an index that a query is confined to: a Maryland question is asked of Maryland’s namespace and can return no other state’s law, whatever the vectors say. The index holds about 172,000 vectors, 143,000 of them subsections of the states’ vehicle codes.
It is filled by a script, scripts/law-vectors.ts, and not by a deploy, and the second of the script’s two limits is a measurement:
/** At most this many laws in one embedding request: Vectorize's upsert takes them a hundred at a time. */
const BATCH_LAWS = 100
/**
* At most this many characters in one embedding request, **counted as every
* law the length of the longest**. bge-m3 refuses a request over 60,000
* tokens, and it pads each text in a request to the longest one: Alabama's
* refusal read 68,400 tokens before and after the request was cut by its
* summed length, because it was 100 texts padded to one of 684 tokens.
* Prose runs about three characters a token, but statute tables and fee
* schedules run nearer one and a half: Kansas's 120,000 padded characters
* came to 75,012 tokens and were refused. 60,000 padded characters stays
* under the limit at that density.
*/
const BATCH_CHARS = 60_000 Your buildIndex sends a hundred texts at a time and would hit the second limit on a state whose subsections run long. The deployed one cuts its requests by the padded size as well, and a test holds that nothing is lost or reordered in the cutting.
What is embedded for a code chunk is one thing more than yours: the heading of the section it was cut from. Alaska’s “(c) A person convicted under this section … shall pay a mandatory fine of $500” sat at 0.504 from what is the fine if I cannot show proof of insurance, a hair over the cutoff and below every law it was fused against, because the subsection never says what it is the fine for. Headed “Proof of insurance to be exhibited on demand; penalty”, it scores 0.654, above the manual’s own 0.614. A state whose code publishes no headings, Maryland among them, embeds exactly what you do.
And the script never deletes a vector. When a section is fetched again and cut differently, the old subsections’ vectors stay in the index under ids the corpus no longer holds, and the meant filter in your retrieve is what makes that harmless. On 10 October 2026 a different path through the deployed pipeline, one that reads a law’s words from a database by id rather than from the state’s file, had no such filter and refused every question on that path in production, because one hit in 102, North Carolina’s § 20-137.1(a) re-chunked since it was embedded, was a stale id, and the rule written for a missing id failed the whole question. One stale vector was enough. The rule now drops the id and goes on.