perf: query one SourceDoc instead of retokenizing per quote

↗ view on GitHub · Eli Ziff · 2026-07-27 · 2f78a7e4

Stage 3 of the SourceDoc consolidation. Every pinpoint-link consumer now
queries the compiled artifact: phrase search walks word postings built once
per document, a first query streams the text and stops early, and a resolve
shares one artifact across its handles.

Measured on the 2.26 MB Criminal Code shape: buildDirective 2737 ms -> 232 ms
per quote, appendLegalSourcePinpointLinks 693 ms -> 15 ms per source, a
64-handle evidence resolve 122 ms -> 4 ms per handle. backend/scripts/
bench-pinpoint.ts runs on either side of the change and prints the ratio.

Also fixes quotes carrying editorial alterations ("[T]he ...") losing their
link when the passage repeats: disambiguation now compares the resolved form
as well as the raw one.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QUsMXzBsEJ27DjJVPSfW5o
Repository eliziff/Beaver
Author Eli Ziff <eliasziff@gmail.com>
Authored
Parents d18580f1
Stats 6 files changed , +5952 , -45
Part of SourceDoc / DOCX engine: redlines, tracked changes, editing benchmark

Capture this commit into my fork

Download a Markdown prompt that tells Claude how to port this exact commit into your working tree. Run it via claude -p < capture-commit-2f78a7e4.md from inside the repo you want the change in.

⬇ Download capture-commit-2f78a7e4.md