Biologically-inspired memory for AI agents.
Cortex combines principles from neuroscience, immunology, and library science into a unified memory system that actually works across sessions.
Every AI memory system picks one insight and stops. Mem0 does extraction. Zep does temporal graphs. Letta does self-management. Cortex combines all of them — because that's how actual memory works.
- Three memory types: Episodic (events, decays fast), Semantic (facts, durable), Procedural (learned behaviors, most durable)
- Consolidation "sleep cycles": Raw episodes get compressed into semantic facts. Each re-encounter makes facts more precise, not just more confident.
- Immune system decay: Memories require retrieval to survive. No retrieval = decay. Contradictions get detected and pruned.
- Multi-strategy retrieval: Semantic similarity + BM25 keyword + graph traversal + temporal reasoning, fused with Reciprocal Rank Fusion.
- "Walk into the room": One call loads a compressed, task-aware context bundle — call prep surfaces risks, bug triage surfaces product issues.
- Fully local: SQLite + local embeddings. Zero API calls. Your data never leaves your machine.
- MCP-native: Works with Claude Code, Cursor, or any MCP client.
pip install cortex-memory
# Store memories
cortex remember "Acme Corp renewed for $120k ARR" -t "customer:acme"
cortex remember "John wants API access by Q3" -t "customer:acme" -s "meeting"
# Search
cortex search "Acme contract"
# Knowledge graph
cortex graph "Acme Corp"
# Health dashboard
cortex status
# Start MCP server (for Claude Code / Cursor)
cortex serveAdd to your Claude Code config:
{
"mcpServers": {
"cortex": {
"command": "cortex",
"args": ["serve"]
}
}
}Then use cortex_remember, cortex_recall, cortex_forget, cortex_connect, cortex_traverse, cortex_entities, cortex_health, cortex_pin tools from any agent.
Input → Encode → Episodic Store → [Consolidation] → Semantic Store → [Decay] → Archive
→ [Contradiction] → Supersede
→ [Pattern Extract] → Procedural Store → [Track] → Refine
Storage: Single SQLite file at ~/.cortex/cortex.db with sqlite-vec for vector search.
Embeddings: Local via sentence-transformers (default: all-MiniLM-L6-v2). No API calls.
Decay model: Modified Ebbinghaus with retrieval-frequency boosting. Episodic: 3-day half-life. Semantic: 30-day. Procedural: 60-day. Pinned memories never decay.
| Principle | Source | Implementation |
|---|---|---|
| Index ≠ content | Hippocampus | Separate pointer index from full content |
| Encode surprise | Predictive coding | Weight by prediction error, not recency |
| Consolidation | Sleep cycles | Periodic episode → fact compression |
| Affinity maturation | Immune system | Each re-encounter refines the representation |
| Maintenance signals | T-cell persistence | Decay without retrieval |
| Negative selection | Immune thymus | Detect and prune contradictions |
| Pheromone evaporation | Ant colonies | Decay rate ∝ 1/retrieval frequency |
| Faceted coordinates | Library science | Multi-dimensional tags, not single hierarchy |
MIT
Deway — the autonomous adoption platform for B2B SaaS. We run 35 AI agents daily and needed memory that actually works.