Skip to main content

Cross-project memory for AI coding agents

Project description

crossmem

PyPI Downloads Python License

Your AI tools forget. crossmem doesn't.

Cross-tool memory for AI coding agents. One pip install, zero cloud, zero accounts — your Claude Code, GitHub Copilot, and Gemini CLI sessions remember everything, across every project, automatically.

Before and after crossmem

Quick start

pip install crossmem        # 1. Install
crossmem setup              # 2. Done. All tools configured.

That's it. Every AI coding session now starts with cross-project context.

crossmem demo

Why crossmem?

40-50% of tokens in a typical AI coding session are wasted re-establishing context the model already knew last session. In a real experiment, two AI agents (Claude Code and GitHub Copilot) both bypassed their own memory tools and re-derived everything from training data — proving the problem they were explaining.

crossmem fixes this by injecting remembered context before the AI starts thinking — not as a suggestion it can ignore, but as enforced context.

You: "How should I handle credentials in this new service?"

AI: [crossmem recalls patterns from 3 of your projects]
    Based on your backend-api, mobile-app, and infra-tools projects,
    you use a middleware layer for credential masking — keys in
    Secret Manager, never env vars, masked in logs via
    _mask_sensitive_headers(). Applying the same pattern here.

No copy-pasting. No "I already solved this." Your AI remembers — across every project.

How it differs

crossmem Mem0 Letta Zep
Install pip install + SQLite Cloud API key or self-hosted Qdrant Server + Docker Postgres + Go server
Cross-tool Claude + Copilot + Gemini Single app Single app Single app
Cross-project All projects, one index Per-app scoped Per-agent scoped Per-session scoped
Protocol MCP-native REST API Custom framework SDK
Infrastructure None. Local SQLite. Cloud or Qdrant + server Letta server Postgres + server
Enforcement Hook injects context before generation LLM decides to call API LLM self-manages memory LLM calls SDK

Works with

Tool Auto-recall How
Claude Code SessionStart hook — fires on startup, resume, compact crossmem install-hook
GitHub Copilot Injects memories into copilot-instructions.md crossmem install-hook --tool copilot
Gemini CLI Instruction in GEMINI.md crossmem install-instructions

What happens under the hood

cd ~/any-project
claude                    # Claude Code: hook fires, memories injected automatically
code .                    # Copilot: reads context pre-injected into copilot-instructions.md
gemini                    # Gemini: calls mem_recall via instruction in GEMINI.md
  1. Auto-ingest — pulls latest memories from Claude, Copilot, and Gemini native files
  2. Auto-init — first time in a project? Indexes README.md, CLAUDE.md, etc.
  3. Tiered recall — returns most relevant context within a token budget: curated memories > tool memories > CLAUDE.md > CONTRIBUTING.md > README.md
  4. Learn — AI saves new discoveries via mem_save during sessions. Knowledge compounds.

MCP Server

Add to your tool's MCP config so AI assistants can search, recall, and save memories in real-time:

Claude Code (~/.mcp.json)
{
  "mcpServers": {
    "crossmem": {
      "command": "crossmem-server"
    }
  }
}
GitHub Copilot (.vscode/mcp.json)
{
  "servers": {
    "crossmem": {
      "command": "uvx",
      "args": ["--from", "crossmem", "crossmem-server"]
    }
  }
}
Gemini CLI (~/.gemini/settings.json)
{
  "mcpServers": {
    "crossmem": {
      "command": "crossmem-server"
    }
  }
}

If crossmem-server isn't on PATH, use uvx --from crossmem crossmem-server instead.

MCP Tools

Tool Description
mem_recall Load project context + cross-project patterns at session start
mem_search Search across all memories (query, project filter, limit)
mem_save Save a discovery during a session
mem_update Update a memory in place (preserves ID)
mem_forget Delete a memory by ID
mem_get Get full content of a memory by ID
mem_init Index project documentation files
mem_ingest Refresh the index from native tool memory files
CLI reference
# Recall (runs automatically via hook)
crossmem recall                  # auto-detects project from cwd
crossmem recall -p backend-api   # explicit project
crossmem recall --format copilot # marker-wrapped for Copilot injection

# Search
crossmem search "JWT token rotation"
crossmem search "retry strategy" -p backend-api -n 5

# Save / Update / Delete
crossmem save "Always use middleware for credential masking" -p backend-api -s Patterns
crossmem update 42 "corrected content here"
crossmem forget 42

# Index project docs
crossmem init                        # current directory
crossmem init -p my-api --path ~/projects/api

# Hooks
crossmem install-hook                              # Claude Code
crossmem install-hook --tool copilot               # Copilot (workspace)
crossmem install-hook --tool copilot --global      # Copilot (all workspaces)
crossmem install-hook --tool copilot --if-stale    # refresh if >30 min old
crossmem install-instructions                      # Gemini

# Other
crossmem ingest       # re-ingest tool memories
crossmem graph        # visualize knowledge graph in browser
crossmem stats        # database stats
crossmem setup        # one-time: Claude hook + Copilot injection + Gemini instructions + ingest

Supported tools

Tool Memory files
Claude Code ~/.claude/projects/*/memory/*.md
Gemini CLI ~/.gemini/GEMINI.md
GitHub Copilot (macOS) ~/Library/Application Support/Code/User/globalStorage/github.copilot-chat/memory-tool/memories/*.md
GitHub Copilot (Linux) ~/.config/Code/User/globalStorage/github.copilot-chat/memory-tool/memories/*.md
GitHub Copilot (Windows) %APPDATA%\Code\User\globalStorage\github.copilot-chat\memory-tool\memories\*.md

Ingestion is pluggable — PRs welcome for new tools.

Contributing

Found a bug? Want to add support for another AI tool? Open an issue or submit a PR.

If crossmem saves you from re-explaining your codebase to AI, consider giving it a star — it helps others find it.

License

MIT

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

crossmem-0.7.0.tar.gz (27.5 kB view details)

Uploaded Source

Built Distribution

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

crossmem-0.7.0-py3-none-any.whl (31.4 kB view details)

Uploaded Python 3

File details

Details for the file crossmem-0.7.0.tar.gz.

File metadata

  • Download URL: crossmem-0.7.0.tar.gz
  • Upload date:
  • Size: 27.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.10 {"installer":{"name":"uv","version":"0.10.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for crossmem-0.7.0.tar.gz
Algorithm Hash digest
SHA256 50f5f903202a5879d520c10daf02199388ecf6ffd3ddfd71b5c1a6134e9a88a4
MD5 5d23373ba39065a8eb5fc4160c3abc67
BLAKE2b-256 1ead92148fb53326048810851c52e77130c05a40e10ce95baa60bec07f3ec738

See more details on using hashes here.

File details

Details for the file crossmem-0.7.0-py3-none-any.whl.

File metadata

  • Download URL: crossmem-0.7.0-py3-none-any.whl
  • Upload date:
  • Size: 31.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.10 {"installer":{"name":"uv","version":"0.10.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for crossmem-0.7.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ae19b2d1a985abc392e375456282fa057005237bb2be25a4e066cb9d75f0a7ee
MD5 a6cd3061250de93ba154e71c21234e9c
BLAKE2b-256 c0a0d1a39e49b9564012f63c6f73d55e73b4bb1a7472f927e81b58c049a899f0

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