🐙
Freememoryagentsclaude codecontextpersistenceopen source

Claude Mem is a JavaScript library that gives stateless AI agents durable memory. During a session it captures everything the agent does, compresses it with AI into a structured context summary, and automatically injects the most relevant memories into future sessions. It works across Claude Code, OpenClaw, Codex, Gemini CLI, Hermes, GitHub Copilot, OpenCode, and more. Over 83,000 GitHub stars make it one of the most popular agent infrastructure tools available.

What is Claude Mem?

Claude Mem is a JavaScript library that gives stateless AI agents durable memory across sessions. While a session runs it captures what the agent does, compresses that record with a model into a structured summary rather than a raw transcript, and then injects the most relevant pieces back into later sessions automatically. The effect is that the agent starts a new session knowing what you decided last week instead of asking again. It is built to work across several agents rather than one, with support listed for Claude Code, OpenClaw, Codex, Gemini CLI, Hermes, GitHub Copilot and OpenCode among others, so the memory follows you if you change tools. Two things are worth understanding before adopting it. Compression is lossy by design, and injected memory occupies context and tokens in every session it touches, so what gets remembered is a real design decision rather than a free win.

Who is Claude Mem for?

This matters most on long running projects where the same context has to be rebuilt at the start of every session. Architectural decisions and the reasoning behind them, conventions specific to your codebase, the approaches already tried and rejected, the quirks of a system that surprise you once a month. Retyping that is tedious and easy to do incompletely, which is how agents end up relitigating settled decisions. It is also useful if you move between agents, since the memory layer is shared rather than tied to one tool. It is overkill for short, self contained tasks where a session starts and finishes in an hour. And if your project already keeps good written documentation the agent reads, some of this value is already covered.

How does Claude Mem compare?

Graphiti is the structured alternative, building a temporal knowledge graph so relationships and how facts changed over time can be queried, which suits applications that need to reason over the memory rather than simply recall it. Claude Mem is lighter and more automatic, aimed at the agent's own working memory instead of an application's data layer. Caveman attacks the same token budget from the other direction, compressing how the assistant writes rather than what it retains between sessions. Claude Code Router is complementary infrastructure again, controlling which model handles a request while this controls what the model knows when it starts. Memory and routing are separate problems and running both is reasonable.

Compare with: Graphiti, Caveman, Claude Code Router

Claude Mem pricing

The catalog records this as free. It is an open source library you install and run yourself, so there is no service and nothing to subscribe to. The running cost is model usage, and it appears twice. Compressing a session into a summary is itself a model call, and injected memories consume context in every session that loads them. Neither is large per session, but both scale with how much you choose to remember, which is a good reason to keep what is stored tight rather than exhaustive.

Notes

No notes have been added for this tool yet.

Claude Mem FAQ

Where does Claude Mem store my data?
It is a library you run yourself rather than a hosted service, so the memory lives wherever you install it. The compression step calls a model, which means the session content being summarized goes to that provider under its terms. Keep that in mind if you work on code that should not leave your environment.
Does it work with agents other than Claude Code?
Yes. Cross agent support is a core part of the design, with compatibility listed for tools including OpenClaw, Codex, Gemini CLI, Hermes, GitHub Copilot and OpenCode. That is a practical advantage if you switch between agents, because the accumulated memory is not stranded inside whichever tool you happened to start with.
Will remembering everything blow up my context window?
That is the constraint the design works around. Sessions are compressed into structured summaries rather than stored as transcripts, and only relevant memories are injected rather than everything. It is still not free, since injected context costs tokens on every session, so keeping memory selective is worth the attention.
Browse all Open Source