Repository navigation
Closed
Description
Problem
We say hybrid search is good. Prove it.
Six retrieval tuning audit docs exist in docs/ from the v0.3.x era. That work was valuable but ad-hoc β run once, results in a markdown file, never re-run. For v1.0, search quality needs to be measurable, repeatable, and gated in CI.
Design
Golden Query Set
Build a corpus of 50+ queries with expected results against a known test dataset:
- query: "what model does Mister use"
expected_ids: [42, 187] # memory IDs that MUST appear in top-5
mode: hybrid
min_precision: 0.6
- query: "SB health juice recipe"
expected_ids: [91]
mode: bm25
min_precision: 0.8Test Dataset
Use a frozen snapshot of a real corpus (anonymized if needed) committed to the repo as testdata/benchmark/. This never changes between test runs β that's what makes results comparable.
Metrics
For each query Γ mode combination:
- Precision@5: What fraction of top-5 results are relevant?
- Recall@5: What fraction of expected results appear in top-5?
- MRR (Mean Reciprocal Rank): How high does the first relevant result rank?
- Latency P50/P99: Search speed on the frozen corpus
CI Integration
go test ./scripts/bench/ -run TestSearchQualityruns the full benchmark- Results written to
testdata/benchmark/results.json - CI fails if any mode's aggregate precision drops below threshold (e.g., 0.5)
- Latency regression: fail if P99 > 2x baseline
Mode Coverage
Benchmark all four modes:
| Mode | What it proves |
|---|---|
| BM25 | Keyword precision β known terms find known facts |
| Semantic | Conceptual recall β vague queries find related memories |
| Hybrid | Best-of-both default β the one most users will use |
| RRF | Rank fusion quality β does combining improve over hybrid? |
Acceptance Criteria
- 50+ golden queries with ground-truth relevance judgments
- Frozen test corpus committed to
testdata/benchmark/ - Benchmark runs in CI (
go test) with pass/fail thresholds - All four search modes benchmarked
- Latency baselines established and regression-gated
- Results history tracked (so we can see quality trend over time)
- Retrieval tuning audit docs in
docs/either updated or archived
Activity
feat: search quality benchmark + scale testing (#230, #232)
hurttlocker commentedon Feb 26, 2026
Search quality benchmark suite shipped (commit c0dfb22).
What shipped:
~/.cortex/search_quality_results.jsongo test ./scripts/bench/ -run TestSearchQualityResults on production corpus (1,913 memories, 4,005 facts):
Acceptance criteria:
go test) with pass/fail thresholdsdocs/archive/(done in π Technical documentation overhaulΒ #235)