← Back to all projects

claude-mem

Install once and Claude Code remembers: hooks capture every session, a small model compresses it into searchable memory

Apache-2.0
Stars
92.5k
Forks
8.1k
Open issues
262
Last commit
26 Aug 2026

What is claude-mem?

It hooks into the agent's lifecycle, captures every tool call, and has a small model — Claude Haiku by default, on your existing subscription or key — compress the stream into titled observations that are injected back at the next session's start; search goes through MCP tools staged from cheap index lines to full detail. Storage is local SQLite with an optional vector index, installs are documented beyond Claude Code for OpenCode, Cursor and Codex CLI, and a private tag keeps marked text out of storage. Adopt it knowing what it is: a resident daemon plus Bun and Python tooling rather than a passive plugin, compression that spends real model quota every session, and a project that went through thirteen major versions in its first year.

What can you do with claude-mem?

  • Memory without asking for it — Five lifecycle hooks capture tool use as it happens, summaries are written per response, and the next session starts with recent observations already in context — fifty from the last ten sessions by default, an index view the docs put at 50 to 200 tokens, both figures configurable.
  • Search that spends tokens in stages — The MCP tools disclose progressively: a search returns cheap index lines, a timeline places them, and only the observations you open pay the full price — a workflow the project states saves roughly tenfold over dumping matches whole.
  • Local first, and no longer Claude Code only — Everything lands in SQLite with full-text search under your home directory, with an optional local vector index for semantic queries; documented installs cover OpenCode, Cursor, Codex CLI and OpenClaw, and Claude Desktop can search the same memory over MCP. Telemetry is on by default with documented opt-outs, and the opt-in cloud sync uploads observation narratives and full prompt text.
  • You choose what never gets stored — Text wrapped in a private tag is stripped before storage — from prompts and tool data, though not from the model's own responses or the summaries it writes, a boundary the docs spell out.

Before you choose claude-mem

  • Compression is real inference on your account — every session spends subscription quota or API budget, and observation batches have been dropped when a spend limit was hit.Reported in#3652
  • The maintainer's own tracker documents resource leaks measured in tens of gigabytes and session summaries silently discarded — acknowledged and actively worked, but part of today's experience.Reported in#3602#3587
  • It is effectively one person's fast-moving project — thirteen majors in a year — with a commercial layer forming around it, including a paid tier and a crypto token promoted in the README.

Star history

19 Aug to 28 Aug · +1.3k

91.2k92.5k

Frequently asked questions

Is claude-mem free for commercial use?

claude-mem is released under the Apache-2.0 licence — OSI-approved open source, which permits commercial use.

How can claude-mem be deployed?

claude-mem is available as Runs locally.

Documentation

Reproduced from the thedotmack/claude-mem README, published under Apache-2.0. Read the original ↗


Quick Start

Install with a single command:

npx claude-mem install

Or install for OpenCode:

npx claude-mem install --ide opencode

Or install for Antigravity CLI (setup guide):

npx claude-mem install --ide antigravity

Or install from the plugin marketplace inside Claude Code:

/plugin marketplace add thedotmack/claude-mem

/plugin install claude-mem

Restart Claude Code. Context from previous sessions will automatically appear in new sessions.

Note: Claude-Mem is also published on npm, but npm install -g claude-mem installs the SDK/library only — it does not register the plugin hooks or set up the worker service. Always install via npx claude-mem install or the /plugin commands above.

🦞 OpenClaw Gateway

Install claude-mem as a persistent memory plugin on OpenClaw gateways with a single command:

curl -fsSL https://install.cmem.ai/openclaw.sh | bash

The installer handles dependencies, plugin setup, AI provider configuration, worker startup, and optional real-time observation feeds to Telegram, Discord, Slack, and more. See the OpenClaw Integration Guide for details.

Key Features:

  • 🧠 Persistent Memory - Context survives across sessions
  • 📊 Progressive Disclosure - Layered memory retrieval with token cost visibility
  • 🔍 Skill-Based Search - Query your project history with mem-search skill
  • 🖥️ Web Viewer UI - Real-time memory stream at the worker URL printed on startup
  • 💻 Claude Desktop Skill - Search memory from Claude Desktop conversations
  • 🔒 Privacy Control - Use <private> tags to exclude sensitive content from storage
  • ⚙️ Context Configuration - Fine-grained control over what context gets injected
  • 🤖 Automatic Operation - No manual intervention required
  • 🔗 Citations - Reference past observations with IDs through the worker API or view all in the web viewer

Documentation

📚 View Full Documentation - Browse on official website

Getting Started

  • Installation Guide - Quick start & advanced installation
  • Usage Guide - How Claude-Mem works automatically
  • Search Tools - Query your project history with natural language
  • Cloud Sync - Back up your memories to cmem.ai — no daemon, the worker syncs on write

Best Practices

Architecture

Configuration & Development


How It Works

Core Components:

  1. 5 Lifecycle Hooks - SessionStart, UserPromptSubmit, PostToolUse, Stop, SessionEnd (6 hook scripts)
  2. Smart Install - Cached dependency checker (pre-hook script, not a lifecycle hook)
  3. Worker Service - Local HTTP API with web viewer UI and search endpoints, managed by Bun
  4. SQLite Database - Stores sessions, observations, summaries
  5. mem-search Skill - Natural language queries with progressive disclosure
  6. Chroma Vector Database - Hybrid semantic + keyword search for intelligent context retrieval

See Architecture Overview for details.


MCP Search Tools

Claude-Mem provides intelligent memory search through 4 MCP tools following a token-efficient 3-layer workflow pattern:

The 3-Layer Workflow:

  1. search - Get compact index with IDs (~50-100 tokens/result)
  2. timeline - Get chronological context around interesting results
  3. get_observations - Fetch full details ONLY for filtered IDs (~500-1,000 tokens/result)

How It Works:

  • Claude uses MCP tools to search your memory
  • Start with search to get an index of results
  • Use timeline to see what was happening around specific observations
  • Use get_observations to fetch full details for relevant IDs
  • ~10x token savings by filtering before fetching details

Available MCP Tools:

  1. search - Search memory index with full-text queries, filters by type/date/project
  2. timeline - Get chronological context around a specific observation or query
  3. get_observations - Fetch full observation details by IDs (always batch multiple IDs)

Example Usage:

// Step 1: Search for index
search(query="authentication bug", type="bugfix", limit=10)

// Step 2: Review index, identify relevant IDs (e.g., #123, #456)

// Step 3: Fetch full details
get_observations(ids=[123, 456])

See Search Tools Guide for detailed examples.


Release Branches

Stable releases ship from main and are published to npm. core-dev and community-edge are source-run branches for early reliability fixes and community integrations. See Release Branches for the branch flow and non-stable run instructions.


System Requirements

  • Node.js: 20.0.0 or higher
  • Claude Code: Latest version with plugin support
  • Bun: JavaScript runtime and process manager (auto-installed if missing)
  • uv: Python package manager for vector search (auto-installed if missing)
  • SQLite 3: For persistent storage (bundled)

Windows Setup Notes

If you see an error like:

npm : The term 'npm' is not recognized as the name of a cmdlet

Make sure Node.js and npm are installed and added to your PATH. Download the latest Node.js installer from https://nodejs.org and restart your terminal after installation.


Configuration

Settings are managed in ~/.claude-mem/settings.json (auto-created with defaults on first run). Configure AI model, worker port, data directory, log level, and context injection settings.

See the Configuration Guide for all available settings and examples.

Mode & Language Configuration

Claude-Mem supports multiple workflow modes and languages via the CLAUDE_MEM_MODE setting.

This option controls both:

  • The workflow behavior (e.g. code, chill, investigation)
  • The language used in generated observations

How to Configure

Edit your settings file at ~/.claude-mem/settings.json:

{
  "CLAUDE_MEM_MODE": "code--zh"
}

Modes are defined in plugin/modes/. To see all available modes locally:

ls ~/.claude/plugins/marketplaces/thedotmack/plugin/modes/

Available Modes

ModeDescription
codeDefault English mode
code--zhSimplified Chinese mode
code--jaJapanese mode

Language-specific modes follow the pattern code--[lang] where [lang] is the ISO 639-1 language code (e.g., zh for Chinese, ja for Japanese, es for Spanish).

Note: code--zh (Simplified Chinese) is already built-in — no additional installation or plugin update is required.

After Changing Mode

Restart Claude Code to apply the new mode configuration.

Development

See the Development Guide for build instructions, testing, and contribution workflow.


Troubleshooting

If experiencing issues, describe the problem to Claude and the troubleshoot skill will automatically diagnose and provide fixes.

See the Troubleshooting Guide for common issues and solutions.


Bug Reports

Create comprehensive bug reports with the automated generator:

cd ~/.claude/plugins/marketplaces/thedotmack
npm run bug-report

Support


Built with Claude Agent SDK | Works with Claude Code | Made with TypeScript


What About CMEM?

CMEM is a token created by a 3rd party but officially embraced by the creator of Claude-Mem (Alex Newman, @thedotmack). The token acts as a community catalyst for growth and a vehicle for bringing CMEM to the developers and knowledge workers that need it most.

Official BASE CA: 0x76b1967eec0ccaeb001bbbb2b40dc4badba31ba3