Write a DFD spec to .kuzushi/dfd.spec.json (create .kuzushi/ if needed). Shape:
{
"title": "<system> - data flow diagram",
"nodes": [
{"id": "att", "name": "Remote client", "type": "external_entity", "trustZone": "external"},
{"id": "srv", "name": "Request handler", "type": "process", "trustZone": "internal"},
{"id": "db", "name": "State store", "type": "data_store", "trustZone": "internal"}
],
"flows": [
{"sourceId": "att", "targetId": "srv", "name": "request", "protocol": "tcp",
"dataClassification": "untrusted", "trustBoundaryIds": ["tb_net"]},
{"sourceId": "srv", "targetId": "db", "name": "read/write"}
],
"trustBoundaries": [
{"id": "tb_net", "name": "network / process boundary",
"outerZone": "external", "innerZone": "internal", "crossingFlowIds": ["...optional..."]}
]
}
type: external_entity | process | data_store.
trustZone: any label (external, dmz, entrypoint, internal, trusted, ...);
rendered grouped, ordered external → trusted.
- Keep
ids short (<= 6 chars) — flows and boundaries reference them.
- Set
trustBoundaryIds on every flow that crosses a boundary — those are the
security-interesting flows and the renderer flags them.
Render and print:
node "${CLAUDE_PLUGIN_ROOT}/scripts/cmd/dfd-render.mjs" \
--in .kuzushi/dfd.spec.json --out .kuzushi/dfd.txt
The script prints a connected, top-down ASCII diagram (boxes joined by labelled
arrows; trust boundaries as dashed rules the flows cross) to stdout and saves it to
.kuzushi/dfd.txt. Add --ascii for pure-ASCII glyphs on terminals that mangle Unicode.
PNG (optional, if the user wants an image): render the same spec to a PNG with
python3 "${CLAUDE_PLUGIN_ROOT}/scripts/cmd/dfd-png.py" \
--in .kuzushi/dfd.spec.json --out .kuzushi/dfd.png --scale 2
(requires Pillow: python3 -m pip install pillow). Then surface the file to the user
(e.g. send/attach .kuzushi/dfd.png) — don't try to paste an image into chat.