Agent guide
Diagrams
Load this ruleset when you write a diagram.
Diagrams
A diagram block holds its source in the body, with lang (mermaid or d2) and an alt text. rdy draws a Mermaid diagram as SVG when it builds a site.
- rdy draws four Mermaid types: flowchart (also
graph), class, sequence and state. Any other type shows its source as a code block, withW_DIAGRAM_UNSUPPORTED. - A D2 diagram always shows its source.
- A Mermaid diagram that does not parse, or is over a size bound, shows its source with
W_DIAGRAM_INVALID. A drawing that fails rdy's checks shows its source withW_DIAGRAM_FAILED. The build never fails for a diagram. - The bounds: 65,536 bytes of source, 2,048 statements and a nesting depth of 32. In a flowchart, close each subgraph with
end, and keep each arrow to 256 bytes or fewer. - The arrows and groups of one diagram cost at most 200. An arrow costs one for each rank it spans, so a longer arrow costs more. A group, a state note and each boundary between concurrent regions cost one each.
- To fix a bound, make the diagram smaller, split it into parts, or use shorter arrows.
- A build's warnings name the doc and the block of each diagram that rdy could not draw. Relay them to the person, then fix the source if they ask.
rdy_schemalists the three warnings, with when each applies and its fix.
- Keep a diagram free of loops. The site's layout draws back edges and state-diagram edges across boxes. Use a top-down flowchart, and put the loop in the box text, such as "proposes again".