MIT License Docker Pulls Python 3.12+

Engram

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.

Concept

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.

Features

Hybrid search

SQLite FTS5 (BM25) fused with cosine similarity over local Model2Vec embeddings via Reciprocal Rank Fusion — zero cloud dependency.

Typed graph relations

kb://uuid#type links resolved both directions on every recall, with optional second-hop traversal.

Schema-enforced entry types

hub, decision, diagnostic, feature, procedure, and more — declared in a JSON schema, exposed as a client-side enum.

Bi-temporal versioning

supersede creates a new version instead of overwriting — history stays queryable, nothing is lost.

Doctor integrity pass

One schema-driven check over the Markdown files for dangling links, undeclared types, and structural drift.

Web dashboard

Force-directed graph view, hybrid search, and a CRUD panel over the same knowledge base the MCP tools use.

Three transports

stdio, SSE, streamable-http — one agent locally, or a shared multi-agent deployment.

Markdown as source of truth

The SQLite index is a rebuildable cache; delete it and rebuild — no data is ever lost.

Measured against a plain Markdown wiki

Same knowledge base, browsed with Read/Grep/Glob vs. searched with Engram — 32 questions over 5,070 entries, equivalent fact coverage:

-44%
Tool calls
-35%
Total tokens
-19%
Cost
-24%
Wall time
+3.7%
Fact rate

Comparison

EngramMem0Zep / GraphitiLangMem
Source of truthMarkdown files on diskVector DB / managed APITemporal knowledge graphVector store (LangChain)
SearchBM25 + local embeddings (RRF)Vector similarityGraph traversal + embeddingsVector similarity
RelationsExplicit kb:// links, agent-authoredImplicit (LLM-extracted)Auto-extracted temporal edgesNone built-in
DeploymentSelf-hosted, single Docker imageHosted API or self-hosted + vector DBSelf-hosted, needs Neo4jLibrary, no server

Architecture

Markdown files ---> Search index ---> MCP ---> Agent (source of truth) (SQLite FTS5 + (server.py) (Claude Code, Model2Vec, ChatGPT, ...) rebuildable cache)

Quick start

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.