Skip to content
claudemods

diagram-pane Claude Code mod: a Claude Code diagram pane for mermaid charts

A side pane that pins the mermaid and ASCII diagrams Claude writes and keeps a live, editable map of the work.

Permissions

  • Writes filesCan create or overwrite files on your machine ($.fs.write).
  • Calls the model (uses your quota)Can send its own requests to Claude, which count against your plan's usage ($.model.* / $.agent.spawn).
  • Intercepts tool callsSees every tool call Claude makes (tool.call / tool.check) and could block or change it.
  • Reads your promptsCan see what you type and the conversation transcript (prompt.* / session.append / session.messages).
  • Changes the UIDraws into the Claude Code interface: bands, panes, status text, toasts (ui.render / $.ui.*).
  • Adds commands/toolsRegisters new slash commands or tools that you or Claude can invoke ($.command.register / $.tool.register).
  • Stores dataKeeps data between sessions in the plugin's private store ($.store.*).
tested with
v2.1.307
last tested
requires
Claude Code ≥ 2.1.287
surfaces
pane

Install inside Claude Code:

/plugin install diagram-pane --marketplace ray-amjad/claude-code-mods
All install options ↓

What does this mod do?

diagram-pane is a community mod by Ray Amjad (ray-amjad) from his claude-code-mods collection. It is a Claude Code diagram pane: Claude often explains things with mermaid charts, but in a terminal you only see the raw code, and it scrolls away. This pane pins each chart and draws it as boxes and arrows.

According to the author's README, the pane has two parts:

  • Pinned diagrams: every mermaid block or ASCII box diagram in one of Claude's replies is pinned, newest first (five are kept by default).
  • Live work map: a small graph of the files, components and steps Claude is working on, with a ▶ on the box it is on now. Square boxes are files, round ones components, double ones steps.

You can also go into a box. The first nine boxes of a level are numbered, a number key opens that box's detail, b goes back and t returns to the top. A box with no detail yet gets one drawn by a fork of your session. Press c, or Tab to the field, and type a change such as "split auth into login and token refresh". Claude can do the same through two tools.

Install

The install block above adds the author's marketplace and installs the plugin from it. On a terminal narrower than 144 columns, type /diagram once to open the pane. Restart Claude Code or run /reload-plugins after installing.

$ install diagram-pane

Requires Claude Code ≥ 2.1.287

Installs from the author's own marketplace: ray-amjad/claude-code-mods

  1. 1.One line, inside Claude Code

    /plugin install diagram-pane --marketplace ray-amjad/claude-code-mods

    Paste into a running session (v2.1.275+). Claude Code asks to add the marketplace first.

  2. 2.From your shell

    claude plugin marketplace add ray-amjad/claude-code-mods
    claude plugin install diagram-pane@claude-code-mods

    Then run /reload-plugins in any session that is already open.

  3. 3.Try it without installing

    git clone https://github.com/ray-amjad/claude-code-mods
    claude --plugin-dir ./claude-code-mods/plugins/diagram-pane

    Loads the mod for one session only. Nothing is added to your settings.

How it works

Everything is in one function-hooks module, hooks/register.js, plus two pure helpers: draw.js (finds diagrams in replies, parses mermaid, lays boxes out) and graph.js (the editable tree). On turn.complete the plugin reads the transcript, pins new diagrams and, every N turns, runs the map check. This is the gate and the fork, from register.js:

const gate = await $.model.complete({
  model: 'haiku',
  system: GATE_SYSTEM,
  prompt: `CURRENT MAP: ${mapSummary()}\n\nFILES TOUCHED SINCE, NOT ON THE MAP: ...`,
  maxTokens: 5,
  timeoutMs: 20000,
})
...
const r = await $.model.fork({ prompt: FORK_PROMPT + (base ? basePrompt(base) : '') })

The fork is asked for a JSON object with 3 to 8 nodes and at most 10 edges, which parseMap validates and trims before drawing. The map, edited pins and open view are saved per session in $.store (the newest 20 sessions), so they survive a reload or --resume. /clear starts the pane fresh, and a fork still running from before it is discarded.

Customize it

Two options, set with /plugin configure diagram-pane@claude-code-mods: everyTurns (turns between work-map checks, default 3) and maxPins (pinned diagrams kept, default 5). The environment variable DIAGRAM_PANE_EVERY overrides everyTurns for one session, for example DIAGRAM_PANE_EVERY=1 claude. The commands are /diagram (run the gate now), /diagram force (skip the gate and redraw from scratch, dropping edits) and /diagram open (give the pane the keyboard).

Permissions & safety

We read every file the plugin loads: plugin.json, hooks/hooks.json, register.js, draw.js and graph.js, about 60 KB of readable JavaScript with no build step, no package.json and no binaries. The repository also holds PNG screenshots and test files, which the plugin does not load. Here is what we found:

  • Network: none in the plugin code. No fetch, sockets or $.http. The model calls below go through Claude Code, the same way your session does.
  • Processes: none. No $.process, child_process or shell strings.
  • Model calls cost tokens and send context. $.model.complete asks Haiku about a short digest (tool names, file names, the last 40 lines of activity, the first 160 characters of each user prompt). $.model.fork asks a copy of your own session, so it sees the whole conversation, but it is told not to call tools and cannot.
  • File writes: $.fs.write is used in one place, to write the pane's text to the path in DIAGRAM_PANE_DUMP, a test aid that does nothing unless you set that variable. Everything else is saved with $.store, the plugin's own store. Nothing is written under ~/.claude, to settings, shell files or LaunchAgents.
  • Background services and telemetry: none, and nothing keeps running after Claude Code exits.
  • Secrets: it reads only DIAGRAM_PANE_DUMP, DIAGRAM_PANE_EVERY and DIAGRAM_PANE_SYNC. No keychain or credential access.
  • Prompt influence: it registers two tools whose descriptions tell Claude to call diagram_get before diagram_set and to re-read, because the user can edit the pane too. The prompts it sends to forks are marked as side requests. We found no hidden or zero-width text and no instructions aimed at the model beyond that.
  • Gating hooks: the two tool.call hooks only answer the plugin's own diagram_get and diagram_set tools, with a .catch that denies and leaves the pane unchanged. They do not touch other tools or prompts.
  • Obfuscation: none. License is MIT (LICENSE present).

claude plugin validate passed with no errors; its only warning is that the plugin has no icon, which does not affect use. claude plugin test ran 32 tests across 7 files on Claude Code 2.1.307, all passing.

Writes files
Can create or overwrite files on your machine ($.fs.write).
Calls the model (uses your quota)
Can send its own requests to Claude, which count against your plan's usage ($.model.* / $.agent.spawn).
Intercepts tool calls
Sees every tool call Claude makes (tool.call / tool.check) and could block or change it.
Reads your prompts
Can see what you type and the conversation transcript (prompt.* / session.append / session.messages).
Changes the UI
Draws into the Claude Code interface: bands, panes, status text, toasts (ui.render / $.ui.*).
Adds commands/tools
Registers new slash commands or tools that you or Claude can invoke ($.command.register / $.tool.register).
Stores data
Keeps data between sessions in the plugin's private store ($.store.*).

Compatibility & troubleshooting

We loaded the plugin on Claude Code 2.1.307 and ran the author's test suite there. If the pane does not appear, type /diagram (the automatic open needs 144 columns). If the map says "not drawn yet", the first check runs after everyTurns turns, or run /diagram. Before the first reply there is nothing to fork, and the pane says so.

Limits from the README: only flowcharts are redrawn; every chart is drawn top to bottom, even graph LR; edges that skip a row or point back up are listed under the drawing with ⇢ and ↺ instead of routed; a fork's detail holds only what the session has already seen. Reinstalling or moving the plugin to another marketplace starts with no saved maps. To remove it, run /plugin disable diagram-pane.

FAQ

Does the Claude Code diagram pane cost extra tokens?
Yes, a little. Every few turns (3 by default) a Haiku call with a short digest of recent activity decides whether the work map is out of date. Only when it answers YES does a fork of your session draw a new map. Opening a box with no detail, or typing a change into the pane, also runs a fork. Pinning diagrams from replies costs nothing, because it only reads the transcript.
Which diagrams does it draw?
Mermaid graph and flowchart charts are redrawn as boxes and arrows, top to bottom, to fit a pane about 60 columns wide. Other mermaid types (sequence, class, state) are pinned as raw code, and ASCII box diagrams in plain code blocks are shown as written. The author's README says a typed change or diagram_set with mermaid can turn a raw chart into a flowchart.
Why does the pane not open on my terminal?
Unasked, it opens only on terminals 144 columns or wider. On a narrower terminal, type /diagram once and it opens at any width. With fullscreen rendering it docks beside the transcript; in the classic renderer it sits above the prompt.
Can Claude change what the pane shows?
Yes, through two tools the plugin registers, diagram_get and diagram_set. diagram_get returns the map and the pinned diagrams as mermaid; diagram_set replaces a level with a mermaid flowchart or applies small patches such as add_node and relabel. Edits only change the pane's own state, and the next automatic map refresh builds on them.
Does it do anything in claude -p or SDK sessions?
No. When session.start reports a non-interactive session, the plugin opens no pane and registers no command or tool, unless the DIAGRAM_PANE_SYNC or DIAGRAM_PANE_DUMP environment variable is set. Those two exist for the author's tests.
>_ agent-flow

Agent Flow Subagent Tree

A live tree of your Claude Code subagents beside the transcript: status, current tool, approval waits, time and tokens.

  • pane
  • status
  • transcript
  • Intercepts tool calls
  • Changes the UI
  • Adds commands/tools
  • Stores data

tested with v2.1.291

>_ cctop

cctop Dashboard Pane

A btop-style dashboard docked beside the Claude Code transcript: context, cost, rate limits, tools, agents and a coach.

  • pane
  • status
  • toast
  • Reads files
  • Writes files
  • Runs commands
  • Intercepts tool calls
  • Changes the UI
  • Adds commands/tools
  • Stores data

tested with v2.1.291

More in Panes & dashboards, Tools you add to Claude.