Skip to main content

Local-first agent memory CLI — dump, diff, migrate & query across Mem0, Letta, and more

Project description

🧠 mnemo

Local-first agent memory CLI — dump, diff, migrate, and query memories across Mem0, Letta, and your local filesystem.

Agents are finally getting good long‑term memory, but every framework (Mem0, Letta, Supermemory, custom Postgres) stores it differently. mnemo is a git‑like CLI for agent memory: you can dump, diff, migrate, and query what your agents know, all from your terminal, using a simple normalized schema and local‑first files. It’s designed for developers who want to own their agent’s “brain” instead of locking it into a single vendor.

Inspired by Mnemosyne (Greek goddess of memory), mnemo is a portable CLI for managing agent memory: capture facts, version-control dumps, compare snapshots, and sync to cloud memory providers — all from your terminal.


Features

  • 11 CLI commands with rich --help and tab-completion
  • Normalized schema — facts with {entity, attribute, value, source, timestamp, confidence}
  • Multi-provider — local JSON, Mem0, Letta (stubs → real APIs with optional deps)
  • TF-IDF searchmnemo recall "query" with zero external ML deps
  • Rich tables — confidence color-coded (🟢 ≥0.8, 🟡 ≥0.5, 🔴 <0.5)
  • HTML + graph diffs — visual diff between dump snapshots
  • MCP server — FastAPI /mcp/list_tools + /mcp/call_tool for Ollama/Claude Code agents
  • Safe writes--dry-run and --approval flags

Quick Start

# Install
cd mnemo-agent
pip install -e .          # core (local only)
pip install -e ".[all]"   # everything (mem0 + letta + parquet + graph)

# Initialize Joshua's job-prep agent
mnemo init --agent job-prep

# Add facts manually (entity defaults to agent name, --tag is repeatable)
mnemo add --fact "Joshua uses React, Node, Supabase, Vercel" --agent job-prep
mnemo add --fact "Joshua is based in Toronto" --agent job-prep --confidence 1.0
mnemo add --fact "Chose Supabase over Firebase for auth" --agent job-prep --attribute decision --tag decision --tag auth

# View stored memories — plain format shows IDs for retract/edit
mnemo show --agent job-prep
mnemo show --agent job-prep --format plain

# Recall using natural language, optionally filtered by tag
mnemo recall "tech stack" --agent job-prep
mnemo recall "auth" --agent job-prep --tag decision
mnemo search "Supabase database" --agent job-prep --limit 5

# Edit or remove facts by ID (use 'show --format plain' to find IDs)
mnemo retract a1b2c3d4 --agent job-prep
mnemo edit a1b2c3d4 --value "Updated wording" --agent job-prep

# List all agents
mnemo ls --pretty

# Dump to a timestamped file
mnemo dump --agent job-prep

# Load a sample dump
mnemo load --file tests/fixtures/job_prep_sample.json --agent job-prep

# Compare two agents (or two dump files)
mnemo diff --agent-a job-prep --agent-b job-prep-v2
mnemo diff dump1.json dump2.json --html diff_report.html

# Start the MCP server (for Ollama / Claude Code agents)
mnemo serve --agent job-prep --port 8080

📋 All Commands

Command Description
mnemo init --agent <name> Initialize agent directory + config
mnemo add --fact "text" --agent <name> Add a memory fact (--entity, --attribute, --tag supported)
mnemo dump --agent <name> [--source mem0|letta] Dump memories to JSON
mnemo load --file dump.json --agent <name> Load dump into local/Mem0/Letta
mnemo ls [--agent all] List agents and fact counts
mnemo show --agent <name> Display agent's latest memories (--format pretty|json|plain)
mnemo diff --agent-a <a> --agent-b <b> Diff two agents (or diff a.json b.json)
mnemo recall "query" [--tag <tag>] TF-IDF search across all agents, optional tag filter
mnemo search "query" [--limit 10] [--tag <tag>] Alias for recall with higher default limit
mnemo retract <fact-id> --agent <name> Remove a fact by ID or 8-char prefix
mnemo edit <fact-id> --agent <name> Edit value/attribute/confidence of an existing fact
mnemo migrate --dump f.json --target mem0 --agent name Migrate between providers
mnemo serve --agent <name> [--port 8080] [--read-only] MCP FastAPI server

Project Structure

mnemo-agent/
├── src/mnemo/
│   ├── __init__.py          # version
│   ├── cli.py               # Click CLI (all commands)
│   ├── models.py            # Pydantic: Fact, AgentDump, MnemoConfig
│   ├── storage.py           # Local file I/O (JSON, YAML, Parquet)
│   ├── search.py            # TF-IDF search + diff engine
│   ├── server.py            # FastAPI MCP server
│   └── adapters/
│       ├── mem0_adapter.py  # Mem0 API → normalized facts
│       └── letta_adapter.py # Letta API → normalized facts
├── tests/
│   ├── test_cli.py          # pytest suite
│   └── fixtures/
│       └── job_prep_sample.json
├── config.yaml              # Sample agent config
├── pyproject.toml
└── requirements.txt

Memory Schema

{
  "agent": "job-prep",
  "dump_ts": "2026-03-21T23:00Z",
  "source": "manual",
  "version": "1",
  "facts": [
    {
      "id": "uuid",
      "entity": "Joshua",
      "attribute": "tech_stack",
      "value": "React, Node, Supabase, Vercel",
      "source": "chat|tool|manual|mem0|letta|import",
      "timestamp": "2026-03-21T20:00Z",
      "confidence": 0.95,
      "metadata": {}
    }
  ]
}

Example: Project Memory for advisor-prep

{
  "agent": "advisor-prep",
  "facts": [
    {
      "id": "uuid-1",
      "entity": "advisor-prep-agent",
      "attribute": "project_summary",
      "value": "CLI + agent that helps students prep for advisor meetings using UBC context.",
      "source": "manual",
      "timestamp": "2026-03-22T01:00Z",
      "confidence": 0.9,
      "metadata": { "tags": ["summary", "high-level"] }
    },
    {
      "id": "uuid-2",
      "entity": "advisor-prep-agent",
      "attribute": "decision",
      "value": "Chose Supabase over Firebase for auth due to better Postgres integration.",
      "source": "manual",
      "timestamp": "2026-03-22T01:05Z",
      "confidence": 0.95,
      "metadata": { "tags": ["decision", "auth"], "ticket": "ADR-001" }
    },
    {
      "id": "uuid-3",
      "entity": "advisor-prep-agent",
      "attribute": "stack",
      "value": "Next.js, React, Node, Supabase, Vercel.",
      "source": "manual",
      "timestamp": "2026-03-22T01:10Z",
      "confidence": 1.0,
      "metadata": { "tags": ["stack"] }
    }
  ]
}

🔌 MCP Server (for Ollama / Claude Code)

mnemo serve --agent job-prep --port 8080
Endpoint Description
GET /mcp/list_tools List available tools (MCP schema)
POST /mcp/call_tool Call a tool by name with arguments
GET /facts REST: list all facts
GET /search?q=query REST: search memories
GET /docs Swagger UI

Available MCP tools

{ "name": "search_memory",  "description": "TF-IDF search over agent memory" }
{ "name": "list_facts",     "description": "Return all facts, optionally filtered" }
{ "name": "upsert_fact",    "description": "Add a fact to agent memory" }
{ "name": "get_agent_info", "description": "Agent metadata and fact count" }

⚙️ Configuration

Each agent has ~/.mnemo/<agent>/config.yaml:

agent: job-prep
default_source: local
default_target: local
mem0_api_key: null          # https://app.mem0.ai
mem0_user_id: joshua
letta_base_url: http://localhost:8283
letta_agent_id: null        # from your Letta agent
tags: [job-prep, interview]
notes: Memory store for interview prep agent

Environment Variables

Variable Description
MNEMO_AGENT Default agent name (skips --agent flag)
MNEMO_DIR Override base directory (default: ~/.mnemo)

Tests

pip install -e ".[dev]"
pytest tests/ -v

Roadmap

  • Vector embeddings for semantic search (v2)
  • Parquet export for analytics
  • mnemo audit — fact provenance trace
  • Web UI dashboard
  • Native Ollama MCP client registration

Example Use Case: job-prep Agent

# Bootstrap your interview prep memory
mnemo init --agent job-prep
mnemo load --file tests/fixtures/job_prep_sample.json --agent job-prep

# Ask your agent questions via MCP (Ollama / Claude Code reads from :8080)
mnemo serve --agent job-prep --port 8080

# After a practice interview, add what you learned
mnemo add --fact "Lead with Supabase migration story at FAANG interviews" \
  --agent job-prep --attribute interview_tip --confidence 0.9 --tag tip

# Before next session, recall relevant context
mnemo recall "React Supabase full-stack" --agent job-prep

License

MIT © Joshua Ndala

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

mnemo_agent-0.1.0.tar.gz (26.3 kB view details)

Uploaded Source

Built Distribution

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

mnemo_agent-0.1.0-py3-none-any.whl (23.3 kB view details)

Uploaded Python 3

File details

Details for the file mnemo_agent-0.1.0.tar.gz.

File metadata

  • Download URL: mnemo_agent-0.1.0.tar.gz
  • Upload date:
  • Size: 26.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.2

File hashes

Hashes for mnemo_agent-0.1.0.tar.gz
Algorithm Hash digest
SHA256 e46fe9e8d13a9388aa25382924d17a71f4fb03aca0dc248ecb115a807b3626c4
MD5 3d7b070878dbe504f6bc6db96ce379f5
BLAKE2b-256 83725ff3b943ee71945c4c539dc4d17f4cc7361d0227074cb4421ccb881b84af

See more details on using hashes here.

File details

Details for the file mnemo_agent-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: mnemo_agent-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 23.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.2

File hashes

Hashes for mnemo_agent-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 881ca625b400854fd7c92d1ebafc2144b14355f126efe2026f4bb7a523c0a85a
MD5 6e243e4c8f8f97c24fd5a0445390b637
BLAKE2b-256 19d6c63baeb94a23e08ca9dd7bdf2022a4547dbc1aed39f3e7dca20dfb23ecd2

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