Cross-project memory for AI coding agents
Project description
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.
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.
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 (startup/resume/compact) + UserPromptSubmit hook (every prompt) | crossmem install-hook |
| GitHub Copilot | Injects memories into copilot-instructions.md | crossmem install-hook --tool copilot |
| VS Code Agent Mode | SessionStart + UserPromptSubmit hooks (Preview) | crossmem install-hook --tool copilot-agent |
| 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
- Auto-ingest — pulls latest memories from Claude, Copilot, and Gemini native files
- Auto-init — first time in a project? Indexes README.md, CLAUDE.md, etc.
- Tiered recall — returns most relevant context within a token budget: curated memories > tool memories > CLAUDE.md > CONTRIBUTING.md > README.md
- Mid-session recall (Claude Code + VS Code Agent Mode) — every prompt is searched against your memories. Relevant context is injected before the model responds — no manual
mem_recallneeded. - Learn — AI saves new discoveries via
mem_saveduring sessions. Knowledge compounds. - Smart search (v1.1.0) — a two-layer noise filter separates signal tokens from noise before every FTS query. Layer 1 excludes 168 linguistically fixed closed-class words (prepositions, pronouns, auxiliaries, etc.) in O(1). Layer 2 applies corpus-adaptive IDF via FTS5 — tokens that appear in more than 40% of your documents are treated as project-specific noise. Zero additional dependencies.
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-serverisn't on PATH, useuvx --from crossmem crossmem-serverinstead.
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
crossmem recall --format vscode # JSON for VS Code agent-mode hooks
# 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 (SessionStart + UserPromptSubmit)
crossmem install-hook --tool copilot # Copilot (workspace instructions)
crossmem install-hook --tool copilot --global # Copilot (all workspaces)
crossmem install-hook --tool copilot --if-stale # refresh if >30 min old
crossmem install-hook --tool copilot-agent # VS Code agent mode (.github/hooks/)
crossmem install-instructions # Gemini
# Internal (installed as hooks — not run manually)
crossmem prompt-search # mid-session recall via UserPromptSubmit
# Diagnose
crossmem doctor # health check: binary, DB, hooks, Gemini, FTS index
# 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.
Changelog
See CHANGELOG.md for release notes.
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file crossmem-1.1.0.tar.gz.
File metadata
- Download URL: crossmem-1.1.0.tar.gz
- Upload date:
- Size: 41.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d945879f7b830c4f3ed5d737c2b0a833b0ba37f285a2b7154fd62a9fe6af9288
|
|
| MD5 |
c97ce6744bb496ec9515fa9a0d5720d3
|
|
| BLAKE2b-256 |
3e5084798a60896c3ef57ebd4072650c6520f1af534faf90cead6d31971fc0ad
|
Provenance
The following attestation bundles were made for crossmem-1.1.0.tar.gz:
Publisher:
ci.yml on Crack525/crossmem
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
crossmem-1.1.0.tar.gz -
Subject digest:
d945879f7b830c4f3ed5d737c2b0a833b0ba37f285a2b7154fd62a9fe6af9288 - Sigstore transparency entry: 1392658404
- Sigstore integration time:
-
Permalink:
Crack525/crossmem@c9973caf1899cd5d3afaacde9d80cdf54d4b136f -
Branch / Tag:
refs/tags/v1.1.0 - Owner: https://github.com/Crack525
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@c9973caf1899cd5d3afaacde9d80cdf54d4b136f -
Trigger Event:
push
-
Statement type:
File details
Details for the file crossmem-1.1.0-py3-none-any.whl.
File metadata
- Download URL: crossmem-1.1.0-py3-none-any.whl
- Upload date:
- Size: 47.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
202b27649e7d1074028980e0a0f95b6ede4e9b785d215762e5163e051d2822e0
|
|
| MD5 |
c3c7637c7f8438277b7a0bee2635849b
|
|
| BLAKE2b-256 |
c13f7f84e2307214e3129908a483938e216b06916acbf30edb5a57715e114fe0
|
Provenance
The following attestation bundles were made for crossmem-1.1.0-py3-none-any.whl:
Publisher:
ci.yml on Crack525/crossmem
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
crossmem-1.1.0-py3-none-any.whl -
Subject digest:
202b27649e7d1074028980e0a0f95b6ede4e9b785d215762e5163e051d2822e0 - Sigstore transparency entry: 1392658407
- Sigstore integration time:
-
Permalink:
Crack525/crossmem@c9973caf1899cd5d3afaacde9d80cdf54d4b136f -
Branch / Tag:
refs/tags/v1.1.0 - Owner: https://github.com/Crack525
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@c9973caf1899cd5d3afaacde9d80cdf54d4b136f -
Trigger Event:
push
-
Statement type: