Source repository thedotmack/claude-mem ↗ 100,226 stars · JavaScript

The problem: stateless agents

When you run a Claude Code session or any AI agent, it has no built-in memory of previous interactions. Each new session is a blank slate. If your agent learned something useful last week—a workaround, a discovered API pattern, a user preference—that knowledge is lost.

For single-shot tasks this doesn't matter. But for ongoing automation, code review loops, or multi-stage projects, the agent repeats the same mistakes, rediscovers the same solutions, and wastes context tokens rehashing past events.

Claude-Mem fixes this by capturing session activity, compressing it with AI, and making it available as context for future runs. Your agent builds up a persistent knowledge base without you manually maintaining a changelog.

How Claude-Mem works

Claude-Mem is a Claude Code plugin built on lifecycle hooks. Per its README:

Besides Claude Code, the installer supports other agents and tools; check the README for the current list.

Fitting it into a Claude Code workflow

Claude Code runs discrete, often iterative tasks: debugging, generating features, refactoring. Without memory, you repeat context: "I tried approach X last session and hit problem Y." Claude-Mem eliminates that friction.

A typical workflow:

This is especially valuable for long-running automation tasks where the agent needs to adapt based on past attempts. It also reduces context bloat—instead of pasting full logs, you get a compressed memory.

Real limitations

Getting started

Install (sets up the plugin, hooks and worker)
npx claude-mem install

Or from inside Claude Code:

Install from the plugin marketplace
/plugin marketplace add thedotmack/claude-mem /plugin install claude-mem

Don't use npm install -g claude-mem for this: the README notes it installs only the SDK/library and does not register the hooks or start the worker. Restart Claude Code after installing; the next sessions start building memory automatically. Claude-Mem is Apache-2.0 licensed.