EngramDB

Project-scoped persistent memory for coding agents. Stores decisions, hazards, conventions, and context about your codebase so your agent remembers across sessions.
EngramDB gives your AI coding agent a memory layer that persists between conversations. It stores what the agent learns about your project — architectural decisions, known hazards, team conventions, debugging context — and surfaces relevant memories automatically when the agent reads or edits files.
Features
- Semantic search — vector similarity search powered by LanceDB and all-MiniLM-L12-v2 embeddings
- Automatic context injection — hooks surface relevant memories when your agent touches files
- Contradiction detection — NLI-based challenge system flags conflicting information
- Epistemic classes — every memory is a
fact, observation, or decision, orthogonal to its type; retrieval reweights classes by situation (observations surface while debugging, decisions while designing)
- Bi-temporal validity — outdated memories are invalidated instead of deleted; superseded and consolidated memories stay queryable as history
- Task-scoped memories — declare the task a session works on; completing it demotes its task-scoped memories, re-confirmed ones get promoted, and
verify/doctor re-check what's still accurate
- Memory lifecycle — criticality scoring, garbage collection, compression of stale memories
- MCP server — full Model Context Protocol integration (stdio and SSE transports)
- Shared embedding daemon — auto-spawned and self-healing; loads models once machine-wide instead of once per agent session, stays resident while sessions are connected, and is usable from the CLI too, with graceful in-process fallback
- Claude Code plugin — one-command install with hooks, MCP, and permissions
- Offline-first — all embeddings run locally via ONNX Runtime (or optionally Ollama); ONNX Runtime is installed separately
- Multiple output formats — pretty, JSON, or plain text for scripting
Quick Start
Install
EngramDB needs ONNX Runtime 1.24 or later on the machine. It is not bundled.
brew install onnxruntime # macOS / Linuxbrew
sudo apt-get install -y libonnxruntime # where packaged
Or set ORT_DYLIB_PATH to a library you already have. Without a runtime
EngramDB still runs, with keyword search only. See
installation.
Then build from source (needs a recent stable Rust toolchain and protoc):
cargo install --locked --git https://github.com/egeapak/engramdb engram-cli
Set up Claude Code integration
The recommended way is via the plugin:
# Add the marketplace
/plugin marketplace add egeapak/engramdb
# Install the plugin
/plugin install engram@engramdb
Or let engramdb setup write the hooks (to ~/.claude/settings.json) and the MCP entry (to ~/.claude.json):
engramdb setup --global
For project scope (writes <project>/.claude/settings.json and <project>/.mcp.json):
engramdb setup
Use the CLI directly
# Initialize a store in the current project
engramdb init
# Add a memory (summary is required; omit it and a terminal will prompt for one)
engramdb add --type decision --title "Use PostgreSQL for persistence" \
--summary "Chose PostgreSQL over SQLite for concurrent write support" \
"The app needs many concurrent writers and SQLite serializes all writes."
# Find memories by keyword (filter mode requires a query signal)
engramdb query --mode filter "database choice"
# Rank memories relevant to a file (rank mode browses by context)
engramdb query --mode rank --path src/db/connection.rs
How It Works
EngramDB stores memories as structured files (TOML + markdown) in .engramdb/memories/ within your project. Each memory has:
- Type — decision, convention, hazard, context, intent, relationship, debug, preference
- Epistemic class — fact, observation, or decision (defaults from the type), with a bi-temporal validity window: memories are invalidated, not deleted
- Visibility —
shared (committed with the project) or personal (kept outside the repository)
- Criticality — 0.0 to 1.0 score that decays over time
- Embeddings — vector representations stored in a LanceDB index for semantic search
When integrated with Claude Code: