The only database that gives AI agents episodic, semantic, and procedural memory — all in one engine.
from cogdb import CognitiveDB
db = CognitiveDB(db_path="./agent_memory")
# Store an episodic memory
db.remember("Deployed v2.3. CORS error on /users.", agent_id="devops", importance=0.9)
# Store a fact (auto-supersedes contradictions)
db.learn(subject="api", predicate="version", object="v2.3", agent_id="devops")
# Store a workflow
db.learn_procedure(name="fix_cors", steps=[...], agent_id="devops")
# Recall with a 500-token budget — nothing wasted
memories = db.recall("How do we fix CORS errors?", agent_id="devops", token_budget=500)
You bolt on a vector DB. Then a graph DB. Then SQLite. Now you're maintaining three backends that don't talk to each other — and silent data loss happens at every concurrent write.
Vector DB + graph DB + SQLite — maintained separately, queried separately, breaking separately. Every search requires three round-trips you stitched together by hand.
No token management means every recall dumps a wall of context into the LLM and hopes for the best. Your agent burns the entire budget on memories from last week.
Concurrent agent writes with no conflict resolution. Facts overwrite each other. Two agents disagree about the same fact. Nobody notices until production breaks.
CogDB unifies the three types of memory that map to how cognition actually works. One install, one API, one store.
Timestamped records of agent interactions, observations, and tool calls. Stored as vector embeddings with full metadata. Agents search by similarity — "find me situations like this one."
A temporal knowledge graph where facts have lifecycles. Facts get superseded automatically when newer ones contradict them. Confidence scores, validity windows, provenance links — all built in.
Learned workflows captured from successful agent task completions. Reusable templates with EMA success tracking. This memory type basically doesn't exist in any other system.
Most memory systems bolt on vector search as an afterthought. CogDB was designed from scratch for the full cognitive stack.
| Capability | Mem0 | Zep | Letta | MemPalace | CogDB |
|---|---|---|---|---|---|
| Episodic memory | ✓ | ✓ | ✓ | ✓ | ✓ |
| Semantic / knowledge graph | ✓ | ✓ | ✓ | ✓ | ✓ |
| Procedural memory | ⚠️ | ✗ | ⚠️ | ✗ | ✓ |
| Token-aware retrieval | ✗ | ✗ | ✗ | ⚠️ | ✓ |
| Multi-agent memory scopes | scoped | per-user | shared | per-agent | 4 formal scopes |
| Single unified engine | ✗ | ✗ | ✗ | ✗ | ✓ |
| MCP server built-in | ✗ | ✗ | ✗ | ✓ | ✓ |
| AutoGen + LangGraph adapters | partial | ✗ | ✗ | ✗ | ✓ |
| CrewAI adapter | ✗ | ✗ | ✗ | ✗ | ✓ |
| OpenAI Agents SDK adapter | ✗ | ✗ | ✗ | ✗ | ✓ |
| Semantic Kernel adapter | ✗ | ✗ | ✗ | ✗ | ✓ |
| LlamaIndex adapter | ✗ | ✗ | ✗ | ✗ | ✓ |
| Schema migration tooling | ✗ | ✗ | ✗ | ✗ | ✓ |
Suite 1 measures episodic + semantic + procedural recall quality across a mixed workload. Score improved from 87.9 → 90.7 with the learned ImportanceModel (Ridge regression). 140/140 tests pass.
Most memory systems dump everything and hope the LLM figures it out. CogDB fills your token budget from the top with the highest-importance memories that fit — and stops the moment the budget is spent.
Faster responses. Lower API costs. No context window blowouts. Set a budget and forget about it.
Drop-in adapters — not wrappers. Native protocol implementations for each framework.
From zero to a working tri-memory agent in 30 lines. Framework adapters are single-file drop-ins.
from cogdb import CognitiveDB
db = CognitiveDB(db_path="./agent_memory")
# ─── Episodic: timestamped events with vector search ───
db.remember(
"Deployed v2.3 to production. CORS error on /users endpoint.",
agent_id="devops-agent",
importance=0.9,
)
# ─── Semantic: facts with auto-supersession ───
db.learn(
subject="api_service", predicate="version", object="v2.3",
agent_id="devops-agent", confidence=1.0,
)
# ─── Procedural: reusable learned workflows ───
db.learn_procedure(
name="fix_cors_error",
steps=[
{"action": "check_nginx_config", "tool": "cat /etc/nginx/conf.d/api.conf"},
{"action": "add_cors_headers", "tool": "sed"},
{"action": "reload_nginx", "tool": "systemctl reload nginx"},
{"action": "verify", "tool": "curl -I"},
],
agent_id="devops-agent",
applicable_contexts=["cors", "nginx", "api"],
)
# ─── Recall with a 500-token budget ───
memories = db.recall(
"How do we fix CORS errors?",
agent_id="devops-agent",
token_budget=500,
)
# ─── Progressive context loading (L0 → L3) ───
context = db.get_context(
agent_id="devops-agent", level=2,
task_hint="API gateway returning 403 on preflight",
token_budget=800,
)
from cogdb.adapters.autogen import CogDBMemory
from autogen_agentchat.agents import AssistantAgent
from autogen_ext.models.openai import OpenAIChatCompletionClient
# Drop-in replacement for AutoGen's basic ListMemory
memory = CogDBMemory(db_path="./agent_memory")
agent = AssistantAgent(
name="assistant",
model_client=OpenAIChatCompletionClient(model="gpt-4o"),
memory=[memory],
)
# Memories persist across sessions automatically
# Episodic + semantic + procedural — all three memory types available
# ─── LangGraph ───
from cogdb.adapters.langgraph import CogDBCheckpointer, CogDBStore
from langgraph.graph import StateGraph
graph = StateGraph(State).compile(
checkpointer=CogDBCheckpointer(db_path="./memory"),
store=CogDBStore(db_path="./memory"),
)
# ─── MCP server (Claude Code, Cursor, Windsurf) ───
# cogdb-mcp --db-path ./memory
# Exposes: remember, recall, learn, learn_procedure, get_context, forget
A Rust storage core behind a clean Python API. Every layer is independently testable and replaceable.
┌─────────────────────────────────────────────────────────────────────────┐ │ Layer 1 — Agent Interface │ │ AutoGen · LangGraph · CrewAI · OpenAI Agents · Semantic Kernel │ │ LlamaIndex · MCP server (cogdb-mcp) · Native Python SDK │ └────────────────────────────────────┬────────────────────────────────────┘ │ ┌────────────────────────────────────▼────────────────────────────────────┐ │ Layer 2 — Query Planner │ │ Token-aware retrieval · Store routing · ImportanceModel (Ridge) │ │ L0 → L3 progressive loading · HNSW rank blending │ └────────────────────────────────────┬────────────────────────────────────┘ │ ┌────────────────────────────────────▼────────────────────────────────────┐ │ Layer 3 — Cognitive Pipeline │ │ Encoder (sentence-transformers) · Consolidator · Decay (EMA) │ │ Schema validation · Migration · SPO extraction │ └────────────────────────────────────┬────────────────────────────────────┘ │ ┌────────────────────────────────────▼────────────────────────────────────┐ │ Layer 4 — Tri-Memory Store (Rust · cogdb_engine · PyO3) │ │ │ │ Episodic Semantic Procedural │ │ HNSW vectors petgraph DiGraph SQLite + WAL fence │ │ SQLite + WAL SQLite + WAL EMA success rate │ │ Scope filters Auto-supersession Tokenised retrieval │ └─────────────────────────────────────────────────────────────────────────┘
Purpose-built HNSW vector index, WAL crash recovery, and petgraph knowledge graph — all behind a clean Python API. No external vector DB required.
Ridge regression on access patterns ranks memories by relevance. Trained offline, runs locally. No external API key required — ever.
Private, team, org, and session scopes with contradiction detection at write time. Scope enforcement happens in Rust — no unguarded code path.
Versioned add / rename / drop / change_type with metadata backfill. db.migrate_schema() keeps data consistent across schema changes without data loss.
cogdb-mcp --db-path ./memory exposes 6 tools to any MCP-compatible agent. Claude Code, Cursor, Windsurf, and more — zero configuration.
Singleton engine per db_path. No connection pools, no warmup, no daemon. Just import and call. ~1.2 ms write, ~0.9 ms search — excluding encoding.