Cortex
Self-organizing graph memory for AI agents. One binary. Zero dependencies.
Cortex is an embedded temporal graph memory that auto-links knowledge, decays what's irrelevant, detects contradictions, and synthesises context briefings on demand. Think SQLite, but for agent memory.
Why Cortex?
Your agents each know something. Cortex discovers what they know together.
Most agent memory systems are glorified key-value stores with a vector index. Cortex is a self-organizing knowledge graph: it wires itself, forgets what's stale, resolves contradictions, computes trust from topology, and tells each agent exactly what it needs to know.
Self-organizing -- the auto-linker runs in the background, discovering relationships via embedding similarity, shared entities, temporal proximity, and configurable structural rules. You store facts; Cortex finds the connections.
Temporal -- every node carries validity windows (valid_from, valid_until) and lifecycle expiry (expires_at). Query "facts true on January 15th" or "facts that expired before June." Stale knowledge is filtered, not deleted.
Trust from topology -- confidence is not a field you set. It's computed from the graph structure: corroboration across agents, contradiction count, source track record, access reinforcement, and freshness. Like PageRank for knowledge.
Briefing synthesis -- "what does my agent need to know?" generates a structured context document from the graph. Configurable roles, agent or cross-agent scope, contradiction alerts.
Embedded -- single Rust binary, redb storage (ACID, mmap), HNSW vector index. No external dependencies. No server to manage. cargo install and go.
Quick Start
Install
# Linux / macOS -- one line, no Rust or protoc needed
|
# Via Cargo
# Docker
5 Minutes to Memory
# Create a project
# Start the server
# Store some knowledge
# Store with temporal validity
# Search
# Get a briefing for your agent
# Get a cross-agent briefing
# Check trust score for a node
Use with AI Agents (MCP)
Cortex speaks MCP natively. One command gives your AI agent persistent, self-organizing memory.
Claude Code
# Start Cortex in the background
&
# Add to Claude Code
Claude Code now has 7 memory tools: cortex_store, cortex_search,
cortex_recall, cortex_briefing, cortex_traverse, cortex_relate,
cortex_observe.
Cursor
Add to .cursor/mcp.json:
Windsurf
Add to your MCP config:
VS Code (Copilot)
Add to .vscode/mcp.json:
Without installing the binary
Use the Node.js bridge (no Rust needed):
Or with a remote Cortex server:
What your agent gets
| Tool | Purpose |
|---|---|
cortex_store |
Remember facts, decisions, goals, events, patterns |
cortex_search |
Semantic search by meaning |
cortex_recall |
Hybrid search (semantic + graph structure) |
cortex_briefing |
"What do I need to know?" context document |
cortex_traverse |
Explore how concepts connect in the graph |
cortex_relate |
Explicitly link related knowledge |
cortex_observe |
Record performance metrics for prompt selection |
The briefing tool supports scope: agent (default), shared (cross-agent),
or unified (multi-agent overview for orchestrators).
Prompt Management
Cortex includes a built-in prompt versioning system with branching, inheritance, and context-aware selection.
# Import prompts from a migration file
# List all prompts
# Get the resolved HEAD of a prompt (with inherited sections)
# Bind a prompt to an agent
# Select the best variant for current context (epsilon-greedy)
# Record performance and auto-update weights
# Check performance metrics
As a Library (Python)
=
=
# Cross-agent briefing
# Store an entity
Embedded in Rust
use ;
let cx = open?;
cx.store?;
let results = cx.search?;
Documentation
- Quick Start
- MCP Setup -- Claude Code, Cursor, Windsurf, VS Code
- Configuration Reference
- CLI Reference
- Python SDK
- gRPC API
- HTTP API
- Prompt System
- Architecture
Concepts
- Self-Organizing Memory -- how Cortex discovers what your agents know together
- Graph Model -- nodes, edges, temporal validity, entities
- Trust Scoring -- PageRank for knowledge
- Entity Resolution -- cross-agent discovery via shared entities
- Briefings -- role-based context synthesis with scope
- Auto-Linker -- configurable rules, entity promotion
- Decay and Memory -- edge decay vs temporal validity
- Metadata Conventions -- well-known metadata keys
Guides
- Coding Agent -- memory for coding agents
- Research Agent -- memory for research agents
- Browser Agent -- memory for browser agents
- Multi-Agent -- shared memory, entities, scoped briefings
How Cortex Compares
| Cortex | Mem0 | Zep/Graphiti | Cognee | Letta | Engram | |
|---|---|---|---|---|---|---|
| Embedded (no server) | Yes | No | No | No | No | Yes |
| Self-organizing graph | Yes | No | Partial | Partial | No | No |
| Auto-linking | Yes | No | No | No | No | No |
| Temporal validity | Yes | No | Yes | No | No | No |
| Knowledge decay | Yes | No | No | Partial | No | Yes |
| Contradiction detection | Yes | No | Yes | No | No | No |
| Trust from topology | Yes | No | No | No | No | No |
| Briefing synthesis | Yes | No | No | No | No | No |
| Entity resolution | Yes | Yes | Yes | Yes | No | No |
| Cross-agent discovery | Yes | Yes | No | Yes | No | No |
| Single binary | Yes | No | No | No | No | Yes |
| Rust (performance) | Yes | No | No | No | No | No (Go) |
| Open source (MIT) | Yes | Partial | Partial | Yes | Yes | Yes |
Cortex occupies a unique position: embedded AND self-organizing. Every competitor requires external infrastructure or manual curation. Cortex does neither.
Graph Visualisation
Cortex ships a live graph explorer. Start the server and open http://localhost:9091/viz:
- Force-directed layout with nodes coloured by kind
- Node size reflects importance score
- Click any node for full details (title, body, metadata, connections)
- Search, filter by kind, filter by minimum importance
- Export as SVG, PNG, or JSON
Architecture
┌────────────────────────────────────────────────┐
│ Your Application │
│ AI Agent(s) SDK / gRPC / MCP │
└──────────────────┬─────────────────────────────┘
│
┌──────────────────▼─────────────────────────────┐
│ Cortex │
│ gRPC :9090 HTTP :9091 │
│ ┌───────────┐ ┌────────────┐ ┌──────────┐ │
│ │ Storage │ │ Graph │ │ HNSW │ │
│ │ (redb) │ │ Engine │ │ Index │ │
│ └───────────┘ └────────────┘ └──────────┘ │
│ ┌───────────┐ ┌────────────┐ ┌──────────┐ │
│ │ Auto-Link │ │ Briefing │ │ Trust │ │
│ │ + Entities │ │ + Scope │ │ Engine │ │
│ └───────────┘ └────────────┘ └──────────┘ │
│ ┌───────────┐ ┌────────────┐ ┌──────────┐ │
│ │ Prompt │ │ Selection │ │ Retention│ │
│ │ Resolver │ │ Engine │ │ + Expiry │ │
│ └───────────┘ └────────────┘ └──────────┘ │
└────────────────────────────────────────────────┘
Integration Guides
- LangChain -- Use Cortex as a LangChain memory backend
- CrewAI -- Share memory across a multi-agent team
- OpenClaw / Warren -- Native integration with Warren
Examples
examples/
langchain-agent/ LangChain agent with Cortex memory
crewai-team/ CrewAI multi-agent with shared Cortex
personal-assistant/ Simple assistant with briefings
rag-pipeline/ Cortex as a RAG backend
rust-embedded/ Rust app using cortex-core directly
Contributing
See CONTRIBUTING.md. All contributions welcome.
License
MIT -- see LICENSE.