Skip to main content

Dual-layer ChromaDB + Mem0 Git commit index for Claude Code

Project description

claudememory

PyPI version Python License: AGPL v3

Give Claude Code a long-term memory of your Git history.


The problem

Claude Code is great at reading your current codebase — but it has no memory of why things were built the way they are.

Every session starts fresh. Ask it why a module was refactored, which bugs have hit the payment service before, or what architectural decision introduced the current state machine — and it has no answer. That context lives in your Git history, but it's inaccessible to the AI.

claudememory solves this. It indexes your entire Git commit history into a dual-layer semantic store and exposes it to Claude Code via MCP. Claude can now answer:

  • "Has the auth module had bugs before?"
  • "Why was this abstraction introduced?"
  • "What changed in PaymentService over the last year?"
  • "What commits touched this file?"

How it works

Two storage layers work together on every indexed commit:

Layer Technology Purpose
Facts layer ChromaDB 1 document per commit — cosine similarity search, metadata filters, zero LLM overhead
Context layer Mem0 LLM-extracted interpretation — the why behind each change, cross-session learned context

ChromaDB acts as the ground truth (fast, accurate, deduplicated). Mem0 enriches results with learned context over time. Claude sees both merged together.


Install

pip install claudememory

PyPI

No external services required. Ollama is optional — if it's not running, claudememory falls back to ChromaDB-only mode automatically.

Mode Setup Cost
ChromaDB only (no setup) Nothing Free, works immediately
Ollama ollama pull nomic-embed-text Free, fully local, adds semantic layer
sentence-transformers pip install "claudememory[sentence-transformers]" Free, fully local, no Ollama
OpenAI pip install "claudememory[openai]" + OPENAI_API_KEY ~$0.0001/commit

Quick start

cd /your/repo

# 1. Index your repository (run from inside the repo)
claude-memory index

# 2. Install Claude Code skills + MCP config
claude-memory install

# 3. Restart Claude Code — then use /claude-memory-search, /claude-memory-debug etc.

After setup, Claude Code automatically has access to your commit history. No prompting required — it calls the tools proactively based on what you're working on.


MCP tools exposed to Claude

Tool What Claude can ask
search_git_history(query) "Find commits related to discount logic"
latest_commits(limit) "What changed while I was away?"
commits_touching_file(filename) "What's the history of PaymentService?"
bug_fix_history(component) "Has auth had bugs before?"
architecture_decisions(topic) "Why was the state machine introduced?"

Claude Code skills

Skill Trigger
/claude-memory-search Search commit history for a topic
/claude-memory-index Index a new repository
/claude-memory-status Check what's indexed
/claude-memory-debug Debug a regression with full history

CLI reference

claude-memory index                    # bulk index all commits (run from repo root)
claude-memory install                  # install Claude Code plugin (run from repo root)
claude-memory status                   # show indexed coverage
claude-memory serve                    # start MCP server (stdio)
claude-memory store HEAD               # store single commit (post-commit hook)

# Optional flags
claude-memory index --repo-path /other/repo --user-id myapp
claude-memory status --repo-path /other/repo

Configuration

All settings via environment variables:

Variable Default Description
CLAUDE_MEMORY_REPO_PATH . Repository to index
CLAUDE_MEMORY_USER_ID claude_memory_system Mem0 namespace (use per-repo names)
CLAUDE_MEMORY_CHROMA_DIR ~/.cache/claude_memory/chroma_commits ChromaDB storage path
CLAUDE_MEMORY_EMBED_PROVIDER ollama Embedding backend: ollama, openai, sentence-transformers
CLAUDE_MEMORY_EMBED_MODEL (provider default) Override embedding model name
CLAUDE_MEMORY_LLM_MODEL (provider default) Override LLM model name (Mem0 layer)
OPENAI_API_KEY (empty) Enables OpenAI embeddings + LLM automatically
MEM0_API_KEY (empty) Use Mem0 cloud instead of local inference
OLLAMA_URL http://localhost:11434 Ollama endpoint

Works great alongside GitNexus

These two tools answer different questions and are better together:

Question Tool
What does this function call? GitNexus
Why was this function written this way? claudememory
What will break if I change this? GitNexus
Has this area had bugs before? claudememory
What changed recently? claudememory

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

claudememory-0.1.10.tar.gz (43.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

claudememory-0.1.10-py3-none-any.whl (46.4 kB view details)

Uploaded Python 3

File details

Details for the file claudememory-0.1.10.tar.gz.

File metadata

  • Download URL: claudememory-0.1.10.tar.gz
  • Upload date:
  • Size: 43.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for claudememory-0.1.10.tar.gz
Algorithm Hash digest
SHA256 3fbbb9cb236d7c68a61ebd5baf0dbdfab1c8b7e711c0628b2d32a33571ae7f98
MD5 5fe421daa523da4cc179a7363b2b0a94
BLAKE2b-256 3c893b5b0f41b3286cadc409b414854c29518dce47a9340a04327536e6f34009

See more details on using hashes here.

File details

Details for the file claudememory-0.1.10-py3-none-any.whl.

File metadata

  • Download URL: claudememory-0.1.10-py3-none-any.whl
  • Upload date:
  • Size: 46.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for claudememory-0.1.10-py3-none-any.whl
Algorithm Hash digest
SHA256 8026d60b80637fc0c12c66181ead70e0871c42070aac4d1989fa37a97aaa5038
MD5 3b24d511c226e404d5f51960c26723d4
BLAKE2b-256 66bc9b0d48d0f187aef6fa19a6c094d44a01dc6663b86f51e8d2d7f93ec48c4c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page