Phase 5 — Advanced Retrieval & Graph Memory
Phase 5 upgrades retrieval from single-vector ANN search to hybrid dense+sparse+reranking with graph-aware traversal.
Phase 5 — Advanced Retrieval & Graph Memory
Status: Planned
Depends on: Phase 4.5 — Intelligence Layer
Next: Future roadmap work (org-wide production hardening remains deferred)
Purpose
Phase 3 established a flat vector store with a memory_relationships graph table that is not yet
traversed at query time. Phase 5 is where retrieval quality moves beyond "one embedding, one ANN
search, one score" toward hybrid search, reranking, and graph-aware packing:
- Hybrid search: Dense (HNSW) + Sparse (BM25 via Postgres GIN) combined with Reciprocal Rank Fusion
- Cross-encoder reranking:
BAAI/bge-reranker-v2-m3via TEI for top-50 candidate refinement - Graph-aware retrieval: Multi-hop traversal of
memory_relationshipsfor lineage/contradiction chains - Production shadow evaluation: 1% traffic sampling for online retrieval-quality monitoring
Suggested paths and libraries below are planning defaults. Implementation may revisit them after measurement, further research, or operational constraints.
Milestones
| ID | Milestone | Status |
|---|---|---|
| 5.A.1 | BM25 Sparse Retrieval | Planned |
| 5.A.2 | Reciprocal Rank Fusion | Planned |
| 5.A.3 | Cross-Encoder Reranking | Planned |
| 5.B.1 | Graph Traversal Query Layer | Planned |
| 5.B.2 | Graph-Boosted Scoring | Planned |
| 5.B.3 | MCP get_memory_lineage | Planned |
| 5.C.1 | Hybrid-Aware Gold Set v2 | Planned |
| 5.C.2 | Multi-Mode Benchmark Runner | Planned |
| 5.C.3 | Production Shadow Evaluation | Planned |
| 5.D.1 | Retrieval Quality Sign-off | Planned |
| 5.D.2 | Phase 5 Exit Audit | Planned |
What Phase 5 is not
- Org-wide observability stack / chaos engineering / release governance (future work)
- Replacing the Phase 3 dense retrieval path as the only available mode (dense-only remains a baseline)
- A separate graph database requirement (Postgres recursive CTEs are the starting preference)
Entry criteria
- Phase 4.5 exit criteria met
- Phase 3
memory_relationshipspopulated and Phase 3.5 context assembly live
Exit criteria
- Hybrid retrieval (BM25 + RRF) live behind feature flag, default-on, beating dense-only on gold-set lexical queries
- Cross-encoder reranker meets latency budget without breaking context assembly p95 <= 50ms
- Graph traversal live via API and MCP
get_memory_lineagetool with cross-tenant isolation test passing - Gold-set v2 committed with inter-annotator agreement >= 0.8 kappa
- Multi-mode benchmark running in CI on every retrieval-touching PR
- Shadow-evaluation pipeline live with divergence dashboard
- All Phase 1–4.5 regression suites still green
make e2e-smoke-p5exits 0- Phase 5 gap register published with zero open P0s
- Org-wide production hardening remains explicitly deferred as future roadmap scope
Execution order
Track A: 5.A.1 → 5.A.2 → 5.A.3
Track B: 5.B.1 → 5.B.2 → 5.B.3 (can start after Phase 4.5; pairs with Track A for eval)
Track C: 5.C.1 → 5.C.2 → 5.C.3 (depends on A/B surfaces existing)
Track D: 5.D.1 → 5.D.2 (after A–C verification)Documents
- tracks.mdx — Track purpose and milestone grouping
- goals.mdx — Goal overview by track
- risks.mdx — Risks and mitigations
- milestones/ — PR-sized work units
Goal overview
Edit on GitHub
Last updated on