figures
A Claude Code mod that draws diagrams, LaTeX math, and tool-result images inline in the terminal
transcript, using the kitty graphics protocol.

What it draws
- Diagrams. A code block tagged
mermaid, dot (or graphviz), d2, or svg in Claude's
reply is rendered and drawn under the reply. The code stays visible above the picture.
- Math. LaTeX display math,
$$ … $$, \[ … \], or a math, latex, or tex code block, is
typeset with MathJax. Inline $…$ stays text, since a picture cannot
sit inside a line, and a latex block holding a whole document (\documentclass) stays code.
- Tool-result images.
Read on a PNG, JPEG, GIF, WebP, or SVG file, or a screenshot an MCP
tool returns, is drawn under the tool's row, where Claude Code otherwise shows only a size line;
an SVG read only in part is left alone. In a collapsed tool group they are thumbnails; ctrl+o
unfolds the group and draws them full size. A PNG, JPEG, GIF, WebP, or SVG Claude sends to another
device with SendUserFile is drawn under its attachment line too, so it is on screen when you
come back to the terminal. It is read from disk when the row is first drawn; overwriting the file
later leaves that picture as it was.
A picture the size caps would shrink below 60% of its natural size grows up to the terminal's
height, and one still smaller says so under it, such as shown at 43% · /figures to enlarge.
/figures opens a pane with the session's pictures, starting on the newest one drawn too small to
read, or else the newest. In fullscreen mode, select part of a diagram's source or a tool row with
the mouse before running it to start on that picture instead. p and n step through them, o
opens the current one with open (macOS) or xdg-open, and Escape or your next prompt closes the
pane.

The plugin also ships a diagrams skill, which tells Claude which languages are drawn and how to
write them so they render.
Each rendered PNG is cached under $TMPDIR/claude-figures/, named by a hash of the source and the
theme, so a resumed session draws its pictures again without re-rendering. Files older than seven
days are removed when a session starts.
Requirements
Claude Code 2.1.288 or later, with mods (function-hook plugins) enabled, in a terminal it treats as
kitty-graphics capable; see Terminal support. Each kind of picture also needs
programs on PATH:
| Picture | Needs |
|---|
mermaid | mmdr, mmdc, or resvg for the bundled pele; resvg recommended |
dot, graphviz | Graphviz's dot and resvg |
d2 | d2 and resvg |
svg, math | resvg |
| Tool images other than PNG | magick (ImageMagick) or sips (built into macOS) |