What Is claude-mem? The Memory Layer That Follows Claude Code Between Sessions

2026-11-09
Hooks capture what the agent does, a model compresses it, and search pulls back only what matters. A practical look at the GitHub-trending memory plugin.
Every coding agent has the same morning problem. You open a session, type "continue the migration we started Tuesday," and the agent has no idea what Tuesday was.
claude-mem is an open-source fix for that. It hooks into Claude Code, records what the agent does, compresses those records with a model, and injects the relevant parts back into future sessions. The repository, thedotmack/claude-mem, passed 109,000 stars on GitHub and sits at the top of the trending list, which is how most people found it.
The pitch is simple. The implementation is not, and the caveats matter more than the star count.
What claude-mem Solves
Claude Code has a context window, not a memory. When a session ends, everything the agent learned about your file layout, your naming conventions, and the bug you fixed at 2 AM goes with it.
That is fine for one-off tasks. It is expensive for multi-day work. You re-explain the architecture, the agent re-reads the same six files, and you pay for those tokens again on every restart.
claude-mem targets exactly that waste. Instead of dumping old transcripts back into the prompt, it stores structured observations and retrieves only what matches the current request. The difference between "here is everything from yesterday" and "here are the three decisions that touch this file" is the whole product.
How claude-mem Works Under the Hood
Five moving parts, and they explain most of the tool's strengths and weaknesses.
- Lifecycle hooks on six events: SessionStart, UserPromptSubmit, PreToolUse, PostToolUse, Stop, and SessionEnd
- A local worker service that exposes an HTTP API and a web viewer
- SQLite for sessions, observations, and summaries
- Chroma, a vector database, for hybrid semantic and keyword search
- A mem-search skill that queries the store in stages
The hooks are how it sees anything. Each one runs a single command, and there is no proxy sitting between Claude Code and your files. When you read a file or run a command, the hook records the observation.
A background observer model turns raw tool activity into compact summaries. That model is where the cost and the privacy questions live, because summarizing requires sending session content to a provider.
Search uses progressive disclosure. You get a compact index first, then a timeline around the hits, then full details only for the IDs you pick. That staged retrieval is the mechanism behind the token savings claim.
Storage is local by default, in a SQLite file plus the Chroma index, with settings in ~/.claude-mem/settings.json. Cloud sync exists and is optional.
What claude-mem Setup Actually Involves
Two install paths, one requirement, and one mistake people keep making.
The requirement is Node.js 20 or newer. Bun and uv install themselves, and SQLite is bundled.
The first path is the installer:
npx claude-mem install
The second runs inside Claude Code:
/plugin marketplace add thedotmack/claude-mem
/plugin install claude-mem
Restart Claude Code afterward. Open the web viewer the worker serves and you will see what it has recorded.
The mistake is npm install -g claude-mem. That installs the SDK and nothing else. No hooks, no worker, no recording. If you have done that and wonder why nothing happens, run the installer instead.
Support extends beyond Claude Code. The same installer takes an --ide flag for Codex, Gemini, Copilot, OpenCode, and several others. Where an agent has no hooks, claude-mem falls back to watching log files, which is a weaker integration and worth knowing before you expect parity.
What claude-mem Saves in Tokens
The README claims roughly 10x savings from the staged search design. Third-party write-ups repeat numbers between 60 and 80 percent, and some go higher. None of those figures come from an independent benchmark.
That gap is the honest state of things. A 10x reduction and a 65 percent reduction are very different outcomes, and the difference depends on how much context you were dumping before. If you were pasting whole files into the prompt, almost any retrieval system looks like a miracle. If you already keep a tight CLAUDE.md and reference files by path, the headroom is smaller.
Try it against a control. Run a multi-day task with claude-mem, then run the same task on a branch with only a hand-written notes file. Count the tokens spent before the first useful edit, and count how often the agent repeats a mistake it already made. If the gap is noise, the tool is not paying for itself.
There is a cost side too. Summarizing every session means model calls, and the hosted observer has a 30-day trial before falling back to your Anthropic plan. Background work consumes the same usage limits you use for actual coding.
Where claude-mem Can Go Wrong
Three risks deserve attention before you install it on a work machine.
Privacy is the first. The hooks see every tool call, which means file contents, command output, and any credentials that happen to appear in an environment dump. tags exclude content from storage, but they only work if you remember to use them. The observer provider you pick receives session content, so choose one whose data terms you already accept.
Stale or poisoned context is the second. Memory persists, which means a wrong assumption written on Monday can steer the agent on Friday. A prompt injection that lands in stored memory has the same durability. Inspect what gets stored, especially in the first week.
Storage growth is the third. Observations accumulate, and a long project produces a lot of them. The vector index grows with the store, and retrieval quality degrades when the database fills with low-value noise.
There is also a category-level question. Research on agent memory systems has found that many of them lose to plain retrieval-augmented generation on real tasks. That does not condemn claude-mem specifically, but it argues for measuring instead of trusting a badge.
claude-mem vs a Notes File
The cheapest alternative is a markdown file the agent updates at the end of each session. No hooks, no worker, no model calls, no privacy surface.
A notes file wins on inspectability. You can read it, edit it, and delete a line you regret. claude-mem wins on volume. It captures decisions you did not think to write down, and it can search them semantically instead of by keyword.
Most developers I would expect to land in the middle: a notes file for architecture and conventions, claude-mem for the long tail of small decisions that never make it into documentation.
Should You Install claude-mem?
If re-explaining a large codebase every morning is your main friction with Claude Code, yes. Install it locally, keep cloud sync off, pick a provider you already pay for, and read the viewer after day one.
If you work with client code, secrets, or anything under NDA, start with a notes file. Add automation only after you have read the hook and worker code, or after your team has agreed on what may be stored.
Give it a week, not a session. The value shows up in the second and third task that depends on the first, and that is also when bad memory starts costing you. Check what it kept, delete what it should not have, and decide with evidence rather than a trending badge.