A self-hosted Model Context Protocol server that gives AI agents persistent memory across sessions and projects. Markdown files as source of truth, hybrid keyword + semantic search, typed graph relations.
Agent conversations end and take their context with them. Engram is the piece that survives: a knowledge base an agent searches before acting and writes to after resolving something non-obvious, so the next session — same project or a different one — starts with what was already learned instead of re-deriving it.
It deliberately stores zero discoverable information. If a fact can be pulled from code, git history, config files, or existing docs, it does not belong in Engram. What belongs: a decision and the alternatives it ruled out, a bug's root cause and fix, a procedure learned the hard way, a preference stated once that should hold from then on.
SQLite FTS5 (BM25) fused with cosine similarity over local Model2Vec embeddings via Reciprocal Rank Fusion — zero cloud dependency.
kb://uuid#type links resolved both directions on every recall, with optional second-hop traversal.
hub, decision, diagnostic, feature, procedure, and more — declared in a JSON schema, exposed as a client-side enum.
supersede creates a new version instead of overwriting — history stays queryable, nothing is lost.
One schema-driven check over the Markdown files for dangling links, undeclared types, and structural drift.
Force-directed graph view, hybrid search, and a CRUD panel over the same knowledge base the MCP tools use.
stdio, SSE, streamable-http — one agent locally, or a shared multi-agent deployment.
The SQLite index is a rebuildable cache; delete it and rebuild — no data is ever lost.
Same knowledge base, browsed with Read/Grep/Glob vs. searched with Engram — 32 questions over 5,070 entries, equivalent fact coverage:
| Engram | Mem0 | Zep / Graphiti | LangMem | |
|---|---|---|---|---|
| Source of truth | Markdown files on disk | Vector DB / managed API | Temporal knowledge graph | Vector store (LangChain) |
| Search | BM25 + local embeddings (RRF) | Vector similarity | Graph traversal + embeddings | Vector similarity |
| Relations | Explicit kb:// links, agent-authored | Implicit (LLM-extracted) | Auto-extracted temporal edges | None built-in |
| Deployment | Self-hosted, single Docker image | Hosted API or self-hosted + vector DB | Self-hosted, needs Neo4j | Library, no server |
stdio — your agent manages the server. Recommended for Claude Code, ChatGPT Desktop, Cursor.
claude mcp add --transport stdio engram -- \
docker run -i --rm -v ./knowledge:/knowledge foreigndmitryi/engram
See the full README for SSE, streamable-http, and multi-tenant setups.