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-m3 via TEI for top-50 candidate refinement
  • Graph-aware retrieval: Multi-hop traversal of memory_relationships for 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

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_relationships populated and Phase 3.5 context assembly live

Exit criteria

  1. Hybrid retrieval (BM25 + RRF) live behind feature flag, default-on, beating dense-only on gold-set lexical queries
  2. Cross-encoder reranker meets latency budget without breaking context assembly p95 <= 50ms
  3. Graph traversal live via API and MCP get_memory_lineage tool with cross-tenant isolation test passing
  4. Gold-set v2 committed with inter-annotator agreement >= 0.8 kappa
  5. Multi-mode benchmark running in CI on every retrieval-touching PR
  6. Shadow-evaluation pipeline live with divergence dashboard
  7. All Phase 1–4.5 regression suites still green
  8. make e2e-smoke-p5 exits 0
  9. Phase 5 gap register published with zero open P0s
  10. 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

Goal overview

GoalFocus
5.AHybrid retrieval (dense + sparse + reranking)
5.BGraph-aware retrieval
5.CEvaluation harness upgrade
5.DExit gate
Edit on GitHub

Last updated on

On this page

0%