Expand description
Memory Recall Engine — Hybrid vector + FTS search (Phase N10).
Auto-embeds memories at write time using the Embedder trait,
and fuses Tantivy BM25 + vector cosine similarity at recall time.
§Architecture
RecallEngine
├── embedder: Arc<dyn Embedder>
├── vector_store: VectorStore
├── search_engine: SearchEngine (Tantivy BM25)
├── embedding_cache: HashMap<content_hash, Vec<f32>>
└── hybrid_search(query, limit) → Vec<RecallResult>
1. Embed query → query vector
2. Tantivy BM25 search → text scores
3. Vector cosine similarity → vector scores
4. Fuse: w1*BM25 + w2*vector + w3*importance
5. Return ranked results§Environment Variables
| Variable | Default | Description |
|---|---|---|
WM_RECALL_BM25_WEIGHT | 0.5 | Weight for BM25 text score |
WM_RECALL_VECTOR_WEIGHT | 0.3 | Weight for vector cosine similarity |
WM_RECALL_IMPORTANCE_WEIGHT | 0.2 | Weight for memory importance |
WM_TRUST_WEIGHT | 0.0 | Post-fusion trust multiplier (source_trust 0.7 neutral) |
WM_RECALL_CONFORMAL_ALPHA | unset | Conformal set miscoverage level (unset = off) |
Structs§
- Backfill
Report - Report from a
RecallEngine::backfill_embeddingspass. - Recall
Config - Configuration for the recall engine.
- Recall
Engine - Hybrid recall engine combining BM25 + vector search.
- Recall
Result - A single recall result with fused scores.