Skip to content
InnovateTechie
Claude Code

How to Install Claude-mem: Memory for Claude Code

InnovateTechieBy InnovateTechie9 min read
Share
How to install claude-mem for persistent memory in Claude Code

Part ofWhat Is Claude Code? The Complete Guide

Quick answer

To install claude-mem, run its interactive installer with `npx claude-mem install`, or add it as a Claude Code plugin with `/plugin marketplace add thedotmack/claude-mem` then `/plugin install claude-mem`. Claude-mem is a community tool that gives Claude Code persistent memory across sessions — not an official Anthropic product.

If you use Claude Code every day, you have felt the pain: you close the terminal, come back tomorrow, and Claude has forgotten everything. The architecture you agreed on, the naming conventions you settled, the bug you already ruled out — gone. Every new session starts from zero, and you end up re-explaining your project again and again. That reset is exactly the gap this tool is built to close.

This guide explains what it is, how to install it correctly, how the tool works under the hood, and how it stacks up against the memory options Claude Code already ships with. Claude Code currently runs on the latest models like Claude Opus 4.8 and Claude Sonnet 4.6, and claude-mem works the same way across them — the install takes about 60 seconds, and this guide is reviewed regularly so the steps stay accurate. It is written to be honest about one important thing first.

Claude-mem is community software, not an official Anthropic tool

Let's be clear up front: it is an open-source, community-built project (maintained by the developer "thedotmack"), not something Anthropic makes or supports. It is popular and useful, but it is third-party software that runs on your machine and reads your session activity. Treat it the way you'd treat any developer tool you install with elevated access — more on the security side of that below.

With that framing in place, here is what the tool actually does.

What the tool does

Claude-mem captures what your agent does during a session, compresses that record into concise summaries, and injects the relevant pieces back into future sessions automatically. In plain terms: it watches the work, remembers the important parts, and hands them back to Claude next time so you don't have to.

Mechanically, it hooks into Claude Code's lifecycle. When a session ends, it uses AI (the Claude Agent SDK) to summarize what happened — decisions made, files touched, problems solved — and stores those observations in a local SQLite database on your machine. When you start a new session, relevant memories are loaded back into context so Claude picks up roughly where you left off.

A few properties matter here. The storage is local — the memory lives in a database file on your machine, not a cloud service. And the project supports scoping what gets stored: you can wrap sensitive content in <private> tags so API keys, credentials, or personal details are never persisted. Because it works through hooks and Claude Code's plugin system, it fits neatly alongside other tools; if you want to understand that mechanism, our explainer on Claude Code hooks covers how these lifecycle events fire.

Diagram of how claude-mem captures and recalls Claude Code memory

How to install claude-mem

There are two supported paths, and the project's official GitHub repository is the source of truth for the exact, current commands. Always prefer its README over any memorized instruction, since tools like this iterate quickly. That said, here is the general shape.

Run the installer with npx:

npx claude-mem install

The interactive installer runs a runtime check, detects the AI coding tools you have installed (Claude Code, and depending on the version, others like Cursor, Codex, or OpenCode), and lets you multi-select which ones to wire up. It handles registering the plugin hooks and starting the background worker for you.

Option 2 — As a Claude Code plugin

If you'd rather do it from inside a session, use Claude Code's plugin commands:

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

Then restart Claude Code so the hooks load. This uses the same plugin marketplace system Anthropic documents for extending Claude Code.

One important gotcha

The project ships on npm, but running a plain npm install -g claude-mem installs the library/SDK only — it does not register the plugin hooks or start the worker service that actually captures memory. In other words, installing the npm package by itself won't make the plugin work. Use the interactive installer (npx claude-mem install) or the /plugin commands so the hooks get wired up properly. When in doubt, follow the current install steps in the official repo, because the exact package name and flow can change between releases.

Once installed and running, you generally don't have to do anything else: the plugin captures memory in the background, and context from previous sessions starts appearing automatically in new ones.

How it compares to Claude Code's built-in memory options

Claude-mem is one approach among several. Before you add a third-party tool, it's worth knowing what Claude Code and the wider Claude ecosystem already give you — because sometimes a simpler option is enough.

The main options break down like this:

Memory approachWhat it isBest for
CLAUDE.mdA plain Markdown file in your repo that Claude reads on every session. You write and maintain it by hand.Stable project facts: conventions, architecture, commands, "always do X."
Claude's built-in memoryClaude's own memory features that recall facts and preferences you've shared across conversations.Personal preferences and cross-session recall without extra tooling.
MCP memory serverA Model Context Protocol server that exposes a memory/knowledge store Claude can read and write via tools.Structured, queryable memory you control, shareable across tools.
Auto-capture pluginA community plugin (claude-mem) that auto-captures, compresses, and re-injects session context via hooks.Hands-off, automatic recall of what you actually did last session.

Each has a different trade-off. CLAUDE.md is manual but transparent and version-controlled — you decide exactly what Claude remembers, and it's the first place most teams should invest. Claude's built-in memory works without any setup; our guide to Claude memory explains what it retains and how to manage it. An MCP memory server gives you a structured store that Claude can query through tools — if that's new to you, start with what is Claude Code and the walkthrough on how to add an MCP server to Claude Code, plus our deeper reference on the Claude Code MCP ecosystem.

Where the tool differs is automation: instead of you writing memory by hand or standing up a server, it observes the session and does the capture-and-recall loop for you. That convenience is the whole point — and also the reason to vet it.

Comparison of persistent memory approaches for Claude Code

Security: what to check before you trust any memory tool

A memory tool sees a lot. To do its job, the tool reads what happens in your session and writes summaries to disk — which can include code, file paths, commands, and whatever context you discuss. That's not a knock on the project; it's inherent to the category. It does mean you should be deliberate:

  • Install only from the official source. Use the project's real GitHub repo or its documented installer. Don't grab a random fork or a copycat npm package with a similar name.
  • Review what it stores. The database lives locally on your machine; open it or read the docs to understand what's being kept.
  • Keep secrets out. Use the project's <private> tag mechanism (or your own hygiene) so API keys, tokens, and credentials never land in the memory store.
  • Understand it runs on your machine. Hooks execute code around your sessions. Skim the source or release notes so you know what you're enabling.

None of this is unique to this tool — it's the same due diligence you'd apply to any plugin. If you want to go deeper on running Claude Code well and safely, our roundup of Claude Code tips and tricks is a good companion, and if you organize work across long-running efforts, Claude Projects pairs naturally with persistent memory.

When persistent memory actually helps

Persistent memory shines on long, multi-session projects: a refactor that spans a week, a codebase where the "why" behind decisions matters, or a workflow where you're constantly re-establishing the same context. For a quick one-off script, the overhead isn't worth it — a good CLAUDE.md or even nothing at all is fine.

The honest takeaway: the tool solves a real problem elegantly, but it's a community tool, so weigh the convenience against the fact that it watches and stores your session. For many developers that trade is clearly worth it. For others, a well-maintained CLAUDE.md plus Claude's built-in memory covers 80% of the value with zero third-party code.

Frequently Asked Questions

No. It is a community, open-source project maintained by an independent developer, not built or supported by Anthropic. It works with Claude Code but is third-party software, so vet it and install it only from its official repository.

The simplest way is the interactive installer: run npx claude-mem install and select Claude Code when prompted. Alternatively, add it through Claude Code's /plugin marketplace commands shown above, then restart Claude Code. Always confirm the current commands in the official repo.

Installing the npm package globally only pulls in the library — it does not register the plugin hooks or start the worker that captures memory. Use npx claude-mem install or the /plugin commands instead so it is actually wired into Claude Code's session lifecycle.

It keeps memory locally in a SQLite database on your machine, rather than in the cloud. You can wrap sensitive content in <private tags so secrets and personal information are excluded from what it persists.

They complement each other. CLAUDE.md is your hand-written, version-controlled source of stable project facts, while the tool automatically captures the evolving record of what you did each session. Many developers keep a lean CLAUDE.md and let it handle the running history.

It's as safe as any developer tool with access to your sessions, provided you install it from the official source, review what it stores, and keep credentials out of its memory. Because it reads session activity and runs hooks on your machine, apply the same caution you would to any plugin before trusting it.
InnovateTechie

Written by

InnovateTechie

Writing about Claude and the Anthropic toolkit — models, Claude Code, pricing, features, and fixes, in clear, practical, hands-on guides tested by daily use.

View all posts →