claude-db
Project memory and a code-symbol graph for Claude Code, stored in your own SQLite, Postgres or MongoDB
Persistent memory plugin for Claude Code and other coding agents, with MCP tools to search past sessions
By Alex Newman (individual) TypeScript Local · stdio Knowledge and memoryDeveloper tools
107 popularity score ★ 114k ↓ 36k/wk
Opens the app, which asks before it adds the server. Then replace each <NAME> in its settings with your value.
npx claude-mem installclaude mcp add claude-mem -- node '<ABSOLUTE_PATH_TO_HOME>/.claude/plugins/marketplaces/thedotmack/plugin/scripts/mcp-server.cjs'{
"mcpServers": {
"claude-mem": {
"command": "node",
"args": [
"<ABSOLUTE_PATH_TO_HOME>/.claude/plugins/marketplaces/thedotmack/plugin/scripts/mcp-server.cjs"
]
}
}
}{
"mcpServers": {
"claude-mem": {
"command": "node",
"args": [
"<ABSOLUTE_PATH_TO_HOME>/.claude/plugins/marketplaces/thedotmack/plugin/scripts/mcp-server.cjs"
]
}
}
}{
"servers": {
"claude-mem": {
"type": "stdio",
"command": "node",
"args": [
"<ABSOLUTE_PATH_TO_HOME>/.claude/plugins/marketplaces/thedotmack/plugin/scripts/mcp-server.cjs"
]
}
}
}[mcp_servers.claude-mem]
command = "node"
args = ["<ABSOLUTE_PATH_TO_HOME>/.claude/plugins/marketplaces/thedotmack/plugin/scripts/mcp-server.cjs"]gemini mcp add --scope user claude-mem node -- '<ABSOLUTE_PATH_TO_HOME>/.claude/plugins/marketplaces/thedotmack/plugin/scripts/mcp-server.cjs'| Set together: provider | |
|---|---|
CLAUDE_MEM_PROVIDER |
Optional: Which model condenses observations: claude, gemini, openrouter, openai-compatible, codex or cmem (hosted observer). The interactive installer offers cmem first. Set in ~/.claude-mem/settings.json or the environment. |
CLAUDE_MEM_MODEL |
Optional: Claude model used when the provider is claude. The haiku alias follows each new Haiku release. |
CLAUDE_MEM_GEMINI_API_KEY secret |
Optional: Gemini key, used when CLAUDE_MEM_PROVIDER=gemini. |
CLAUDE_MEM_OPENROUTER_API_KEY secret |
Optional: OpenRouter key, used when CLAUDE_MEM_PROVIDER=openrouter. |
CLAUDE_MEM_OPENAI_COMPAT_API_KEY secret |
Optional: Key for an OpenAI-compatible endpoint (with CLAUDE_MEM_OPENAI_COMPAT_BASE_URL), used when CLAUDE_MEM_PROVIDER=openai-compatible. |
CLAUDE_MEM_DATA_DIR |
Optional: Where the database, settings and logs are kept. |
CLAUDE_MEM_WORKER_PORT |
Optional: Port of the local worker API and viewer. Where there is no user ID (Windows) the offset comes from a hash of the data folder. |
CLAUDE_MEM_WORKER_HOST |
Optional: Address the worker binds to. |
CLAUDE_MEM_CHROMA_ENABLED |
Optional: Set to false to use SQLite-only search without the Chroma vector index. |
CLAUDE_MEM_WORK_STATE_ENABLED |
Optional: Set to false to hide work_state_write and work_state_read and the to-do section at session start. |
CLAUDE_MEM_RUNTIME |
Optional: worker (local SQLite) or server (beta server runtime, which adds the observation_* tools). |
CLAUDE_MEM_TELEMETRY |
Optional: Set to 0, false or off to stop anonymous analytics; DO_NOT_TRACK=1 also turns it off. |
Claude-Mem is a memory plugin for Claude Code and other coding harnesses such as Codex, Cursor, OpenCode and Pi. Lifecycle hooks (SessionStart, UserPromptSubmit, PreToolUse, PostToolUse, Stop, SessionEnd) record what happens in a session. Each hook is a plain `claude-mem hook ...` command run through a small launcher the installer puts on PATH. A local background worker sends that activity to an AI model, which condenses it into observations and session summaries stored in SQLite under ~/.claude-mem, with an optional Chroma index for meaning-based search. Context from earlier sessions is fed into new ones.
The bundled MCP server is far larger than the README's short tool list: src/servers/mcp-server.ts defines 26 tools. In the default worker mode it advertises 19: the three-step search (search, then timeline, then get_observations), a quick one-call dumb_search, save_memory for explicit notes, a per-project to-do list (work_state_write and work_state_read, hidden when CLAUDE_MEM_WORK_STATE_ENABLED=false), code-structure tools (smart_search, smart_outline, smart_unfold) that read files inside the current workspace, and knowledge corpora built from observations that can be primed and questioned. team_brief and team_search appear only after the install joins a TeamBrain team, and five observation_* tools only when CLAUDE_MEM_RUNTIME=server (src/servers/mcp-tool-visibility.ts).
TeamBrain is an optional paid shared workspace on cmem.ai. Each person picks which projects to share, and personal requests and review notes stay local. Install with `npx claude-mem install`. It asks in the terminal which agents to set up, or you can name one with `--ide <id>`, and `--runtime worker` picks the local runtime up front. The /plugin marketplace commands inside Claude Code work too, and `npx claude-mem doctor` checks a broken setup. A global npm install gives only the SDK.
| Runtime | Node.js 20.19+Bun |
|---|---|
| Runs on | macOS, Windows, Linux |
| Anthropic (Claude plan or API) | Paid planDefault observer model; or set your own Gemini, OpenRouter, OpenAI-compatible or Codex provider, or the hosted claude-mem observer (30-day free trial). |
| Also |
|
Run `npx claude-mem install` in an interactive terminal first. It asks which agents to set up (skip the question with `--ide <id>`), registers the hooks, installs Bun and uv when they are missing and places the claude-mem launcher on PATH. It then opens setup in the browser with an email sign-in for the hosted observer, which you skip with an explicit --provider flag or CLAUDE_MEM_ONLINE_OPTIN=false. Node must be 20.19 or later in the 20 line, or 22.12 or later. Restart the terminal or IDE so the new PATH is picked up. If hooks report that claude-mem is not found, run `npx claude-mem doctor`. Other MCP clients such as Claude Desktop point at the installed plugin's scripts/mcp-server.cjs.
It suits developers who use Claude Code (or OpenCode, T3 Code, Pi and the other supported harnesses) daily and want earlier sessions' decisions and fixes carried forward without writing notes by hand. Memory stays in local SQLite unless you opt into cloud sync or TeamBrain. It is not a standalone memory server for any MCP client: the value comes from its capture hooks, it runs a background worker, and each captured event costs model usage. If you only want an assistant to store and recall notes you write explicitly, a plain memory server without capture hooks is lighter.
17 only read, 9 change things. A ? marks an optional parameter.
searchquery?: stringlimit?: numberproject?: stringprojectId?: stringplatformSource?: stringtype?: stringobs_type?: stringdateStart?: stringdateEnd?: stringoffset?: numberorderBy?: stringtimelineanchor?: anyquery?: stringdepth_before?: numberdepth_after?: numberproject?: stringprojectId?: stringget_observationsids: arrayprojectId?: stringdumb_searchquery: stringproject?: stringlimit?: integermaxDetails?: integerdepthBefore?: integerdepthAfter?: integerimportant_workflowget_tool_usesids: arraylimit?: numberproject?: stringcontentSessionId?: stringsave_memory changestext: stringtitle?: stringproject?: stringmetadata?: objectwork_state_write changeslist: stringfields: objectwork_state_readlist?: stringincludeClosed?: booleanteam_briefproject?: stringteam_searchquery: stringlimit?: integersession_start_contextproject?: stringprojects?: anyplatformSource?: stringfull?: booleancolors?: booleansmart_searchquery: stringpath?: stringmax_results?: numberfile_pattern?: stringsmart_outlinefile_path: stringsmart_unfoldfile_path: stringsymbol_name: stringbuild_corpus changesname: stringdescription?: stringproject?: stringtypes?: stringconcepts?: stringfiles?: stringquery?: stringdateStart?: stringdateEnd?: stringlimit?: numberlist_corporaprime_corpus changesname: stringquery_corpus changesname: stringquestion: stringrebuild_corpus changesname: stringforce?: booleanreprime_corpus changesname: stringobservation_add changescontent: stringprojectId?: stringserverSessionId?: stringkind?: stringmetadata?: objectobservation_record_event changeseventType: stringprojectId?: stringsourceType?: enumserverSessionId?: stringcontentSessionId?: stringmemorySessionId?: stringplatformSource?: stringpayload?: anyoccurredAtEpoch?: numbergenerate?: booleanobservation_searchquery: stringprojectId?: stringplatformSource?: stringlimit?: numberobservation_contextprojectId?: stringquery?: stringplatformSource?: stringlimit?: numberobservation_generation_statusjobId: string