Persistent semantic memory for Claude Code — auto-saves and recalls conversation history across sessions.
Project description
claude-memory
Persistent, semantic, long-term memory for Claude Code. Conversations are auto-saved across sessions and the most relevant snippets are injected into context whenever you start a new prompt — no special syntax, no "remember this" phrasing required.
You : Do you remember Dandan?
Claude : Of course — Dandan is your golden Border Collie. 🐶
(auto-recalled from a chat 3 weeks ago)
How it works
Three Claude Code hooks + a small Python service:
| Hook | What it does |
|---|---|
UserPromptSubmit |
Embeds your prompt and injects the top-K most similar prior turns. |
Stop |
Persists the current user/assistant turn into SQLite + Chroma. |
SessionEnd |
Asks Claude Haiku to produce a coarse summary of the session. |
Storage:
- SQLite — source of truth for raw turns and summaries
- Chroma — local vector index over both
- Voyage AI (
voyage-3) — embeddings
Install
pip install claude-code-memory
claude-memory init
init will:
- Create
~/.claude/claude-memory/(data directory) - Prompt for your
VOYAGE_API_KEY(get one free at https://www.voyageai.com/) - Back up your existing
~/.claude/settings.jsonand add the three hooks - Print verification steps
Then open a fresh Claude Code session, chat for a few turns, and run:
claude-memory status
You should see turns and chroma_turns counters going up.
CLI
claude-memory init Install hooks
claude-memory status Show data dir, hook registration, DB stats
claude-memory doctor Verify Python, deps, API key, settings.json
claude-memory uninstall Remove hooks (keeps your data)
Configuration
All optional, set in ~/.claude/claude-memory/.env:
| Variable | Default | Purpose |
|---|---|---|
VOYAGE_API_KEY |
— | Required for embeddings |
TOP_K |
5 |
Max memories injected per prompt |
MIN_SCORE |
0.3 |
Cosine similarity floor (0–1) |
CLAUDE_MEMORY_DIR |
~/.claude/claude-memory |
Where SQLite + Chroma live |
CLAUDE_MEMORY_SUMMARY_MODEL |
claude-haiku-4-5-20251001 |
Model used by SessionEnd |
Optional: MCP server
You can also expose memory as MCP tools for Claude Code (search_memory,
list_recent, stats, forget). Add to ~/.claude.json or .mcp.json:
{
"mcpServers": {
"claude-memory": {
"command": "claude-memory-mcp"
}
}
}
Uninstall
claude-memory uninstall # removes hooks from settings.json
rm -rf ~/.claude/claude-memory # delete all your stored data (irreversible)
Privacy
- All data stays on your machine in
~/.claude/claude-memory/. - The only outbound call is to Voyage AI for embeddings (your prompt text) and Anthropic for end-of-session summaries.
- Set
CLAUDE_MEMORY_DIRto encrypt at rest with whatever filesystem-level encryption your OS provides.
License
MIT — see LICENSE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file claude_code_memory-0.1.0.tar.gz.
File metadata
- Download URL: claude_code_memory-0.1.0.tar.gz
- Upload date:
- Size: 14.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6b9e896a6e3ea572b9edbc2cfa4c3db1d1ab41e1e05c87867b6a06299fc3b407
|
|
| MD5 |
94ceb2979524847c111acb39cfc630df
|
|
| BLAKE2b-256 |
06e7ea359ce6380dcefc519841cd1dbf565d46a8d316097101acb5010f0278b0
|
File details
Details for the file claude_code_memory-0.1.0-py3-none-any.whl.
File metadata
- Download URL: claude_code_memory-0.1.0-py3-none-any.whl
- Upload date:
- Size: 16.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
088e03414f78aca974cf27b865cee4987bcc3bf03bc403a840ce18884a8277ee
|
|
| MD5 |
44cbb01edacec280b1797a42600641a3
|
|
| BLAKE2b-256 |
5e9983524feefa857278480a76a5a855f4699a8e63d631d7acba4f0ee8300c0d
|