claude-mem
by thedotmack
Claude forgets everything between sessions. You explain your architecture on Monday. By Tuesday, it asks again. claude-mem fixes this by capturing every coding session and injecting relevant context into future ones automatically. The system works through 5 lifecycle hooks: SessionStart, UserPromptSubmit, PostToolUse, Stop, and SessionEnd. Every decision, code pattern, and architectural choice gets recorded as observations in a SQLite database backed by Chroma vector search. When you start a new session, claude-mem automatically retrieves and injects the most relevant past context — no manual prompting needed. Token efficiency is the design philosophy. A 3-layer search workflow keeps costs down. Layer 1 returns a compact index with observation IDs (50-100 tokens). Layer 2 provides chronological context around matches. Layer 3 fetches full details only for filtered results (500-1,000 tokens). This achieves roughly 10x token savings compared to dumping entire session histories into context. The web dashboard at localhost:37777 shows a real-time memory stream — every observation being captured, every context injection happening. Privacy controls let you wrap sensitive content in <private> tags to exclude it from memory storage. A citation system lets you reference past observations by ID in conversations. Installation takes one command through Claude Code's plugin marketplace: /plugin marketplace add thedotmack/claude-mem. Alternatively, the OpenClaw Gateway offers a curl-based install. Requirements are minimal: Node.js 18+, Claude Code (latest), with Bun runtime and uv package manager auto-installed as needed. With 42,600+ GitHub stars and version 6.5.0, claude-mem has become the de facto persistent memory solution for Claude Code users. It complements Claude's built-in CLAUDE.md memory but operates at a much more granular level — capturing individual decisions rather than high-level project notes. Related: See how Hermes Agent handles persistent memory differently, and explore Claude Code productivity tips for more workflow optimizations.
Installation
Key Features
- ✓5 lifecycle hooks capture every coding session decision, pattern, and architectural choice automatically
- ✓3-layer search workflow achieves 10x token savings through progressive disclosure of context
- ✓Chroma vector database enables hybrid semantic and keyword search across session history
- ✓Real-time web dashboard at localhost:37777 for monitoring memory stream and observations
- ✓Privacy controls with <private> tags to exclude sensitive content from memory storage
- ✓Citation system for referencing past observations by ID in conversations
- ✓Natural language search via the mem-search skill for querying project history
Use Cases
- →Maintaining project context across multi-day coding sessions without re-explaining architecture
- →Searching past coding decisions and rationale when revisiting old code
- →Preserving team knowledge across different Claude Code sessions and developers
- →Reducing token waste by injecting only relevant past context instead of full session logs
- →Tracking architectural decisions and code pattern evolution over time