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

  • 16 CLI commands with rich --help and tab-completion
  • Normalized schema โ€” facts with {entity, attribute, value, source, timestamp, confidence, metadata.tags}
  • Multi-provider โ€” local JSON, Mem0, Letta (stubs โ†’ real APIs with optional deps)
  • TF-IDF search โ€” mnemo recall "query" with zero external ML deps, filterable by --tag
  • Rich tables โ€” confidence color-coded (๐ŸŸข โ‰ฅ0.8, ๐ŸŸก โ‰ฅ0.5, ๐Ÿ”ด <0.5)
  • HTML + graph diffs โ€” visual diff between dump snapshots
  • MCP server โ€” JSON-RPC 2.0 + stdio transport; plug directly into Claude Desktop, Cursor, or any MCP client
  • Web UI โ€” mnemo ui opens a local dashboard: browse all agents, add/edit/retract facts, import/export dumps
  • Push/pull sync โ€” S3, Cloudflare R2, or local filesystem remote; timestamp-based merge
  • Safe writes โ€” --dry-run on load, pull, and migrate

Quick Start

# Install
pip install mnemo-agent              # core (local only)
pip install "mnemo-agent[s3]"       # + S3/R2 push-pull sync
pip install "mnemo-agent[all]"      # everything (mem0 + letta + parquet + graph + s3)

# 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 โ€” HTTP mode
mnemo serve --agent job-prep --port 8080
# Or stdio mode (Claude Desktop / Cursor โ€” no port needed)
mnemo serve --agent job-prep --stdio

# Open the web dashboard (all agents, auto-opens browser)
mnemo ui
# Or jump straight to a specific agent
mnemo ui --agent job-prep

# Sync to S3 (prompts for credentials on first add)
mnemo remote add origin s3://my-bucket/mnemo --agent job-prep
mnemo push --agent job-prep
mnemo pull --agent job-prep   # merges remote facts into local

๐Ÿ“‹ 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] [--stdio] [--read-only] MCP server โ€” HTTP (JSON-RPC 2.0) or stdio for Claude Desktop / Cursor
mnemo ui [--agent <name>] [--port 7742] [--read-only] Open web dashboard โ€” all agents overview, per-agent facts/search/diff/import/export
mnemo remote add <name> <url> --agent <name> Add a named remote (s3://, r2://, file://)
mnemo remote list --agent <name> List configured remotes
mnemo remote remove <name> --agent <name> Remove a remote
mnemo push [--remote origin] --agent <name> Push local memory to remote
mnemo pull [--remote origin] --agent <name> Pull and merge remote memory into local

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, credentials)
โ”‚   โ”œโ”€โ”€ search.py            # TF-IDF search + diff engine
โ”‚   โ”œโ”€โ”€ remotes.py           # Push/pull backends: FileBackend, S3Backend
โ”‚   โ”œโ”€โ”€ server.py            # FastAPI MCP server (HTTP + JSON-RPC 2.0) + multi-agent UI server
โ”‚   โ”œโ”€โ”€ stdio_server.py      # stdio MCP transport (Claude Desktop / Cursor)
โ”‚   โ”œโ”€โ”€ static/
โ”‚   โ”‚   โ””โ”€โ”€ ui.html          # Single-file web dashboard (Alpine.js + Tailwind CDN)
โ”‚   โ””โ”€โ”€ adapters/
โ”‚       โ”œโ”€โ”€ mem0_adapter.py  # Mem0 API โ†’ normalized facts
โ”‚       โ””โ”€โ”€ letta_adapter.py # Letta API โ†’ normalized facts
โ”œโ”€โ”€ tests/
โ”‚   โ”œโ”€โ”€ test_cli.py          # CLI command tests
โ”‚   โ”œโ”€โ”€ test_remote.py       # Remote backends, merge, push/pull tests
โ”‚   โ”œโ”€โ”€ test_server.py       # MCP server: JSON-RPC 2.0, tools, stdio transport
โ”‚   โ””โ”€โ”€ 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

mnemo implements the MCP 2024-11-05 spec and supports two transports.

stdio โ€” Claude Desktop / Cursor

Add to ~/.claude/claude_desktop_config.json:

{
  "mcpServers": {
    "mnemo-job-prep": {
      "command": "mnemo",
      "args": ["serve", "--agent", "job-prep", "--stdio"]
    }
  }
}

That's it โ€” Claude Desktop will spawn mnemo as a subprocess and communicate over stdin/stdout.

HTTP โ€” REST + JSON-RPC 2.0

mnemo serve --agent job-prep --port 8080
Endpoint Description
POST / JSON-RPC 2.0 โ€” initialize, tools/list, tools/call, ping
GET /mcp/list_tools List available tools (legacy, kept for compatibility)
POST /mcp/call_tool Call a tool by name (legacy, kept for compatibility)
GET /facts REST: list all facts (?entity=, ?attribute=, ?tag=)
GET /search?q=query REST: search memories (?tag= filter supported)
GET /health Health check with version info
GET /docs Swagger UI

Available MCP tools

Tool Description
search_memory TF-IDF keyword search; supports tag filter
list_facts List all facts; filterable by entity, attribute, tag; shows IDs
upsert_fact Add a fact; supports tags array
retract_fact Remove a fact by ID or 8-char prefix
edit_fact Update a fact's value, attribute, or confidence
get_agent_info Agent name, fact count, last updated timestamp

retract_fact and edit_fact are disabled when --read-only is set.


๐Ÿ–ฅ Web Dashboard

mnemo ui                        # opens http://localhost:7742/ui
mnemo ui --agent job-prep       # deep-links to that agent
mnemo ui --port 8080 --read-only

mnemo ui requires uvicorn (pip install uvicorn). The browser opens automatically.

Agent list view

  • Cards for every agent โ€” fact count, dump count, last updated, top tags
  • Create a new agent directly from the UI
  • Delete an agent (confirmation required)
  • Click any card to open the agent detail view

Agent detail view

  • Facts table โ€” entity, attribute, value, confidence bar, tags, relative age
  • Filter chips โ€” one-click entity/attribute filters above the table; tag filter in sidebar
  • Add / Edit / Retract facts with a slide-in panel
  • Import โ€” upload a dump JSON, merges new facts by ID
  • Export โ€” download the agent's latest dump as <agent>-dump.json
  • Search โ€” TF-IDF results with relevance scores
  • Diff โ€” upload a second dump file and see added/removed/unchanged facts side by side

โš™๏ธ 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
remotes:
  origin: s3://my-bucket/mnemo

Remote credentials (S3/R2 access keys) are stored separately in ~/.mnemo/credentials with chmod 600. They are populated automatically when you run mnemo remote add โ€” you will be prompted for them interactively. Pass --no-creds to skip prompting and rely on the standard boto3 credential chain (AWS_ACCESS_KEY_ID env var, ~/.aws/credentials, IAM role).


Environment Variables

Variable Description
MNEMO_AGENT Default agent name (skips --agent flag)
MNEMO_DIR Override base directory (default: ~/.mnemo)
AWS_ACCESS_KEY_ID / AWS_SECRET_ACCESS_KEY S3 credentials (alternative to prompting)
R2_ACCOUNT_ID Cloudflare R2 account ID (alternative to prompting)

Tests

pip install "mnemo-agent[dev,s3]"
pytest tests/ -v

114 tests across test_cli.py, test_remote.py, and test_server.py.

The web UI (mnemo ui) is served by the same FastAPI process as mnemo serve and is covered by the existing server tests.


Roadmap

  • Push/pull sync to S3, R2, and local filesystem remotes
  • Write-time conflict detection with overwrite / keep-both / abort prompt
  • Full MCP 2024-11-05 protocol โ€” JSON-RPC 2.0 + stdio transport (Claude Desktop / Cursor)
  • Web UI dashboard โ€” multi-agent overview, per-agent facts/search/diff/import/export
  • Vector embeddings for semantic search
  • Parquet export for analytics
  • mnemo audit โ€” fact provenance trace
  • Snapshot history browser in UI

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

# Connect to Claude Desktop (add to claude_desktop_config.json, then restart)
mnemo serve --agent job-prep --stdio

# Or run as an HTTP server for other MCP clients
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

# If you added a conflicting fact by mistake, retract it by ID prefix
mnemo show --agent job-prep --format plain   # see IDs
mnemo retract a1b2c3d4 --agent job-prep

# 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.4.0.tar.gz (45.1 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.4.0-py3-none-any.whl (34.6 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for mnemo_agent-0.4.0.tar.gz
Algorithm Hash digest
SHA256 2231deaa68fca82b220caa4a9b5780b34b205a383be1e607269c998550ac4842
MD5 0347fbecdcb5505e3dd55c2c45138af6
BLAKE2b-256 c7675bf3196f565b084d0b9b82fb632610d68464247e7d1183632c4cba92a066

See more details on using hashes here.

Provenance

The following attestation bundles were made for mnemo_agent-0.4.0.tar.gz:

Publisher: publish.yml on joshndala/mnemo-agent

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

File details

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

File metadata

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

File hashes

Hashes for mnemo_agent-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 dac7a6d0259af94b98426527e76c3d056e7c9f51da7f3d46a6dd7fd1ce1ae043
MD5 73a10fb66e3876f18d91a1f237254962
BLAKE2b-256 7629945709dd266e4f7d1d4931097c9bf4000be9e7ae3804c7602ba781af5691

See more details on using hashes here.

Provenance

The following attestation bundles were made for mnemo_agent-0.4.0-py3-none-any.whl:

Publisher: publish.yml on joshndala/mnemo-agent

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