# claude-mem

> Saves what your coding agent does and feeds the useful parts back into later sessions

- Repository: https://github.com/thedotmack/claude-mem
- Category: Memory, RAG & data
- Stars: 102,346 · Forks: 9,027 · Language: TypeScript · License: Apache-2.0
- Experience: Some experience
- Page: https://ir.adyog.com/repos/thedotmack/claude-mem/

Coding agents forget everything when a session ends. You then have to explain the project, past decisions and old bugs all over again. Claude-mem keeps a running memory of what the agent did, so the next session starts with that background.

It works through lifecycle hooks in Claude Code: session start, prompt submit, tool use, stop and session end. The hooks capture observations about what the agent did. A local worker service, run with Bun, turns them into summaries and stores them in SQLite. A Chroma vector database adds semantic search alongside keyword search. When a new session starts, relevant context is injected back in.

Search is layered to keep token use down. The agent first gets a compact index of results, then a timeline around the interesting ones, and only then full details for the IDs it picked. The README claims about 10x token savings from this. It also lists installers for OpenCode, OpenClaw, Antigravity and others. For the memory provider, you can use the hosted claude-mem observer, your own OpenRouter or Gemini key, or your Anthropic plan.

## What it does

- **Automatic capture through hooks**: Five lifecycle hooks record tool usage and generate summaries without manual steps.
- **Three-step memory search**: The search, timeline and get_observations MCP tools let the agent filter an index first and fetch full details only for the IDs that matter.
- **Hybrid local storage**: Sessions, observations and summaries live in SQLite with full-text search. Chroma adds semantic search.
- **Web viewer and privacy tags**: A web UI shows the memory stream in real time. Wrapping text in <private> tags keeps it out of storage.
- **Many agent installers**: One npx command installs it for Claude Code, OpenCode, Antigravity, OMP and Grok Bot. A separate script handles OpenClaw gateways.

## What you could build

- Continue a multi-day coding task in Claude Code without re-explaining earlier decisions.
- Search your project history for a past bugfix by asking in natural language.
- Browse what your agent did in a session through the web viewer.
- Keep sensitive snippets out of stored memory by marking them private.
- Add persistent memory to an OpenClaw gateway and stream observations to Telegram, Discord or Slack.

## Who it's for

Developers who use Claude Code or a similar coding agent daily and have Node.js 20 or newer; knowing what hooks and MCP tools are helps.

## Get started

Run the installer, then sign in through the browser or pass an explicit --provider flag to skip sign-in. Restart your agent and context from earlier sessions appears in new ones. Don't use npm install -g, because that installs only the SDK and not the plugin hooks.

```
npx claude-mem install
```
```
/plugin marketplace add thedotmack/claude-mem
```
```
/plugin install claude-mem
```

Tags: memory, claude-code, context, sqlite, mcp
