Persistent Context Across Sessions for Every Agent – Captures everything your agent does during sessions, compresses it with AI, and injects relevant context back into future sessions. Works with Claude Code, OpenClaw, Codex, Gemini, Hermes, Copilot, OpenCode + More
Search ranking eval
search-fusion-eval.ts measures how the worker's relevance search ranks observations. It does not run in CI. Run it again before a change to search ranking, such as a different RRF_K or a distance cutoff for Chroma.
What it compares
- Keyword leg: the real
SessionSearch.searchObservationsover FTS5, read toKEYWORD_LEG_CANDIDATESrows, with no date window. - Vector leg:
LocalEmbedderwith all-MiniLM-L6-v2. Its vectors match Chroma's default embedding. Each observation is embedded the wayChromaSyncindexes it, and ranks by its nearest document. - Dates: each observation keeps its real date: the LOCOMO session date, or the merge date of the pull request. "Now" is the newest observation of the query's project. Results are also grouped by the age of a question's evidence.
- keyword: the keyword leg alone.
- vector 90d:
fuseByReciprocalRankwithRRF_K. The vector leg drops rows older than the default 90-day window the wayChromaSearchStrategydoes: it widens 100..1600 candidates until a page of 20 rows survives. This is a typed search after #6539. - no window: the same fusion, with the vector leg's first
CHROMA_BATCH_SIZErows of any age. This is the server's hybrid search. - decay: "no window", with each fused score multiplied by age^-0.5 in days, the ACT-R decay of
src/services/reinforcement/rank.ts. - recency list: "no window", plus a third ranked list: the fused rows, newest first.
- rrf k=5: "no window" with a smaller k, for comparison.
Data
Put both files in one folder:
locomo10.jsonfrom https://github.com/snap-research/locomo (data/locomo10.json). Each dialogue turn becomes one observation, and each conversation is one project. The questions of categories 1 to 4 are the queries, and their evidence turns are the relevant rows.prs.json, the merged pull requests of this repository:gh pr list -R thedotmack/claude-mem --state merged --limit 3000 --json number,title,body,mergedAt > prs.jsonEach pull request becomes one observation. A query is a code identifier in backticks that at most five pull requests contain, and those pull requests are the relevant rows. 600 identifiers are sampled with a fixed seed.
Run
CLAUDE_MEM_DATA_DIR=$(mktemp -d) bun scripts/eval/search-fusion-eval.ts prs <folder>
CLAUDE_MEM_DATA_DIR=$(mktemp -d) bun scripts/eval/search-fusion-eval.ts locomo <folder>
The first run downloads the model and embeds every document, which takes a few minutes. It caches the vectors in <folder>/*.f32.
Results (2026-12-04): recency window on the vector leg
R@10 / nDCG@10, real dates:
| Ranking | LOCOMO, all (1,535) | LOCOMO, evidence older than 90 days (674) | LOCOMO, evidence within 90 days (667) | LOCOMO, mixed (194) | Identifiers, all (600) | Identifiers, evidence older than 90 days (66) |
|---|---|---|---|---|---|---|
| keyword | 0.569 / 0.444 | 0.583 / 0.432 | 0.654 / 0.530 | 0.230 / 0.191 | 0.987 / 0.971 | 1.000 / 0.971 |
| vector 90d | 0.326 / 0.246 | 0.024 / 0.008 | 0.678 / 0.514 | 0.170 / 0.151 | 0.986 / 0.873 | 0.985 / 0.608 |
| no window | 0.557 / 0.399 | 0.557 / 0.393 | 0.635 / 0.455 | 0.287 / 0.226 | 0.985 / 0.912 | 0.992 / 0.823 |
| decay | 0.143 / 0.074 | 0.001 / 0.000 | 0.304 / 0.156 | 0.079 / 0.049 | 0.596 / 0.342 | 0.023 / 0.008 |
| recency list | 0.518 / 0.318 | 0.464 / 0.233 | 0.650 / 0.445 | 0.254 / 0.177 | 0.818 / 0.732 | 0.485 / 0.468 |
| rrf k=5 | 0.615 / 0.441 | 0.623 / 0.436 | 0.701 / 0.510 | 0.289 / 0.222 | 0.985 / 0.906 | 0.992 / 0.819 |
- The window on the vector leg also hides old keyword matches. A recent row that both legs rank scores twice, so such rows fill the page. For the 674 LOCOMO questions with only old evidence, the keyword leg's top 10 held evidence for 422 of them. The "vector 90d" top 10 held it for 17.
- Questions whose evidence is all recent lose a little without the window (LOCOMO R@10 0.678 to 0.635), because old rows compete for the page.
- Both decay rankings are worse than "no window" in every group.
Results (2026-11-30): fusion (#6539)
These numbers came from fake dates (every observation one second apart) and no window. Commit 72637708 reproduces them.
R@10 / nDCG@10:
| Ranking | Identifier lookups (600 queries, 2,543 documents) | LOCOMO questions (1,535 queries, 5,882 documents) |
|---|---|---|
| before | 0.310 / 0.219 | 0.451 / 0.308 |
| keyword | 0.987 / 0.971 | 0.569 / 0.444 |
| after (k=60) | 0.985 / 0.912 | 0.557 / 0.399 |
| rrf k=5 | 0.985 / 0.906 | 0.615 / 0.441 |
The keyword leg took 0.17 ms (identifiers) and 5.9 ms (LOCOMO) per query at p50.
Limits
- Identifier lookups favor the keyword leg by construction. LOCOMO questions are closer to what the vector leg is for.
- A LOCOMO observation's title holds the speaker and the session date, and FTS5 indexes the title. The vector leg embeds only the turn.
- Keyword-only ranking scores well here. It finds nothing for a question that shares no term with the note, or for a question in Chinese, Japanese or Korean (see rich-murphey/claude-mem-search-eval). The vector leg is for those queries.