Diagrams that survive ten rounds of design review
In an RFC or ADR the diagram is the part reviewers argue about — and redraw. Staff engineers sketch intent, the agent drafts the doc, and mdd regenerates the ASCII in place on every revision, so the diagram stays reviewable in plain diffs and terminal-based review where images and Mermaid fences cannot follow.
A pipeline in an RFC
A processing pipeline with a cluster boundary, as it appears in a design doc. Each revision edits the JSON; the ASCII is always regenerated, never patched.
<!-- mdd:begin id=pipeline src=docs/rfc-012-pipeline.diagram.json -->
```
┌────────────┐
│ Ingest API │
└──────┬─────┘
┌──────┴──────┐
│ │
┌┄ ingest pipeline ┄┄┼┄┄┄┄┄┄┐
┆ ┌────▼───┐ ┌─────▼────┐ ┆
┆ │ Parser │ │ Enricher │ ┆
┆ └────┬───┘ └─────┬────┘ ┆
└┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┘
│ │
├─────────────┘
┌──────▼──────┐
│ Event Store │
└──────┬──────┘
│
│
┌─────▼─────┐
│ Query API │
└───────────┘
```
[diagram source](docs/rfc-012-pipeline.diagram.json)
<!-- mdd:end -->The model your agent edits
{
"version": 1,
"boxes": [
{
"id": "ingest",
"label": "Ingest API",
"row": 0,
"connections": [
{
"to": "parse",
"arrow": "to"
},
{
"to": "enrich",
"arrow": "to"
}
]
},
{
"id": "parse",
"label": "Parser",
"row": 1,
"connections": [
{
"to": "store",
"arrow": "to"
}
]
},
{
"id": "enrich",
"label": "Enricher",
"row": 1,
"connections": [
{
"to": "store",
"arrow": "to"
}
]
},
{
"id": "store",
"label": "Event Store",
"row": 2,
"connections": [
{
"to": "query",
"arrow": "to"
}
]
},
{
"id": "query",
"label": "Query API",
"row": 3
}
],
"clusters": [
{
"id": "pipeline",
"label": "ingest pipeline",
"members": [
"parse",
"enrich"
]
}
]
}Your agent draws it, you review it
- Sketch the system as JSON while drafting the doc — or have your agent draft both.
- Splice the diagram into the RFC with mdd render.
- Each review round edits the JSON model; re-rendering is idempotent, so prose around the block never churns.
- Reviewers see the diagram change as a readable diff, not a binary image swap.
A prompt to hand your agent
This RFC's diagram is maintained with mdd. To change it, edit docs/rfc-012-pipeline.diagram.json, then run: npx mdd render --json docs/rfc-012-pipeline.diagram.json --file docs/rfc-012.md --id pipeline.
Why mdd here
Design docs are co-authored and heavily revised; hand-drawn ASCII breaks on the second edit and Mermaid is unreviewable in a terminal. mdd's idempotent splice means ten revision rounds produce ten clean diagram diffs, and cluster boxes mark the zones reviewers care about.
More use cases
- AGENTS.md architecture maps — An architecture map in your agent context file: ASCII for humans, JSON ground truth for the agent.
- Diagrams in code comments — Header-comment state machines and layouts, computed from JSON and spliced behind // or #.
- Runbook flowcharts — Decision flows and failure maps readable in any terminal, drafted and updated by your incident tooling.
- ASCII sequence diagrams — Auth flows and call chains as plain text: message order in the JSON is the layout.
- Data pipeline lineage maps — A curated lineage map your agent keeps current as pipeline models change.
- Multi-agent orchestration maps — Agent hand-offs, tool wiring, and memory flow — documentation the agents themselves can update.
- Docs-as-code threat models — Data-flow diagrams with trust boundaries, drafted from the code and reviewed in the diff.
- Tutorials & conceptual docs — Conceptual diagrams that survive every downstream medium: docs site, README, PDF, chat.
- diagram spec (clusters & layout)