Claude-Mem: The Complete Guide to the Long-Term Memory Plugin for Claude Code
Claude-Mem is a Claude Code plugin that automatically captures everything Claude does during coding sessions, compresses it with AI (using Claude's agent-sdk), and injects relevant context back into future sessions. SQLite + ChromaDB hybrid search, 4 MCP tools with 10x token savings, 5 lifecycle hooks. 33,700+ stars, TypeScript, 212 releases.
What Is Claude-Mem?
Claude Code sessions end — and all that context is lost. Claude-Mem fixes this by seamlessly preserving context across sessions: automatically capturing tool usage observations, generating semantic summaries, and making them available to future sessions. Claude maintains continuity of knowledge about your projects, even after sessions end.
- Stars: 33,700+ ⭐
- Forks: 2,329
- Releases: 212
- Contributors: 66
- Language: TypeScript
- Website: claude-mem.ai
- Topics: claude-code-plugin, long-term-memory, RAG, ChromaDB, embeddings, openmemory
Quick Start
/plugin marketplace add thedotmack/claude-mem
/plugin install claude-mem
Restart Claude Code. Context from previous sessions automatically appears in new sessions.
How It Works: 6 Core Components
1. 5 Lifecycle Hooks
| Hook | Trigger |
|---|---|
SessionStart | New session begins |
UserPromptSubmit | User sends prompt |
PostToolUse | After tool execution |
Stop | Session pausing |
SessionEnd | Session ends |
2. Smart Install
Cached dependency checker runs pre-hook — auto-installs Bun and uv if missing.
3. Worker Service
HTTP API on port 37777 with web viewer UI and 10 search endpoints, managed by Bun.
4. SQLite Database
Stores sessions, observations, and summaries persistently.
5. mem-search Skill
Natural language queries with progressive disclosure.
6. Chroma Vector Database
Hybrid semantic + keyword search for intelligent context retrieval via embeddings.
4 MCP Search Tools — 3-Layer Token-Efficient Workflow
The killer feature: ~10x token savings by filtering before fetching details.
Layer 1: search → Get compact index with IDs (~50-100 tokens/result)
Layer 2: timeline → Get chronological context around results
Layer 3: get_observations → Fetch full details ONLY for filtered IDs
(~500-1,000 tokens/result)
Available MCP Tools
| Tool | Purpose | Token Cost |
|---|---|---|
search | Search memory index with full-text queries, filters | ~50-100/result |
timeline | Chronological context around observations | Low |
get_observations | Fetch full details by IDs (batch) | ~500-1,000/result |
Example
// Step 1: Search for index
search(query="authentication bug", type="bugfix", limit=10)
// Step 2: Review index, identify relevant IDs
// Step 3: Fetch full details
get_observations(ids=[123, 456])
Beta: Endless Mode
Biomimetic memory architecture for extended sessions. Switch between stable and beta from the web viewer UI at localhost:37777 → Settings.
Claude-Mem vs Alternatives
Category: This is a long-term memory system for AI coding agents.
| Feature | Claude-Mem | CLAUDE.md | Mem0 | SuperMemory |
|---|---|---|---|---|
| Focus | Auto long-term memory | Manual project notes | Memory layer for LLMs | Memory management |
| Stars | 33.7K ⭐ | Built-in | ~24K ⭐ | ~8K ⭐ |
| Auto-Capture | ✅ 5 hooks | ❌ Manual | ❌ | ❌ |
| Session Continuity | ✅ Automatic | Partial | ❌ | ❌ |
| Vector Search | ✅ ChromaDB | ❌ | ✅ | ✅ |
| Token Efficiency | ✅ 10x savings | N/A | N/A | N/A |
| MCP Tools | ✅ 4 tools | ❌ | ✅ MCP | ❌ |
| Web UI | ✅ localhost:37777 | ❌ | ✅ | ✅ |
| Claude Code Plugin | ✅ Native | N/A | ❌ | ❌ |
| SQLite + Chroma | ✅ Hybrid | ❌ | Custom | Custom |
| Lifecycle Hooks | ✅ 5 | ❌ | ❌ | ❌ |
| Endless Mode | ✅ Beta | ❌ | ❌ | ❌ |
When to choose Claude-Mem: You want automatic long-term memory for Claude Code — zero config, session continuity, and token-efficient semantic search.
When to choose CLAUDE.md: You want simple manual project documentation without infrastructure.
When to choose Mem0: You want a general-purpose memory layer for any LLM application.
Conclusion
Claude-Mem solves the biggest pain point of AI coding: memory loss between sessions. With 5 lifecycle hooks for automatic capture, ChromaDB hybrid search, a 3-layer token-efficient MCP workflow, and Endless Mode for extended sessions, it turns Claude Code from a stateless tool into a persistent coding partner. 33.7K stars and 212 releases show massive adoption and rapid iteration.
