Sandbox
@Lyellr88/marm-memory

MCP memory server for Claude Code and Codex

MARM Memory is a local-first memory layer and MCP server for coding agents. It stores sessions, notes, project history, and concept links in SQLite, then serves them back through HTTP or STDIO so your agent can recall context instead of starting over. It also indexes repositories into a code graph, so agents can look up symbols, trace paths, and follow project structure. The bundled console lets you inspect memories, graphs, and indexed projects, and the server supports shared multi-agent setups as well as private local use.

350 stars72 forksPythonUpdated 7d ago
Who it's for

Builders who want their agent to remember past sessions, index codebases, and share context across Claude Code, Codex, Cursor, Gemini CLI, or other MCP clients.

What it delivers

You can keep project context, code structure, and prior decisions available across chats instead of re-explaining everything.

What it does

Persistent local memory

Stores conversations, notes, notebooks, summaries, and semantic memories in a local SQLite-backed store.

Code graph indexing

Indexes repositories, tracks symbols, follows code paths, and keeps project structure available for recall.

Concept graph

Extracts people, decisions, errors, and ideas from stored memories and links them back to code when possible.

MCP transport support

Serves the same tools over HTTP and STDIO so different clients can connect locally or through a shared server.

Multi-agent presets

Provides `swarm`, `swarm-max`, and `trusted` profiles for shared or high-throughput agent use.

Bundled console

Offers a local UI to browse memories, knowledge graphs, and indexed projects.

Setup skill

Includes the `marm-init` skill to help agents set up MARM from chat.

How to get it

  1. 1Install and initialize with your preferred agent profiles
    pip install marm-mcp-server
    marm-memory init --g-claude --g-codex --g-gemini
  2. 2Manual pip install
    pip install marm-mcp-server
  3. 3"agent" refers to claude, gemini, grok, qwen, or any MCP client. Codex uses --url…
    pip install marm-mcp-server
    marm-memory start
    # Stuck on client setup? Open a Q&A thread: https://github.com/Lyellr88/marm-memory/discussions
    # most agents use this --transport command
    "agent" mcp add --transport http marm-memory http://localhost:8001/mcp
    codex mcp add marm-memory --url http://localhost:8001/mcp
  4. 4Default pip/local startup is zero-config: MARM binds to localhost and does not require a…
    pip install marm-mcp-server
    python -m marm_mcp_server.server_stdio
    # most agents use this --transport command
    "agent" mcp add --transport stdio marm-memory-stdio marm-mcp-stdio
    codex mcp add marm-memory-stdio -- marm-mcp-stdio
  5. 5--bearer-token-env-var takes the environment variable name, not the raw key. Start or…
    # --swarm: write queue on, 200 RPM - recommended for multi-agent shared servers
    docker run -d --name marm-mcp-server \
      -p 127.0.0.1:8001:8001 \
      -e SERVER_HOST=0.0.0.0 \
      -e MARM_API_KEY=your-generated-key \
      -v ~/.marm:/home/marm/.marm \
      lyellr88/marm-mcp-server:latest --swarm
  6. 6Then index the container path, not the Windows host path
    marm_graph_index(repo_path="/workspace/marm-memory")

README

marm-memory - persistent local memory server for AI agents (Model Context Protocol)

marm-memory v2.48.0 - Give your AI Agents a permanent memory in 60 seconds

License Python FastAPI Docker Pulls PyPI Downloads PyPI Version MCP Registry

Discord Publish CodeQL marm-memory MCP server

Contributions welcome! Browse open issues to contribute, or join the MARM Discord to share workflows, get setup help, and connect with other builders.

Table of Contents

Quick Start

  1. Install and initialize with your preferred agent profiles:
pip install marm-mcp-server
marm-memory init --g-claude --g-codex --g-gemini

Also available: --g-qwen and --g-kiro. Run without flags to install into your current project folder instead of home

  1. Hand off to your AI companion. Tell your agent:

"Use the marm-init skill to set up MARM."

  1. Interact: Your agent will handle the entire setup (Python/Docker, HTTP/STDIO, keys, and client configs) interactively right inside your chat.

Manual setup

Prefer to wire it up yourself:

Replace "agent" with your client’s CLI command (for example, claude, gemini, or qwen). For Codex, use codex mcp add marm-memory --url http://localhost:8001/mcp instead.

If you are...Start the serverConnect your MCP client
Solo developer / researchermarm-memory start"agent" mcp add --transport http marm-memory http://localhost:8001/mcp
Private local STDIO usermarm-mcp-stdio"agent" mcp add --transport stdio marm-memory-stdio marm-mcp-stdio
Multiple agents sharing memorymarm-memory start --profile swarm"agent" mcp add --transport http marm-memory http://localhost:8001/mcp
Private high-throughput swarmmarm-memory start --profile swarm-max"agent" mcp add --transport http marm-memory http://localhost:8001/mcp
Trusted private lab/servermarm-memory start --profile trusted"agent" mcp add --transport http marm-memory http://localhost:8001/mcp
  • ⚡ Fastest HTTP Startup: Run marm-memory fast-start-http to spin up the local runtime, launch the console, and open it in your browser immediately.
  • 🖥️ Web Console: Run marm-memory console to view the local UI app instantly (no Node.js required).
  • ⚙️ Lifecycle Management: Manage the background daemon using status, logs --follow, restart, and stop.
  • 💡 Quick Flags: Use --no-console or --no-browser to restrict startups. Run marm-memory --help for full command lists.

Why MARM Memory

Your AI forgets everything. MARM Memory doesn't.

marm-memory gives your agents a private, shared memory for the context that normally gets lost between chats: decisions, research, fixes, notes, and project history. Switch from Claude Code to Codex or Gemini without losing the context already gathered.

It brings three things together:

  • 🧠 Core Memory (7 tools) stores conversations, notes, notebook entries, and summaries so they stay searchable.
  • 💻 Code Graph (5 tools) maps your repository so agents can find symbols, follow code paths, and understand the project without rereading it all. Point it at a repo once and it keeps itself current as you work.
  • 🧩 Concept Graph (2 tools) connects people, decisions, errors, and ideas from your stored memories, with links back to relevant code when available. It builds itself as you store memories.

All 14 tools work over HTTP and STDIO. Your agents share the same local memory across sessions instead of starting from scratch each time. The bundled Console App provides a browsable view of Memories, the Knowledge Graph, and Indexed Projects, including progress for graph builds and repository indexing. Indexing a repository creates its independent Code Graph, which you can explore from Knowledge Graph → Code Explorer even before storing any memories.

How It Works

LayerWhat it doesWhy it matters
Memory modelSessions, structured logs, notebooks, summaries, and semantic memoriesKeeps project history searchable instead of trapped in one chat
Scale layerSQLite WAL mode, connection pooling, serialized write queue, and HTTP rate-limit presetsLets one server support solo use, multi-agent work, and swarm-style bursts
Intelligence layerFTS filter, semantic re-rank, bounded semantic fallback, auto-classification, write-time consolidation, and compaction candidatesKeeps recall useful as memory grows instead of letting duplicates pile up
Code graph layerRepo indexing, symbol lookup, call tracing, architecture overview, and change-impact analysisGives agents project structure without rereading the whole codebase
Concept graph layerEntity and relationship extraction from stored memories, with links back into the code graphConnects decisions, errors, tools, and people across sessions instead of leaving them as flat text
Token layerLightweight 7-tool core surface (14 total with bundled graph tools), semantic re-rank before retrieval, and write-time deduplicationReduces tokens sent to the model on every recall and cost stays predictable as memory scales
Deployment layerPip, Docker, STDIO, HTTP, and managed swarm, swarm-max, and trusted profilesLets you run private local memory or shared multi-agent memory with the same MCP surface

See Performance & Scaling Benchmarks for retrieval latency, concurrency, and write-cost numbers, and Architecture & Internals for the mechanisms behind each layer.

Runtime CLI Commands

marm-memory is the local runtime manager installed with the Python package. These are the normal operational commands; use marm-memory <command> --help for flags and command-specific examples.

Daily runtime work

marm-memory fast-start-http                # start HTTP, Console, and open the browser
marm-memory start                          # start or reuse the managed HTTP runtime
marm-memory start --profile swarm          # shared multi-agent preset
marm-memory stop                           # stop the managed runtime safely
marm-memory restart                        # restart the managed runtime
marm-memory status                         # inspect runtime, database, queue, and graph status
marm-memory logs --follow                  # follow bounded runtime logs
marm-memory console                        # start or reuse the bundled local Console

Transports and setup

marm-memory http                           # run HTTP in the foreground
marm-memory stdio                          # run the strict local MCP STDIO transport
marm-memory init                           # install the MARM skill into detected agents (project scan)
marm-memory init --g-claude                # install the skill into the home-folder claude directory
marm-memory doctor                         # diagnose the local install
marm-memory key init                       # create or reuse ~/.marm/.env without displaying the key
marm-memory key path                       # print the managed key-file path
marm-memory key reveal                     # explicitly display the managed key
marm-memory console --import-key           # open an authenticated local Console session
marm-memory upgrade --check                # compare the installed package with PyPI
marm-memory uninstall                      # preview package removal; always preserves ~/.marm

Knowledge, projects, and maintenance

marm-memory knowledge status               # Indexers, models, and how far behind automatic indexing is
marm-memory knowledge build --all          # Rebuild the whole concept graph (new memories index themselves)
marm-memory knowledge auto off             # Stop indexing memories automatically (on, off, status)
marm-memory projects list                  # List all tracked workspaces
marm-memory projects index <path>          # Add a repo to the code graph (kept current after that)
marm-memory projects status                # Inspect target repo graph readiness
marm-memory projects auto off              # Stop re-indexing repos automatically (on, off, status)
marm-memory maintenance status             # Check internal database optimization state
marm-memory maintenance embeddings migrate # Upgrade old 384-dim vectors to 512-dim
marm-memory maintenance chunks rechunk     # Recalibrate long memory text splits

Docker commands are documented separately below because they require explicit data mounts, network exposure, and key-handling choices.

Performance & Scaling Benchmarks

MARM is tuned for fast recall first, even as memory grows and long memories are chunked behind the scenes.

These measurements use the fastembed-backed jinaai/jina-embeddings-v2-small-en encoder and a throwaway local SQLite database. Every timed path calls the shipped MARMMemory code, not a benchmark-local reimplementation. Sections 1-4 are timings from a single run of scripts/benchmarking/performance/bench_hotpath.py on local hardware; absolute milliseconds vary by machine, so treat the scaling shape as the signal. Section 5 is a separate accuracy benchmark (run_eval.py) measuring retrieval rather than speed, and its latest row is a controlled before and after, explained there.

1. Retrieval Latency Scaling

End-to-end recall_similar latency (includes query encoding).

Session Size ($N$)Min LatencyMedian Latencyp95 Latency
N = 1007.4 ms7.9 ms9.4 ms
N = 25011.9 ms13.5 ms15.4 ms
N = 50010.9 ms11.8 ms13.4 ms
N = 1,00013.3 ms13.5 ms15.6 ms
N = 2,00017.5 ms18.2 ms19.6 ms
N = 4,00023.8 ms25.9 ms30.9 ms

Run-to-run variance at small $N$ is larger than the gap between adjacent sizes, which is why N = 250 reads slower than N = 500 here. Treat the trend from N = 1,000 upward as the real signal.

2. Encoder + Concurrency

  • Cold model load: 893ms
  • Warm encode: median 3.8ms, p95 4.3ms
  • Concurrent recall: 10 gathered recalls completed in 151.5ms vs 176.0ms serial (gather/serial = 0.86). Do not read that as parallelism: repeated runs of this same benchmark land anywhere from 0.63 to 0.86, so the ratio is not stable enough to claim a speedup. The path is serialized around shared encoder and SQLite work by design, and any apparent gain is measurement noise.

3. Write-Time Ingestion Cost

  • Consolidation off: median 6.5ms, p95 7.6ms
  • Consolidation on: median 58.1ms, p95 106.5ms
  • Tradeoff: write-time dedupe/clustering adds 9.0x median cost so recall stays fast and the store stays cleaner over time. Consolidation is off by default.

4. Recall Scaling: Full Scan vs Production Hybrid

Why recall stays flat as memory grows: Instead of scanning every vector, production recall uses an FTS keyword pre-filter to narrow the candidate pool, then re-ranks using a blended semantic + BM25 + temporal score. Both benchmark columns represent authentic asynchronous code paths timed with precomputed vectors to isolate retrieval speed from raw encoding overhead. Tests alternate execution to ensure completely unbiased cache conditions.

Session Size ($N$)Full Semantic ScanProduction HybridSpeedupFTS candidates
N = 1003.3 ms6.6 ms0.5x85 / 200
N = 50016.3 ms11.6 ms1.4x200 / 200
N = 1,00031.1 ms14.7 ms2.1x200 / 200
N = 2,00063.5 ms19.0 ms3.3x200 / 200
N = 4,000127.2 ms29.1 ms4.4x200 / 200
N = 10,000316.7 ms53.8 ms5.9x200 / 200

The full scan grows roughly linearly with $N$ while hybrid recall grows far more slowly, so the advantage still widens with session size. At very small $N$ the pre-filter is not worth its overhead and hybrid is slower.

5. LoCoMo Retrieval Accuracy

All 10 LoCoMo conversations are ingested through marm_log_entry (5,882 memories), then top-5 marm_smart_recall results are scored against 1,977 evidence-annotated questions. No answer-generation model or LLM judge is involved, so this measures whether the right memory is retrieved, not whether an agent answers correctly with it.

ConfigurationAny evidence hitAll evidence hitMean evidence recall
MiniLM baseline37.5%29.5%not published
Jina v2 Small (v2.29.0)53.0%43.4%47.6%
v2.33.1 through v2.44.362.9 - 63.5%53.1 - 53.5%57.4 - 57.9%
v2.44.4 (log lane fix)69.1 - 69.6%58.2 - 58.6%63.0 - 63.5%

The last row is a controlled comparison, same build and data with the log lane as the only variable. That lane previously substring-matched the whole query against log topics and summaries, so a natural-language question never matched and it scored 0.0% on all 1,977 questions. It now tokenizes the query and reaches 53.3% on its own. Ranges rather than single figures because the semantic lane varies about half a point between runs, so a sub-point difference is not a result.

Multi-hop remains the weakest category at 44.9%, and single-hop evidence recall is 36.6% against a 66.2% any-hit rate, so the lane often surfaces some of a question's evidence rather than all of it. Reproduce with run_eval.py.

6. vs Competitors: Architecture

MARM targets a specific niche: local-first memory for MCP-connected coding agents, not general personalization memory or a full agent runtime. Here's how it differs architecturally from established names in AI agent memory:

MARMMem0Letta (MemGPT)Zep / Graphitiagentmemory
TypeMemory engine, MCP-nativeMemory layer APIFull agent runtimeTemporal knowledge graphMemory engine, MCP-native
Required infrastructureNo separate data service (embedded SQLite)Vector DB (Qdrant/pgvector)Postgres + vector DBNeo4jSeparate iii-engine runtime
DeploymentLocal-first by default; Docker for shared/remoteCloud API or self-hostedSelf-hosted or cloudCloud or self-hostedLocal-first
Retrieval modelHybrid: FTS5 BM25 exact lane + semantic rerankVector + graph + key-valueVector archival store + agent-managed core memoryTemporal knowledge graph (fact validity windows)BM25 + vector + graph (RRF fusion)
Write captureExplicit tool calls from the connected agentExplicit add() calls (some integrations auto-extract)Agent self-edits its own memoryExplicit API callsHook-based, automatic (no explicit calls needed)
Code structure awarenessBundled code graph + concept graph, fused with memoryNot built inNot built inNot built inNot built in (pairs with a separate project)
Framework lock-inNone (any MCP client)NoneHigh (must run within Letta)NoneNone (any MCP client)

Disclaimers & Accuracy: Competitor landscapes evolve rapidly. The matrix above reflects core architectural traits as of Q3 2026, based on public documentation and READMEs, not internal testing of each system. If any data point regarding an alternative framework has changed or is misrepresented, please open an issue or submit a Pull Request to update the table. We actively welcome corrections from peer maintainers.

MCP Client Setup for HTTP & STDIO

Manual pip install

pip install marm-mcp-server

Use this quick rule of thumb to choose your setup

  • Local HTTP/STDIO = fastest single-machine setup.
  • Docker HTTP = shared/always-on server (key required).
  • Docker STDIO = private containerized local use (no HTTP key).

Swarm / multi-agent note: The write queue is enabled by default to serialize memory writes through one worker. For shared HTTP deployments, use marm-memory start --profile swarm (200 RPM) or --profile swarm-max (600 RPM). --profile trusted disables rate limiting entirely for private deployments. STDIO is still best for private single-agent/local use. See Swarm & multi-agent presets for the full table.

Local pip HTTP

"agent" refers to claude, gemini, grok, qwen, or any MCP client. Codex uses --url instead of --transport to add MCP tools.

pip install marm-mcp-server
marm-memory start
# Stuck on client setup? Open a Q&A thread: https://github.com/Lyellr88/marm-memory/discussions
# most agents use this --transport command
"agent" mcp add --transport http marm-memory http://localhost:8001/mcp
codex mcp add marm-memory --url http://localhost:8001/mcp

Default pip/local startup is zero-config: MARM binds to localhost and does not require a key unless you expose it with SERVER_HOST=0.0.0.0.

Local pip STDIO
pip install marm-mcp-server
python -m marm_mcp_server.server_stdio
# most agents use this --transport command
"agent" mcp add --transport stdio marm-memory-stdio marm-mcp-stdio
codex mcp add marm-memory-stdio -- marm-mcp-stdio

Replace marm-mcp-stdio with python -m marm_mcp_server.server_stdio if using a virtualenv or a path-based setup. Works with Claude Code, Cursor, VS Code, Qwen, and Gemini CLI. STDIO stays a single local process with no port and no API key, and exposes the same 14 tools as HTTP.

Local Python swarm modes (HTTP & STDIO)

Use HTTP when multiple agents need to share one live MARM server. STDIO is still best for private single-agent use because each client owns its own local process.

# HTTP shared server, normal multi-agent use
marm-memory start --profile swarm

# HTTP shared server, heavier private swarm
marm-memory start --profile swarm-max

# HTTP trusted private lab/server, rate limiting disabled
marm-memory start --profile trusted

# STDIO remains keyless/private and does not use swarm flags
marm-mcp-stdio

Docker HTTP (key required)

Docker HTTP requires an API key because it exposes MARM as a network server; STDIO stays local to the client process and does not need one.

If you installed MARM through pip, the product CLI can safely preview or run the same setup. It uses a loopback port by default, preserves ~/.marm, stores the generated key in ~/.marm/.env rather than shell history, and refuses to replace an existing container.

marm-memory docker command                 # preview the exact HTTP command
marm-memory docker run                     # create the managed HTTP container
marm-memory docker stdio-command           # print a Docker STDIO client command
marm-memory docker status
marm-memory docker logs --follow
marm-memory docker stop

# Optional: mount repositories read-only for code indexing.
marm-memory docker run --repo /absolute/path/to/repository

# Optional: preview or explicitly write a Compose configuration.
marm-memory docker compose
marm-memory docker compose --yes

The HTTP run, command, and compose commands accept the same operational flags:

FlagPurpose
--data-dir <absolute path>Persistent host directory mounted at /home/marm/.marm. Defaults to ~/.marm; this holds memory, indexes, logs, and the managed key file.
--env-file <path>Explicit Docker env file. It must already contain MARM_API_KEY; without this flag, MARM uses ~/.marm/.env and creates a key there only when docker run or docker compose --yes needs one.
--port <number>Host HTTP port. Default: 8001.
--expose-networkBind the host port to 0.0.0.0 instead of loopback. This is deliberate network exposure; configure a firewall and TLS proxy.
--profile standard|swarm|swarm-max|trustedSelect the same write-queue and rate-limit preset as native HTTP startup.
--rate-limit-rpm <number>Override the selected profile's HTTP rate limit. 0 disables rate limiting.
--repo <absolute path>Repeatable read-only repository mount for code indexing. MARM reports each corresponding /workspace/repo-N path to index inside the container.
--tag <tag>Official image tag. Default: latest.
--pullPull the selected image before creating a new HTTP container.
--name <name>Managed container name. MARM refuses to replace an existing container with that name.
--memory <limit> / --cpus <limit>Optional Docker resource limits.
--dry-rundocker run only: print the planned command without creating a container or key file. docker command is always a preview.

For example:

# Shared local server with a custom data path and two repositories for indexing.
marm-memory docker command \
  --profile swarm \
  --data-dir /srv/marm-data \
  --repo /srv/projects/api \
  --repo /srv/projects/web

# Execute the reviewed command, pulling the image first.
marm-memory docker run --profile swarm --data-dir /srv/marm-data --pull

Docker STDIO is separate from Docker HTTP: marm-memory docker stdio-command uses docker run -i --rm, has no port and no bearer key, but still

Files in the repo

Repository payload22 top-level entries
  • .github
  • assets
  • docs
  • docs-site
  • marm-console
  • marm-mcp-server
  • scripts
  • skills
  • .coderabbit.yaml
  • .dockerignore
  • .gitignore
  • AGENTS.md
  • CHANGELOG.md
  • CONTRIBUTING.md
  • CONTRIBUTORS.md
  • glama.json
  • LICENSE
  • NOTICE
  • README.md
  • ruff.toml
  • SECURITY.md
  • THIRD_PARTY_NOTICES.md

Discussion (0)

Ask about usage, or say what you built with it

Sign in to join the discussion.

No comments yet. Be the first to say what this is good for.

More connectors

Real-time global intelligence dashboard. AI-powered news aggregation, geopolitical monitoring, and infrastructure tracking in a unified situational awareness interface

86k

High-performance code intelligence MCP server. Indexes codebases into a persistent knowledge graph — average repo in milliseconds. 158 languages, sub-ms queries, 99% fewer tokens. Single static binary, zero dependencies.

43k

Universal provider proxy for OpenAI Codex & Claude Code — use any LLM (Claude, Gemini, Grok, DeepSeek, Ollama…) with Codex CLI, App, SDK, and Claude Code

14k
okf-memory/
okf-agent-memory

Git-native persistent memory for AI coding agents. Implements Google OKF v0.2 with sub-300µs in-memory BM25 search, embedded MCP server, and progressive disclosure. Slashes token bloat by 80% with zero external databases or dependencies. Built in pure Go.

547
tirth8205/
code-review-graph

Local-first code intelligence graph for MCP and CLI. Builds a persistent map of your codebase so AI coding tools read only what matters, with benchmarked context reductions on reviews and large-repo workflows.

31k
2akouwu/
reverify

Stop your AI from making things up — it proposes, deterministic tools decide, every claim checked against ground truth with evidence. Grounded facts and context survive resets. Reverse engineering is the proving ground. MCP server + CLI.

1.1k