← Blog Open Source Nov 21, 2026 · 6 min read

claude-mem: Give Your Coding Agent a Memory Between Sessions

claude-mem gives Claude Code and other coding agents memory across sessions. How it captures and re-injects context, how to install it, what to keep private.

claude-mem: Give Your Coding Agent a Memory Between Sessions

claude-mem is an open-source plugin that gives your coding agent a memory, so a new session starts with a short summary of what you did before instead of a blank slate. This guide explains how claude-mem works, when it saves time and tokens, how to install it from the official README, and what private data you should keep out of it.

What claude-mem is

claude-mem is a GitHub project by thedotmack. Its README describes it as capturing what your coding agent does, compressing it with AI and injecting relevant context into later sessions. It works with Claude Code, Codex, Cursor, OpenCode, OpenClaw and others; some tools such as Copilot CLI, Goose, Roo Code, Warp and Zed can search the memory but do not have their sessions recorded.

Why it is trending: on GitHub's monthly trending page on November 21, 2026, claude-mem showed 118,630 stars, with 17,313 added that month. It is licensed under Apache-2.0, and the version badge on the README showed 16.0.2 when I checked. Repos change quickly, so check the repo yourself before installing.

The problem it solves

Coding agents forget. Every new session starts without knowing:

  • which files you already explored,
  • what you tried yesterday and why it failed,
  • the decisions you made about structure or naming,
  • the bug you fixed last week that looks similar to today's.

You end up re-explaining, or the agent re-reads the same files, which costs time and tokens. claude-mem tries to carry that context forward automatically.

How claude-mem works

According to the README, there are four parts:

1. Capture

Hooks in the agent send each tool call (reads, edits, commands) to a local worker. For Claude Code, it uses hooks such as SessionStart, UserPromptSubmit, PreToolUse, PostToolUse, Stop and SessionEnd.

2. Compression

A second "observer" agent turns raw activity into short observations and writes a summary when the session ends.

3. Injection

A new session starts with a compact index of relevant observations. Full details are fetched only when needed, through a three-step search: search, then timeline, then get_observations.

4. Storage

Everything lives in a local SQLite database at ~/.claude-mem/claude-mem.db. Chroma adds semantic search on top of SQLite's keyword search. A local web viewer shows memory, sessions and settings at /viewer on the worker URL printed at startup.

Installing claude-mem (from the official README)

Requirements listed in the README: Node.js 20.19+ or 22.12+, a supported agent (for Claude Code, the latest version with plugin support), plus Bun and uv, which are installed automatically if missing.

The quick install:

npx claude-mem install

Or from inside Claude Code:

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

Then restart Claude Code. For other agents, the README uses an --ide flag, for example:

npx claude-mem install --ide opencode

One warning from the README: npm install -g claude-mem installs only the SDK library, not the plugin hooks or worker. Use the commands above.

Does it really save tokens?

The README says index rows are roughly 50 to 100 tokens, compared with about 500 to 1,000 tokens for a full record, so injecting an index is much cheaper than pasting full history. It also claims memory can give "up to 100% more usage from your plan."

To its credit, the README also notes that the per-record ratio is not a measured end-to-end saving. Real savings depend on your work:

  • Saves the most on long-running projects where you return to the same codebase daily.
  • Saves less on one-off scripts or tiny repos the agent can read in seconds.
  • May cost extra because the observer agent also uses a model to compress sessions.

If you are watching your plan limits closely, measure before and after for a week. Our article on AI agent usage limits explains why agent workflows burn quota.

Privacy: what to keep out of claude-mem

A memory tool records what your agent sees. That can include secrets. Here is what the README offers and what you should do.

Built-in controls

  • <private> tags: content wrapped in <private> tags is not stored.
  • Local by default: memory stays in ~/.claude-mem on your machine. Cloud Sync is opt-in.
  • Telemetry: anonymous usage analytics are on by default. Turn them off with npx claude-mem telemetry disable.
  • Skip sign-in: setting CLAUDE_MEM_ONLINE_OPTIN=false skips the online sign-in step.
  • Screenshots go to the project's cloud only if Cloud Sync is on.

Keep these out

  • API keys, tokens and passwords, even in .env files the agent opens.
  • Client data covered by an NDA or contract.
  • Customer personal data (names, phone numbers, addresses) in databases or exports.
  • Production credentials and server details.

Practical habits

  1. Do not let the agent print secrets in the terminal; use environment variables.
  2. Wrap sensitive notes in <private> tags.
  3. Keep Cloud Sync off for client projects unless the client agrees.
  4. Review the web viewer now and then and delete what should not be there.
  5. Back up or delete ~/.claude-mem when you finish a client project.

Our AI privacy checklist for creators covers the same thinking for other AI tools.

Useful settings

The README lists a settings file at ~/.claude-mem/settings.json, created on first run, covering the AI model, worker port, data directory, log level and context injection. A mode setting, CLAUDE_MEM_MODE, switches workflow and language modes (for example code). Restart Claude Code after changes.

Who should try it

  • Freelance developers juggling several client codebases.
  • Solo builders who work on one product for months.
  • Anyone tired of re-explaining project context every morning.

Skip it, or test carefully, if you work mostly with highly sensitive code, or if your projects are short enough that context does not matter. For more ways to work well with Claude on code, see our guide to Claude for developers.

Key takeaways

  • claude-mem captures coding agent sessions, compresses them and injects a compact index into new sessions.
  • It had 118,630 GitHub stars on November 21, 2026, with 17,313 added in the month, under the Apache-2.0 license.
  • Install with npx claude-mem install or the Claude Code plugin commands from the README.
  • Data is local by default, telemetry is on by default, and secrets should be kept out with <private> tags and good habits.

FAQ

Is claude-mem free?

The code is open source under Apache-2.0. The observer step uses a model, which may count toward your plan or API usage.

Where does claude-mem store my data?

In a local SQLite database at ~/.claude-mem/claude-mem.db. Cloud Sync is optional.

Does claude-mem work outside Claude Code?

Yes. The README lists Codex, Cursor, OpenCode, OpenClaw and others, with varying levels of support.

Sources

Read next