Agent Integrations

Integrate mdnb with AI coding agents for plan review and code annotation.

Agent integrations are experimental. They connect mdnb's native review UI to AI coding agents so you can visually review plans, annotate code, and approve or reject changes before the agent proceeds.

Quick Start

mdnb install

This auto-detects which agents you have installed and configures each one. To remove all integrations:

mdnb uninstall

Restart your agents after installing or uninstalling.

What Gets Installed

mdnb install sets up the following based on what's available on your machine:

AgentWhat's configured
Claude CodeExitPlanMode hook (auto-opens review when a plan is submitted), /mdnb-review and /mdnb-annotate skills
OpenCode@mdnb/opencode plugin with submit_plan tool and /mdnb-review command
Pi@mdnb/pi extension with plan mode, /mdnb-review, /mdnb-status commands
All agentsShared skills in ~/.agents/skills/ for /mdnb-review and /mdnb-annotate

Claude Code

mdnb hooks into Claude Code's ExitPlanMode event. When the agent finishes a plan and calls ExitPlanMode, mdnb automatically opens a native review window with the plan content.

You can approve the plan, deny it with feedback, or annotate specific sections. The result flows back to the agent as the tool response.

Two skills are also installed:

  • /mdnb-review opens the review UI for current code changes (uses git diff internally)
  • /mdnb-annotate opens a specific markdown file for annotation

The hook is configured in ~/.claude/settings.json under hooks.PermissionRequest. Skills are installed to ~/.claude/skills/.

OpenCode

The @mdnb/opencode plugin registers a submit_plan tool that the agent calls when its plan is ready. The plugin:

  • Injects planning instructions into the system prompt
  • Opens mdnb's review UI when submit_plan is called
  • Returns approval status and feedback as the tool result
  • Supports the /mdnb-review command for code review

The plugin is added to your OpenCode config at ~/.config/opencode/config.json.

Pi

The @mdnb/pi extension adds a full plan mode state machine:

Commands:

  • /mdnb or Ctrl+Alt+P: toggle plan mode
  • /mdnb-review: open code review for current changes
  • /mdnb-status: show current phase and progress

How plan mode works:

  1. Enter plan mode with /mdnb. The agent can only write to the plan file (default: PLAN.md).
  2. The agent writes its plan, then calls exit_plan_mode.
  3. mdnb opens the review UI. You approve or deny with feedback.
  4. On approval, the agent gets full tool access and executes the plan.
  5. If the plan has a checklist, the agent reports progress with [DONE:n] markers and the status line tracks completion.

CLI Review Protocol

For custom integrations, mdnb review accepts plan content on stdin and blocks until the user responds:

echo "## My Plan\n\n- Step 1\n- Step 2" | mdnb review --origin my-agent --mode plan

Options:

  • --origin <name>: identifies the calling agent (affects output format)
  • --mode <plan|review|annotate>: review UI mode

Output:

For claude-code origin, the output is JSON with hookSpecificOutput conforming to the Claude Code hook protocol. For all other origins, the output is plain text:

  • Approved: Plan approved. (or Plan approved with notes above. if annotated)
  • Denied: feedback text followed by The reviewer has identified issues above. You must address all of them.

Configuration

VariableDefaultDescription
MDNB_PLAN_TIMEOUT_SECONDS345600 (96 hours)How long to wait for a review response. Set to 0 to wait indefinitely.