How developers are solving Claude Code's amnesia problem — and the open-source MCP solution that does it automatically.
17,000+ Claude Code users affectedClaude Code is powerful inside a session. But between sessions, it has amnesia. Every new conversation starts from zero. On a complex project, this means spending the first few minutes re-explaining your architecture, your decisions, your conventions — before you can do any real work.
"Every time I hit /compact, Claude forgets everything we just worked on. All those architecture decisions we debated? Gone. That bug fix we finally figured out? Vanished. Client preferences I mentioned three times? Claude asks again. It's like Groundhog Day, except I'm the one who has to repeat myself." — Mohamed Ali, DEV Community (Feb 11, 2026)
Two independent developers built MCP servers specifically for Claude Code memory persistence. Both discovered the same approach: watch the /compact hook, intercept the context, save it somewhere persistent, then restore it on the next session.
By Mohamed Ali. Blocks Claude with "save your work first" when /compact fires. Gentle reminders every 10 turns if nothing saved yet.
By Yuval. Two-tier architecture: CLAUDE.md (~150 lines) for session briefing + vector store for detailed memories. Uses Claude Code's built-in hooks.
Open-source MCP server for persistent context management in AI coding assistants. GitHub: mkreyman/mcp-memory-keeper.
Open-source MCP server that works with Claude Code, Cursor, and any MCP client. No configuration needed. JSON/SQLite/Redis backends. TTL. AES encryption.
Yuval's architecture article describes the key insight that shapes all Claude Code memory solutions:
These two features, combined, are everything you need for persistent memory. The hooks capture knowledge. CLAUDE.md delivers it. No custom protocols, no external databases.
| Tier | Storage | Content | When Used |
|---|---|---|---|
| Tier 1 | CLAUDE.md | ~150 lines of compact briefing | Every session start |
| Tier 2 | Vector store / JSON | Full memories, decisions, preferences | When Claude searches or asks |
| ★ agent-memory | JSON / SQLite / Redis | Everything above + TTL + encryption | Always — MCP tools |
pip install agent-memorypython -m agent_memory.mcp_serverWith a persistent memory system, Claude Code remembers:
| Solution | Type | Claude-Specific | Encryption | TTL | License |
|---|---|---|---|---|---|
| MemCP | MCP Server | Yes (hooks) | — | — | Open |
| memory-mcp | MCP Server | Yes | — | — | Open |
| mcp-memory-keeper | MCP Server | Partial | — | — | MIT |
| agent-memory | MCP Server | Yes (universal) | AES-256 | Yes | MIT |
You might think /compact is the enemy. But it's actually necessary — Claude's context window is finite, and long conversations need to be compressed to stay productive.
The real problem is that compaction destroys valuable context that should be saved, not lost. The solution isn't to avoid /compact — it's to intercept it and save the context before it disappears.
"There's a constraint that shaped everything: Claude Code already reads a file called CLAUDE.md on every session start. Whatever is in that file becomes part of Claude's initial context. Claude Code also has a hook system. These two features, combined, are everything you need for persistent memory." — Yuval, The Architecture of Persistent Memory for Claude Code