claude-mem: persistent memory for Claude Code with -75% tokens
Captures every Claude Code session, compresses it with AI, and reinjects the relevant context into the next one. Up to 75% fewer tokens, survives /clear, compaction, and machine switches.
Why it matters Turns every conversation with Claude Code into searchable persistent memory: the next session starts knowing what was investigated, decided, and completed in earlier ones. Compatible with several agents (Codex, Gemini, Copilot).
claude-mem: persistent memory for Claude Code with -75% tokens
What is it?
claude-mem is a context compression and persistence system designed for Claude Code, though it also works with Codex, OpenClaw, Gemini, Hermes, Copilot, and OpenCode. It captures every session of the agent — what was investigated, what was decided, what was completed, what remained pending — runs it through an AI compressor, and stores it in a local vector database (ChromaDB).
In the next session, before the agent starts, claude-mem looks up the most relevant memories for the current context and injects them as history. The result: the agent “remembers” without having to re-read all the code or reload the context by hand.
The project reports up to 75% fewer tokens per session. It reached #1 on GitHub Trending and exceeds 76,000 stars.
When does it fit?
- Long engagements where context drift between sessions hurts quality and reproducing the mental state is expensive.
- Teams that pay for tokens and where saving 75% translates directly into margin.
- Continuity across machines: the context lives in local ChromaDB, so the operator can hop from laptop to desktop without losing the thread.
- Standardising memory across several agents (Claude, Codex, Gemini) in the same workflow.
Quickstart
npx claude-mem init
This configures hooks in ~/.claude/settings.json, brings up ChromaDB locally, and opens the viewer at http://localhost:37777. From the next Claude Code session, capture and retrieval are automatic.
Requirements: Node ≥ 18, ChromaDB running locally (the install itself manages it).
When NOT to use it
- One-shot tasks: the capture overhead isn’t worth it.
- Hosted commercial deliverables: AGPL 3.0 is copyleft and triggers on network use. If claude-mem is embedded in a SaaS delivered to a client, the source code of that service may need to be released under AGPL.
- Regulated environments where storing session content (even compressed) creates a data surface that wasn’t part of the original threat model.
License considerations
AGPL 3.0 is not “generic open-source”. The network-copyleft implies:
- Internal use (laptop, your own infrastructure) → no issue.
- Self-hosted on operator-owned servers → no issue.
- Embedded in a client-facing SaaS → requires legal review before adoption.
Why we are publishing it
At dataqbs we treat tools that multiply agent efficiency as critical infrastructure. claude-mem is one of them: if the reported 75% saving holds for our workloads, the ROI is immediate. The public note also serves as a reminder about the license trade-off, which is the part most teams overlook when adopting modern OSS tools.
Repository: github.com/thedotmack/claude-mem · License: AGPL 3.0
This note is a recommendation based on internal evaluation. Verify license, fit with your business model, and project maturity before adopting it in production.