Memory that doesn't forget — and gets graded for it.
↓ scroll
How the loop closes
Five stages. Every chat, every agent run, every retrieval feeds the next one.
The closed learning loop is what separates ContextBrain from a stateless RAG pipeline. Each stage is independently measurable — and is measured, on every release.
- 1 · CAPTURE
Capture
Chat turns, agent outputs, manual notes, doc edits — every signal lands in session memory with provenance.
- 2 · EXTRACT
Extract
Claude Haiku pulls structured facts: decisions, patterns, constraints. Each candidate carries a confidence score.
- 3 · PROMOTE
Promote
When a fact recurs across ≥ 3 sessions, it gets queued for one-click promotion to project memory. Org-level after wider corroboration.
- 4 · RETRIEVE
Retrieve
Hybrid search: semantic + keyword + entity match, fused with RRF. Audience filter applied before any chunk reaches the LLM.
- 5 · RE-RANK
Re-rank
Cross-encoder reranker reorders the RRF top-50; freshness multiplier deprioritizes stale memories before the final cut.
Retrieval pipeline
Three signals, fused. Then re-ranked.
Stage 1
Hybrid fan-out
Semantic (pgvector cosine), keyword (Postgres ts_rank), and entity (symbol / ticket-key extraction) each return a top-K. RRF fuses the three rankings into one ordered set.
Stage 2
Cross-encoder rerank
A pluggable reranker reorders the RRF top-50. Default is the local BGE reranker; Cohere is one env-var away. Hard timeout falls back to RRF order on slow paths.
Stage 3
Freshness multiplier
Stale + drifted memories get scaled down before the audience filter applies. Supersedes-lineage means a retired memory never wins over the one that replaced it.
Methodology
How we grade ourselves.
The fixture (currently 2 hand-curated cases) ships in the repo at src/lib/eval/fixtures/contextbrain-eval-v1.json. Each case carries an expected set of code chunks, memories, and documents. The runner builds a context pack for each task and computes:
- Structural metrics — recall@10, MRR, nDCG@10, comparing pack content to the expected set.
- LLM-judged metrics — factual accuracy, tier correctness, staleness correctness. The judge is Claude Haiku with a versioned prompt; the prompt content-hash lands in every audit row.
- Sanitized snapshot — every pass writes
public/eval/latest.jsonwith the numbers + commit SHA but no project names, fixture IDs, or chunk content.
Snapshot generated at commit 33ec47f.
Honest comparison
How ContextBrain stacks up.
Six capabilities × five tools. If a competitor has a feature we have, it gets a checkmark — no asterisks.
| Capability | ContextBrain | mem0 | Cody | Greptile | Continue |
|---|---|---|---|---|---|
Closed extraction loop (chat → memory) Agent + chat traffic gets extracted into reusable memory candidates with human-in-the-loop approval. | |||||
Multi-tier memory (org / project / session) | |||||
Entity-linked memory (memory ↔ code symbols) | |||||
Public eval benchmarks | |||||
Self-host option | |||||
RBAC-aware retrieval |
✓ present · — partial · ✗ absent (sourced from each tool's public docs as of 2026 Q2)
See something miscategorized? Tell us and we'll update.
Run it yourself
Track your own project's numbers.
npm i @contextbrain/sdk
Typed TypeScript client for memory, search, context, and session surfaces. Same auth model as the MCP server.
SDK referencenpm i -g @contextbrain/cli
Run contextbrain eval baseline in any project to print these numbers — or your own deployment's — from the terminal.
Memory that grades itself, every release.
Connect a repo, run the harness, see your numbers next to ours.