Claude-engram
Claude forgets everything between sessions. Your preferences, your project state, where you left off — gone the moment you close the terminal.
claude-engram fixes that. ~350 ambient tokens. No Docker, no API keys, no MCP.
What you see
When you open Claude Code, claude-engram injects a 3-bullet executive summary from your last session:
- status: claude-engram MVP+D2 completo, 79 tests passing
- last change: D2 error-loop enrichment con memory.db cross-reference
- next: fix install.sh memdoctor → translate EXEC_PROMPT → docs
friction: correction-heavy(4x), error-loop(2x) (run: engram doctor)
Three bullets, zero latency. The merge (recap + memory + patterns) happens in the background between sessions, so opening is instant. The optional friction: line surfaces when memdoctor detects active signals for the current project.
How it works
claude-engram has two jobs: remember and inject.
- While you work — two triggers capture state:
- Every 25 prompts (UserPromptSubmit) — mid-session digest fires a background LLM pass to update memories.
- On compaction (PreCompact) — transcript → SQLite; digest + snapshot + pattern wiki refresh; executive summary rebuild.
- Between sessions — Sonnet merges Claude Code's own
※ recap with engram's memories/patterns into a 3-bullet executive summary, cached per project.
- On session start — the cached executive is injected (zero latency). Falls back to ~350-token inject if the cache is missing.
That's the core. No config, no commands to run. It works while you work.
What it remembers
| What | Example | Lifetime |
|---|
| Handoffs | Where you left off | "Refactoring auth to JWT; signup still on old sessions" | 7 days |
| Preferences | How you like to work | "uses uv, not pip · responds in Spanish" | Forever |
| Patterns | How you actually work | files always edited together, recurring errors | Updated on each session |
Handoffs and preferences are the core — they inject automatically on every session start. Patterns are a bonus: an Obsidian-compatible wiki in ~/.claude/patterns/ that detects file co-edits, recurring errors, and tool habits from your history. Browse it, ignore it, or use /patterns inside Claude Code to explore.
Install
Requirements: Claude Code, uv
As a Claude Code plugin (recommended):
# In Claude Code:
/plugin install claude-engram@sebastianbreguel/claude-engram
Or clone and run the installer:
git clone https://github.com/sebastianbreguel/claude-engram.git
cd claude-engram && ./install.sh
# Uninstall (keeps your memory.db data)
cd claude-engram && ./uninstall.sh
Why not built-in memory?
Claude Code has auto-memory (MEMORY.md) — it stores what you explicitly tell it to remember. claude-engram watches what you actually do: it extracts decisions, errors, preferences, and project state from every session automatically. It scopes memories per project, detects workflow patterns across sessions, and rebuilds a structured executive summary so your next session starts exactly where you left off — without you lifting a finger.
How it compares
| claude-engram | claude-mem | OpenMemory | cortex |
|---|
| Ambient token cost | ~350 | ~2K+ | ~1K+ (MCP) | ~3K (27 tools) |
| External services | None | Agent SDK worker | Docker + MCP server | MCP server |
| API keys required | No | Yes | No | No |
| Runtime | Python + SQLite | Node worker | Docker | Rust binary |
| Install | ./install.sh | npm + worker | docker compose | cargo |
Privacy and transparency
Everything lives in ~/.claude/memory.db (SQLite) and ~/.claude/patterns/ (markdown). Nothing leaves your machine.
- Captured: session metadata, files touched, tool usage, error strings, and LLM-extracted memories.
- NOT captured: no full transcripts, no code content, no secrets from
.env.
- LLM calls:
claude --print (Sonnet 4.6) on compaction + every 25 prompts (~2-5K tokens each, local to your session). No external API calls.
- Uninstall:
./uninstall.sh removes tools and hooks. Your data is preserved unless you delete it.
CLI