Add a diagram, section, or annotation to an existing Excalidraw canvas. Trigger on: add to the canvas, add a section for, add to the diagram, put this on the canvas, annotate.
Add a new diagram section, annotation, or element to an existing Excalidraw canvas.
.excalibrain.json sidecar in the project and read its canvas field..excalidraw file in the current directory or docs/diagrams/.Run canvas-inspect to understand what is already on the canvas and find free space:
node ${CLAUDE_PLUGIN_ROOT}/tools/canvas-inspect.js <canvas.excalidraw>
Parse the output for:
| User intent | Action |
|---|---|
| "add a section for X" | Generate a new diagram section via dagre/mermaid |
| "annotate X with Y" | Add a text annotation near section X |
| "add a note about X" | Add a text annotation near section X |
| "connect X to Y" | Add an arrow between existing sections |
| "add a label/title" | Add a text element |
references/diagram-type-rubric.md to choose the right diagram type for the new section.references/color-palette.md and the appropriate recipe from references/diagram-recipes/.auth_, "data-layer" -> dl_).Dagre path:
node ${CLAUDE_PLUGIN_ROOT}/tools/dagre-layout.js <input.json> \
--merge <canvas.excalidraw> \
--position <x>,<y> \
--prefix <section_prefix> \
--output <canvas.excalidraw>
Mermaid path:
node ${CLAUDE_PLUGIN_ROOT}/tools/mermaid-convert.js <input.mmd> \
--merge <canvas.excalidraw> \
--position <x>,<y> \
--prefix <section_prefix> \
--output <canvas.excalidraw>
Gantt path:
node ${CLAUDE_PLUGIN_ROOT}/tools/gantt-layout.js <input.json> \
--merge <canvas.excalidraw> \
--position <x>,<y> \
--prefix <section_prefix> \
--output <canvas.excalidraw>
.excalidraw JSON.type: "text"fontSize: 14fontFamily: 1 (Virgil / hand-drawn)strokeColor: "#6b7280" (gray-500)text / originalText: the annotation contentx, y: calculated positionid (8-char alphanumeric)width and height based on text length (approximate: width = chars * 8, height = 20 per line)elements array in the canvas JSON.references/graph-json-format.md).boundElements arrays on both source and target.Read the .excalibrain.json sidecar and update it:
sections with prefix, type, bounding box, and description.annotations array (or create one).updated timestamp.Tell the user what was added:
Read these as needed:
| File | When to read |
|---|---|
references/color-palette.md | Before adding any diagram section |
references/diagram-type-rubric.md | When choosing diagram type for a new section |
references/patterns.md | Visual pattern library |
references/layout-rules.md | Layout rules + coordinate templates |
references/graph-json-format.md | Dagre graph JSON input format |
references/diagram-recipes/<type>.md | Before generating — complete examples per type |