AI Coding Agents
claude-mem Persistent Memory Review for Coding Agents
claude-mem captures coding-agent activity with hooks, uses an observer model to compress it into observations, then injects a project index into later sessions. It can reduce repeated investigation, but the observer calls, injected context, and follow-up searches all have a cost. Trial it on work you regularly resume and verify what leaves your machine before enabling capture.
At a glance
| Question | Answer |
|---|---|
| What is it? | Persistent memory that turns coding-agent activity into observations and surfaces them in later sessions. |
| What cost does it target? | Repeated investigation and context rebuilding. Observer calls, startup context, and searches add costs of their own. |
| Where does it act? | Host hooks send tool activity to a local worker. The context builder supplies a project index at startup. |
| How do you try it? | Use the general installer or the Claude Code marketplace. |
| What can you retrieve? | Search for matching observations and load full observation records with get_observations. |
| How do you undo it? | Disable or remove the host plugin or hooks and restart the host. Check the worker, retained data, and any cloud copy separately. |
| When is it a good fit? | Investigations or migrations you resume across sessions and would otherwise have to reconstruct. |
| When should you skip it? | Your project cannot retain sensitive captures, or you cannot establish the capture scope and observer provider. |
Which part of the bill persistent memory can change
A fresh coding-agent session often has to reconstruct why a decision was made. A diff can show that a guard was added, while the reason it exists may be buried in test output from an earlier session. If the new session can retrieve the old observation, it can spend less input on reconstructed history and fewer turns repeating the diagnostic work. The savings come from work the new session actually avoids.
That makes interrupted investigations a useful test. Suppose the previous session ruled out a configuration change and isolated a failure to a particular fixture. The next session can start with the fixture and reproduce the failure before editing. If the next task concerns an unrelated area, the same memory index could add startup tokens without saving any reads. The value depends on how often you resume work in the same project and how much of the original investigation you would otherwise repeat.
How hooks, the observer, and search fit together
In the README’s architecture, an agent-specific hook adapter sends tool activity to a local HTTP worker managed by Bun. Claude Code’s hook events include session startup, prompt submission, and tool use. The observer turns activity into shorter observations and writes a summary at the end of a session. SQLite stores sessions, observations, and summaries. Chroma adds semantic search alongside SQLite keyword search. The worker also serves a viewer where you can inspect stored entries and review settings.
At startup, the context builder prepares a compact project index. For searches during work, the documented sequence starts with search to retrieve matching IDs and then uses timeline for surrounding activity when useful. get_observations retrieves the full records for selected IDs and supports batching them. This separates the decision to inspect an entry from the cost of reading its details. The records describe earlier activity, so inspect the current file or rerun a relevant check before relying on a previous conclusion.
The observer and the coding agent perform separate model work. Shortening the stored observation does not shorten the original command output already sent to the coding model. It creates a smaller representation for future recall. Opening a full observation later can add a model turn, and both the search results and the retrieved record can appear in subsequent requests.
Install, confirm capture, and plan removal
The README’s general installer discovers agents on your machine and asks which to configure. Installing the npm library leaves hook and worker setup to you.
npx claude-mem install
After sign-in, choose the claude-mem observer, your own OpenRouter or Gemini key, or your Anthropic plan. The README says choosing the observer starts a 30-day free trial on a checkout page that asks for a payment method. Memory falls back to your Anthropic plan when the trial ends unless you subscribe. The README says an explicit --provider flag or CLAUDE_MEM_ONLINE_OPTIN=false skips sign-in.
For the Claude Code marketplace path, enter these commands inside Claude Code and restart the client.
/plugin marketplace add thedotmack/claude-mem
/plugin install claude-mem
Start with a disposable repository and make a distinctive, harmless decision that leaves a trace in tool activity. Check the worker viewer for the observation, open a fresh session in the same project, and see whether the startup index contains a relevant entry. Ask the agent to find and explain the decision. Verify that the explanation points to the right observation and agrees with the current checkout. If the worker or hook never appears, the README documents a setup diagnostic.
npx claude-mem doctor
The README describes recording integrations for Claude Code, Codex, Cursor, and OpenCode, and gives agent-specific instructions for others including T3 Code, Pi, and DeepSeek Harness. Copilot CLI, Goose, Roo Code, Warp, and Zed are described as search-only. For those clients, validate that they can retrieve a record created by a recording integration. A successful search alone gives you no basis to assume that the client contributes new observations.
The README snapshot gives install steps and points to integration-specific removal guidance for T3 Code. It gives no general removal command. For a rollback test, record the host settings before installation, remove or disable the plugin or hooks through the host, and restart it. Verify that a fresh session starts without the memory block and that subsequent tool calls produce no new entries. Treat worker shutdown, retained data, and any cloud copy as separate cleanup checks. Decide whether you need an export before deleting records.
Set the privacy boundary before the first capture
The README says local memory lives under ~/.claude-mem, with cloud sync opt-in and anonymous usage analytics enabled by default. It also describes a separate choice of observer provider. Local storage tells you where the records live. Observer selection tells you who may process the activity needed to create those records. Review both choices before opening a real repository. The README gives this command for disabling analytics.
npx claude-mem telemetry disable
According to the README, content wrapped in <private> tags is excluded from storage. Treat that as a documented control to verify with harmless test text. Tool output may contain data you never typed into the prompt, such as a fixture value or a path printed by a failed command. The README also says the tool keeps converted screenshots by default. It describes separate controls for keeping images, syncing them, and sending them for image inference. Review those controls independently if your tasks produce screenshots.
For Claude Code and Codex, the documented default limits startup context to the current harness. A setting can include observations from other harnesses within the startup limit. Before enabling it, test the scope with benign records from different projects and clients. Skip the real-data trial if you cannot establish which hook events are retained, which model provider sees them, and which sessions can recall them.
What the project measures and what you need to measure
The README reports that a search index result uses roughly 50 to 100 tokens and a full observation roughly 500 to 1,000. Those are project estimates for different record shapes. The gap illustrates why filtering IDs before fetching full details can limit search input. A whole search also includes the query, any timeline results, and selected full records. The project’s figures give no session-wide savings estimate or independent measure of recall accuracy.
The harder question is what the developer would have paid without the memory. Reopening a short project note could be cheaper than running an observer during the entire previous session. Retrieving the explanation for an intermittent failure could avoid a lengthy rerun. A useful trial compares both against the same expected result and charges each arm for everything it took to get there, including capture sessions whose notes never get read.
Record separate observer charges and any usage against a shared plan allowance. Keep the billing arrangement with the trial results so you can interpret the comparison.
Startup injection, caching, and follow-up turns
If the memory block changes between sessions, compare cache reads and writes as well as total input. Cache behavior depends on where the host inserts the block and what the provider recognizes as a shared prefix. An unchanged portion ahead of the injection can still qualify for reuse. A changed block before a long stable section can make later context ineligible for the expected hit. The README offers injection settings, but it does not establish how your host and provider will bill such a change. How providers price prompt caching
Measure search turns on their own. A relevant observation can eliminate several reads or test runs. An ambiguous index can prompt a timeline call, a detail lookup, and the original investigation anyway. If both conditions appear in the same trial, report the resumed tasks that benefited alongside the tasks that only paid the overhead.
What the open issues suggest testing
An open issue title reports that Claude provider condense calls ignore the observer’s maximum-output setting. Test observed output usage directly if that setting is part of your spending limit. The title alone gives no basis for a general estimate of excess output. Observer output cap report
Another open issue title reports that some Claude Code startup and append hooks were skipped and automatic injection was lost. An open search issue title says a Chroma result can displace an exact keyword match. Those titles suggest two useful smoke checks for your version. Confirm the startup block actually appears, then verify that a distinctive literal string can be found in the project where it was captured. Startup hook report Search ranking report
An open issue title reports billed API calls from observer warmup pings with no off switch. Another asks to remove or make opt-in promotional messages addressed to the model in hook context. Check observer usage while idle and inspect the startup block for unexpected text. Observer warmup issue Hook context promotion issue
An estimate for observer cost and avoided reads
Assume both the coding agent and the observer use usage-billed Claude Sonnet (claude-sonnet-5-5), with the committed rates of $2 per million fresh input tokens and $10 per million output tokens. For one resumed task, assume memory avoids 150,000 fresh input tokens, retrieval adds 10,000, and the observer used 40,000 fresh input and 10,000 output tokens while capturing the session. With coding output unchanged and cache charges excluded, the estimated net saving is 0.10 × $2 − 0.01 × $10 = $0.10.
Estimate net savings by multiplying avoided coding input minus extra coding input and observer input, measured in millions, by $2. Then add the avoided coding output minus extra coding output and observer output, measured in millions, multiplied by $10. Count the startup index and fetched details as extra coding input. Use separate terms when the observer uses a different provider or any input is billed as a cache read or write. Use reported usage to price the actual run. ByteCosts provider pricing
Where to use it and where to skip it
- Trial it on recurring investigations, multi-session migrations, and recurring incidents where earlier reasoning is expensive to reconstruct. Look for observations that send the next session directly to a check or a file you can verify.
- Consider a short handoff note when developers resume a small, predictable task set. A note with the current branch, open question, and last confirmed result makes a useful comparison against automatic capture.
- Skip automatic recording when sensitive tool output or screenshots cannot be retained under your project’s policy, or when you cannot account for the observer provider and your host’s capture scope.
- For a search-only client, use it when another supported host is already capturing work and the team has decided what can be shared across them.
Run a measured trial across session boundaries
- Select recurring tasks with an acceptance check, such as identifying a failing fixture and reaching the same verified diagnosis. Save the starting checkout and the handoff instructions.
- Run the baseline with your usual memory practice. In the other arm, start capture in the earlier session so the measurement includes the cost of creating observations. Keep the model, tasks, and acceptance checks fixed.
- Record observer usage, coding usage by cache class, search turns, startup context size, elapsed time, and task acceptance. Inspect which records the agent opened and verify that it used current evidence where required.
- Compare total cost per accepted resumed task. Include capture on sessions that never benefit from recall, and confirm data retention and rollback on the test project before expanding to other repositories. Measure coding-agent token savings
Alternatives for different kinds of repeated work
Compare memory systems if your cost comes from reestablishing what happened in a prior session. If the old decisions are already easy to recover and the large inputs come from fresh logs or repeated tool output, start with the layer that produces those tokens. The context-compression guide maps those interventions to the request and shows which meters to compare. claude-mem vs. memU Coding-agent context compression
Sources
- claude-mem README and architecture (GitHub, accessed 2026-11-30)
- Observer maximum-output issue (GitHub, accessed 2026-11-30)
- Startup hook issue (GitHub, accessed 2026-11-30)
- Search ranking issue (GitHub, accessed 2026-11-30)
- Observer warmup issue (GitHub, accessed 2026-11-30)
- Hook context promotion issue (GitHub, accessed 2026-11-30)
How this note was produced
Drafted with AI assistance from committed ByteCosts pricing snapshots and deterministic cost formulas. Figures are grounded in the linked sources (last updated 2026-11-30). Read our editorial & automation policy, inspect the methodology, or report a discrepancy.
claude-mem Persistent Memory Review for Coding Agents. ByteCosts. Updated 2026-11-30. https://bytecosts.com/blog/claude-mem-persistent-memory-review/