Newsletter image

Subscribe to the Newsletter

Join 10k+ people to get notified about new posts, news and tips.

Do not worry we don't spam!

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Search

GDPR Compliance

We use cookies to ensure you get the best experience on our website. By continuing to use our site, you accept our use of cookies, Privacy Policy, and Terms of Service.

Claude Mem - AI Agent, AI Coding

claude-mem

claude-mem hooks the session lifecycle, compresses what your agent did and re-injects it next time. Works across many agents. Defaults to hosted memory, so set the local flag.

License Apache 2.0
License Apache 2.0
TL;DR
  • Five lifecycle hooks capture observations, compress them and re-inject next session
  • SQLite with FTS5 plus a Chroma vector store, hybrid search at recall
  • Defaults to hosted CMEM Pro; --provider host keeps everything local

Close a coding agent session and everything it learned about your codebase evaporates. Claude-mem is the layer that stops that: it hooks into the session lifecycle, records what the agent actually did, compresses it, and injects the relevant parts back the next time you start. It has 94,978 stars, it is Apache 2.0, and it works across Claude Code, OpenCode, Codex, Gemini, Copilot and Hermes. There is one default you should change on install, and we will get to it.

How it captures

Five lifecycle hooks do the work: SessionStart, UserPromptSubmit, PostToolUse, Stop and SessionEnd. The project's own description of the loop is "automatically capturing tool usage observations, generating semantic summaries, and making them available to future sessions".

The storage is a sensible, boring stack. SQLite with FTS5 for full-text search, a Chroma vector database for semantic retrieval, and hybrid search across both at recall time. A local HTTP worker managed by the Bun runtime sits in front. Nothing exotic, which is what you want in a component that runs on every tool call you make.

The compression step is the interesting one. It does not replay raw transcripts back at you, it summarises observations and injects what is relevant, which is the difference between memory and a log file. Whether the summarisation keeps what you needed is the thing to evaluate, and only your own work will tell you.

The default to change

Claude-mem is local-first in architecture and hosted-first in configuration. The default provider is CMEM Pro, the project's hosted memory service. Local-only operation is available and is one flag: --provider host.

Be clear about what that means, because it is easy to miss in an Apache 2.0 project. By default, summaries of everything your agent does, in your codebase, sync to a third-party service. That is a defensible product decision and the escape hatch is present and documented. It is also the opposite default from CodeGraph, which states flatly that no data leaves your machine, and the two tools sit at the same layer of the stack reading the same proprietary code.

If you work under a client NDA or on anything you cannot send to a vendor, set the flag at install time rather than after.

There is a second control worth knowing: <private> tags exclude content from storage entirely, so you can keep specific material out of the memory even when syncing is on.

Installing it

npx claude-mem install

npx claude-mem install --ide opencode
npx claude-mem install --ide grok-bot
npx claude-mem install --ide antigravity

The --ide flag is how it reaches beyond Claude Code. Supported targets include Claude Code as primary, plus Grok Bot, OpenCode, Antigravity CLI and OpenClaw gateways, with the README listing Codex, Gemini, Copilot and Hermes among the rest.

Where memory sits in the agent stack

This series has now covered five distinct layers, and it is worth seeing them together because almost nobody ships all of them.

LayerWhat it ownsExample
RuntimeThe terminals agents run inHerdr
HarnessThe agent loop over your repositoryOpenCode, ZCode
Code indexStructural knowledge of the codebaseCodeGraph
MemoryWhat happened in previous sessionsclaude-mem
General agentLong-running assistant with its own loopHermes

Two of these overlap in an interesting way. Hermes has its own built-in learning loop with skill creation and cross-session user modelling, so running claude-mem alongside it means two memory systems with different opinions about what matters. The layers are complementary in principle and not always in practice, and nobody has published guidance on combining them.

The pattern this series keeps finding

Claude-mem reaches many agents through lifecycle hooks. CodeGraph reaches nine through MCP. Neither needed the harnesses to agree on anything, because both attach at boundaries that are already standard.

Meanwhile the plugin layer, where every harness invented its own system, has produced nothing portable at all. The agent-agnostic tooling around these harnesses is healthier than the harnesses' own extension ecosystems, and it is healthier for exactly one reason: it builds on interfaces nobody owns.

Who should install it

Install it if you work in the same repositories over weeks and are tired of re-explaining context every session, or if you switch between agents and want continuity across them. The multi-agent support is the genuine differentiator, since your memory is not stranded in whichever harness you used on Tuesday.

Change the provider flag if your code is not yours to share. Skip it if your sessions are short and self-contained, where the hook overhead on every tool call buys you nothing.

Sources and further reading

Ten minutes: install it with --provider host, work a normal session, then start a fresh one and ask the agent what it remembers about the project. If the injected context is the part you would have re-explained anyway, it has paid for itself. If it is a summary of things you did not care about, the compression is not tuned for your work.

Tested on: not independently tested. The hook architecture, storage backends, supported agents, provider defaults and privacy controls are quoted from the project's own README and documentation. Repository statistics were read from the GitHub API on the date below.
Date checked: 2026-09-30

Prev Article
CodeGraph
Next Article
Ruflo

Related to this topic: