retrieval: put the passage lane on the product chat path
Wires today's passage stack into a2aj_search behind MIKE_PASSAGE_SEARCH=1.
All additive and flag-gated; the document-level lane is untouched and is
the silent fall-back whenever the lane cannot serve the request.
- build-passage-index.ts: --mode chars|clause, part of sidecar identity;
the MissingPassageIndexError hint now names --mode when one is asked
for.
- a2ajPassageSearch: mode passthrough, and rerank {model} (or
MIKE_RETRIEVAL_RERANK_MODEL) widening the pool to max(48, size*8) at
perDocCap 24 before rerankPassages cuts back to size. Rerank is async,
so searchLocalA2AJPassages now returns a Promise - a signature change,
its only callers were tests.
- citation short-circuit expands each detected key through the citator's
resolution evidence (new citationAliasKeys wrapper over the existing
private keysForQuery), so a French twin or parallel reporter cite
reaches the same decision. No citator graph, or an ambiguous key,
degrades to exactly today's literal-key behaviour.
- chat/tools/a2ajTools: a2aj_search prefers the passage lane when the
env is set AND the sidecar exists (never built inline), returning the
same result shape with the passage in `snippet` plus passage_start/
passage_end. Name search and dataset/date/sort filters stay on the
document lane rather than being silently dropped.
Tests are model-call-free (a completeText tripwire asserts zero calls):
clause-mode round trip against clauseChunkText spans, --mode in the
refusal, rerank short-circuit and env-absent no-op, alias pin with and
without a fixture citator graph, and chat-lane serve/fall-back.
18 passed across a2ajPassageWiring, a2ajPassageSearch, passageRetrieval;
tsc --noEmit clean.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012AgUm5EcRKbT3duVFMbrQD
| Repository | eliziff/Beaver |
|---|---|
| Author | Eli Ziff <eliasziff@gmail.com> |
| Authored | |
| Parents | 09767629 |
| Stats | 6 files changed , +464 , -32 |
| Part of | Chat backend features and prompt/context-budget management |
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-d6d03a4f.md
from inside the repo you want the change in.