claude-engram
Claude Engram is an MCP server providing persistent memory, session intelligence, and code quality assurance for AI coding assistants.
Memory Management — Store, search, recall, archive, and deduplicate memories (discoveries, rules, mistakes, notes) with hybrid semantic/keyword search, LLM-powered clustering/consolidation, tiered hot/archive storage, and batch operations. Rules and mistakes never archive.
Session Lifecycle — Load full context at session start (memories, checkpoints, decisions, deduplication) and generate summaries at session end.
Work Tracking — Log decisions (with reasoning and alternatives) and mistakes (with affected files and prevention strategies).
Pre-Edit Safety — Before editing, check past mistakes for a file, detect edit loop risk, and verify scope compliance.
Scope Guard — Declare task scope with allowed files/globs, check file inclusion, expand scope with justification, and track violations.
Loop Detection — Record edits and test results; warn when a file has been edited 3+ times without progress.
Context Protection — Save/restore task checkpoints, verify task completion with evidence, register critical instructions, and create session handoff documents.
Convention Tracking — Add, retrieve, and check code/filenames against project conventions (naming, architecture, style, patterns, avoidances).
Output Validation — Validate generated code for fake/silent failures and check command output against expected formats.
Codebase Intelligence
scout_search— semantic search across codebasescout_analyze— LLM-based code analysisfile_summarize— quick or detailed file summariesdeps_map— map imports and reverse dependenciesimpact_analyze— change impact with risk levelcode_quality_check— detect long functions, deep nesting, vague namescode_pattern_check— check code against stored conventionsaudit_batch— batch audit files with severity filteringfind_similar_issues— regex-based bug pattern search
Session Mining — Search past conversations, find past decisions, replay file histories, detect recurring struggles and error patterns, correlate co-edited files, generate project timelines, predict needed context before edits, and reflect with LLM-powered analysis across sessions or projects.
Health Check — Query server status, model, and memory statistics.
Claude Engram
Persistent memory and session intelligence for Claude Code. Hooks into the session lifecycle to auto-track mistakes, decisions, and context — then mines your full session history so past work resurfaces exactly when it's relevant.
Zero manual effort. Works with any MCP-compatible client.
What It Does
Everything below is automatic (hooks) unless marked as a tool:
Tracks every edit, error, test result, and session event; captures decisions straight from your prompts ("let's use X")
Injects the 3 most relevant memories before each file edit; warns before you repeat a past mistake
Error deja-vu: a failure matching a known recurring error gets the past fix injected at failure time
Verifies imports and shows blast radius before edits, and orients before reads — all from a per-project code index (AST, no LLM)
Lists the project's known-good test commands at session start
Survives compaction: checkpoint before, re-inject after; deliberate checkpoints live in a durable per-project ring
Mines your full history in the background (and live, mid-session): decisions, mistakes, recurring struggles — searchable across everything you've ever discussed, scoped to the right sub-project
Stays honest: failing TDD runs aren't logged as mistakes, edit loops get flagged, subagents are tracked without wasting their context
Tools (on demand):
memory,session_mine,work,contextcheckpoints,deps_map,impact_analyze,scout_search— all annotated read-only/idempotent where true./engramloads the full reference.
Related MCP server: Doclea MCP
How to Use It Effectively
From the author — mostly it just works in the background. The few things worth doing on purpose:
Pull
/engramwhen you want Claude to actively reach for the tools (background tracking happens either way).Half-remember something from weeks ago? Ask Claude to mine the sessions for it — it searches everything, not just what's in context.
Something it should never forget → save it as a rule. Per-project rules stay local; rules at your workspace root cascade to every project under it.
Before compacting, it auto-checkpoints — but a manual checkpoint with what you're doing and what's left resumes far cleaner. Deliberate saves always beat automatic ones.
On return, ask what you said you'd do this session (
session_mine(commitments)) — a quick, best-effort reorient from the live transcript.
The less you poke at it, the better it works. Work in progress — issues welcome.
How It Works
Claude Code
|
+-- Hooks (remind.py) <- intercept every tool call (1-2s budget)
+-- Session mining (mining/) <- background + live-tick intelligence
+-- MCP server (server.py) <- on-demand tools
+-- Scorer daemon <- warm encoder + hook dispatch, cpu-resident;
bulk embeddings in a transient GPU workerBenchmarks
Retrieval (recall@k): LongMemEval 0.966 R@5 / 0.982 R@10 (500 questions), ConvoMem 0.960 (250 items), LoCoMo 0.649 R@10 (~2k questions); ~43ms/query, 112ms cross-session over 7,310 chunks.
Product behavior: integration suites green — decision capture (97.8% precision), error auto-capture (100% recall), compaction survival (6/6), multi-project isolation (11/11), edit-loop detection (12/12), session mining (64/64), Obsidian-vault compat (25/25).
Full tables and reproduction commands: library-book.
Compatibility
Platform | What Works | Auto-Capture |
Claude Code (CLI, desktop, VS Code, JetBrains) | Everything | Full — hooks + session mining |
Cursor / Windsurf / Continue.dev / Zed / any MCP client | MCP tools | No hooks |
Obsidian vaults | Full (with CLAUDE.md at root) | Full with Claude Code |
Install
git clone https://github.com/20alexl/claude-engram.git
cd claude-engram
python -m venv venv
source venv/bin/activate # or venv\Scripts\activate on Windows
pip install -e . # Core
pip install -e ".[semantic]" # + embedding model for vector search and semantic scoring
python install.py # Hooks, MCP server, /engram skill, migrationsPer-Project Setup
python install.py --setup /path/to/your/projectOr copy .mcp.json to your project root. That's the only per-project file — hooks and the /engram skill are global. (The CLAUDE.md in this repo documents engram for people working on engram; your projects don't need it.)
Updating
cd claude-engram
git pull
pip install -e ".[semantic]" # Reinstall if dependencies changed
python install.py # Re-run to update hooks and /engram skillHooks pick up code changes immediately (editable install); reconnect the MCP server (/mcp) to reload it. Data migrations run automatically and are forward-only, idempotent, and downgrade-safe.
Mid-Project Adoption
Install normally. On first session, engram detects your existing Claude Code history and mines it in the background — decisions, mistakes, and patterns from every past conversation.
Configuration
All optional. Deep detail on each lives in the library-book.
Variable | Default | Description |
|
| Ollama model — only |
|
| Embedding model (~1.1GB scorer RAM). |
| model native | Matryoshka truncation dim. Stores are signature-stamped — model changes rebuild them automatically |
| smart | Unset: daemon stays on cpu, bulk jobs use a transient GPU worker (full VRAM release). |
|
| Job size (texts) that routes to the GPU worker |
|
| Live mining tick interval (seconds); |
|
| Days until inactive memories archive |
|
| Scorer daemon idle timeout (seconds) |
|
| Storage location (also the test-isolation seam) |
|
| Prune session-search shards older than N days |
| unset | Mirror last-read file path to this file (statusline integration) |
| unset |
|
~/.claude_engram/config.json additionally accepts embed_model, embed_dim, and lessons_globs (opt-in lessons bridge: globs of curated markdown whose dated entries sync as protected memories).
Reindexing
If search quality degrades or after a big update:
python scripts/reindex.py "/path/to/your/workspace" --force # rebuild search index
python scripts/reindex.py "/path/to/your/workspace" --force --extract # also re-extract decisions/mistakesOr via MCP: session_mine(operation="reindex", mode="bootstrap")
Documentation
Library Book — design, internals, full usage guide, API reference, gotchas, changelog.
/engram — quick tool reference (installed by install.py).
License
MIT
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseCqualityAmaintenanceProvides AI assistants with persistent memory and code intelligence across all tools and conversations. Features semantic search, knowledge graphs, decision tracking, and impact analysis with 60+ tools for universal context preservation.Last updated3632338MIT

Doclea MCPofficial
Alicense-qualityCmaintenanceProvides persistent memory for AI coding assistants, storing and retrieving architectural decisions, patterns, and solutions across sessions using semantic search, while also offering git integration for commit messages and code expertise mapping.Last updatedMIT- Alicense-qualityDmaintenanceProvides AI coding assistants with persistent, context-rich memory of a codebase, including documentation and git history, enabling recall across sessions.Last updated104Apache 2.0
- Alicense-qualityDmaintenanceNever start from zero. Persistent session intelligence for AI coding assistants.Last updated801MIT
Related MCP Connectors
Persistent memory and cross-session learning for AI coding assistants (hosted remote MCP).
Persistent memory for AI agents. Search, store, and recall across sessions.
Persistent memory and knowledge graphs for AI agents. Hybrid search, context checkpoints, and more.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/20alexl/claude-engram'
If you have feedback or need assistance with the MCP directory API, please join our Discord server