claude-mem: Give Your Coding Agent a Memory Between Sessions
claude-mem gives Claude Code and other coding agents memory across sessions. How it captures and re-injects context, how to install it, what to keep private.

claude-mem is an open-source plugin that gives your coding agent a memory, so a new session starts with a short summary of what you did before instead of a blank slate. This guide explains how claude-mem works, when it saves time and tokens, how to install it from the official README, and what private data you should keep out of it.
What claude-mem is
claude-mem is a GitHub project by thedotmack. Its README describes it as capturing what your coding agent does, compressing it with AI and injecting relevant context into later sessions. It works with Claude Code, Codex, Cursor, OpenCode, OpenClaw and others; some tools such as Copilot CLI, Goose, Roo Code, Warp and Zed can search the memory but do not have their sessions recorded.
Why it is trending: on GitHub's monthly trending page on November 21, 2026, claude-mem showed 118,630 stars, with 17,313 added that month. It is licensed under Apache-2.0, and the version badge on the README showed 16.0.2 when I checked. Repos change quickly, so check the repo yourself before installing.
The problem it solves
Coding agents forget. Every new session starts without knowing:
- which files you already explored,
- what you tried yesterday and why it failed,
- the decisions you made about structure or naming,
- the bug you fixed last week that looks similar to today's.
You end up re-explaining, or the agent re-reads the same files, which costs time and tokens. claude-mem tries to carry that context forward automatically.
How claude-mem works
According to the README, there are four parts:
1. Capture
Hooks in the agent send each tool call (reads, edits, commands) to a local worker. For Claude Code, it uses hooks such as SessionStart, UserPromptSubmit, PreToolUse, PostToolUse, Stop and SessionEnd.
2. Compression
A second "observer" agent turns raw activity into short observations and writes a summary when the session ends.
3. Injection
A new session starts with a compact index of relevant observations. Full details are fetched only when needed, through a three-step search: search, then timeline, then get_observations.
4. Storage
Everything lives in a local SQLite database at ~/.claude-mem/claude-mem.db. Chroma adds semantic search on top of SQLite's keyword search. A local web viewer shows memory, sessions and settings at /viewer on the worker URL printed at startup.
Installing claude-mem (from the official README)
Requirements listed in the README: Node.js 20.19+ or 22.12+, a supported agent (for Claude Code, the latest version with plugin support), plus Bun and uv, which are installed automatically if missing.
The quick install:
npx claude-mem install
Or from inside Claude Code:
/plugin marketplace add thedotmack/claude-mem
/plugin install claude-mem
Then restart Claude Code. For other agents, the README uses an --ide flag, for example:
npx claude-mem install --ide opencode
One warning from the README: npm install -g claude-mem installs only the SDK library, not the plugin hooks or worker. Use the commands above.
Does it really save tokens?
The README says index rows are roughly 50 to 100 tokens, compared with about 500 to 1,000 tokens for a full record, so injecting an index is much cheaper than pasting full history. It also claims memory can give "up to 100% more usage from your plan."
To its credit, the README also notes that the per-record ratio is not a measured end-to-end saving. Real savings depend on your work:
- Saves the most on long-running projects where you return to the same codebase daily.
- Saves less on one-off scripts or tiny repos the agent can read in seconds.
- May cost extra because the observer agent also uses a model to compress sessions.
If you are watching your plan limits closely, measure before and after for a week. Our article on AI agent usage limits explains why agent workflows burn quota.
Privacy: what to keep out of claude-mem
A memory tool records what your agent sees. That can include secrets. Here is what the README offers and what you should do.
Built-in controls
<private>tags: content wrapped in<private>tags is not stored.- Local by default: memory stays in
~/.claude-memon your machine. Cloud Sync is opt-in. - Telemetry: anonymous usage analytics are on by default. Turn them off with
npx claude-mem telemetry disable. - Skip sign-in: setting
CLAUDE_MEM_ONLINE_OPTIN=falseskips the online sign-in step. - Screenshots go to the project's cloud only if Cloud Sync is on.
Keep these out
- API keys, tokens and passwords, even in
.envfiles the agent opens. - Client data covered by an NDA or contract.
- Customer personal data (names, phone numbers, addresses) in databases or exports.
- Production credentials and server details.
Practical habits
- Do not let the agent print secrets in the terminal; use environment variables.
- Wrap sensitive notes in
<private>tags. - Keep Cloud Sync off for client projects unless the client agrees.
- Review the web viewer now and then and delete what should not be there.
- Back up or delete
~/.claude-memwhen you finish a client project.
Our AI privacy checklist for creators covers the same thinking for other AI tools.
Useful settings
The README lists a settings file at ~/.claude-mem/settings.json, created on first run, covering the AI model, worker port, data directory, log level and context injection. A mode setting, CLAUDE_MEM_MODE, switches workflow and language modes (for example code). Restart Claude Code after changes.
Who should try it
- Freelance developers juggling several client codebases.
- Solo builders who work on one product for months.
- Anyone tired of re-explaining project context every morning.
Skip it, or test carefully, if you work mostly with highly sensitive code, or if your projects are short enough that context does not matter. For more ways to work well with Claude on code, see our guide to Claude for developers.
Key takeaways
- claude-mem captures coding agent sessions, compresses them and injects a compact index into new sessions.
- It had 118,630 GitHub stars on November 21, 2026, with 17,313 added in the month, under the Apache-2.0 license.
- Install with
npx claude-mem installor the Claude Code plugin commands from the README. - Data is local by default, telemetry is on by default, and secrets should be kept out with
<private>tags and good habits.
FAQ
Is claude-mem free?
The code is open source under Apache-2.0. The observer step uses a model, which may count toward your plan or API usage.
Where does claude-mem store my data?
In a local SQLite database at ~/.claude-mem/claude-mem.db. Cloud Sync is optional.
Does claude-mem work outside Claude Code?
Yes. The README lists Codex, Cursor, OpenCode, OpenClaw and others, with varying levels of support.
Sources
Read next
NEW
DeepTutor: The Open-Source AI Tutor Trending on GitHub
DeepTutor is an open-source AI tutor with quizzes, cited research, memory and spaced review. What it does, how to run it from the README, and its real limits.
Read more
NEW
AdGuard Home vs Pi-hole: Block Ads on Every Device in 2026
AdGuard Home vs Pi-hole after AdGuard Home 1.0 and Pi-hole 6.6: features, licenses, setup on a spare PC or STB, and how to keep Shopee and bank apps working.
Read more
NEW
Open-Source Projects Leaving GitHub: What Happened in 2026
Projects leaving GitHub in 2026: PocketBase, BookStack and the ONNX Runtime outage, why it happens, and how to follow a project safely when its repo moves.
Read more