Muninn

A Rust LLM agent that searches and edits a Markdown vault from the terminal, or as an MCP server for coding agents.

Muninn is an LLM agent that works directly on a folder of Markdown notes, with no separate database or knowledge store. One Rust core powers three interfaces: one-shot CLI requests, a terminal conversation, and an MCP server that Claude Code, Codex, and other coding agents can call. It is the MCP server my own coding agents use to read and file notes in my vault.

Muninn terminal interface showing its command list, keyboard shortcuts, notes panel, and message input
The terminal interface on a demo vault, after setup.

What it does

  • Searches, reads, and edits notes inside one pinned vault. It has no shell, web, move, or delete tool.
  • Follows the vault’s own rules: a shared AGENTS.md for every agent, plus an optional MUNINN.md for Muninn alone, both re-read on every turn.
  • Shows changes as diffs when the rules require review: an approval dialog in the terminal, a prompt in the CLI, a pending diff over MCP.
  • Journals every change, so /undo reverts it without overwriting later edits.

Design decisions

  • Plain files, plain search. Search walks the vault with literal and regex matching, falling back to any-word matches. There is no embedding index to build or keep in sync, and the notes stay editable by any other tool.
  • One filesystem boundary. Every path is resolved against the canonical vault root: absolute paths outside it, .., symlinks that lead out, and ignored paths are rejected, and hidden paths cannot be written. Ignore settings live outside the vault, so the model cannot edit its own access limits.
  • Undo that respects later edits. Each write is journaled with its before and after content. /undo restores the earlier version only if the file still matches what Muninn wrote; otherwise it reports a conflict instead of overwriting.
  • Review where a mistake spreads. Changes to the rules files and to MEMORY.md, which agents load at the start of every session, always need approval. Memory is capped at 3,000 characters to stay under Claude Code’s 4,096-character limit for server instructions.
  • Reusable crates. Seven crates: provider clients (OpenAI-compatible and native Anthropic), the agent loop, the vault boundary and journal, the MCP server, terminal widgets, the librarian core, and the binary. The libraries don’t depend on the interface, so the same vault rules apply wherever a request comes from.
  • Long conversations fit the context. Old tool results are dropped first, then old turns, never the current one.

How I test it

70 tests: unit tests for path traversal, symlinks, ignored files, undo conflicts, exact-match edits, and approval ordering, plus end-to-end tests that run the real binary against a scripted model server in a temporary vault and home directory.

A 20-task benchmark drives Muninn through a coding agent over MCP on fixture vaults: retrieval, capture in English and Turkish, following conventions, archiving, and refusing secrets, symlink escapes, ignored paths, and unapproved rules changes. 19 of 20 runs pass the machine checks (expected text present, protected files unchanged, no secrets written). The failure was a research vault that protects recorded results: asked to correct a logged result, Muninn changed the original table row as well as adding an erratum. The graders’ notes surfaced subtler problems too: a list of checked notes reported as complete when it was not, and a detail added that the user never gave.

Limits

Muninn is a local tool in active development, built from source until the first tagged release. Over MCP, the calling agent approves a pending change by replying in the same conversation; Muninn can require a later turn, but cannot verify that the agent actually asked its user first.

What I took from it

  • Put access limits out of the model’s reach. Rules about conventions can live in the vault; rules about what the agent may touch cannot.
  • Check the report, not just the edit. Several benchmark problems were in what Muninn said it had done: a list called complete that wasn’t, a change reported after a failed turn.
  • Approval over MCP is only as strong as the caller. Code can enforce the order of turns, not that a person said yes.
Status
Active development
Role
Designer and developer
Stack
Rust, Tokio, Ratatui, MCP, OpenAI-compatible APIs, Anthropic API, Markdown
Written up
, updated