Skip to main content

relate-codemem

Long-term project memory for Claude Code, stored in a relate embedded graph database: one local store per project, no server.

Claude Code forgets everything between sessions. relate-codemem gives each project a graph that remembers the code (with content hashes and revisions), the documentation, the decisions, the meeting notes and what happened in earlier sessions, and lets Claude search it.

  • Hooks write. Every prompt, reply, edit and file change is recorded by Claude Code hooks, whether or not the model thinks about it.
  • CLAUDE.md reads. A section of CLAUDE.md tells Claude what the memory holds and when it is worth querying; Claude decides.
  • Hybrid search. relate's full-text index and its vector index, fused by reciprocal rank. Embeddings are computed locally by default.
  • Everything stays in the project. The store is a directory under .claude/relate/. Nothing leaves the machine unless you pick a remote embedding API.

Works on macOS, Linux and Windows.

Status: 0.1.0, early development. The graph model, the command names and the configuration keys may still change before 1.0. Developed and tested on macOS; the Linux and Windows paths are covered by CI only.

Install

macOS and Linux:

git clone https://github.com/cedricbarbin/relate-codemem && cd relate-codemem && ./install.sh

Windows (PowerShell):

git clone https://github.com/cedricbarbin/relate-codemem; cd relate-codemem; .\install.ps1

The installer checks for uv and relate and offers to install them, asks which embedding provider should be the default on this machine, installs the relate-codemem command (alias rcm), and adds the /relate-codemem-init skill to Claude Code. Details and manual steps: docs/install.md.

Check the result at any time:

relate-codemem doctor

Set up a project

In Claude Code, inside the project, type /relate-codemem-init. Or from a terminal at the project root:

relate-codemem init

This merges the hooks into .claude/settings.json, registers a read-only MCP server in .mcp.json, adds the memory section to CLAUDE.md, creates docs/decisions/ and docs/meetings/, ignores the store in git, then runs the initial analysis of the code base. Restart Claude Code afterwards so the hooks load.

The initial analysis can be run on its own, and rerun at any time; it only processes what changed:

relate-codemem index

What is stored

Source In the graph Written by
Code (30+ file types) File, FileRevision, Symbol, Module, file dependencies hooks, index
Documentation (*.md, *.rst, *.txt, ...) File, Chunk per section hooks, index
Decisions in docs/decisions/ (ADRs) Decision, Chunk hooks, index
Decisions made in a session Decision, Note Claude, with decide and note
Meetings in docs/meetings/ (.md, .txt, .vtt, .srt) Meeting, Person, Chunk hooks, index
Sessions Session, Prompt, Reply, ToolCall, files read hooks

Every file carries a sha256 hash and a revision number. When the hash changes, the revision is incremented and a FileRevision node records the hash, time, git commit and session, linked to the previous one. Symbols keep the revision they appeared in and the last revision that changed their body. Decisions and notes are never deleted: a newer entry in the same slot supersedes the old one. See docs/architecture.md.

Use it

Claude runs these itself when it judges the memory relevant; they work the same in a terminal.

relate-codemem recall                              # open decisions, notes, meetings, recent sessions
relate-codemem search "how are tokens refreshed"   # hybrid search
relate-codemem search retry --kind decision        # code | doc | decision | meeting | session | note
relate-codemem file src/app/config.py              # revisions, symbols, dependencies, decisions, sessions
relate-codemem symbol parse_config
relate-codemem query "MATCH (f:File) RETURN f.kind, count(*) LIMIT 10"    # read-only Cypher
relate-codemem decide --title "..." --text "..." --rationale "..." --slot area/topic --files a.py,b.py
relate-codemem note "Integration tests need Docker running" --slot tests/prerequisites
relate-codemem status

A worked example with real output is in examples/.

Embeddings

Provider Runs Default model Needs
local (default) on this machine, via fastembed paraphrase-multilingual-MiniLM-L12-v2 a one-time model download (about 220 MB)
ollama your Ollama server bge-m3 ollama pull bge-m3
openai any OpenAI-compatible /embeddings API text-embedding-3-small an API key in an environment variable
none - - nothing; search is full-text only

The default is chosen at install time (relate-codemem setup --embeddings ...) and can be overridden per project in .claude/settings.local.json:

{
  "env": {
    "RELATE_CODEMEM_EMBEDDINGS": "ollama",
    "RELATE_CODEMEM_EMBEDDING_MODEL": "bge-m3"
  }
}

relate-codemem init --embeddings ollama writes that block for you, and relate-codemem config shows the effective value and where it comes from. When nothing is configured, embeddings are local. Changing provider or model rebuilds the project's vectors on the next relate-codemem embed. All settings: docs/configuration.md.

Privacy

  • The store (.claude/relate/) holds prompts, replies and file contents in clear text. init adds it to .gitignore; do not share it unreviewed.
  • With local, ollama on localhost or none, nothing leaves the machine. With openai, the text of indexed files, prompts and replies is sent to the configured API.
  • API keys are read from an environment variable and never written to disk.
  • The relate binary collects anonymous usage metrics by default; relate telemetry off disables them.

Limitations

  • Symbol extraction is exact for Python (ast) and pattern-based for other languages: end lines are approximate and some methods are missed.
  • The default local model is small. It handles paraphrases and cross-language queries on sentences well, raw code and long passages less so.
  • relate's vector index is an exact scan, so its cost grows linearly with the number of vectors.
  • Full-text search matches whole words without stemming; identifiers are split (config finds parseConfig and parse_config).
  • Timestamps are shown in UTC.
  • Windows: relate 1.2.0 is unstable there when a read-only open follows a write, so reads are serialised with writes. The read-only MCP server is untested on Windows.

Uninstall

uv tool uninstall relate-codemem

Then delete ~/.claude/skills/relate-codemem-init and the user configuration (~/.config/relate-codemem, or %APPDATA%\relate-codemem on Windows). In a project, remove the relate-codemem hook entries from .claude/settings.json, the server from .mcp.json, the marked section of CLAUDE.md and the .claude/relate/ directory.

Contributing

See CONTRIBUTING.md. Security reports: SECURITY.md.

License

MIT. relate-codemem is an independent project; it drives the relate binary, which is distributed separately under its own license.

Metadata

Release files for relate-codemem 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for relate-codemem 0.1.0
File Size Uploaded Provenance Actions
relate_codemem-0.1.0.tar.gz 62.1 kB Without provenance Details for relate_codemem-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for relate-codemem 0.1.0
File Interpreter ABI Platform Actions
relate_codemem-0.1.0-py3-none-any.whl Python 3 none any Details for relate_codemem-0.1.0-py3-none-any.whl

Total release size: 109.2 kB

Release files / relate_codemem-0.1.0.tar.gz

Download URL relate_codemem-0.1.0.tar.gz
Size 62.1 kB
Tags Source
SHA-256 checksum
How to use checksums
565f3ac0d8d12ef63d869c90606424a3fff576d725c5e866abd5cf2117e0c802
BLAKE2b-256 checksum
How to use checksums
e481b4dedf3b091b04dfbc0dc3b561fb35de2c3bf430f2f6415c78e72f141f93
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / relate_codemem-0.1.0-py3-none-any.whl

Download URL relate_codemem-0.1.0-py3-none-any.whl
Size 47.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
71e11d37c2947d0829f6898dbdc3f901717933d13c4a9654b770b48360da2744
BLAKE2b-256 checksum
How to use checksums
a9f6b5c03858b12e161c2c3fce89a6b4df4005ab1372813f94f8c48385a29a05
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for relate-codemem 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page