loading…
Search for a command to run...
loading…
Persistent memory and session intelligence for Claude Code. Auto-tracks mistakes, decisions, and context via hooks. Mines session history for patterns and cross
Persistent memory and session intelligence for Claude Code. Auto-tracks mistakes, decisions, and context via hooks. Mines session history for patterns and cross-session search. Loop detection, pre-edit warnings, context compaction survival. Runs locally with Ollama.
Persistent memory and session intelligence for AI coding assistants. Hooks into Claude Code's lifecycle to auto-track mistakes, decisions, and context — then mines your full session history to surface patterns, predict what you'll need, and search across everything you've ever discussed.
Zero manual effort. Works with any MCP-compatible client.
Automatic (hooks — zero invocation):
Session Mining (automatic, background):
On-demand (MCP tools):
memory — store, search, archive, and manage memoriessession_mine — search past conversations, find decisions, replay file history, detect patternswork — log decisions and mistakes with reasoningClaude Code
|
+-- Hooks (remind.py) <- Intercepts every tool call
| SessionStart / Edit / Bash / Error / Compact / Stop
|
+-- Session Mining (mining/) <- Background intelligence
| JSONL parser -> Extractors -> Search index -> Pattern detection
|
+-- MCP Server (server.py) <- Tools for manual operations
| memory, session_mine, work, scope, context, ...
|
+-- Scorer Server (scorer_server.py) <- Persistent AllMiniLM process
TCP localhost, ~90MB RAM, batch embeddings
Hooks fire on every tool call (1-2s budget each). Heavy processing happens in a background subprocess after session end. The scorer server stays loaded in memory for fast semantic scoring.
These test what the product actually does.
| Benchmark | What it tests | Result |
|---|---|---|
| Decision Capture (220 prompts) | Auto-detect decisions from user prompts | 97.8% precision, 36.7% recall |
| Injection Relevance (50 memories, 15 cases) | Right memories surface before edits | 14/15 passed, 100% isolation |
| Compaction Survival (6 scenarios) | Rules/mistakes survive context compression | 6/6 |
| Error Auto-Capture (53 payloads) | Extract errors, reject noise, deduplicate | 100% recall, 97% precision |
| Multi-Project Scoping (11 cases) | Sub-project isolation + workspace inheritance | 11/11 |
| Edit Loop Detection (12 scenarios) | Detect spirals vs iterative improvement | 12/12 |
| Session Mining (27 tests) | JSONL parsing, indexing, search, incremental processing | 27/27 |
| Obsidian Vault (25 tests) | Compatibility with PARA + CLAUDE.md vault structure | 25/25 |
Reproduce: python tests/bench_integration.py, bench_session_mining.py, bench_obsidian_vault.py
Retrieval-only (recall@k) — whether the right memory is found in top results.
| Benchmark | Score |
|---|---|
| LongMemEval Recall@5 (500 questions) | 0.966 |
| LongMemEval Recall@10 | 0.982 |
| ConvoMem (250 items, 5 categories) | 0.960 |
| LoCoMo R@10 (1,986 questions) | 0.649 |
| Speed | 43ms/query |
| Cross-session search | 112ms/query over 7310 chunks |
Reproduce: python tests/bench_longmemeval.py, bench_locomo.py, bench_convomem.py
| Platform | What Works | Auto-Capture |
|---|---|---|
| Claude Code (CLI, desktop, VS Code, JetBrains) | Everything | Full — hooks + session mining |
| Cursor | MCP tools (memory, search, etc.) | No hooks |
| Windsurf | MCP tools | No hooks |
| Continue.dev | MCP tools | No hooks |
| Zed | MCP tools | No hooks |
| Any MCP client | MCP tools | No hooks |
| Obsidian vaults | Full (with CLAUDE.md at root) | Full with Claude Code |
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]" # + AllMiniLM for vector search and semantic scoring
python install.py # Configure hooks, MCP server, and /engram skill
python install.py --setup /path/to/your/project
Or copy .mcp.json to your project root.
Note: The CLAUDE.md in this repo is engram-specific documentation — it's not required for engram to work. Hooks fire automatically and the /engram skill provides a quick reference on demand. If you already have a CLAUDE.md for your project, keep it as-is and don't copy ours over it. If you want engram docs alongside your project rules, rename it to CLAUDE-ENGRAM.md (or similar) so it doesn't clobber your existing file — Claude will see it when relevant.
cd claude-engram
git pull
pip install -e ".[semantic]" # Reinstall if dependencies changed
python install.py # Re-run to update hooks and /engram skill
Hooks and MCP tools pick up code changes immediately (editable install). Reconnect the MCP server in Claude Code (/mcp) to reload the server process.
Already deep in a project? Install normally. On first session, engram auto-detects your existing Claude Code session history and mines it in the background — extracting decisions, mistakes, and patterns from all past conversations. No manual effort.
| Variable | Default | Description |
|---|---|---|
CLAUDE_ENGRAM_MODEL |
gemma3:12b |
Ollama model (optional — only for scout_search, convention checking) |
CLAUDE_ENGRAM_ARCHIVE_DAYS |
14 |
Days until inactive memories archive |
CLAUDE_ENGRAM_SCORER_TIMEOUT |
1800 |
AllMiniLM server idle timeout (seconds) |
If search quality is poor or you want to rebuild after an update:
python scripts/reindex.py "E:\workspace" --force # rebuild search index
python scripts/reindex.py "E:\workspace" --force --extract # also re-extract decisions/mistakes
Or via MCP: session_mine(operation="reindex", mode="bootstrap")
Library Book — design philosophy, internals, full usage guide, API reference, gotchas, and changelog.
/engram — slash command with quick tool reference (installed by install.py).
MIT
Добавь это в claude_desktop_config.json и перезапусти Claude Desktop.
{
"mcpServers": {
"20alexl-claude-engram": {
"command": "npx",
"args": []
}
}
}