Munin

  • rust
  • mcp
  • sqlite
  • ai-agents
  • cli
Munin

Munin is local memory for AI coding agents. An agent searches it before unfamiliar work and records what it learned afterwards: decisions, how the system is built, bugs and their fixes. Everything lives in one SQLite file, and every MCP client on the machine (Claude Code, Codex, Cursor, OpenCode) reads and writes the same memory.

Why

Agents start every session from zero. Instructions files such as AGENTS.md hold what people write down; they do not hold what an agent found out an hour ago while chasing a bug.

Munin reimplements the ideas of larchanka/memo-mcp in Rust: one SQLite file, a search that returns compact cards first and the full entry only on request, and entries that fade with age by kind. It changes what does not hold up over months of use:

memo-mcpMunin
Entries can never changeAn entry is superseded by a newer one or retracted with a reason
No links between entriessupersedes links both ends of the chain
Project only as a prefix in the summaryProject is a column; search stays inside it by default
Decay applied after a top-30 cut by raw BM25Decay applied to every match before the limit
Invalid input silently becomes a noteInvalid input is rejected with the field and what is allowed
npx -y fetches the latest version on every startOne pinned binary

How It Works

MCP, stdio Claude Code Codex Cursor munin serve You, in a shell Munin CLI ~/.munin/munin.db SQLite + FTS5
Agents and people work on the same database file.

On connect, the server sends the agent its instructions: search before unfamiliar work, record after a decision or a fix, reuse existing tags. Nothing has to be copied into the agent's own instructions file.

Entries

KindForFades with age
decisiona choice or convention that holds until replacedno
architecturehow the system is builtno
bugfixa problem, its cause and the fixhalf its weight every 30 days
noteanything elsehalf its weight every 30 days

Ranking is BM25 text relevance times the age factor of the kind, computed by a function registered in SQLite. It covers every match before the limit is applied, so one old decision is not pushed out by a pile of stale fixes.

An entry is never edited. Its status only moves away from active, and either way it stays readable with its history:

append active found by search a newer entry supersedes it retracted with a reason superseded points to its replacement retracted keeps the reason it is wrong
An entry leaves active once and is never deleted.

Triggers in the database refuse edits and deletes, so this holds for any client that opens the file, not only for Munin's own code.

Projects and Groups

Every entry belongs to a project, named after the git root the agent works in. Projects can be grouped, for example the services of one microservice system. A project in a group searches the whole group by default, and a decision that spans the services is recorded on the group itself, so every member sees it.

Getting Started

Each release has an archive for Apple Silicon Macs and one for x86_64 Linux (statically linked), each with a .sha256 next to it: unpack it and put munin on your PATH. Or build from source:

git clone https://github.com/alnovis/munin.git
cd munin
cargo install --locked --path .

Then connect it to Claude Code:

claude mcp add --scope user munin -- munin serve

For the agent to use Munin without being asked, allow its tools and add a session-start hook that runs munin brief; both are a few lines in ~/.claude/settings.json. These settings, connecting Codex, Cursor, OpenCode and agents without MCP, the command line and the search syntax are described in the repository's install and usage guides.