Skip to main content

Durable, hierarchical, repo-scoped memory for Claude Code. Local-first MCP server with hybrid lexical + vector retrieval over your codebase, docs, and accumulated decisions.

Project description

claude-repo-mem

Durable, hierarchical, repo-scoped memory for Claude Code. Local-first MCP server.

claude-repo-mem indexes your repository — code, docs, and your own accumulated decisions — into a SQLite database with hybrid lexical + vector retrieval, then exposes it to Claude Code as 11 MCP tools.


Why claude-repo-mem

Working with an AI agent in a real codebase runs into the same friction every session:

  • Context burns fast. Native Read/Grep pull whole files into the window to answer narrow questions. recall returns ranked, summarized, scoped results inside a token budget — full source for the top hits, summaries for the rest — so you spend context on what matters.
  • Following code flow is expensive. Chasing a caller → handler → route by hand means repeated reads. trace walks the relation graph from a seed and returns the connected source in one round-trip.
  • Nothing carries across sessions. Decisions, conventions, and the "why" behind the code evaporate when the conversation ends. remember, handoff, and resume persist durable memory and task state as git-trackable markdown.
  • It stays on your machine. Everything lives in a single .claude-repo-mem/ directory with a local embedding model by default — no code leaves the repo, no API key required.

The result: the agent treats your repo as the authoritative source for its own structure and history, instead of rediscovering it file-by-file each time.


Install

pip install claude-repo-mem

Requires Python 3.11+.


Quick start

cd your-repo
claude-repo-mem index               # build the index (downloads bge-small on first run, ~90MB)
claude-repo-mem doctor              # verify: units, by_layer, T2 coverage, counters

To expose it to Claude Code, drop a .mcp.json in your repo root:

{
  "mcpServers": {
    "claude-repo-mem": {
      "command": "claude-repo-mem",
      "args": ["serve", "--watch"]
    }
  }
}

Claude Code will auto-launch the server on workspace load. The --watch flag runs an incremental file watcher (debounced 750ms) so the index stays current as you edit.

No path needed under Claude Code: it injects CLAUDE_PROJECT_DIR into the server's environment, which the server uses to locate the index even though MCP servers are launched from a system working directory rather than your repo. Under a different MCP host that doesn't set CLAUDE_PROJECT_DIR, pin the repo with "--root", "/abs/path" or the CLAUDE_REPO_MEM_ROOT env var. See docs/usage.md.

Prefer not to run the watcher? Install a git hook instead:

claude-repo-mem install-hooks       # writes .git/hooks/post-commit

CLI

claude-repo-mem index [--embedder NAME] [--no-embed] [--reset]
claude-repo-mem serve [--watch | --no-watch]
claude-repo-mem doctor                              # layer counts, T2 coverage, counters
claude-repo-mem install-hooks [--force]             # git post-commit reindex
claude-repo-mem distill [--yes] [--transcript PATH] # extract durable memories from a transcript
claude-repo-mem bench   --fixture queries.yaml [--k 5] [--no-embed]

Languages and synthesizers

Language Parser Notes
Python tree-sitter classes, methods, functions, docstrings
JavaScript / TypeScript tree-sitter functions, classes, methods, JSX
Java tree-sitter classes, interfaces, methods, constructors
Go tree-sitter funcs, methods, structs, interfaces
Rust tree-sitter fn, impl methods, structs, traits
Markdown markdown-it sections by heading hierarchy

Synthesizers add cross-file edges on top of parser output:

  • Flask @app.route(...) → handler.
  • Django path(...) / re_path(...) → handler (resolves dotted refs against views.py).
  • Express app.METHOD(url, handler) → same-file handler.
  • Python imports → cross-module edges.
  • React hooksuseState setter calls emit mutates_state_of edges on the containing component.

Documentation

Full documentation lives in docs/:

  • Usage guide — indexing, Claude Code setup, configuration, workflows, troubleshooting.
  • Tool reference — the 11 MCP tools, their parameters and returns.
  • Architecture — how indexing, storage, and retrieval work.
  • Contributing — dev setup, tests, and release flow.

License

MIT. See LICENSE.

Release notes for each version live in CHANGELOG.md.

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

claude_repo_mem-0.1.3.tar.gz (45.8 kB view details)

Uploaded Source

Built Distribution

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

claude_repo_mem-0.1.3-py3-none-any.whl (81.6 kB view details)

Uploaded Python 3

File details

Details for the file claude_repo_mem-0.1.3.tar.gz.

File metadata

  • Download URL: claude_repo_mem-0.1.3.tar.gz
  • Upload date:
  • Size: 45.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for claude_repo_mem-0.1.3.tar.gz
Algorithm Hash digest
SHA256 67f911c9a75c4ea7ec9031d951b640739d6cf9916eff6db7a933a7da7f8e5167
MD5 9e218c969a0876337c2a8e8b9008f278
BLAKE2b-256 9707f811d093b1e97f8314a6042bdb41a73a57494825dd20173b632f137133e9

See more details on using hashes here.

Provenance

The following attestation bundles were made for claude_repo_mem-0.1.3.tar.gz:

Publisher: python-publish.yml on amritmalla/claude-repo-mem

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file claude_repo_mem-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: claude_repo_mem-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 81.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for claude_repo_mem-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 477c8f8848ac76f9b29d345a8c21bc16da22a7c332565fb176584b6a06b4f361
MD5 7c3d4e125e9c67fb3659109c255dbd64
BLAKE2b-256 7a5cc3eebfc5b86397f99fa6c50a674078d520af70bbddded979d42af3c0a572

See more details on using hashes here.

Provenance

The following attestation bundles were made for claude_repo_mem-0.1.3-py3-none-any.whl:

Publisher: python-publish.yml on amritmalla/claude-repo-mem

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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