Repository navigation
N2: FTS-first retrieval candidate generation (retire 5k scan cap) - #56
Merged
Merged
Conversation
…s and parity gate
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TL;DR: Retrieval previously scanned every active memory (up to a 5k cap) per request. This branch adds an opt-out-able candidate-union fast path: five SQL arms (lexical content, topic slug, FTS join, high-authority rows, long-row/phrase-window backstop) with a future N7 eligibility predicate seam, a batched row loader (kills per-memory N+1 fetches), and a watermark-invalidated embedding-matrix cache — with a byte-identical-score parity test gate and a config kill switch.
Ideal-state fidelity (verified 1:1 by the F-wave; F1-F4 all APPROVE):
Probe results: Live store (read-only): 2213 actives, 55 non-ASCII-glued rows (documented completeness-boundary class), 0 rows >8192 chars. Fresh-store manual QA: short queries served mode=candidates non-degenerate on a 605-row store; degeneracy warning exactly once per watermark move; kill-switch boot returns byte-identical results on 20 sampled queries; cross-mode corpus 15/15.
Honest live-store note: this branch does NOT yet make retrieval sublinear on the production store — semantic-arm saturation degenerates the union there until the live-embeddings decision (roadmap N3) lands. It makes every store cheaper via the loader/cache wins and retires the silent 5k scan cap with a loud WARNING.
Verification: suite 513 passed; Final Wave F1 (compliance) / F2 (code quality) / F3 (live HTTP QA incl. live-box probes) / F4 (IS fidelity) all APPROVE, evidence in .omo/evidence/F{1..4}-n2-fts-first-candidates.log (local ledger).
Known follow-ups (not blocking, not in this PR): consolidation.py still does a per-pass whole-working-set embedding fetch (background path only); the semantic arm carries no N7 predicate yet (relevant when N7 lands); fallback memo set is unbounded across process lifetime by design.