Commit f9f5cc4
fix(search): aggressive over-fetch for kind=content/checkpoint
Companion to 398f42f's filter-planner workaround. After moving the
kind= exclusion to the post-filter, search results were dominated by
CHECKPOINT diary entries because the post-filter doesn't reach far
enough into the ranking — top-10 hits for typical content queries on
the canonical 151K palace were ALL checkpoints (sims 0.30-0.44),
because checkpoints are short word-dense user-prompt snippets that
embed strongly to many queries and out-rank the longer substantive
content drawers.
Without over-fetch, post-filter empties the candidate set entirely:
limit=5 → vector returns 5 → 5 checkpoints → post-filter drops 5
→ "vector ranked 0" warning even though content drawers exist
further down the ranking.
Fix: pull max(n_results*20, 100) candidates when kind != "all", so
the post-filter has somewhere to find substantive content. The 3x
over-fetch for kind="all" stays — no post-filter runs, no need to
over-pull.
Trade-off: kind=content vector queries fetch ~100 candidates
typically. Negligible cost given chromadb HNSW is fast on top-N,
and this is the difference between "kind=content returns useful
content" vs "kind=content returns empty."
Same root cause as the engram-2 critique: vector recall is high
(content drawers ARE in the index, findable by query) but checkpoint
shape dominates ranking. Over-fetch is the surgical fix; structural
fix is to stop indexing checkpoints as searchable drawers (separate
session-recovery table) — captured in roadmap, not in this commit.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 398f42f commit f9f5cc4
1 file changed
Lines changed: 15 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
658 | 658 | | |
659 | 659 | | |
660 | 660 | | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
661 | 675 | | |
662 | 676 | | |
663 | 677 | | |
664 | | - | |
| 678 | + | |
665 | 679 | | |
666 | 680 | | |
667 | 681 | | |
| |||
0 commit comments