MCPcopy
hub / github.com/thedotmack/claude-mem

github.com/thedotmack/claude-mem @v13.9.2 sqlite

repository ↗ · DeepWiki ↗ · release v13.9.2 ↗
12,808 symbols 49,123 edges 595 files 134 documented · 1%
README

Claude-Mem Vercel OSS Program

🇨🇳 中文🇹🇼 繁體中文🇯🇵 日本語🇵🇹 Português🇧🇷 Português🇰🇷 한국어🇪🇸 Español🇩🇪 Deutsch🇫🇷 Français🇮🇱 עברית🇸🇦 العربية🇷🇺 Русский🇵🇱 Polski🇨🇿 Čeština🇳🇱 Nederlands🇹🇷 Türkçe🇺🇦 Українська🇻🇳 Tiếng Việt🇵🇭 Tagalog🇮🇩 Indonesia🇹🇭 ไทย🇮🇳 हिन्दी🇧🇩 বাংলা🇵🇰 اردو🇷🇴 Română🇸🇪 Svenska🇮🇹 Italiano🇬🇷 Ελληνικά🇭🇺 Magyar🇫🇮 Suomi🇩🇰 Dansk🇳🇴 Norsk

Persistent memory compression system built for Claude Code.

License Version Node Mentioned in Awesome Claude Code

  <img src="https://raw.githubusercontent.com/thedotmack/claude-mem/main/docs/public/trendshift-badge.svg" alt="thedotmack/claude-mem | Trendshift" width="250" height="55"/>

Claude-Mem Preview Star History Chart

Quick StartHow It WorksSearch ToolsDocumentationConfigurationTroubleshootingLicense

Claude-Mem seamlessly preserves context across sessions by automatically capturing tool usage observations, generating semantic summaries, and making them available to future sessions. This enables Claude to maintain continuity of knowledge about projects even after sessions end or reconnect.


Quick Start

Install with a single command:

npx claude-mem install

Or install for Gemini CLI (auto-detects ~/.gemini):

npx claude-mem install --ide gemini-cli

Or install for OpenCode:

npx claude-mem install --ide opencode

Or install from the plugin marketplace inside Claude Code:

/plugin marketplace add thedotmack/claude-mem

/plugin install claude-mem

Restart Claude Code or Gemini CLI. 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 http://localhost:37777
  • 💻 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 (access via http://localhost:37777/api/observation/{id} or view all in the web viewer at http://localhost:37777)
  • 🧪 Beta Channel - Try experimental features like Endless Mode via version switching

Documentation

📚 View Full Documentation - Browse on official website

Getting Started

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 - HTTP API on port 37777 with web viewer UI and 10 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.


Beta Features

Claude-Mem offers a beta channel with experimental features like Endless Mode (biomimetic memory architecture for extended sessions). Switch between stable and beta versions from the web viewer UI at http://localhost:37777 → Settings.

See Beta Features Documentation for details on Endless Mode and how to try it.


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

Mode Description
code Default English mode
code--zh Simplified Chinese mode
code--ja Japanese mode

Language-specific modes follow the pa

Extension points exported contracts — how you extend this code

CloseableClient (Interface)
(no doc) [12 implementers]
src/services/infrastructure/GracefulShutdown.ts
ServerGenerationProvider (Interface)
(no doc) [10 implementers]
src/server/generation/providers/shared/types.ts
PostgresQueryable (Interface)
(no doc) [5 implementers]
src/storage/postgres/utils.ts
FakeCli (Interface)
* All probing goes through the _internals seam, so these tests swap its * members instead of module-mocking child_proce
tests/shared/find-claude-executable.test.ts
TableColumnInfo (Interface)
(no doc)
src/types/database.ts
ObserverToolAttempt (Interface)
(no doc)
src/utils/observer-audit.ts
ShutdownCascadeOptions (Interface)
(no doc)
src/supervisor/shutdown.ts
ObservationRow (Interface)
(no doc)
src/cli/claude-md-commands.ts

Core symbols most depended-on inside this repo

push
called by 1702
plugin/scripts/server-service.cjs
optional
called by 1238
plugin/scripts/worker-service.cjs
push
called by 1031
plugin/scripts/worker-service.cjs
join
called by 943
plugin/scripts/server-service.cjs
string
called by 862
plugin/scripts/server-service.cjs
includes
called by 857
plugin/scripts/worker-service.cjs
log
called by 850
src/utils/logger.ts
trim
called by 792
plugin/scripts/worker-service.cjs

Shape

Function 7,375
Method 4,606
Interface 479
Class 346
Enum 2

Languages

TypeScript100%
Python1%

Modules by API surface

plugin/scripts/worker-service.cjs4,155 symbols
plugin/scripts/server-service.cjs2,780 symbols
plugin/scripts/mcp-server.cjs927 symbols
plugin/ui/viewer-bundle.js688 symbols
plugin/scripts/transcript-watcher.cjs597 symbols
plugin/scripts/context-generator.cjs209 symbols
src/services/sqlite/SessionStore.ts80 symbols
plugin/scripts/worker-cli.js50 symbols
openclaw/src/index.ts48 symbols
src/server/routes/v1/ServerV1PostgresRoutes.ts45 symbols
src/npx-cli/commands/install.ts45 symbols
src/sdk/index.ts42 symbols

Dependencies from manifests, versioned

@anthropic-ai/claude-agent-sdk0.3.172 · 1×
@better-auth/api-key1.6.16 · 1×
@clack/prompts1.3.0 · 1×
@derekstride/tree-sitter-sql0.3.11 · 1×
@modelcontextprotocol/sdk1.29.0 · 1×
@tree-sitter-grammars/tree-sitter-lua0.4.1 · 1×
@tree-sitter-grammars/tree-sitter-markdown0.3.2 · 1×
@tree-sitter-grammars/tree-sitter-toml0.7.0 · 1×
@tree-sitter-grammars/tree-sitter-yaml0.7.1 · 1×
@tree-sitter-grammars/tree-sitter-zig1.1.2 · 1×
@types/bun1.3.13 · 1×
@types/cors2.8.19 · 1×

Datastores touched

dbDatabase · 1 repos
(mongodb)Database · 1 repos
(mysql)Database · 1 repos
dbDatabase · 1 repos
appDatabase · 1 repos
cmem_testDatabase · 1 repos

For agents

$ claude mcp add claude-mem \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact