Introduction
Every AI coding session starts fresh โ your assistant has no memory of previous conversations, decisions made yesterday, or lessons learned from past projects. You end up repeating the same context, explaining the same codebase structure, and losing valuable insights buried in conversation history.
Claude-mem solves this problem by creating a persistent memory system for Claude Code. It automatically captures tool usage observations, compresses them using AI, and stores them in a hybrid SQLite + Chroma vector database. When you start a new session, relevant context is intelligently injected based on semantic similarity and keyword matching.
With 29,663 GitHub stars and active community adoption, claude-mem has become the go-to solution for developers who want their AI coding assistant to remember and learn from past interactions.
What is Claude-Mem?
Claude-mem is an open-source Claude Code plugin that adds persistent memory to your AI coding assistant. Unlike Claude's basic built-in memory (which only stores simple facts), claude-mem captures and compresses the full context of your tool usage, decisions, and development patterns.
How It Works
- Capture: 5 lifecycle hooks monitor every tool usage (file operations, searches, commands)
- Compress: Claude Agent SDK processes observations and extracts key insights
- Store: SQLite database + Chroma vector embeddings for hybrid search
- Inject: MCP tools provide relevant context in new sessions via progressive disclosure
The system achieves ~10x token savings by filtering observations before retrieval โ you get relevant context without overwhelming the AI with unnecessary details.
Key Features
5 Lifecycle Hooks
Claude-mem hooks into every aspect of your coding session:
- SessionStart: Initialize memory context for the session
- UserPromptSubmit: Capture user intent and context
- PostToolUse: Log tool results, decisions, and patterns
- Stop: Process and compress observations when stopping
- SessionEnd: Final compression and storage
Worker Service & Web UI
A background worker service runs on port 37777 with a web viewer interface. You can browse your memory database, search observations, and see how context is being compressed and retrieved.
Hybrid Search System
Claude-mem uses both semantic similarity (via Chroma vector embeddings) and keyword matching (SQLite full-text search) to find relevant context. This hybrid approach ensures you get both conceptually related and specifically relevant observations.
MCP Integration with Progressive Disclosure
Three MCP tools provide intelligent memory access:
- search: Find relevant observations (returns summaries)
- timeline: Show chronological context for specific topics
- get_observations: Fetch full details for specific observations
This 3-layer system prevents context overload while ensuring relevant details are accessible when needed.
Privacy Controls
Wrap sensitive information in <private> tags to exclude it from memory storage:
<private>
API_KEY=sk-1234567890abcdef
DATABASE_URL=postgres://user:pass@localhost/db
</private>
The system automatically filters out private content during observation processing.
Endless Mode (Beta)
For extended coding sessions, Endless Mode prevents memory fragmentation by maintaining continuous context compression across multiple session boundaries.
Architecture & Technology
Technology Stack
| Component | Technology | Purpose |
|---|---|---|
| Core Plugin | TypeScript | Claude Code plugin with lifecycle hooks |
| Worker Service | Node.js + Bun | Background processing and web UI (port 37777) |
| Database | SQLite3 | Structured data and full-text search |
| Vector DB | Chroma | Semantic similarity search via embeddings |
| AI Compression | Claude Agent SDK | Intelligent observation summarization |
| Integration | MCP (Model Context Protocol) | Memory search tools for Claude |
Data Flow
# Memory Creation Flow
User Action โ Tool Usage โ PostToolUse Hook โ
Raw Observation โ Claude Agent SDK โ
Compressed Summary โ SQLite + Chroma โ Stored Memory
# Memory Retrieval Flow
New Session โ User Query โ MCP Search Tools โ
Hybrid Search (Semantic + Keyword) โ
Progressive Disclosure โ Injected Context
Installation Guide
Prerequisites
- Node.js 18+ (for the plugin and worker service)
- Claude Code with OpenClaw Gateway integration
- SQLite3 (automatically installed)
The system automatically installs Bun and uv (Python package manager) as needed.
Installation Steps
๐ Quick Install (OpenClaw Gateway)
If you're using OpenClaw Gateway, installation is a one-liner:
/plugin marketplace add thedotmack/claude-mem
/plugin install claude-mem
The plugin will be automatically configured and activated.
๐ฆ Manual Installation
- Clone the repository:
git clone https://github.com/thedotmack/claude-mem.git cd claude-mem - Install dependencies:
npm install - Build the plugin:
npm run build - Configure Claude Code:
Add the plugin to your Claude Code configuration file
- Start the worker service:
npm run start:workerThe web UI will be available at
http://localhost:37777
Configuration
Create a claude-mem.config.js file to customize behavior:
module.exports = {
// Database location
dbPath: './claude-mem.db',
// Worker service port
workerPort: 37777,
// Compression settings
compression: {
enabled: true,
batchSize: 10,
maxObservations: 1000
},
// Privacy settings
privacy: {
enablePrivateTags: true,
excludePatterns: ['password', 'token', 'secret']
},
// MCP tools configuration
mcp: {
searchLimit: 20,
progressiveDisclosure: true
}
};
Use Cases
Long-term Project Development
Working on a complex codebase over weeks or months? Claude-mem remembers:
- Architecture decisions and reasoning
- File structure and component relationships
- Bug fixes and their solutions
- Performance optimizations tried
- Code review feedback incorporated
Team Knowledge Sharing
Multiple developers can benefit from shared memory contexts:
- Onboarding new team members with project context
- Preserving architectural knowledge
- Sharing debugging techniques and solutions
- Maintaining consistent coding patterns
Learning & Skill Development
Claude-mem accelerates learning by remembering:
- New frameworks and their patterns
- Debugging strategies that worked
- Common mistakes and their fixes
- Best practices discovered through experience
Research & Experimentation
Perfect for research projects where context accumulates over time:
- Experiment results and insights
- Literature review findings
- Model performance comparisons
- Research methodology decisions
Community Feedback
What Developers Are Saying
"This is exactly what I needed. No more explaining the same codebase structure every session. Claude-mem makes my AI assistant actually feel like a team member who remembers our conversations."
"The progressive disclosure system is brilliant. I get relevant context without token bloat. The 3-layer MCP integration (search โ timeline โ get_observations) prevents information overload."
"Started using this for a 6-month React Native project. The memory compression is incredible โ it captures the essence of decisions without storing every single detail. Game changer for long-term development."
Community Resources
- Discord Server: Active community for support and feature requests
- GitHub Discussions: Technical discussions and architecture feedback
- Blog Coverage: Multiple technical blogs have covered setup and use cases
- Reddit Thread: Popular discussion with 500+ upvotes and real-world experiences
Competitors
| Solution | Type | Pros | Cons |
|---|---|---|---|
| Claude Built-in Memory | Native Feature | Simple, no setup required | Basic facts only, no tool context, limited capacity |
| ChatGPT Memory | Native Feature | Automatic, works across sessions | Not available in Claude, limited technical depth |
| Cursor Memory | IDE-Specific | Deep codebase integration | Cursor-only, limited to current project |
| Custom CLAUDE.md Files | Manual Approach | Full control, no dependencies | Manual maintenance, no search, token-expensive |
| Recall (Redis-backed) | Custom Solution | Fast retrieval, scalable | Complex setup, requires Redis infrastructure |
| Claude-mem | Plugin System | Automatic capture, AI compression, hybrid search, MCP integration | Setup required, additional dependencies |
Pros & Cons
โ Pros
- Fully Automatic: No manual memory management โ captures everything intelligently
- AI-Powered Compression: Claude Agent SDK extracts key insights, not raw data dumps
- Hybrid Search: Semantic + keyword matching for precise context retrieval
- Progressive Disclosure: 3-layer MCP system prevents context overload
- Privacy Controls:
<private>tags protect sensitive information - OpenClaw Integration: One-line installation with gateway support
- Open Source: AGPL-3.0 license, active community development
- Web UI: Browse and search memory database visually
- Token Efficient: ~10x reduction in token usage vs manual context
โ ๏ธ Cons
- Setup Complexity: Requires Node.js, dependencies, and configuration
- Storage Requirements: Database grows over time (SQLite + Chroma)
- Claude Code Dependency: Only works with Claude Code, not other AI assistants
- Beta Features: Endless Mode and some advanced features are still experimental
- Resource Usage: Worker service consumes system resources
- Learning Curve: Understanding MCP tools and memory structure takes time
Pricing
๐ฐ Pricing Structure
- Open Source: Free to use under AGPL-3.0 license
- Self-Hosted: No subscription fees, you control the infrastructure
- Operational Costs: Claude API usage for compression (minimal)
- $CMEM Token: Community-driven Solana token (optional, speculative)
Estimated Monthly Cost: $2-5 in Claude API calls for active users
Cost Breakdown
The main cost is Claude API usage for observation compression:
- Light Usage (10 sessions/week): ~$1-2/month
- Heavy Usage (daily coding): ~$5-10/month
- Team Usage (shared memory): ~$20-50/month
Compare this to the time saved from not having to re-explain context โ claude-mem typically pays for itself in saved developer hours within days.
Getting Started
Quick Start Guide
- Install via OpenClaw Gateway:
/plugin marketplace add thedotmack/claude-mem /plugin install claude-mem - Start coding normally โ claude-mem begins capturing observations automatically
- Check the web UI at
http://localhost:37777to see memory building - Use MCP search tools to retrieve context:
search "React components"โ find related observationstimeline "debugging session"โ see chronological contextget_observations [123, 456]โ fetch specific details
- Add privacy tags for sensitive content:
<private>API_KEY=your-secret-key</private>
Best Practices
- Let it build: Use claude-mem for 2-3 sessions before expecting significant context
- Use descriptive names: Good file names and clear prompts improve memory quality
- Review periodically: Check the web UI to understand what's being captured
- Tag sensitive data: Always wrap secrets in
<private>tags - Monitor storage: Database can grow large with extensive usage
Troubleshooting
- Worker service won't start: Check port 37777 is available
- No memory capture: Verify lifecycle hooks are properly configured
- Search returns no results: Wait for Chroma embeddings to process
- High API costs: Adjust compression batch size in config
For additional support, join the GitHub Discussions or the community Discord server.
References
- Claude-mem GitHub Repository โ Official source code and documentation
- Claude-mem Documentation โ Complete setup and usage guide
- Persistent Memory for Claude Code โ Never Lose Context โ Medium setup guide
- Reddit Discussion: Claude-mem Community Feedback โ Real-world experiences and use cases
- Claude-mem: AI Memory for Long-term Coding Projects โ Technical deep dive
- How to Use Claude-mem for Persistent AI Memory โ Step-by-step tutorial
- Claude-mem: Persistent Memory for AI Coding Assistants โ Architectural analysis
- Claude's Built-in Memory โ Comparison with native Claude features