Skip to main content

Open-source cross-agent memory layer for AI coding agents

Project description

CrossAgentMemory ๐Ÿง 

Open-source cross-agent memory layer for AI coding agents.

Your AI agent should remember what you built yesterday, why you rejected that approach last week, and that you prefer async/await over callbacks.

CrossAgentMemory makes that happen.

CI Python 3.10+ License: MIT


The Problem

Every time you start a new session with Claude Code, Codex, or Cursor, your agent remembers nothing. You re-explain your codebase. You re-teach your preferences. You burn tokens and patience.

CrossAgentMemory fixes session amnesia.


Features

Feature Status Description
Local-first storage โœ… SQLite database on your machine. No cloud. No API keys.
Cross-agent โœ… Works with Claude Code, Codex, Cursor, Gemini CLI, or any agent that reads text.
Semantic search โœ… Find memories by meaning, not just keywords. Pure numpy โ€” no heavy deps.
Auto-summarize โœ… Generate project/session summaries automatically.
Confidence decay โœ… Old memories fade. Important ones stick.
Memory reinforcement โœ… Boost confidence when a memory is validated.
CLAUDE.md sync โœ… Auto-generates CLAUDE.md from memory. Claude Code reads it automatically.
Git hooks โœ… Auto-sync CLAUDE.md on every commit.
Auto-capture โœ… Capture from git log, shell history, and Claude sessions automatically.
Team sync โœ… Share memories via .crossagentmemory/ folder in your repo.
MCP server โœ… Expose CrossAgentMemory as an MCP server for Cursor/Copilot/Claude.
Web dashboard โœ… Browse, search, and manage memories in a local web UI.
Shell integration โœ… Auto-inject context into Claude Code via shell aliases.
Background daemon โœ… Silent auto-capture while you work.
Memory graph โœ… Visualize relationships between memories.
Mem0 importer โœ… Migrate from Mem0 to CrossAgentMemory.
Social sharing โœ… Auto-post milestones to Twitter/LinkedIn.
VS Code extension โœ… Capture memories directly from your editor.
LLM summarization โœ… GPT/Claude-powered project & session summaries.
Smart auto-tagging โœ… LLM-generated tags for every memory.
Conflict detection โœ… Detect contradictory memories automatically.
REST API โœ… Full HTTP API for any integration.
Backup & restore โœ… Export/import memories, projects, and embeddings as .zip or .json.
Config file โœ… ~/.crossagentmemory/config.yaml for persistent backend and LLM settings.
FTS5 search โœ… Ranked full-text search with SQLite FTS5 (falls back to LIKE).

Install

pip install crossagentmemory
# or
pipx install crossagentmemory
# or
uv tool install crossagentmemory

Quick Start

1. Initialize memory for your project

cd my-project
crossagentmemory init

2. Capture memories as you work

crossagentmemory capture "Chose PostgreSQL over MongoDB for ACID compliance" --category decision --confidence 0.95

crossagentmemory capture "Always use async/await, never callbacks" --category preference

crossagentmemory capture "Auth bug: JWT refresh tokens not rotating" --category error

3. Find related memories (semantic search)

crossagentmemory related "authentication flow"

Output:

โ”Œโ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ ID โ”‚ Similarity โ”‚ Category โ”‚ Content                                โ”‚
โ”œโ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ 4  โ”‚ 0.58       โ”‚ decision โ”‚ Chose FastAPI over Django for async    โ”‚
โ””โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

4. Summarize your project

crossagentmemory summarize

5. Sync to CLAUDE.md

crossagentmemory sync

This generates CLAUDE.md in your project root. Claude Code reads it automatically on startup.

6. Install git hooks (auto-sync on commit)

crossagentmemory hook install

Now CLAUDE.md updates automatically every time you commit.


Full CLI Reference

# Core memory operations
crossagentmemory init                          # Initialize memory for project
crossagentmemory capture "content"             # Store a memory
crossagentmemory capture "..." --auto-tag      # Auto-generate tags with LLM
crossagentmemory recall                        # List recent memories
crossagentmemory search "keyword"              # Keyword search
crossagentmemory related "query"               # Semantic search
crossagentmemory summarize                     # Auto-summarize project
crossagentmemory summarize --llm               # LLM-powered rich summary
crossagentmemory summarize --session ID        # Summarize one session
crossagentmemory digest                        # Weekly digest
crossagentmemory digest --llm                  # LLM-powered weekly digest
crossagentmemory check-conflicts               # Detect contradictory memories
crossagentmemory reinforce <id>                # Boost memory confidence
crossagentmemory decay                         # Apply confidence decay
crossagentmemory decay --dry-run               # Preview decay

# Auto-capture
crossagentmemory capture-auto                  # Auto-capture from git + shell + Claude
crossagentmemory capture-auto --dry-run        # Preview what would be captured
crossagentmemory capture-auto --sources git    # Only capture from git log

# Agent integration
crossagentmemory load                          # Generate context brief
crossagentmemory sync                          # Sync to CLAUDE.md
crossagentmemory export                        # Export to markdown

# Team sync
crossagentmemory team export                   # Export memories to .crossagentmemory/
crossagentmemory team import                   # Import team-shared memories
crossagentmemory team status                   # Show team sync status

# Shell integration
crossagentmemory shell show                    # Show shell integration script

# Background daemon
crossagentmemory daemon start                  # Start silent auto-capture
crossagentmemory daemon status                 # Check daemon status

# Import & migration
crossagentmemory import <path> --format mem0   # Import from Mem0
crossagentmemory import <path> --format markdown
crossagentmemory import <path> --format json

# Social sharing
crossagentmemory post "Milestone!"             # Post to Twitter/LinkedIn

# Memory graph
crossagentmemory graph                         # Build relationship graph

# MCP server & dashboard & API
crossagentmemory mcp                           # Start MCP server (stdio)
crossagentmemory dashboard                     # Start web dashboard on :8745
crossagentmemory server                        # Start REST API on :8746

# Backup & restore
crossagentmemory backup                        # Create dated .zip backup
crossagentmemory backup -p my-project          # Backup single project
crossagentmemory restore backup.zip            # Restore from backup
crossagentmemory restore backup.zip --dry-run  # Preview restore

# Management
crossagentmemory stats                         # Show statistics
crossagentmemory hook install                  # Install git hooks
crossagentmemory hook uninstall                # Remove git hooks
crossagentmemory delete <project>              # Wipe project memory

How It Works

Your Terminal Agent
       โ”‚
       โ”œโ”€โ”€โ–บ crossagentmemory capture "..."   โ”€โ”€โ–บ SQLite (~/.crossagentmemory/memory.db)
       โ”‚
       โ”œโ”€โ”€โ–บ crossagentmemory capture-auto    โ”€โ”€โ–บ Auto-import from git / shell / Claude
       โ”‚
       โ”œโ”€โ”€โ–บ crossagentmemory related "..."   โ”€โ”€โ–บ TF-IDF + Cosine Similarity (numpy)
       โ”‚
       โ”œโ”€โ”€โ–บ crossagentmemory load            โ”€โ”€โ–บ Markdown brief for agent context
       โ”‚
       โ”œโ”€โ”€โ–บ crossagentmemory sync            โ”€โ”€โ–บ CLAUDE.md (auto-read by Claude Code)
       โ”‚
       โ”œโ”€โ”€โ–บ crossagentmemory team export     โ”€โ”€โ–บ .crossagentmemory/ (git-shared)
       โ”‚
       โ”œโ”€โ”€โ–บ crossagentmemory mcp             โ”€โ”€โ–บ MCP server for Cursor/Copilot/Claude
       โ”‚
       โ””โ”€โ”€โ–บ crossagentmemory dashboard       โ”€โ”€โ–บ Web UI on http://localhost:8745

Storage: Plain SQLite. Query it with any tool. Back it up. Version it.

Semantic Search: Built with TF-IDF + cosine similarity in pure numpy. No scikit-learn, no sentence-transformers, no API calls.

Privacy: Nothing leaves your machine.


Memory Categories

Category Use For
decision Architecture choices, tech stack decisions
preference Coding style, conventions, personal rules
fact Project structure, API behavior, domain knowledge
action What you built, refactored, deployed
error Bugs, gotchas, things that broke

Why Not Just Use CLAUDE.md?

CLAUDE.md is static documentation. CrossAgentMemory is learned memory:

CLAUDE.md CrossAgentMemory
You write it manually Captured as you work
Same every session Grows and evolves
No confidence scoring Tags confidence + source
One file per project Searchable across all history
No semantic search Find related ideas by meaning

Use both. CLAUDE.md for stable conventions. CrossAgentMemory for dynamic context.


Storage Backends

CrossAgentMemory supports multiple storage backends. SQLite is the default โ€” zero config, works offline, perfect for individuals.

PostgreSQL is available for teams, concurrent access, and larger deployments.

SQLite (default)

# No configuration needed โ€” works out of the box
crossagentmemory init

Database file: ~/.crossagentmemory/memory.db

PostgreSQL

# 1. Install with PostgreSQL support
pip install crossagentmemory[postgres]

# 2. Start PostgreSQL (Docker Compose included)
docker compose up -d

# 3. Set the connection URL
export DATABASE_URL=postgresql://crossagentmemory:crossagentmemory@localhost:5432/crossagentmemory

# 4. Initialize
crossagentmemory init

Switching Backends

from crossagentmemory import MemoryEngine

# Auto-detect: uses Postgres if DATABASE_URL is set, otherwise SQLite
engine = MemoryEngine()

# Explicit SQLite
engine = MemoryEngine(backend="sqlite")

# Explicit PostgreSQL
engine = MemoryEngine(backend="postgres")

Migrating Data

# Migrate all memories from SQLite to PostgreSQL
crossagentmemory migrate --from-backend sqlite --to-backend postgres

# Migrate a single project
crossagentmemory migrate -p my-project --from-backend sqlite --to-backend postgres

# Specify custom source DB or target DSN
crossagentmemory migrate --from-db-path ./old.db --to-dsn postgresql://user:pass@host/db

Roadmap

  • Core SQLite engine
  • CLI (init, capture, recall, search, load, export)
  • Markdown context brief generation
  • CLAUDE.md sync
  • Git hooks
  • Semantic search (TF-IDF + cosine similarity)
  • Auto-summarization
  • Confidence decay & reinforcement
  • Auto-capture from agent sessions
  • Team sync (shared memory via git)
  • MCP server integration
  • Web dashboard
  • Shell integration
  • Background daemon
  • Memory graph visualization
  • Mem0 importer
  • Social sharing
  • VS Code extension
  • Pluggable storage backends (SQLite + PostgreSQL)
  • Schema versioning
  • Backup & restore
  • Config file support
  • FTS5 full-text search

Contributing

PRs welcome! This is a community project.

git clone https://github.com/Vish150988/crossagentmemory.git
cd crossagentmemory
pip install -e ".[dev]"
pytest tests/ -v

License

MIT ยฉ Open Source Community

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

crossagentmemory-0.3.9.tar.gz (70.5 kB view details)

Uploaded Source

Built Distribution

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

crossagentmemory-0.3.9-py3-none-any.whl (63.7 kB view details)

Uploaded Python 3

File details

Details for the file crossagentmemory-0.3.9.tar.gz.

File metadata

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

File hashes

Hashes for crossagentmemory-0.3.9.tar.gz
Algorithm Hash digest
SHA256 fec1f88f9f299767f16a57e0326de24403600019b08364930742eb26bd64cb07
MD5 aa4f01b0fb182ac89ae6f3b4a9dd1487
BLAKE2b-256 130249174013161cad85b29060702fdde2f60e0af716ade7b72056e5b37774b2

See more details on using hashes here.

Provenance

The following attestation bundles were made for crossagentmemory-0.3.9.tar.gz:

Publisher: publish.yml on Vish150988/crossagentmemory

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

File details

Details for the file crossagentmemory-0.3.9-py3-none-any.whl.

File metadata

File hashes

Hashes for crossagentmemory-0.3.9-py3-none-any.whl
Algorithm Hash digest
SHA256 6f69176d5dfb8c65c529dc02392cdac66cbccb022b9f35fceaa8eb75ea35d283
MD5 6f58bd8b06bbb13dd8f70a70eb82b5a9
BLAKE2b-256 cf49f4ba9ddfa04fb7178d5818154b64e6862d070b418a71a4d6e2bdb61a525b

See more details on using hashes here.

Provenance

The following attestation bundles were made for crossagentmemory-0.3.9-py3-none-any.whl:

Publisher: publish.yml on Vish150988/crossagentmemory

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