Skip to main content

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

Project description

claudememory

PyPI version Python License: MIT

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 — three embedding options supported out of the box:

Mode Setup Cost
Ollama (default) ollama pull nomic-embed-text Free, fully local
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

# 1. Index your repository
claude-memory index --repo-path /path/to/repo --user-id my-repo

# 2. Install Claude Code skills + MCP config
claude-memory install --repo-path /path/to/repo --user-id my-repo

# 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    --repo-path . --user-id myapp   # bulk index all commits
claude-memory serve                                     # start MCP server (stdio)
claude-memory status   --repo-path .                    # show indexed coverage
claude-memory install  --repo-path . --user-id myapp   # install Claude Code plugin
claude-memory store    HEAD                             # store single commit (post-commit hook)

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.9.tar.gz (42.9 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.9-py3-none-any.whl (46.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: claudememory-0.1.9.tar.gz
  • Upload date:
  • Size: 42.9 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.9.tar.gz
Algorithm Hash digest
SHA256 051bc46916c5976c041a98b867299441a0601713d7332c8f76622f8ec60f6a13
MD5 a96d4211e2f62e9ef218745afe3fe366
BLAKE2b-256 5605c5bcb324e461eb315e3cc8c51dc99bf5a4ba5c7caf9382aef26df4c360d5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: claudememory-0.1.9-py3-none-any.whl
  • Upload date:
  • Size: 46.3 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.9-py3-none-any.whl
Algorithm Hash digest
SHA256 626d2ca72779cb9c4473fca1529d5744e819875862d6edc3142d3c3c87c48556
MD5 bb78193659a3c152e355484a2fe6741c
BLAKE2b-256 c46eb601a4ab75c9a43a857e0a3fde928fd6e1f90c9ec304863cddaf0dd41a86

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