● GeneratorNest

Claude-Mem: Persistent Memory for Claude Code (Guide)

Updated 2026-10-09

Short answer: claude-mem is a free, open-source plugin that gives Claude Code persistent memory across sessions. It automatically records what Claude does while you work, compresses those observations with AI into short notes, stores them locally (SQLite plus a vector index), and injects the relevant ones into your next session – so you don't have to re-explain your project every time. It installs with npx claude-mem install and also works with Gemini CLI and OpenCode.

It is made by developer Alex Newman (GitHub: thedotmack) and is one of the most-starred Claude Code add-ons – coverage in April 2026 counted 65,800 stars, 5,600 forks and over 100 contributors. It is a community project, not an Anthropic product.

The problem it solves

Every new Claude Code session starts cold. You explain the project structure, last week's decisions and the bug you were chasing – and then do it again the next day. CLAUDE.md files help, but you have to write and maintain them by hand. claude-mem automates that loop: capture, compress, retrieve.

How claude-mem works

  1. Capture. Five lifecycle hooks – SessionStart, UserPromptSubmit, PostToolUse, Stop and SessionEnd – record what Claude reads, edits and runs, with no manual logging.
  2. Compress. Raw session data is summarised into structured observations (facts, concepts, file references). Compression keeps the token cost of recalling them low.
  3. Store locally. Observations go into a local SQLite database with full-text search, plus Chroma vector embeddings for semantic search. Embeddings are computed locally.
  4. Retrieve. When a new session starts, relevant observations for that project are injected as context. An MCP server with search tools lets Claude look up older history on demand, returning compact indexes first and full details only for the items it needs.

A local worker service (by default on port 37777) runs in the background and offers a small web UI to browse what has been stored.

How to install claude-mem

  1. Make sure Claude Code is installed and working.

  2. Run:

    npx claude-mem install
    
  3. Restart Claude Code.

  4. Work as usual. Start a new session the next day and ask Claude what it remembers about the project.

Check the project's GitHub page (thedotmack/claude-mem) and its docs site for the current version and any extra setup – the plugin is updated often.

Privacy and safety

  • Everything is stored on your machine by default.
  • <private> tags let you exclude sensitive content from being stored.
  • The worker binds to localhost only, with rate limiting and path-traversal protection.

Still, it records a lot of detail about your code. Review what it keeps (via the web UI) before using it on client or confidential repositories, and don't let it capture secrets – keep API keys out of prompts and files Claude reads.

claude-mem vs CLAUDE.md vs Claude's built-in memory

claude-mem CLAUDE.md Claude app memory
Who writes it Automatic You, by hand Automatic
Scope Per project, detailed Per project, curated Your account, general
Contents Files touched, bugs, decisions, patterns Rules and conventions you choose Preferences and facts about you
Searchable history Yes (full-text + semantic) No Limited

They work well together: keep stable rules in CLAUDE.md, and let claude-mem remember the day-to-day history.

When it's worth installing

  • You use Claude Code on the same codebase across many sessions – debugging, refactors, long features.
  • You're tired of re-explaining context at the start of every session.
  • You switch between Claude Code, Gemini CLI and OpenCode and want one memory layer.

Skip it for one-off scripts or tiny projects – there's nothing much to remember, and the extra hooks add a little overhead.

FAQ

Is claude-mem free? Yes, it's open source. The compression step uses a model, so it consumes some tokens on your existing plan or API key.

Is claude-mem made by Anthropic? No. It's a community plugin by Alex Newman (thedotmack).

Does claude-mem send my code to a server? Observations are stored locally in SQLite and a local vector index. The summarising step uses Claude, like any Claude Code request.

How do I see what claude-mem remembers? Open the local web UI served by the worker (default port 37777), or ask Claude to search its memory through the plugin's MCP tools.

Does it work with Gemini CLI or OpenCode? Yes, according to the project – which makes it one of the few memory layers that spans several AI coding tools.

Try it free

100% free – no sign-up needed.

Open the tool