Skip to main content

Cross-LLM memory layer for AI agents - local, human-editable, Git-native

Project description

0xMemory

🧠 Cross-LLM Memory Layer for AI Agents

PyPI version Python 3.11+ License: MIT Tests MCP

0xMemory gives your AI coding agents specific, persistent, and portable memory.

Instead of explaining your project structure or coding preferences to every new chat session in Cursor, Claude, or Gemini, 0xMemory stores this context in your repo where any agent can find it.

✨ Features

  • 🧠 Persistent Memory: Facts, decisions, and learnings are stored in human-readable Markdown files (.0xmemory/memory/).
  • ⚡ Two Modes:
    1. Lazy Mode: Dump raw text, let 0xMemory extract facts (requires API keys).
    2. Disciplined Mode: Let the Agent (Claude/Cursor) extract facts itself and just tell 0xMemory to remember them. No 0xMemory API keys needed!
  • 🔌 Cross-Agent Compatible: Works with Cursor, Claude Desktop, Gemini, and any MCP-compliant client.
  • 🔍 vector Search: Semantic retrieval helps agents find relevant past decisions and facts.
  • 📄 Human Editable: All memory is just Markdown. You can edit, delete, or version control it with Git.
  • 🚀 Local First: Your data stays in your repo. No external vector DBs required.

🚀 Quick Start

1. Installation

# Clone and install
git clone https://github.com/manoj-80/0xMemory.git
cd 0xMemory
python3 -m venv .venv
source .venv/bin/activate
pip install -e .

2. Initialize a Brain

Go to your project directory and run:

cd /path/to/my/project
0xmemory init

This creates a .0xmemory/ folder. Edit .0xmemory/brain.md to add your initial project context!

3. Connect your AI Agent

🖱️ Cursor (IDE)

  1. Go to Settings > Cursor Settings > Models > MCP.
  2. Click Add new MCP server.
  3. Name: 0xmemory
  4. Type: SSE
  5. URL: http://localhost:8000/sse

Note: You must have the server running:

0xmemory serve --transport http

JSON Configuration (Advanced) If you are configuring via a settings file (e.g., settings.json or generic MCP client config), use:

{
  "mcpServers": {
    "0xMemory": {
      "url": "http://localhost:8000/sse",
      "transport": "sse"
    }
  }
}

🤖 Claude Desktop

Add this to your claude_desktop_config.json:

{
  "mcpServers": {
    "0xmemory": {
      "command": "0xmemory",
      "args": ["serve"],
      "cwd": "/absolute/path/to/your/project"
    }
  }
}

🛠️ Usage

Once connected, your AI agent has access to these Tools:

  • remember: Save important info.

    "Remember that we use Poetry for dependency management."

  • recall: Search past memories.

    "What did we decide about database migrations?"

  • extract: Auto-extract knowledge from a conversation.

    "Extract the key decisions from these meeting notes..."

And these Resources (Context):

  • brain://context: Reads your brain.md (Project Overview).
  • brain://facts: List of all stored facts.
  • brain://decisions: Log of architectural decisions.

🧠 How to Extract Knowledge

You have two powerful ways to build your memory:

1. Lazy Mode (The "Dump" Method)

Best for: Meeting notes, long documentation, or messy brain dumps.

  1. Requirement: Add an API key (GEMINI_API_KEY, etc.) to your .env file.
  2. Action: Run 0xmemory extract "paste your long text here".
  3. Result: 0xMemory uses the cloud LLM to analyze the text and automatically creates facts, decisions, and outcomes in .0xmemory/memory/.

2. Disciplined Mode (The "Agent" Method)

Best for: coding sessions in Cursor/Claude. No API keys required for 0xMemory!

  1. Action: Just talk to your Agent normally.
  2. Prompt: When you decide something important, tell the Agent:

    "Using the remember tool, save the fact that we decided to use PostgreSQL because of its JSONB support."

  3. Result: The Agent (which already has context) calls the tool directly. 0xMemory simply stores it.

🧠 The Separation of Powers

0xMemory is designed with a strict separation of concerns:

  1. Human Territory (.0xmemory/brain.md)

    • Writable by: YOU (The Human) only.
    • Readable by: The Agent.
    • Purpose: High-level strategy, mission statements, and "Supreme Laws" (e.g., "Always use TypeScript").
    • Note: The Agent is forbidden from editing this file. It is your space to lead.
  2. AI Territory (.0xmemory/memory/*.md)

    • Writable by: The Agent (via remember tool).
    • Readable by: The Agent (via recall tool).
    • Purpose: Tactical details, API schemas, decision logs, and user preferences.

📁 Directory Structure

.0xmemory/
├── brain.md              # Main project context (Human curated)
├── config.yaml           # Configuration
├── memory/               # AI memory (Auto-managed)
│   ├── facts.md
│   ├── decisions.md
│   ├── learnings.md
│   └── preferences.md
├── sessions/             # Chat session archives
└── .store/               # ChromaDB vector index (Git ignored)

⌨️ CLI Commands

Command Description
0xmemory init Initialize a brain in the current directory
0xmemory serve Start the MCP server (stdio or http)
0xmemory status View brain statistics
0xmemory add Manually add a memory
0xmemory forget Delete a memory by ID
0xmemory update Update a memory's content
0xmemory search Search for memories
0xmemory extract Extract knowledge from text
0xmemory export Export memories to JSON/CSV
0xmemory rebuild Rebuild vector index from Markdown
0xmemory doctor Run health checks on configuration

🧪 Real-World Testing

We have a detailed guide with 4 real-life scenarios (Context Switching, Decision Logs, etc.) to verify your setup.

👉 Read the Real-World Testing Guide

Pro Tip: Check the Optimizing Token Usage section in the guide to learn how to scale to infinite memory using .cursorignore.

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

📄 License

This project is licensed under the MIT License.

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

oxmemory-1.0.4.tar.gz (182.4 kB view details)

Uploaded Source

Built Distribution

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

oxmemory-1.0.4-py3-none-any.whl (41.7 kB view details)

Uploaded Python 3

File details

Details for the file oxmemory-1.0.4.tar.gz.

File metadata

  • Download URL: oxmemory-1.0.4.tar.gz
  • Upload date:
  • Size: 182.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for oxmemory-1.0.4.tar.gz
Algorithm Hash digest
SHA256 5d624ce1d06ce76c9b2d137551c1d1b623238e0a7d1f4761c02a5cb03ad01f07
MD5 0241ed0da9ce9eacbd6a82f37cb474fc
BLAKE2b-256 f1ec526878be7bac6e81668d2430d920327aab553f49a3cabd8f3d0e90727812

See more details on using hashes here.

Provenance

The following attestation bundles were made for oxmemory-1.0.4.tar.gz:

Publisher: publish.yml on MANOJ-80/0xMemory

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

File details

Details for the file oxmemory-1.0.4-py3-none-any.whl.

File metadata

  • Download URL: oxmemory-1.0.4-py3-none-any.whl
  • Upload date:
  • Size: 41.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for oxmemory-1.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 a2d4a7111ddbe1f8825a78e3b405520b6d7933749525e6d7f546dfcf496cec02
MD5 4d109a0986ce4a9b68649cd682691bf6
BLAKE2b-256 7eb5a841d0e351ba1feaa976a8e93dfa31d449887895cc306be60bcc62401a1e

See more details on using hashes here.

Provenance

The following attestation bundles were made for oxmemory-1.0.4-py3-none-any.whl:

Publisher: publish.yml on MANOJ-80/0xMemory

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