marm-memory AGENTS.md

Repository instructions for marm-memory, a local-first memory server that lets coding agents store and search notes through standard tool connections. They describe its Python service, storage, tools, and transport rules.

In plain words
What is it for?
Use them when modifying marm-memory tools, endpoints, SQLite storage, memory search, or the HTTP and command-line interfaces.
Why use it?
They help preserve matching behavior between web and command-line connections and prevent changes from breaking memory, search, or graph features.

Instructions file for CodexOpenCode

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add instructions/lyellr88/marm-memory/agents-md
Clone the repo
git clone --depth 1 https://github.com/Lyellr88/marm-memory

Made for: Codex, OpenCode.

Per session 2,165 This file is loaded in full into every session.
When invoked 2,165 The same file — it is already loaded in full.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.02165 $0.02165
Opus 5 $0.01082 $0.01082
Sonnet 5 $0.00433 $0.00433
Haiku 4.5 $0.00216 $0.00216

Measured 3d ago against content hash dc8f2a7b2b53, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

marm-memory AGENTS.md scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

AGENTS.md · 87 lines

How it starts

The opening of the file, as written. The whole thing — 87 lines — stays where its author put it; the contents beside it link to each section on GitHub.

marm-memory - Agent Instructions

Instructions for AI coding agents working on this repo. Keep changes surgical: touch only what the task requires, match existing style, preserve behavior in refactors.

Architecture

MARM is a local-first MCP memory server: Python FastAPI in marm-mcp-server/, package marm_mcp_server/.

  • 14 public MCP tools: 7 core memory, 5 code graph, 2 concept graph. HTTP and STDIO must stay in exact parity.
  • HTTP transport: marm_mcp_server/server.py; tools are whitelisted in MCP_TOOL_OPERATIONS. A tool not in that list does not exist over HTTP.
  • STDIO transport: marm_mcp_server/server_stdio.py owns the FastMCP app and seven core @mcp.tool() wrappers. Graph/concept bodies live in services/stdio_graph_tools.py and are explicitly registered after the core tools so tools/list order stays stable. Never fork behavior between transports.
  • Endpoint logic lives in marm_mcp_server/endpoints/ split by surface (memory, logging, notebook, session, compaction, graph, concepts, system). Shared helpers stay in core/.
  • Storage: SQLite WAL at ~/.marm/marm_memory.db (connection pool, FTS5 external-content index memories_fts, memory_chunks for long-memory chunking). The concept graph uses its own database ~/.marm/index/marm_index.db with its own pool. Never share connections between the two.
  • Write path: all memory writes go through the serialized async write queue (one worker). Do not add write paths that bypass it. marm_log_entry dual-writes: a log_entries row plus a semantic memory in memories (via the queue); a semantic-store failure must never fail the log write.
  • Code graph: a pinned external binary (codebase-memory-mcp) supervised as a child process over newline-delimited JSON-RPC (core/graph_supervisor.py, core/graph_client.py). It starts lazily and runs degraded on failure. Graph or concept failures must never break the 7 core memory tools.
  • Both graphs index themselves, on by default, one background worker each on both transports. Concept extraction is queue-driven: a write enqueues a durable outbox row in the same transaction as the memory (core/concept_worker.py). Code indexing is poll-driven: a git signature per indexed repo, re-indexing on a commit and every cycle while the tree is dirty (core/graph_index_worker.py). Neither may be made to block a write, a recall, or startup.
  • Cross-process serialization is a leased DB row, never an asyncio lock. core/lease_lock.py owns the mechanics; concept_build_lock and graph_index_lock are its two bindings, deliberately separate rows. HTTP and STDIO are separate processes, so an in-process lock protects nothing. Every code-index call AND delete_project take the graph gate. Release is driven by the engine call's completion, not the awaiting task: asyncio.to_thread cancellation cancels the await and leaves the thread writing.
  • Runtime switches live in the DB, not just the environment (core/runtime_flags.py). A saved override beats the env var so a Dockerfile cannot silently re-enable what a user turned off, and both workers re-read per cycle so no restart is needed. Any new background worker follows this: read the flag every cycle, and start the loop even when off so it can be turned on from another process.
  • Graph-aware recall: marm_smart_recall keeps primary memory ranking authoritative and may add bounded graph_context from the isolated concept database. Graph enrichment is read-only and fail-open; trim graph details before primary results when enforcing response limits.
  • Embeddings: one fastembed jinaai/jina-embeddings-v2-small-en encoder (512 dimensions), lazy-loaded and serialized behind a lock. Writes must succeed even when the encoder is unavailable. Existing data requires marm-mcp-server --migrate-embeddings before restart when upgrading from MiniLM.

Read the full file on GitHub · 87 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3d ago First seen · 87 lines · 2,165 tokens per session scan A dc8f2a7b2b53

Subscribe to this mod's changes

marm-memory AGENTS.md is an instructions file published in the GitHub repository Lyellr88/marm-memory (339 stars, last pushed 4d ago), licensed Apache-2.0. It adds 2,165 tokens to every session, about $0.0108 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.