dlants/magenta.nvim

A tool-use-focused LLM plugin for neovim.

magenta.nvim – AI‑augmented coding inside Neovim

What it is – A Neovim plugin that lets you talk to an Anthropic LLM (Claude) directly from the editor. It treats the model as an agent: you can give it commands, see its full prompt, edit its output, and have the plugin feed those edits back to the model. The goal is a fluid “developer ↔ AI” loop that stays inside your familiar Vim workflow.

Key ideas

  • Transparent agent interaction – All prompts, tool calls, and token usage are visible. You can edit the model’s suggested changes before they are applied.
  • Edit Description Language (EDL) – A tiny DSL for describing edits (insert, replace, delete) that is far more token‑efficient than sending raw text diffs.
  • OS‑level sandboxing – Uses Anthropic’s sandbox-runtime (Seatbelt on macOS, bubblewrap on Linux) to run tool commands with configurable file‑system and network permissions, reducing accidental credential leaks.
  • Docker sub‑agents – Spawn isolated agents in Docker containers for parallel, unsupervised work (e.g., heavy linting or code generation on a separate branch).
  • Per‑thread buffers – Each conversation thread lives in its own Neovim buffer, letting you navigate, jump‑list, and pick threads just like ordinary files.
  • Declarative UI – A React‑like VDOM system renders rich UI inside buffers (expandable sections, approval dialogs, chimes, etc.).
  • Customizable agents – System prompts are plain markdown files under ~/.magenta/agents/ (or .magenta/agents/), so you can create new personalities without touching Lua/TS code.
  • Smart caching & auto‑compaction – Incremental summarisation keeps long threads cheap by counting tokens accurately and compacting history when needed.

How you use it

  1. Install the plugin (via lazy.nvim or Neovim’s built‑in package manager) and run npm run build to produce dist/magenta.mjs.
  2. Configure a profile that points to an Anthropic model (e.g., claude-opus-4-8). The README shows a minimal Lua setup call.
  3. Open the chat sidebar (<leader>mt) and start typing commands prefixed with @ (e.g., @file: src/main.rs to add a file to context, @fork to branch a thread, @fast to use a cheaper model).
  4. The model replies in the buffer; you can edit its suggested changes, and the diff of your edits is sent back on the next turn.
  5. Optional tools: Docker sub‑agents, sandbox‑controlled shell commands, PDF reading, web search, etc., are invoked via @ commands or the built‑in tool menu.

Installation snippet

-- lazy.nvim example
return {
  "dlants/magenta.nvim",
  lazy = false,
  build = "npm run build",
  opts = {},
}

Or with Neovim’s native pack manager as described in the README.

Configuration highlights

  • Profiles – define model, provider, API‑key env var, and optional fast/thinking models.
  • Project settings – a .magenta/options.json per repo can override profiles, auto‑add context files, and set skill directories.
  • Skills – markdown files that inject project‑specific knowledge into the agent.
  • Sandbox policies – fine‑tune which filesystem paths or network hosts the agent may touch; regex patterns trigger approval prompts (default blocks git push).
  • MCP servers – optional remote tool servers for extra capabilities.

Why it matters

  • Keeps the entire AI‑assisted workflow inside Neovim, avoiding context‑switching to external CLIs or web UIs.
  • Provides fine‑grained control over what the model can do, which is rare among editor‑side AI plugins.
  • The EDL DSL reduces token usage, making expensive Claude models more affordable for large edits.
  • Transparent UI and test‑driven architecture make the plugin approachable for contributors.

Status – Actively maintained (updates listed through Apr 2026). Primarily supports Anthropic; other providers have been dropped for now.

Further reading:help magenta.nvim inside Neovim, the repo’s doc/ files, and the author’s blog posts linked at the top of the README.

Related

  • Project
  • Project
  • Project
  • Project
  • Project