Repository navigation
fix(search): stop capping saved memories at three per search - #1696
Conversation
Saved memories with no session share the synthetic session id "memory", so per-session diversification let only three of them into the first pass, and observations from real sessions ranked ahead of the fourth best memory. Saved memories now skip the per-session cap. BM25 and vector search also return at least 40 candidates before fusion, so a small limit no longer drops a record that ranks well in only one stream.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
Enrichment read only the first ranked candidates. When some of them were stale index entries with no stored record, they used up slots and hid valid lower-ranked records. Enrichment now keeps reading ranked candidates until it has enough records or runs out of candidates. The candidate-pool test now checks a search result. It shows that a record ranked well in both keyword and vector search comes first in a one-result search.
Each refill batch only asked for the number of missing slots, so many stale candidates meant many small sequential batches. Every batch now reads a full limit of candidates, and the result is trimmed to the limit in rank order.
Fixes #1565
Bug
memory_saveand no session all carry the synthetic session id"memory". Hybrid search diversifies results by session and admits at most 3 per session in its first pass. So only the 3 best saved memories made the first pass, and observations from real sessions ranked ahead of the 4th best saved memory.limit * 2candidates before fusion. Withlimit: 5, a record ranked 11th by keywords and 3rd by meaning only got its vector score and lost to records that appeared in both short lists. The report measured 48 vs 54 of 60 correct answers in the top 5 forlimit5 vs 10.Fix
diversifyBySessionlets saved memories (mem_ids) skip the per-session cap. Each saved memory is an independent record, not part of one session. Observations keep the 3 per session cap.max(limit * 2, 40)) before fusion, independent of how many results are returned. Graph retrieval keeps its previous limit, and the enrichment depth (max(limit, 20)) is unchanged.Tests
test/hybrid-search.test.ts:limit: 6(mainreturns 3)limit: 5search asks BM25 for at least 40 candidates (mainasks for 10)The other hybrid search, recall layer, scoped ranking and project isolation suites pass.
npm run build,npm run docs:check,npm run skills:checkpass. Fullnpm testshows only the timing and environment failures that also fail on an unchangedmaincheckout on this machine.Summary by CodeRabbit