Skip to content

Editorial diagram design for Claude Code, Codex, GitHub Copilot, Cursor, Factory Droid, Qoder, and Pi. 45 diagram types. Self-contained HTML + SVG. No shadows. No Mermaid slop.

feat(patterns): add traceable block decomposition semantic pattern (#169)

Zachary Halberdd0a0f46424e0
diff --git a/.github/pr-visual-proof/169/dark.png b/.github/pr-visual-proof/169/dark.png
new file mode 100644
index 0000000..5bbb978
Binary files /dev/null and b/.github/pr-visual-proof/169/dark.png differ
diff --git a/.github/pr-visual-proof/169/full.png b/.github/pr-visual-proof/169/full.png
new file mode 100644
index 0000000..4d1dc0f
Binary files /dev/null and b/.github/pr-visual-proof/169/full.png differ
diff --git a/.github/pr-visual-proof/169/light.png b/.github/pr-visual-proof/169/light.png
new file mode 100644
index 0000000..9a706fa
Binary files /dev/null and b/.github/pr-visual-proof/169/light.png differ
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 0f303f0..d680c85 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -247,6 +247,16 @@ jobs:
id: geometry_tests
run: python scripts/test-verify-geometry.py
+ - name: Verify block registry
+ if: always()
+ id: block_registry
+ run: python scripts/verify-block-registry.py --all
+
+ - name: Verify block registry checker
+ if: always()
+ id: block_registry_tests
+ run: python scripts/test-verify-block-registry.py
+
- name: Verify treemap area fidelity and label fit
if: always()
id: treemap
@@ -407,6 +417,8 @@ jobs:
echo "| Packaged Self-Check | ${{ steps.self_check.outcome == 'success' && '✅ Passed' || (steps.self_check.outcome == 'skipped' && '⏭️ Skipped' || '❌ Failed') }} |" >> $GITHUB_STEP_SUMMARY
echo "| Label Geometry | ${{ steps.geometry.outcome == 'success' && '✅ Passed' || (steps.geometry.outcome == 'skipped' && '⏭️ Skipped' || '❌ Failed') }} |" >> $GITHUB_STEP_SUMMARY
echo "| Label Geometry Checker | ${{ steps.geometry_tests.outcome == 'success' && '✅ Passed' || (steps.geometry_tests.outcome == 'skipped' && '⏭️ Skipped' || '❌ Failed') }} |" >> $GITHUB_STEP_SUMMARY
+ echo "| Block Registry | ${{ steps.block_registry.outcome == 'success' && '✅ Passed' || (steps.block_registry.outcome == 'skipped' && '⏭️ Skipped' || '❌ Failed') }} |" >> $GITHUB_STEP_SUMMARY
+ echo "| Block Registry Checker | ${{ steps.block_registry_tests.outcome == 'success' && '✅ Passed' || (steps.block_registry_tests.outcome == 'skipped' && '⏭️ Skipped' || '❌ Failed') }} |" >> $GITHUB_STEP_SUMMARY
echo "| Treemap Area & Label Fit | ${{ steps.treemap.outcome == 'success' && '✅ Passed' || (steps.treemap.outcome == 'skipped' && '⏭️ Skipped' || '❌ Failed') }} |" >> $GITHUB_STEP_SUMMARY
echo "| Treemap Checker | ${{ steps.treemap_tests.outcome == 'success' && '✅ Passed' || (steps.treemap_tests.outcome == 'skipped' && '⏭️ Skipped' || '❌ Failed') }} |" >> $GITHUB_STEP_SUMMARY
echo "| Dumbbell Domain & Contrast | ${{ steps.dumbbell.outcome == 'success' && '✅ Passed' || (steps.dumbbell.outcome == 'skipped' && '⏭️ Skipped' || '❌ Failed') }} |" >> $GITHUB_STEP_SUMMARY
diff --git a/.maintainer-policy.json b/.maintainer-policy.json
index 50c3ecd..95060f4 100644
--- a/.maintainer-policy.json
+++ b/.maintainer-policy.json
@@ -66,6 +66,8 @@
"python3 scripts/test-self-check.py",
"python3 scripts/verify-geometry.py --all",
"python3 scripts/test-verify-geometry.py",
+ "python3 scripts/verify-block-registry.py --all",
+ "python3 scripts/test-verify-block-registry.py",
"python3 scripts/verify-treemap.py --all",
"python3 scripts/test-verify-treemap.py",
"python3 scripts/verify-dumbbell.py",
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index eeb91f2..b03441a 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -57,6 +57,8 @@ Every validation gate below must pass before a PR is ready. They also run automa
| Packaged output self-check behaves (pass + adversarial cases) | `python3 scripts/test-self-check.py` |
| Label masks are never clipped by a node painted after them | `python3 scripts/verify-geometry.py --all` |
| Label geometry checker behaves (pass + adversarial cases) | `python3 scripts/test-verify-geometry.py` |
+| Traceable block decomposition registries have unique IDs, resolving parents, names, and no cycles | `python3 scripts/verify-block-registry.py --all` |
+| Block registry checker behaves (pass + adversarial cases) | `python3 scripts/test-verify-block-registry.py` |
| Treemap cells match the values they are labelled with, and labels fit | `python3 scripts/verify-treemap.py --all` |
| Treemap checker behaves (pass + adversarial cases) | `python3 scripts/test-verify-treemap.py` |
| Dumbbell domain resolves finitely and its marks clear 3:1 | `python3 scripts/verify-dumbbell.py` |
@@ -112,6 +114,8 @@ python3 scripts/test-plugin-package.py \
&& python3 scripts/test-self-check.py \
&& python3 scripts/verify-geometry.py --all \
&& python3 scripts/test-verify-geometry.py \
+ && python3 scripts/verify-block-registry.py --all \
+ && python3 scripts/test-verify-block-registry.py \
&& python3 scripts/verify-treemap.py --all \
&& python3 scripts/test-verify-treemap.py \
&& python3 scripts/verify-dumbbell.py \
@@ -146,6 +150,7 @@ python3 scripts/test-plugin-package.py \
- **`verify-beeswarm.py`:** a dot is drawn off the shared value scale its peers describe, two dots declaring one value sit at two positions, a pair overprints instead of dodging, a second radius or a second non-focal fill appears, a second dot wears the accent, two dots share a `data-name` (or one is empty), anything positions a mark from CSS (`transform`, `translate`/`rotate`/`scale`, a geometry property, a motion path) by any carrier — attribute, inline `style`, or `<style>` rule, or a bound label/tick disagrees with the mark it names. Fix the geometry, never the binding — and never move a dot along the value axis to open up space, because crowding is data and the dodge is the only honest resolution.
- **`verify-skin-polarity.py`:** a legend key or caption names the ramp's direction by lightness (`darker is larger`) in a file whose ramp composites the other way. `ink` is a role, not a colour — it resolves near-black on light paper and near-white on dark — so one set of opacities runs darker as it strengthens in the light skin and lighter in the dark one. Name the direction by contrast against the paper (`stronger contrast is larger`), which survives the skin swap, and ship the same sentence in every variant; never invert the word for one file. The gate also fails closed on a claim it cannot substantiate — no resolvable paper colour, fewer than three rank-bearing ramp members, or a ramp that is not strictly ordered — and on wording it cannot parse: a tone word within six words of a magnitude word that no supported sentence form binds. Rephrase that as `<tone> <is|means|represents> <magnitude>` (`stronger contrast is larger`), because a claim the gate cannot read is a claim nothing checks.
- **`verify-geometry.py`:** a label mask overlaps a node declared later in the document, so the node fill clips the label at render time. Move the label to a free segment of its connector — keep the 6–10px gap from the stroke required by SKILL.md §6, and do not shrink the mask to sneak under the check.
+- **`verify-block-registry.py`:** a Traceable block decomposition diagram (`semantic-patterns.md` § 8) has a duplicate `data-block-id`, a `data-block-parent` that doesn't resolve to another block's id in the same file, a blank `data-block-id`, a missing or blank `data-block-name`, or a cycle in the parent chain. Fix the diagram's attributes — the checker mirrors the source rather than validating semantics, so a passing file is only as correct as the IDs and parents actually authored on it.
- **Icon assets:** you changed `scripts/vendor/icons/` or `scripts/build-icons.py` and the generated files went stale. Rerun `python3 scripts/build-icons.py` and commit the regenerated files.
Do **not** add a file to `scripts/lint-skin-baseline.txt` to get your example through. The baseline exists only for legacy pre-2.0 examples that legitimately predate the current skin, and it still receives a11y checks.
diff --git a/README.md b/README.md
index 4b93b02..57e70d7 100644
--- a/README.md
+++ b/README.md
@@ -276,7 +276,7 @@ cp skills/diagram-design/assets/template-motion.html my-diagram.html # optional
### Semantic patterns and optional motion
-When behavior matters, the skill chooses a semantic pattern first and a visual type second. The seven routed patterns cover fan-in queues and bottlenecks, repeated stage slots, unstructured-input transformation, paired policy traces, secure paved roads, governance catalogs, and compensating security layers. Each pattern defines its triggers, primitives, budget, anti-patterns, static fallback, and nearest visual type in [`semantic-patterns.md`](skills/diagram-design/references/semantic-patterns.md).
+When behavior matters, the skill chooses a semantic pattern first and a visual type second. The eight routed patterns cover fan-in queues and bottlenecks, repeated stage slots, unstructured-input transformation, paired policy traces, secure paved roads, governance catalogs, compensating security layers, and traceable block decomposition. Each pattern defines its triggers, primitives, budget, anti-patterns, static fallback, and nearest visual type in [`semantic-patterns.md`](skills/diagram-design/references/semantic-patterns.md).
Motion is optional and does not create another visual type. [`animation.md`](skills/diagram-design/references/animation.md) defines `none`, `reveal`, `step`, and `loop` modes with a complete static first frame, deterministic timing, and controls when interaction is available. Reduced-motion output shows the complete static frame and hides/disables playback controls. Motion HTML uses the exact reviewed controller from `template-motion.html`; arbitrary or modified inline scripts, remote assets, CSS imports, and executable HTML attributes are rejected. The default is `none`: ordinary output remains static and script-free. [`example-policy-trace-animated.html`](skills/diagram-design/assets/example-policy-trace-animated.html) is the self-contained interactive example.
@@ -337,6 +337,7 @@ Diagrams ship as self-contained HTML, but you can export the diagram itself for
/export-diagram path/to/diagram.html
/export-diagram path/to/diagram.html --svg-only
/export-diagram path/to/diagram.html --png-only --scale=3
+/export-diagram path/to/diagram.html --registry
```
**Claude Code:**
@@ -345,6 +346,7 @@ Diagrams ship as self-contained HTML, but you can export the diagram itself for
/diagram-design:export-diagram path/to/diagram.html
/diagram-design:export-diagram path/to/diagram.html --svg-only
/diagram-design:export-diagram path/to/diagram.html --png-only --scale=3
+/diagram-design:export-diagram path/to/diagram.html --registry
```
Or just ask in natural language:
@@ -359,6 +361,8 @@ Or just ask in natural language:
Both formats are diagram-only — editorial cards and headers from `-full` variants aren't included. For a screenshot of the full editorial layout, use your browser's print-to-PDF or full-page screenshot. See [`skills/diagram-design/references/export.md`](skills/diagram-design/references/export.md) for the full procedure.
+- **`--registry`** — for diagrams using the [traceable block decomposition](skills/diagram-design/references/semantic-patterns.md) pattern, also emits `<basename>.registry.json`, a structured projection of every block's `data-block-*` metadata. Combine with either raster format or run alone. See [`skills/diagram-design/references/export-registry.md`](skills/diagram-design/references/export-registry.md).
+
For motion-enabled HTML, export the explicit final state: open `?motion=static`, wait for `document.fonts.ready`, and confirm the motion root has `data-frame="static"` before capture. Use `?motion=step&step=N` only when a named intermediate frame was requested.
---
@@ -397,6 +401,7 @@ diagram-design/
│ │ ├── import-mermaid.md — Mermaid redraw procedure
│ │ ├── output-spec.md — format × size × detail level
│ │ ├── export.md — SVG / PNG export + sizing
+│ │ ├── export-registry.md — block-metadata JSON sidecar export
│ │ ├── type-architecture.md
│ │ ├── type-flowchart.md
│ │ ├── type-sequence.md
@@ -480,6 +485,7 @@ it covers all supported grammars, multi-block Markdown, adversarial labels, trus
behavior, resource caps, named failures, and reference/command wiring.
Label placement is gated geometrically: `python3 scripts/verify-geometry.py --all` fails CI when a label mask overlaps a node declared later in the document, because the node fill would clip the text at render time. `python3 scripts/test-verify-geometry.py` keeps that checker honest in both directions.
+Diagrams using the traceable block decomposition pattern get a structural gate on top of that: `python3 scripts/verify-block-registry.py --all` fails CI on a duplicate `data-block-id`, a `data-block-parent` that doesn't resolve to another block in the same file, a cycle in the parent chain, a blank `data-block-id`, or a missing or blank `data-block-name` — the same defects that would make `--registry`'s exported JSON (see [`export-registry.md`](skills/diagram-design/references/export-registry.md)) misrepresent the tree it claims to describe. `python3 scripts/test-verify-block-registry.py` keeps that checker honest in both directions.
Treemaps get a second geometric gate, because their whole claim is that area *is* the encoding: `python3 scripts/verify-treemap.py --all` fails CI when a cell's share of the drawn area doesn't match the value printed inside it, or when a label overruns the cell it names. It measures area error as a *relative* figure — an absolute one passes exactly the small cells most likely to be wrong. `python3 scripts/test-verify-treemap.py` keeps it honest in both directions.
Docs and routing surfaces are themselves gated: `python3 scripts/verify-docs-sync.py` fails CI if the SKILL.md description loses a type's lexical hook, the gallery can't reach a shipped example, the README tree names a file that doesn't exist, a relative reference link is broken, a scanner-visible support path is not shipped inside the skill package, or any command/prompt surface drifts from its routed reference. `python3 scripts/test-verify-docs-sync.py` exercises those newer checks adversarially, including the strict-bundler behavior used by Hermes Agent. The skill also ships `skills/diagram-design/scripts/self_check.py` — a distilled output checker installed agents can run on their own generated diagrams; `python3 scripts/test-self-check.py` keeps it honest. Settled design decisions (why one pinned controller, why patterns never add types, the autoplay policy, the SKILL.md byte cap, why label placement is verified geometrically, and why client profiles use marker-first resolution) live as short ADRs in `docs/adr/` — read them before relitigating one, add one when you settle a new policy.
diff --git a/commands/export-diagram.md b/commands/export-diagram.md
index 2b84445..e09f781 100644
--- a/commands/export-diagram.md
+++ b/commands/export-diagram.md
@@ -1,6 +1,6 @@
---
description: Export a diagram-design HTML file to .svg and .png next to the source
-argument-hint: <html-file> [--svg-only|--png-only] [--scale=N] [--output=<path>]
+argument-hint: <html-file> [--svg-only|--png-only] [--scale=N] [--output=<path>] [--registry]
allowed-tools:
- Read
- Write
@@ -9,14 +9,15 @@ allowed-tools:
- Glob
---
-Export the diagram HTML at `$1` to `.svg` and/or `.png`, following the procedure documented in [`skills/diagram-design/references/export.md`](../skills/diagram-design/references/export.md). Treat that reference as the source of truth — don't reimplement the logic here.
+Export the diagram HTML at `$1` to `.svg` and/or `.png`, following the procedure documented in [`skills/diagram-design/references/export.md`](../skills/diagram-design/references/export.md). Treat that reference as the source of truth — don't reimplement the logic here. If `--registry` is present, also follow [`skills/diagram-design/references/export-registry.md`](../skills/diagram-design/references/export-registry.md) to emit the metadata sidecar — a separate procedure from the SVG/PNG rasterization above.
Full argument string: `$ARGUMENTS`
## Defaults
-- Produce **both** `.svg` and `.png` next to the source (e.g. `diagram.html` → `diagram.svg` + `diagram.png`).
+- **With no format flags, or with `--svg-only`/`--png-only`/`--scale`/`--output` but no `--registry`:** produce **both** `.svg` and `.png` next to the source (e.g. `diagram.html` → `diagram.svg` + `diagram.png`).
- PNG renders at `device_scale_factor=2`.
+- **`--registry` given by itself, with neither `--svg-only` nor `--png-only` also present, produces *only* the registry JSON.** The SVG/PNG defaults above do not also apply, and Playwright is never required for a registry-only call. To get an image alongside the registry, add `--svg-only` and/or `--png-only` explicitly.
## Flags
@@ -24,6 +25,7 @@ Full argument string: `$ARGUMENTS`
- `--png-only` — emit only the PNG.
- `--scale=1` / `--scale=2` / `--scale=3` — override the PNG device scale factor. Default `2`.
- `--output=<path>` — override the output base path; the format extension is appended. Applies to both formats when both are produced.
+- `--registry` — emit `<basename>.registry.json`, a metadata sidecar of every block's `data-block-*` attributes. Follows [`skills/diagram-design/references/export-registry.md`](../skills/diagram-design/references/export-registry.md), a procedure independent of the SVG/PNG rasterization above — it never needs Playwright. Used alone (see Defaults), it is the *only* output produced. Combine with `--svg-only` and/or `--png-only` to also produce an image in the same call.
## Required behaviour
@@ -32,5 +34,7 @@ Full argument string: `$ARGUMENTS`
3. **Source has no `<svg>` block** → refuse and tell the user; don't write anything.
4. **PNG requested but Playwright not installed** → surface the install instruction from the reference verbatim and stop. Do **not** auto-install.
5. **PNG requested with `--scale` outside {1,2,3}** → reject; valid values are 1, 2, 3.
+6. **`--registry` requested but source has no `data-block-id` attributes** → refuse and tell the user; don't emit an empty or partial registry file. Per the export-registry reference's edge-case section.
+7. **`--registry` is the only flag given** (no `--svg-only`/`--png-only`) → emit only the registry JSON. Do not also produce SVG/PNG, and do not check for Playwright — a registry-only call must succeed on a host that doesn't have it installed at all.
After producing the outputs, report the file paths and sizes back to the user.
diff --git a/docs/adr/0002-semantic-patterns-do-not-expand-the-taxonomy.md b/docs/adr/0002-semantic-patterns-do-not-expand-the-taxonomy.md
index 9b28327..eb1bd87 100644
--- a/docs/adr/0002-semantic-patterns-do-not-expand-the-taxonomy.md
+++ b/docs/adr/0002-semantic-patterns-do-not-expand-the-taxonomy.md
@@ -8,7 +8,7 @@ Auditing behavior-rich figures (queues, policy traces, trust boundaries) showed
## Decision
-Behavior is a separate axis. The seven semantic patterns in `references/semantic-patterns.md` each route to the **nearest existing visual type** for layout; a pattern owns semantic primitives and a tighter budget, never a second layout grammar. The visual-type count only moves when a genuinely new *layout* grammar appears (it did in v2.5.10 — see [ADR 0007](0007-new-layout-grammars.md), 28 → 38 — and again for Polar, 38 → 39).
+Behavior is a separate axis. The semantic patterns in `references/semantic-patterns.md` (eight as of this writing; see Amendments) each route to the **nearest existing visual type** for layout; a pattern owns semantic primitives and a tighter budget, never a second layout grammar. The visual-type count only moves when a genuinely new *layout* grammar appears (it did in v2.5.10 — see [ADR 0007](0007-new-layout-grammars.md), 28 → 38 — and again for Polar, 38 → 39).
## Consequences
@@ -24,4 +24,6 @@ Behavior is a separate axis. The seven semantic patterns in `references/semantic
**2026-08-20 — the count is 39.** Polar was admitted under the same escape clause: angle encodes ordered cyclic categories and linear radius encodes one quantitative series, a layout grammar no existing type provides. It shipped the full §10 set, and the counters named above moved 38 → 39 together with the prose.
+**2026-08-31 — the pattern count is eight.** Traceable block decomposition was added: hierarchical, ID-addressable block decomposition with per-block I/O, constraints, and an implementation-code link, for compliance, audit, or IP-style documentation. It routes to the existing Tree type — SysML-informed vocabulary (block, noun-phrase naming, flow port) applied to Tree's existing layout grammar, not a new grammar and not a claim of SysML or IDEF0 conformance. This is the first amendment to the *pattern* count specifically (every prior amendment above moved the *type* count); the mechanism is the same one-line-plus-routing-row cost this ADR's Decision describes, and `verify-semantic-motion.py`'s `PATTERN_NAMES` list is its enforcement, the same way the type counters enforce the type count. See [ADR 0010](0010-block-registry-metadata-contract.md).
+
The decision itself is unchanged — semantic patterns still never add a type, and the count still moves only for a new *layout* grammar. What this amendment records is the procedure: the two counters are this ADR's enforcement, so a PR that edits them without amending this file has quietly made itself the authority. Amend here in the same PR, or the number in the test is just whatever the last contributor typed.
diff --git a/docs/adr/0010-block-registry-metadata-contract.md b/docs/adr/0010-block-registry-metadata-contract.md
new file mode 100644
index 0000000..3a68252
--- /dev/null
+++ b/docs/adr/0010-block-registry-metadata-contract.md
@@ -0,0 +1,42 @@
+# ADR 0010 — Traceable block decomposition: a pattern, on Tree, with a metadata sidecar
+
+**Status:** accepted (v2.6.12)
+
+## Context
+
+Some documentation needs a component cited by a stable identifier, not just shown in a picture — compliance records, IP/patent-support documentation, and any audit trail where a reader must point at one specific structural element and know it will keep resolving to the same thing later, not just to "the box near the middle." Nothing in this skill's existing type/pattern set gives a block that kind of addressable identity: every diagram shows structure, but nothing lets a reader cite one specific block directly, trace it to its parent, to what it consumes and produces, and to the code that implements it.
+
+The brief that first proposed this cited a governing military standard by number. Neither number checked out against a primary source: the first is a real standard, for solderless wire-wrap electrical connectors, unrelated to diagrams; the second does not exist in any standard index. That both were confidently wrong is the reason this ADR insists on primary sources for what it does cite: IDEF0 (FIPS PUB 183) is the real standard for hierarchical *functional* decomposition, read directly from the primary source rather than a secondhand description of it. It was not adopted — see Rejected below — but ruling it out is what led to the vocabulary decision in this ADR.
+
+## Decision
+
+Add one new semantic pattern, **Traceable block decomposition** (`references/semantic-patterns.md` § 8), routed to the existing **Tree** visual type. Not a new type, not IDEF0's four-sided ICOM grammar, and not a claim of formal SysML compliance — SysML-*informed* vocabulary (block, noun-phrase naming, flow port) applied honestly to Tree's existing layout grammar. `references/type-tree.md` points to the pattern from its own "Best for" line.
+
+**Tree, not Nested or Architecture.** Architecture's zones are flat and hard-capped at 3 — no real nesting. Nested is a single concentric chain, one ring inside the next, with no way to show two children of one parent at all. Tree already has multi-child breadth, a single-parent-per-node constraint, and no back-edges, which is the exact "no orphan blocks, no cycles" shape this pattern needs — not a workaround built to fit, the shape the type already had.
+
+**A pattern, not a type.** ADR 0002 fixed the taxonomy at a count that only moves for a genuinely new *layout* grammar; a new type would also require the full §10 shipping set (type reference, three example variants, gallery tab, budget row), and `SKILL.md` was already within a few dozen bytes of its 40,000-byte cap (ADR 0004) when this landed — nowhere near enough. A pattern costs one `semantic-patterns.md` section and a routing-table row in both `SKILL.md` and `semantic-patterns.md` itself; `verify-docs-sync.py` never reads `semantic-patterns.md`, so the type-count gate does not move. `scripts/verify-semantic-motion.py`'s `PATTERN_NAMES` list is what does move, and is this decision's own enforcement (see the ADR 0002 amendment recording the count).
+
+**Noun-phrase block names, not verb-phrase.** The original brief demanded verb-phrase names ("Ingest Raw Video") — IDEF0's convention, because IDEF0 decomposes *functions*. This pattern decomposes a system's *structure* (a payment gateway, an auth service), which is what SysML's noun-phrase Block Definition Diagram convention is for. This is a correctness fix, not a style preference: the wrong convention would misdescribe what is actually being documented, independent of which standard is more current.
+
+**A stable ID per block, shown as a badge — everything else in `data-block-*` metadata, not on the canvas.** This repo's own editorial-minimalism target (density 4/10, delete anything removable) is in real tension with wanting rich per-block metadata. The resolution is a three-tier visibility split: an ID badge, a name, and at most one short in/out port label live on the diagram, using existing primitives (the node-box type-tag chip, the Geist Mono sublabel slot) with zero new SVG grammar; the full record (inputs, outputs, constraints, assumptions, an implementation path) lives in `data-block-*` attributes on the node — precedented already by `type-polar.md`/`type-line.md`'s `data-*` chart attributes, each with its own dedicated validator; anything longer than a short phrase lives in the sidecar registry, regenerated on demand via `/diagram-design:export-diagram --registry` (`references/export-registry.md`), never hand-maintained.
+
+**A dedicated structural checker, `scripts/verify-block-registry.py`**, modeled on `scripts/verify-geometry.py` (ADR 0005): stdlib-only, a dataclass per block, adversarial tests in both polarities (`scripts/test-verify-block-registry.py`). It checks ID uniqueness, parent resolution (every `data-block-parent` must match a `data-block-id` in the same file), presence of `data-block-name`, and cycles in the parent chain. It deliberately does not correlate a block's metadata against its drawn position or connector geometry — that is a different kind of check than the ones this pattern's metadata contract needs, and is left for a future version if it turns out to be needed, not silently assumed.
+
+**Static only.** Per ADR 0001, this pattern has no animated form. Bespoke interaction (click-to-expand an ID, filter by block) is out of this skill's scope entirely, the same boundary ADR 0001 draws for every other diagram.
+
+**Explicit non-claims**, stated in `semantic-patterns.md` § 8 itself: no OCL constraints, no XMI interchange, no tool-certified SysML conformance, and no IDEF0 compliance claim either. The pattern borrows SysML's naming vocabulary because it fits what is being documented — structure, not function — not because the output claims to be a SysML artifact.
+
+## Rejected, with reason
+
+- **IDEF0 / FIPS PUB 183** — the real, verifiable standard for hierarchical decomposition, and the one actually checked against its primary source. Rejected because it decomposes *functions* (verb-phrase, four-sided ICOM boxes with Input/Control/Output/Mechanism arrows on every side), and this pattern documents *structure*. Its rigor is real; its grammar is the wrong fit, and it does not fit Tree's connector rules regardless.
+- **A second, new visual type** for this grammar — rejected on the ADR 0002 bar: nothing here is a new *layout*, only a new set of things a Tree node can carry. Same reasoning ADR 0002 itself gives for rejecting "UML activity diagram" as a type rather than routing it to existing grammars.
+- **A hand-maintained metadata file alongside the diagram** (e.g. a separate YAML/JSON authored independently of the HTML) — rejected because it would create a second source of truth that can silently drift from the diagram it describes. The sidecar registry is generated *from* the diagram's own `data-block-*` attributes, never authored in parallel to them.
+- **Drawing input/output arrows between blocks on the canvas** — that is a dependency graph's job (which explicitly permits multi-parent nodes and cycles this pattern forbids), not a tree's. Cross-block flow, if it must be drawn, routes to that type instead.
+
+## Consequences
+
+- The semantic-pattern count moves to eight; the visual-type count does not move at all. `verify-semantic-motion.py`'s `PATTERN_NAMES` list and the ADR 0002 amendment are the record of the first change.
+- `commands/export-diagram.md` and `prompts/export-diagram.md` gain one flag, `--registry`, routed to a new reference (`export-registry.md`) that shares no logic with the SVG/PNG procedure in `export.md` — it is a metadata projection, not a rasterization.
+- A diagram using this pattern now carries two independent, composable gates: `verify-geometry.py` (does a label mask collide with a node painted after it — unaffected by this pattern, since every new visible element lives fully inside its own block's node rect, which the checker already exempts) and `verify-block-registry.py` (does the metadata cohere as a tree). Neither reads the other's attributes.
+- `data-block-*` is new vocabulary, but it follows existing precedent rather than inventing a new kind of extension point: `type-polar.md` and several of `type-line.md`'s and `type-scatter.md`'s chart variants already bind their own semantics to a dedicated `data-*` attribute family (for example `data-series`, `data-bins`, `data-ranks`, `data-name`), each with its own validator that does not read another contract's attributes. This pattern joins that same family, scoped the same way.
+- This ADR is itself an instance of what the pattern is for: a dated, version-controlled record of why the documentation is shaped the way it is, made contemporaneously rather than reconstructed later — the same discipline a contributor using this pattern for their own compliance or IP-support documentation would want from it.
diff --git a/prompts/export-diagram.md b/prompts/export-diagram.md
index 211830f..38b6c82 100644
--- a/prompts/export-diagram.md
+++ b/prompts/export-diagram.md
@@ -1,16 +1,17 @@
---
description: Export a diagram-design HTML file to SVG and PNG
-argument-hint: "<html-file> [--svg-only|--png-only] [--scale=N] [--output=<path>]"
+argument-hint: "<html-file> [--svg-only|--png-only] [--scale=N] [--output=<path>] [--registry]"
---
-Export diagram HTML at `$1` to `.svg` or `.png`. Locate available `diagram-design` skill using its `SKILL.md` path advertised by Pi. Read that `SKILL.md`, then read `references/export.md` relative to its directory. Treat that reference as source of truth. Do not assume the package lives under the current working directory.
+Export diagram HTML at `$1` to `.svg` or `.png`. Locate available `diagram-design` skill using its `SKILL.md` path advertised by Pi. Read that `SKILL.md`, then read `references/export.md` relative to its directory. Treat that reference as source of truth. Do not assume the package lives under the current working directory. If `--registry` is present, also read `references/export-registry.md` relative to the same directory and follow it to emit the metadata sidecar — a separate procedure from the SVG/PNG rasterization above.
Full argument string: `$ARGUMENTS`
## Defaults
-- Produce both `.svg` and `.png` next to source (for example, `diagram.html` → `diagram.svg` + `diagram.png`).
+- With no format flags, or with `--svg-only`/`--png-only`/`--scale`/`--output` but no `--registry`: produce both `.svg` and `.png` next to source (for example, `diagram.html` → `diagram.svg` + `diagram.png`).
- Render PNG at `device_scale_factor=2`.
+- `--registry` given alone, with neither `--svg-only` nor `--png-only` also present, produces only the registry JSON — the SVG/PNG defaults above do not apply, and Playwright is never required. Add `--svg-only` and/or `--png-only` explicitly to also get an image.
## Flags
@@ -18,6 +19,7 @@ Full argument string: `$ARGUMENTS`
- `--png-only` — emit PNG only.
- `--scale=1`, `--scale=2`, or `--scale=3` — override PNG device scale factor.
- `--output=<path>` — override output base path; append format extension.
+- `--registry` — emit `<basename>.registry.json`, a metadata sidecar of every block's `data-block-*` attributes. Never needs Playwright. Used alone (see Defaults) it is the only output; combine with `--svg-only` and/or `--png-only` to also produce an image.
## Required behavior
@@ -27,5 +29,7 @@ Full argument string: `$ARGUMENTS`
4. PNG requested without Playwright → show install instruction from reference verbatim; stop. Do not auto-install.
5. `--scale` outside {1, 2, 3} → reject.
6. Both `--svg-only` and `--png-only` supplied → reject them as mutually exclusive.
+7. `--registry` requested but source has no `data-block-id` attributes → refuse; write nothing. Per the export-registry reference's edge-case section.
+8. `--registry` is the only flag given (no `--svg-only`/`--png-only`) → emit only the registry JSON; do not also produce SVG/PNG and do not check for Playwright.
After export, report output paths plus sizes.
diff --git a/scripts/test-verify-block-registry.py b/scripts/test-verify-block-registry.py
new file mode 100644
index 0000000..3ea04ff
--- /dev/null
+++ b/scripts/test-verify-block-registry.py
@@ -0,0 +1,346 @@
+#!/usr/bin/env python3
+"""Adversarial tests for the block registry verifier (verify-block-registry.py)."""
+
+from __future__ import annotations
+
+import importlib.util
+import sys
+import tempfile
+from pathlib import Path
+
+ROOT = Path(__file__).resolve().parent.parent
+VERIFIER = ROOT / "scripts/verify-block-registry.py"
+
+
+def load_verifier():
+ spec = importlib.util.spec_from_file_location("verify_block_registry", VERIFIER)
+ assert spec is not None and spec.loader is not None
+ module = importlib.util.module_from_spec(spec)
+ # dataclass's deferred-annotation resolution looks the module up by name
+ # in sys.modules, so it must be registered before exec_module runs it.
+ sys.modules[spec.name] = module
+ spec.loader.exec_module(module)
+ return module
+
+
+SVG_HEAD = (
+ '<svg viewBox="0 0 400 300" xmlns="http://www.w3.org/2000/svg" role="img" '
+ 'aria-labelledby="t-title t-desc">'
+ "<title id=\"t-title\">T</title><desc id=\"t-desc\">T.</desc>"
+)
+
+
+def document(body: str) -> str:
+ return f"<!DOCTYPE html><html><body>{SVG_HEAD}{body}</svg></body></html>"
+
+
+def block(block_id: str, parent: str | None = None, name: str | None = "Name", extra: str = "") -> str:
+ parent_attr = f' data-block-parent="{parent}"' if parent is not None else ""
+ name_attr = f' data-block-name="{name}"' if name is not None else ""
+ return (
+ f'<rect x="0" y="0" width="160" height="48" rx="6" data-block-id="{block_id}"'
+ f"{parent_attr}{name_attr}{extra}/>"
+ )
+
+
+def main() -> int:
+ module = load_verifier()
+ failures: list[str] = []
+
+ def check(label: str, source: str, expect_findings: int) -> None:
+ with tempfile.TemporaryDirectory() as scratch:
+ candidate = Path(scratch) / "candidate.html"
+ candidate.write_text(source, encoding="utf-8")
+ findings = module.check(candidate)
+ if len(findings) != expect_findings:
+ failures.append(
+ f"{label}: expected {expect_findings} finding(s), got "
+ f"{len(findings)}: {findings}"
+ )
+ else:
+ print(f"OK: {label}")
+
+ # A single root block, no parent attribute at all, is legal.
+ check("single root block", document(block("BLK-001")), 0)
+
+ # A valid parent-child pair, parent resolves to a real sibling id.
+ check(
+ "valid parent-child pair",
+ document(block("BLK-001") + block("BLK-001-01", parent="BLK-001")),
+ 0,
+ )
+
+ # A valid three-level chain, root -> child -> grandchild.
+ check(
+ "valid three-level chain",
+ document(
+ block("BLK-001")
+ + block("BLK-001-01", parent="BLK-001")
+ + block("BLK-001-01-01", parent="BLK-001-01")
+ ),
+ 0,
+ )
+
+ # Two children sharing one valid parent is ordinary breadth, not a defect.
+ check(
+ "shared parent, two children",
+ document(
+ block("BLK-001")
+ + block("BLK-001-01", parent="BLK-001")
+ + block("BLK-001-02", parent="BLK-001")
+ ),
+ 0,
+ )
+
+ # Two blocks copy-pasted with the same id is the defect this exists to catch.
+ check(
+ "duplicate id",
+ document(block("BLK-001") + block("BLK-001", name="Renamed")),
+ 1,
+ )
+
+ # A parent attribute pointing at an id absent from the file — a renamed or
+ # deleted parent left a dangling reference behind.
+ check(
+ "orphan parent reference",
+ document(block("BLK-001-01", parent="BLK-999")),
+ 1,
+ )
+
+ # A block whose own id is its parent — the smallest possible cycle.
+ check(
+ "self-parent cycle",
+ document(block("BLK-001", parent="BLK-001")),
+ 1,
+ )
+
+ # Two blocks whose parents point at each other — no root either could reach.
+ check(
+ "two-node cycle",
+ document(
+ block("BLK-001", parent="BLK-002") + block("BLK-002", parent="BLK-001")
+ ),
+ 1,
+ )
+
+ # An id with no data-block-name attribute at all.
+ check(
+ "missing name attribute",
+ document(block("BLK-001", name=None)),
+ 1,
+ )
+
+ # data-block-name present but empty is the same defect as absent.
+ check(
+ "empty name attribute",
+ document(block("BLK-001", name="")),
+ 1,
+ )
+
+ # data-block-name present but whitespace-only is the same defect as empty.
+ check(
+ "whitespace-only name attribute",
+ document(block("BLK-001", name=" ")),
+ 1,
+ )
+
+ # data-block-id present but empty must not silently satisfy itself as a
+ # valid, resolvable identifier.
+ check(
+ "empty id attribute",
+ document(block("")),
+ 1,
+ )
+
+ # data-block-id present but whitespace-only is the same defect as empty.
+ check(
+ "whitespace-only id attribute",
+ document(block(" ")),
+ 1,
+ )
+
+ # A blank id must never act as a resolvable identifier. Two otherwise-valid
+ # blocks joined only by "" used to report 0 findings — a coherent tree
+ # built from an empty string. Now both broken attributes are reported: the
+ # blank id itself, and the child's blank data-block-parent as unresolved.
+ check(
+ "blank id never satisfies a blank parent",
+ document(block("") + block("BLK-001", parent="")),
+ 2,
+ )
+
+ # data-block-parent present but empty is a dangling reference, not root;
+ # absent-means-root is the only root convention (export-registry.md).
+ check(
+ "blank parent attribute is unresolved",
+ document(block("BLK-001") + block("BLK-001-01", parent="")),
+ 1,
+ )
+
+ # A diagram that doesn't use the pattern at all has no data-block-id
+ # anywhere — legal; most Tree diagrams will look like this.
+ check(
+ "no blocks in file",
+ document('<rect x="0" y="0" width="160" height="48" rx="6"/>'),
+ 0,
+ )
+
+ # A node carrying an unrelated data-* attribute, but no data-block-id, is
+ # not a block and must not be collected as one.
+ check(
+ "unrelated data attribute is not a block",
+ document('<rect x="0" y="0" width="160" height="48" rx="6" data-foo="bar"/>'),
+ 0,
+ )
+
+ # The full optional metadata set (input/output/constraint/assumption/impl)
+ # must parse cleanly without tripping any check.
+ check(
+ "full optional metadata set present",
+ document(
+ block(
+ "BLK-001",
+ extra=(
+ ' data-block-input="card details" data-block-output="auth token"'
+ ' data-block-constraint="single writer" data-block-assumption="PCI boundary"'
+ ' data-block-impl="src/payments/authorization/"'
+ ),
+ )
+ ),
+ 0,
+ )
+
+ # Two unrelated root blocks (no shared ancestor) in one file — a diagram
+ # can legally show more than one top-level block.
+ check(
+ "multiple independent trees",
+ document(block("BLK-001") + block("BLK-002")),
+ 0,
+ )
+
+ # A literal '>' inside a quoted attribute value, positioned BEFORE
+ # data-block-id in the tag, is valid HTML and must not truncate the tag
+ # match — a naive [^>]* match would lose data-block-id entirely and the
+ # block would silently vanish (0 findings AND 0 blocks, a false-clean
+ # pass on a file that has a real, valid block).
+ check(
+ "literal greater-than before id does not truncate the tag",
+ document(
+ '<rect data-block-constraint="output > input" data-block-id="BLK-001" '
+ 'data-block-name="X" x="0" y="0" width="160" height="48" rx="6"/>'
+ ),
+ 0,
+ )
+
+ # Same hazard with the '>' positioned after id/name — must also survive;
+ # this ordering happened to work even before the fix, so it guards
+ # against a regression that only re-breaks the before-id ordering above.
+ check(
+ "literal greater-than after id does not truncate the tag",
+ document(
+ '<rect data-block-id="BLK-001" data-block-name="X" '
+ 'data-block-constraint="output > input" x="0" y="0" width="160" height="48" rx="6"/>'
+ ),
+ 0,
+ )
+
+ # Single-quoted attribute values are valid HTML; the parser must not
+ # silently see zero blocks on a file that uses them.
+ check(
+ "single-quoted attribute values are recognized",
+ document(
+ "<rect data-block-id='BLK-001' data-block-name='X' "
+ "x='0' y='0' width='160' height='48' rx='6'/>"
+ ),
+ 0,
+ )
+
+ # Mixed quoting within one tag -- an adversarial author (or a hand-edit)
+ # might quote some attributes one way and others another; both must be
+ # read, not just whichever style the parser happens to expect.
+ check(
+ "mixed quoting styles in one tag",
+ document(
+ '<rect data-block-id="BLK-001" data-block-name=\'X\' '
+ 'data-block-parent="BLK-000" x="0" y="0" width="160" height="48" rx="6"/>'
+ ),
+ 1, # data-block-parent references BLK-000, which this document never defines
+ )
+
+ # Unquoted attribute values are valid HTML; a browser reads them the same
+ # as quoted ones, and so must this parser.
+ check(
+ "unquoted attribute values are recognized",
+ document('<rect data-block-id=BLK-001 data-block-name=X x="0" y="0" width="160" height="48" rx="6"/>'),
+ 0,
+ )
+
+ # Whitespace around the '=' is valid HTML; a naive attribute regex
+ # anchored on `name="value"` misses it entirely.
+ check(
+ "whitespace around the attribute equals sign is recognized",
+ document(
+ '<rect data-block-id = "BLK-001" data-block-name\t=\t"X" '
+ 'x="0" y="0" width="160" height="48" rx="6"/>'
+ ),
+ 0,
+ )
+
+ # data-block-* attribute names are case-insensitive in HTML, same as any
+ # other attribute name; a browser (and this parser) lowercases them.
+ check(
+ "case-insensitive data-block-* attribute names are recognized",
+ document(
+ '<rect DATA-BLOCK-ID="BLK-001" Data-Block-Name="X" '
+ 'x="0" y="0" width="160" height="48" rx="6"/>'
+ ),
+ 0,
+ )
+
+ # A boolean/valueless data-block-id (present, no '=' at all) is a real,
+ # present attribute with a blank value -- it must surface as a blank-id
+ # finding, not vanish the whole element from the scan the way "id" not
+ # in attrs used to when the attribute carried no value.
+ check(
+ "a boolean data-block-id attribute is a blank id, not an invisible block",
+ document('<rect data-block-id data-block-name="X" x="0" y="0" width="160" height="48" rx="6"/>'),
+ 1,
+ )
+
+ # A commented-out block must never be scanned as live: pairing it with a
+ # real block sharing the same id proves it, since a parser that (wrongly)
+ # read tag-like text inside a comment would report a duplicate id here.
+ check(
+ "a commented-out block is not scanned as live",
+ document(
+ block("BLK-001")
+ + '<!-- <rect data-block-id="BLK-001" data-block-name="Ghost"/> -->'
+ ),
+ 0,
+ )
+
+ # HTML gives precedence to an attribute's first occurrence within one
+ # tag; a duplicated data-block-id must resolve the same way a browser's
+ # DOM would, not to whichever value a scanner happened to see last.
+ # Proven the same way "mixed quoting" is: the resulting id collides with
+ # a real block's id only if the *first* value ("BLK-001") won.
+ check(
+ "a duplicated attribute name keeps its first value, matching a browser",
+ document(
+ block("BLK-001")
+ + '<rect data-block-id="BLK-001" data-block-id="BLK-002" data-block-name="X"/>'
+ ),
+ 1, # duplicate data-block-id "BLK-001", only if the first value was kept
+ )
+
+ if failures:
+ print("\nFAILURES:")
+ for failure in failures:
+ print(f" - {failure}")
+ return 1
+ print("All block registry tests passed.")
+ return 0
+
+
+if __name__ == "__main__":
+ sys.exit(main())
diff --git a/scripts/verify-block-registry.py b/scripts/verify-block-registry.py
new file mode 100644
index 0000000..6573c76
--- /dev/null
+++ b/scripts/verify-block-registry.py
@@ -0,0 +1,229 @@
+#!/usr/bin/env python3
+"""Verify a Traceable block decomposition diagram's data-block-* metadata.
+
+semantic-patterns.md § 8 requires every block to carry a stable, unique,
+non-blank data-block-id, a non-blank data-block-name, and (when present) a
+data-block-parent that resolves to another block's id in the same file, with
+no cycles in the parent chain -- the same "no orphan blocks, no cycles" shape
+Tree's own layout already assumes. Nothing in the SVG grammar enforces that
+on its own: a copy-pasted node keeps its sibling's id, a renamed block leaves
+its children pointing at an id that no longer exists, an empty id="" passes
+as a real identifier, and all of them render as an ordinary,
+unremarkable-looking diagram.
+
+This does not correlate a block's metadata against its drawn position or
+connector geometry -- see export-registry.md "What this never does". It is a
+metadata-only structural check, not a visual layout check, and it is
+independent of verify-geometry.py: that script catches a label mask clipped
+by a node painted after it, this one catches a block registry that does not
+cohere as a tree.
+
+Parsing goes through the stdlib html.parser.HTMLParser rather than a regex,
+so a block is recognized exactly when a browser would recognize its
+data-block-* attributes: unquoted values, whitespace around `=`, and
+case-insensitive attribute names all parse the same as their canonical form,
+a comment's contents are never scanned as live markup (HTMLParser routes
+`<!-- ... -->` to handle_comment, never to handle_starttag), and a repeated
+attribute name keeps its first value, matching how a browser resolves a
+duplicate attribute in one tag. A blank or boolean attribute (data-block-id
+present with no value at all) still counts as the attribute being present --
+with an empty string -- so it is reported as a blank id or blank name
+finding rather than silently making the whole block invisible to the scan.
+The prior regex scanner's quoted-`>` fix is superseded by this: a real regex
+tag matcher cannot separate "not yet closed" from "attribute value contains
+a literal `>`" for every valid quoting and spacing HTML allows, and each
+such gap was the same failure shape -- a real block silently vanishing from
+the scan, CI green as if the file had none.
+
+Usage:
+ python3 scripts/verify-block-registry.py --all
+ python3 scripts/verify-block-registry.py skills/diagram-design/assets/example-x.html
+"""
+
+from __future__ import annotations
+
+import argparse
+import sys
+from dataclasses import dataclass
+from html.parser import HTMLParser
+from pathlib import Path
+
+ROOT = Path(__file__).resolve().parent.parent
+ASSET_DIR = ROOT / "skills/diagram-design/assets"
+
+DATA_BLOCK_PREFIX = "data-block-"
+
+
+@dataclass
+class Block:
+ id: str
+ parent: str | None
+ name: str | None
+ line: int
+
+
+class _BlockScanner(HTMLParser):
+ """Collect one Block per start tag carrying a data-block-id attribute.
+
+ HTMLParser already lowercases tag/attribute names, tolerates unquoted
+ values and whitespace around `=`, and never invokes handle_starttag for
+ tag-like text inside a comment or inside <script>/<style> raw text --
+ each of those is exactly a case the previous regex scanner mishandled.
+ """
+
+ def __init__(self) -> None:
+ super().__init__(convert_charrefs=True)
+ self.blocks: list[Block] = []
+
+ def handle_starttag(self, tag: str, attrs: list[tuple[str, str | None]]) -> None:
+ # A repeated attribute name keeps its first value, matching how a
+ # browser resolves a duplicate attribute within one start tag.
+ seen: dict[str, str | None] = {}
+ for name, value in attrs:
+ seen.setdefault(name, value)
+
+ block_attrs: dict[str, str] = {}
+ for name, value in seen.items():
+ if name.startswith(DATA_BLOCK_PREFIX):
+ # A present-but-valueless (boolean) attribute is a blank
+ # value, not an absent attribute -- data-block-id alone
+ # must still register as a block with a blank id.
+ block_attrs[name[len(DATA_BLOCK_PREFIX) :]] = value if value is not None else ""
+
+ if "id" not in block_attrs:
+ return
+ self.blocks.append(
+ Block(
+ id=block_attrs["id"],
+ parent=block_attrs.get("parent"),
+ name=block_attrs.get("name"),
+ line=self.getpos()[0],
+ )
+ )
+
+
+def parse_blocks(source: str) -> list[Block]:
+ scanner = _BlockScanner()
+ scanner.feed(source)
+ scanner.close()
+ return scanner.blocks
+
+
+def find_blank_ids(path: Path, blocks: list[Block]) -> list[str]:
+ findings: list[str] = []
+ for block in blocks:
+ if not block.id.strip():
+ findings.append(
+ f"{path.name}:{block.line}: block has a blank data-block-id"
+ )
+ return findings
+
+
+def find_duplicates(path: Path, blocks: list[Block]) -> list[str]:
+ by_id: dict[str, list[Block]] = {}
+ for block in blocks:
+ by_id.setdefault(block.id, []).append(block)
+
+ findings: list[str] = []
+ for block_id, group in by_id.items():
+ if len(group) > 1:
+ lines = ", ".join(str(b.line) for b in group)
+ findings.append(
+ f'{path.name}: duplicate data-block-id "{block_id}" at lines {lines}'
+ )
+ return findings
+
+
+def find_orphan_parents(path: Path, blocks: list[Block], known_ids: set[str]) -> list[str]:
+ findings: list[str] = []
+ for block in blocks:
+ if block.parent is not None and block.parent not in known_ids:
+ findings.append(
+ f'{path.name}:{block.line}: data-block-parent "{block.parent}" on block '
+ f'"{block.id}" does not match any data-block-id in this file'
+ )
+ return findings
+
+
+def find_missing_names(path: Path, blocks: list[Block]) -> list[str]:
+ findings: list[str] = []
+ for block in blocks:
+ if not block.name or not block.name.strip():
+ findings.append(
+ f'{path.name}:{block.line}: block "{block.id}" has a missing or blank data-block-name'
+ )
+ return findings
+
+
+def find_cycles(path: Path, blocks: list[Block], known_ids: set[str]) -> list[str]:
+ parent_of = {block.id: block.parent for block in blocks}
+ findings: list[str] = []
+ reported: set[str] = set()
+
+ for block in blocks:
+ if block.id in reported:
+ continue
+ chain: list[str] = []
+ current: str | None = block.id
+ while current is not None:
+ if current in chain:
+ cycle = chain[chain.index(current) :] + [current]
+ reported.update(cycle)
+ findings.append(f'{path.name}: parent cycle: {" -> ".join(cycle)}')
+ break
+ chain.append(current)
+ if current not in known_ids:
+ break # broken parent reference; already reported by find_orphan_parents
+ current = parent_of.get(current)
+ return findings
+
+
+def check(path: Path) -> list[str]:
+ source = path.read_text(encoding="utf-8")
+ blocks = parse_blocks(source)
+ if not blocks:
+ return [] # not every diagram uses the pattern; that's legal
+
+ # A blank id is never a resolvable target: a blank data-block-parent must
+ # report as unresolved, not quietly match a block whose id is also blank.
+ known_ids = {block.id for block in blocks if block.id.strip()}
+ findings: list[str] = []
+ findings.extend(find_blank_ids(path, blocks))
+ findings.extend(find_duplicates(path, blocks))
+ findings.extend(find_orphan_parents(path, blocks, known_ids))
+ findings.extend(find_missing_names(path, blocks))
+ findings.extend(find_cycles(path, blocks, known_ids))
+ return findings
+
+
+def targets(args: argparse.Namespace) -> list[Path]:
+ if args.all:
+ return sorted(ASSET_DIR.glob("*.html"))
+ return [Path(p) for p in args.files]
+
+
+def main() -> int:
+ parser = argparse.ArgumentParser(description=__doc__)
+ parser.add_argument("files", nargs="*", help="HTML diagrams to check")
+ parser.add_argument("--all", action="store_true", help="check every shipped asset")
+ args = parser.parse_args()
+
+ paths = targets(args)
+ if not paths:
+ parser.error("pass one or more files, or --all")
+
+ findings: list[str] = []
+ for path in paths:
+ if not path.exists():
+ findings.append(f"{path}: file not found")
+ continue
+ findings.extend(check(path))
+
+ for finding in findings:
+ print(finding)
+ print(f"Summary: {len(paths)} file(s) checked, {len(findings)} finding(s).")
+ return 1 if findings else 0
+
+
+if __name__ == "__main__":
+ sys.exit(main())
diff --git a/scripts/verify-semantic-motion.py b/scripts/verify-semantic-motion.py
index c4b3af9..fb5351b 100644
--- a/scripts/verify-semantic-motion.py
+++ b/scripts/verify-semantic-motion.py
@@ -31,6 +31,7 @@ PATTERN_NAMES = (
"Secure paved road",
"Governance / control catalog",
"Compensating security layers",
+ "Traceable block decomposition",
)
PATTERN_FIELDS = (
"Selection triggers:",
@@ -426,7 +427,7 @@ def main() -> int:
return 1
if not args.example_only:
print(
- f"OK: 7 semantic patterns route independently to the preserved "
+ f"OK: {len(PATTERN_NAMES)} semantic patterns route independently to the preserved "
f"{VISUAL_TYPE_COUNT} visual types"
)
print("OK: animation modes, primitives, static fallback, and accessibility contract")
diff --git a/skills/diagram-design/SKILL.md b/skills/diagram-design/SKILL.md
index 254ac16..1498a9b 100644
--- a/skills/diagram-design/SKILL.md
+++ b/skills/diagram-design/SKILL.md
@@ -75,6 +75,7 @@ When behavior, state, enforcement, or risk carries the meaning, first load [`ref
| Trust boundaries plus permitted/forbidden ingress or deploy paths | **Secure paved road** → Architecture |
| Controls grouped by where they are enforced | **Governance / control catalog** → Layer stack |
| Defenses compensate for prior gaps and residual risk propagates | **Compensating security layers** → Layer stack |
+| Hierarchical, ID-addressable decomposition needing per-block I/O, constraints, and a code link | **Traceable block decomposition** → Tree |
The pattern owns semantic primitives and its tighter budget; the type owns layout grammar. Use [`references/animation.md`](references/animation.md) only when motion is requested or materially clarifies ordered change; static remains the default.
@@ -487,7 +488,7 @@ Run before producing any diagram.
- [ ] No vertical `writing-mode` text?
- [ ] `viewBox` expanded for the legend strip (~60px)?
- [ ] Every font size, coord, width, height, gap divisible by 4?
-- [ ] From the installed skill directory, did `python3 scripts/self_check.py <file>` pass? (Accessible-SVG contract, single-file safety, motion basics; ships with the skill.)
+- [ ] From the installed skill directory, did `python3 scripts/self_check.py <file>` pass? (Accessible-SVG contract, single-file safety, motion basics.)
- [ ] If animated, does the complete static/no-JS frame work, does reduced motion hide/disable playback, and is the controller copied verbatim from `assets/template-motion.html`? From a repository checkout, also run `python3 <repo-root>/scripts/verify-motion.py path/to/generated.html` plus the skin linter; from an installed skill, manually check print and static-query states on top of the self-check.
**Typography:**
@@ -543,7 +544,7 @@ An import is bounded by its source: never invent a component to fill a layout, a
### Output dials — format, size, detail level, audience
-Every imported diagram is shaped by four decisions. Full spec in [`references/output-spec.md`](references/output-spec.md); set them **before** drawing, since they change the deliverable, layout, density, and wording.
+Every imported diagram is shaped by four decisions, set **before** drawing — full spec in [`references/output-spec.md`](references/output-spec.md).
| Dial | Options | Default |
|---|---|---|
@@ -572,10 +573,10 @@ Every diagram is an accessible figure by default:
1. Its `<svg>` carries `role="img"` and `aria-labelledby` naming the diagram's `<title>` and `<desc>`.
2. `<title>` is the first child of `<svg>`, before `<defs>`. Assistive technology may ignore a title placed later.
-3. The IDs are prefixed per diagram and variant: `<slug>-title` / `<slug>-desc`, where the slug matches the file (`loop`, `loop-dark`, `loop-full`). Bare `title` / `desc` IDs are banned because two inline diagrams would create duplicate IDs and the second could be announced with the first diagram's name.
+3. The IDs are prefixed per diagram and variant: `<slug>-title` / `<slug>-desc`, where the slug matches the file (`loop`, `loop-dark`, `loop-full`). Bare `title` / `desc` IDs are banned — two inline diagrams would otherwise share one ID, and the second could be announced with the first's name.
4. `<title>` is the short name of the subject — roughly the page `<h1>`, and about 60 characters or fewer.
5. `<desc>` is one sentence stating what the diagram shows in terms a reader needs without the image. Describe the content, not the geometry: “Org chart showing a command center routing work to specialist agents and escalation owners,” not “A box at the top with five boxes below it.” A shape-by-shape narration is worse than no useful description.
-6. Decorative-only SVG, such as the specimen glyphs in `assets/icons.html`, carries `aria-hidden="true"` instead. Giving decorative marks accessible names adds noise.
+6. Decorative-only SVG, such as the specimen glyphs in `assets/icons.html`, carries `aria-hidden="true"` instead.
### Exporting to PNG / SVG
diff --git a/skills/diagram-design/assets/example-tree-block-decomposition-dark.html b/skills/diagram-design/assets/example-tree-block-decomposition-dark.html
new file mode 100644
index 0000000..e90284d
--- /dev/null
+++ b/skills/diagram-design/assets/example-tree-block-decomposition-dark.html
@@ -0,0 +1,151 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="UTF-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <title>Payment gateway block decomposition · Tree</title>
+ <link href="https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=Geist:wght@400;500;600&family=Geist+Mono:wght@400;500;600&display=swap" rel="stylesheet">
+ <style>
+ *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
+ :root {
+ --color-paper: #2d3142;
+ --color-ink: #f5f5f5;
+ --color-muted: #bfc0c0;
+ --color-accent: #f08a59;
+ --font-sans: 'Geist', system-ui, sans-serif;
+ --font-serif: 'Instrument Serif', serif;
+ --font-mono: 'Geist Mono', ui-monospace, monospace;
+ }
+
+ body {
+ font-family: var(--font-sans);
+ background: var(--color-paper);
+ color: var(--color-ink);
+ min-height: 100vh;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ padding: 3rem 2rem;
+ }
+
+ .frame { max-width: 1100px; width: 100%; }
+
+ .eyebrow {
+ font-family: var(--font-mono);
+ font-size: 0.66rem;
+ font-weight: 500;
+ letter-spacing: 0.18em;
+ text-transform: uppercase;
+ color: var(--color-muted);
+ margin-bottom: 0.5rem;
+ }
+
+ h1 {
+ font-family: var(--font-serif);
+ font-size: clamp(1.5rem, 2.4vw + 0.75rem, 2rem);
+ font-weight: 400;
+ letter-spacing: -0.02em;
+ line-height: 1.15;
+ color: var(--color-ink);
+ margin-bottom: 1.5rem;
+ }
+
+ svg { width: 100%; min-width: 900px; display: block; }
+ </style>
+</head>
+<body>
+ <div class="frame">
+ <p class="eyebrow">Semantic pattern · Traceable block decomposition</p>
+ <h1>Payment gateway block decomposition</h1>
+
+ <svg viewBox="0 0 1000 320" xmlns="http://www.w3.org/2000/svg" role="img"
+ aria-labelledby="tree-block-decomposition-dark-title tree-block-decomposition-dark-desc">
+ <title id="tree-block-decomposition-dark-title">Payment gateway block decomposition</title>
+ <desc id="tree-block-decomposition-dark-desc">Traceable block decomposition of a payment
+ gateway into card authorization, fraud screening, and settlement ledger, with a stable ID,
+ inputs, outputs, constraints, and an implementation path carried as metadata on each block.</desc>
+ <defs>
+ <pattern id="dots" width="22" height="22" patternUnits="userSpaceOnUse">
+ <circle cx="1" cy="1" r="0.9" fill="rgba(245,245,245,0.10)"/>
+ </pattern>
+ </defs>
+
+ <rect width="100%" height="100%" fill="#2d3142"/>
+ <rect width="100%" height="100%" fill="url(#dots)" opacity="0.55"/>
+
+ <!-- Tier tags (left margin) -->
+ <text x="40" y="70" fill="#bfc0c0" font-size="8" font-family="'Geist Mono', monospace" letter-spacing="0.18em">TIER 0 · ROOT</text>
+ <text x="40" y="210" fill="#bfc0c0" font-size="8" font-family="'Geist Mono', monospace" letter-spacing="0.18em">TIER 1</text>
+
+ <!-- Connectors first (§5 paint order), orthogonal elbow, 1px muted stroke -->
+ <path d="M 500 92 V 130 H 280 V 180" fill="none" stroke="#bfc0c0" stroke-width="1"/>
+ <path d="M 500 92 V 180" fill="none" stroke="#bfc0c0" stroke-width="1"/>
+ <path d="M 500 92 V 130 H 720 V 180" fill="none" stroke="#bfc0c0" stroke-width="1"/>
+
+ <!-- Root: PAY-001 Payment Gateway (coral focal) -->
+ <rect x="420" y="40" width="160" height="52" rx="6" fill="#2d3142"/>
+ <rect x="420" y="40" width="160" height="52" rx="6" fill="rgba(240,138,89,0.10)" stroke="#f08a59" stroke-width="1"
+ data-block-id="PAY-001" data-block-name="Payment Gateway"
+ data-block-output="Settled transaction record"
+ data-block-constraint="Every transaction reaches exactly one terminal state"
+ data-block-impl="src/payments/gateway/"/>
+ <rect x="428" y="46" width="46" height="12" rx="2" fill="transparent" stroke="rgba(240,138,89,0.50)" stroke-width="0.8"/>
+ <text x="451" y="55" fill="#f08a59" font-size="7" font-family="'Geist Mono', monospace"
+ text-anchor="middle" letter-spacing="0.08em">PAY-001</text>
+ <text x="500" y="70" fill="#f5f5f5" font-size="12" font-weight="600"
+ font-family="'Geist', sans-serif" text-anchor="middle">Payment Gateway</text>
+ <text x="500" y="86" fill="#bfc0c0" font-size="9"
+ font-family="'Geist Mono', monospace" text-anchor="middle">request → settlement</text>
+
+ <!-- Child: PAY-001-01 Card Authorization -->
+ <rect x="200" y="180" width="160" height="52" rx="6" fill="#2d3142"/>
+ <rect x="200" y="180" width="160" height="52" rx="6" fill="rgba(245,245,245,0.04)" stroke="#f5f5f5" stroke-width="1"
+ data-block-id="PAY-001-01" data-block-parent="PAY-001" data-block-name="Card Authorization"
+ data-block-input="Raw card details from checkout"
+ data-block-output="Authorization token or decline"
+ data-block-constraint="Never persists a raw card number"
+ data-block-assumption="Runs behind the PCI-scoped boundary"
+ data-block-impl="src/payments/authorization/"/>
+ <rect x="208" y="186" width="62" height="12" rx="2" fill="transparent" stroke="rgba(245,245,245,0.40)" stroke-width="0.8"/>
+ <text x="239" y="195" fill="#f5f5f5" font-size="7" font-family="'Geist Mono', monospace"
+ text-anchor="middle" letter-spacing="0.08em">PAY-001-01</text>
+ <text x="280" y="210" fill="#f5f5f5" font-size="12" font-weight="600"
+ font-family="'Geist', sans-serif" text-anchor="middle">Card Authorization</text>
+ <text x="280" y="226" fill="#bfc0c0" font-size="9"
+ font-family="'Geist Mono', monospace" text-anchor="middle">card → token</text>
+
+ <!-- Child: PAY-001-02 Fraud Screening -->
+ <rect x="420" y="180" width="160" height="52" rx="6" fill="#2d3142"/>
+ <rect x="420" y="180" width="160" height="52" rx="6" fill="rgba(245,245,245,0.04)" stroke="#f5f5f5" stroke-width="1"
+ data-block-id="PAY-001-02" data-block-parent="PAY-001" data-block-name="Fraud Screening"
+ data-block-input="Authorization token"
+ data-block-output="Risk score and hold/release decision"
+ data-block-constraint="Blocks release above the configured risk threshold"
+ data-block-impl="src/payments/fraud/"/>
+ <rect x="428" y="186" width="62" height="12" rx="2" fill="transparent" stroke="rgba(245,245,245,0.40)" stroke-width="0.8"/>
+ <text x="459" y="195" fill="#f5f5f5" font-size="7" font-family="'Geist Mono', monospace"
+ text-anchor="middle" letter-spacing="0.08em">PAY-001-02</text>
+ <text x="500" y="210" fill="#f5f5f5" font-size="12" font-weight="600"
+ font-family="'Geist', sans-serif" text-anchor="middle">Fraud Screening</text>
+ <text x="500" y="226" fill="#bfc0c0" font-size="9"
+ font-family="'Geist Mono', monospace" text-anchor="middle">token → score</text>
+
+ <!-- Child: PAY-001-03 Settlement Ledger -->
+ <rect x="640" y="180" width="160" height="52" rx="6" fill="#2d3142"/>
+ <rect x="640" y="180" width="160" height="52" rx="6" fill="rgba(245,245,245,0.04)" stroke="#f5f5f5" stroke-width="1"
+ data-block-id="PAY-001-03" data-block-parent="PAY-001" data-block-name="Settlement Ledger"
+ data-block-input="Released authorization"
+ data-block-output="Settled transaction record"
+ data-block-constraint="Append-only, no ledger row is ever mutated after write"
+ data-block-impl="src/payments/ledger/"/>
+ <rect x="648" y="186" width="62" height="12" rx="2" fill="transparent" stroke="rgba(245,245,245,0.40)" stroke-width="0.8"/>
+ <text x="679" y="195" fill="#f5f5f5" font-size="7" font-family="'Geist Mono', monospace"
+ text-anchor="middle" letter-spacing="0.08em">PAY-001-03</text>
+ <text x="720" y="210" fill="#f5f5f5" font-size="12" font-weight="600"
+ font-family="'Geist', sans-serif" text-anchor="middle">Settlement Ledger</text>
+ <text x="720" y="226" fill="#bfc0c0" font-size="9"
+ font-family="'Geist Mono', monospace" text-anchor="middle">release → ledger</text>
+ </svg>
+ </div>
+</body>
+</html>
diff --git a/skills/diagram-design/assets/example-tree-block-decomposition-full.html b/skills/diagram-design/assets/example-tree-block-decomposition-full.html
new file mode 100644
index 0000000..d55464e
--- /dev/null
+++ b/skills/diagram-design/assets/example-tree-block-decomposition-full.html
@@ -0,0 +1,154 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="UTF-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <title>Payment gateway block decomposition · Tree</title>
+ <link href="https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=Geist:wght@400;500;600&family=Geist+Mono:wght@400;500;600&display=swap" rel="stylesheet">
+ <style>
+ *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
+ :root { --color-paper:#f5f5f5; --color-paper-2:#ececec; --color-ink:#2d3142; --color-muted:#4f5d75; --color-soft:#7a8399; --color-rule:rgba(45,49,66,0.12); --color-accent:#eb6c36; --color-link:#2e5aa8; --font-sans:'Geist',system-ui,sans-serif; --font-serif:'Instrument Serif',serif; --font-mono:'Geist Mono',ui-monospace,monospace; }
+ body { font-family: var(--font-sans); background: var(--color-paper); min-height: 100vh; padding: 3rem 2rem; color: var(--color-ink); }
+ .container { max-width: 1100px; margin: 0 auto; }
+ .header { margin-bottom: 2.5rem; }
+ .header-eyebrow { font-family: var(--font-mono); font-size: 0.66rem; font-weight: 500; letter-spacing: 0.18em; text-transform: uppercase; color: var(--color-muted); margin-bottom: 0.75rem; }
+ h1 { font-family: var(--font-serif); font-size: clamp(1.75rem, 3vw + 1rem, 2.5rem); font-weight: 400; letter-spacing: -0.02em; line-height: 1.1; margin-bottom: 0.5rem; }
+ .subtitle { font-size: 1rem; line-height: 1.55; color: var(--color-muted); max-width: 58ch; }
+ .diagram-container { background: var(--color-paper-2); border-radius: 8px; border: 1px solid var(--color-rule); padding: 1.5rem; overflow-x: auto; }
+ svg { width: 100%; min-width: 900px; display: block; }
+ .cards { display: grid; grid-template-columns: 1.1fr 1fr 0.9fr; gap: 1rem; margin-top: 1.5rem; }
+ @media (max-width: 820px) { .cards { grid-template-columns: 1fr; } }
+ .card { background: #fff; border-radius: 6px; border: 1px solid var(--color-rule); padding: 1.25rem; }
+ .card .eyebrow { font-family: var(--font-mono); font-size: 0.5rem; letter-spacing: 0.18em; text-transform: uppercase; color: var(--color-muted); margin-bottom: 0.5rem; }
+ .card-header { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.875rem; padding-bottom: 0.875rem; border-bottom: 1px solid rgba(45,49,66,0.08); }
+ .card-dot { width: 7px; height: 7px; border-radius: 50%; }
+ .card-dot.ink { background: var(--color-ink); } .card-dot.muted { background: var(--color-muted); } .card-dot.coral { background: var(--color-accent); }
+ .card h3 { font-size: 0.875rem; font-weight: 600; }
+ .card p, .card ul { color: var(--color-muted); font-size: 0.8125rem; line-height: 1.55; list-style: none; }
+ .card li { margin-bottom: 0.3rem; padding-left: 0.875rem; position: relative; }
+ .card li::before { content: '—'; position: absolute; left: 0; color: rgba(45,49,66,0.25); font-size: 0.75rem; }
+ .footer { margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid rgba(45,49,66,0.10); font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.06em; color: var(--color-soft); display: flex; justify-content: space-between; flex-wrap: wrap; gap: 0.5rem; }
+ </style>
+</head>
+<body>
+ <div class="container">
+ <div class="header">
+ <p class="header-eyebrow">Semantic pattern · Traceable block decomposition</p>
+ <h1>Payment gateway block decomposition</h1>
+ <p class="subtitle">Three blocks, one root, each with a stable ID a reader can cite directly. The diagram shows only a badge, a name, and a short flow — inputs, outputs, constraints, and implementation paths live in the metadata, not the canvas.</p>
+ </div>
+
+ <div class="diagram-container">
+ <svg viewBox="0 0 1000 320" xmlns="http://www.w3.org/2000/svg" role="img"
+ aria-labelledby="tree-block-decomposition-full-title tree-block-decomposition-full-desc">
+ <title id="tree-block-decomposition-full-title">Payment gateway block decomposition</title>
+ <desc id="tree-block-decomposition-full-desc">Traceable block decomposition of a payment
+ gateway into card authorization, fraud screening, and settlement ledger, with a stable ID,
+ inputs, outputs, constraints, and an implementation path carried as metadata on each block.</desc>
+ <defs>
+ <pattern id="dots" width="22" height="22" patternUnits="userSpaceOnUse">
+ <circle cx="1" cy="1" r="0.9" fill="rgba(45,49,66,0.10)"/>
+ </pattern>
+ </defs>
+
+ <rect width="100%" height="100%" fill="#f5f5f5"/>
+ <rect width="100%" height="100%" fill="url(#dots)" opacity="0.55"/>
+
+ <!-- Tier tags (left margin) -->
+ <text x="40" y="70" fill="#4f5d75" font-size="8" font-family="'Geist Mono', monospace" letter-spacing="0.18em">TIER 0 · ROOT</text>
+ <text x="40" y="210" fill="#4f5d75" font-size="8" font-family="'Geist Mono', monospace" letter-spacing="0.18em">TIER 1</text>
+
+ <!-- Connectors first (§5 paint order), orthogonal elbow, 1px muted stroke -->
+ <path d="M 500 92 V 130 H 280 V 180" fill="none" stroke="#4f5d75" stroke-width="1"/>
+ <path d="M 500 92 V 180" fill="none" stroke="#4f5d75" stroke-width="1"/>
+ <path d="M 500 92 V 130 H 720 V 180" fill="none" stroke="#4f5d75" stroke-width="1"/>
+
+ <!-- Root: PAY-001 Payment Gateway (coral focal) -->
+ <rect x="420" y="40" width="160" height="52" rx="6" fill="#f5f5f5"/>
+ <rect x="420" y="40" width="160" height="52" rx="6" fill="rgba(235,108,54,0.08)" stroke="#eb6c36" stroke-width="1"
+ data-block-id="PAY-001" data-block-name="Payment Gateway"
+ data-block-output="Settled transaction record"
+ data-block-constraint="Every transaction reaches exactly one terminal state"
+ data-block-impl="src/payments/gateway/"/>
+ <rect x="428" y="46" width="46" height="12" rx="2" fill="transparent" stroke="rgba(235,108,54,0.50)" stroke-width="0.8"/>
+ <text x="451" y="55" fill="#eb6c36" font-size="7" font-family="'Geist Mono', monospace"
+ text-anchor="middle" letter-spacing="0.08em">PAY-001</text>
+ <text x="500" y="70" fill="#2d3142" font-size="12" font-weight="600"
+ font-family="'Geist', sans-serif" text-anchor="middle">Payment Gateway</text>
+ <text x="500" y="86" fill="#4f5d75" font-size="9"
+ font-family="'Geist Mono', monospace" text-anchor="middle">request → settlement</text>
+
+ <!-- Child: PAY-001-01 Card Authorization -->
+ <rect x="200" y="180" width="160" height="52" rx="6" fill="#f5f5f5"/>
+ <rect x="200" y="180" width="160" height="52" rx="6" fill="#ffffff" stroke="#2d3142" stroke-width="1"
+ data-block-id="PAY-001-01" data-block-parent="PAY-001" data-block-name="Card Authorization"
+ data-block-input="Raw card details from checkout"
+ data-block-output="Authorization token or decline"
+ data-block-constraint="Never persists a raw card number"
+ data-block-assumption="Runs behind the PCI-scoped boundary"
+ data-block-impl="src/payments/authorization/"/>
+ <rect x="208" y="186" width="62" height="12" rx="2" fill="transparent" stroke="rgba(45,49,66,0.40)" stroke-width="0.8"/>
+ <text x="239" y="195" fill="#2d3142" font-size="7" font-family="'Geist Mono', monospace"
+ text-anchor="middle" letter-spacing="0.08em">PAY-001-01</text>
+ <text x="280" y="210" fill="#2d3142" font-size="12" font-weight="600"
+ font-family="'Geist', sans-serif" text-anchor="middle">Card Authorization</text>
+ <text x="280" y="226" fill="#4f5d75" font-size="9"
+ font-family="'Geist Mono', monospace" text-anchor="middle">card → token</text>
+
+ <!-- Child: PAY-001-02 Fraud Screening -->
+ <rect x="420" y="180" width="160" height="52" rx="6" fill="#f5f5f5"/>
+ <rect x="420" y="180" width="160" height="52" rx="6" fill="#ffffff" stroke="#2d3142" stroke-width="1"
+ data-block-id="PAY-001-02" data-block-parent="PAY-001" data-block-name="Fraud Screening"
+ data-block-input="Authorization token"
+ data-block-output="Risk score and hold/release decision"
+ data-block-constraint="Blocks release above the configured risk threshold"
+ data-block-impl="src/payments/fraud/"/>
+ <rect x="428" y="186" width="62" height="12" rx="2" fill="transparent" stroke="rgba(45,49,66,0.40)" stroke-width="0.8"/>
+ <text x="459" y="195" fill="#2d3142" font-size="7" font-family="'Geist Mono', monospace"
+ text-anchor="middle" letter-spacing="0.08em">PAY-001-02</text>
+ <text x="500" y="210" fill="#2d3142" font-size="12" font-weight="600"
+ font-family="'Geist', sans-serif" text-anchor="middle">Fraud Screening</text>
+ <text x="500" y="226" fill="#4f5d75" font-size="9"
+ font-family="'Geist Mono', monospace" text-anchor="middle">token → score</text>
+
+ <!-- Child: PAY-001-03 Settlement Ledger -->
+ <rect x="640" y="180" width="160" height="52" rx="6" fill="#f5f5f5"/>
+ <rect x="640" y="180" width="160" height="52" rx="6" fill="#ffffff" stroke="#2d3142" stroke-width="1"
+ data-block-id="PAY-001-03" data-block-parent="PAY-001" data-block-name="Settlement Ledger"
+ data-block-input="Released authorization"
+ data-block-output="Settled transaction record"
+ data-block-constraint="Append-only, no ledger row is ever mutated after write"
+ data-block-impl="src/payments/ledger/"/>
+ <rect x="648" y="186" width="62" height="12" rx="2" fill="transparent" stroke="rgba(45,49,66,0.40)" stroke-width="0.8"/>
+ <text x="679" y="195" fill="#2d3142" font-size="7" font-family="'Geist Mono', monospace"
+ text-anchor="middle" letter-spacing="0.08em">PAY-001-03</text>
+ <text x="720" y="210" fill="#2d3142" font-size="12" font-weight="600"
+ font-family="'Geist', sans-serif" text-anchor="middle">Settlement Ledger</text>
+ <text x="720" y="226" fill="#4f5d75" font-size="9"
+ font-family="'Geist Mono', monospace" text-anchor="middle">release → ledger</text>
+ </svg>
+ </div>
+
+ <div class="cards">
+ <div class="card">
+ <p class="eyebrow">THE HEADLINE</p>
+ <div class="card-header"><span class="card-dot coral"></span><h3>Every block gets a stable ID</h3></div>
+ <p>The badge is the citable handle — "PAY-001-02" means one specific block, permanently. A reader, a review, or a compliance record can point at it directly instead of describing a box's position on a page.</p>
+ </div>
+ <div class="card">
+ <div class="card-header"><span class="card-dot ink"></span><h3>The canvas shows the minimum</h3></div>
+ <ul><li>ID badge, name, and one short flow line</li><li>Inputs/outputs/constraints stay off-canvas</li><li>Carried in data-block-* attributes instead</li><li>Same node primitives, zero new SVG grammar</li></ul>
+ </div>
+ <div class="card">
+ <div class="card-header"><span class="card-dot muted"></span><h3>Registry export on demand</h3></div>
+ <p>The full record — every attribute on every block — projects into a JSON sidecar on request. Regenerated from the diagram itself, never hand-maintained separately from it.</p>
+ </div>
+ </div>
+
+ <div class="footer">
+ <span>payment gateway block decomposition</span>
+ <span>example · schematic system</span>
+ </div>
+ </div>
+</body>
+</html>
diff --git a/skills/diagram-design/assets/example-tree-block-decomposition.html b/skills/diagram-design/assets/example-tree-block-decomposition.html
new file mode 100644
index 0000000..15fd977
--- /dev/null
+++ b/skills/diagram-design/assets/example-tree-block-decomposition.html
@@ -0,0 +1,151 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="UTF-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <title>Payment gateway block decomposition · Tree</title>
+ <link href="https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=Geist:wght@400;500;600&family=Geist+Mono:wght@400;500;600&display=swap" rel="stylesheet">
+ <style>
+ *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
+ :root {
+ --color-paper: #f5f5f5;
+ --color-ink: #2d3142;
+ --color-muted: #4f5d75;
+ --color-accent: #eb6c36;
+ --font-sans: 'Geist', system-ui, sans-serif;
+ --font-serif: 'Instrument Serif', serif;
+ --font-mono: 'Geist Mono', ui-monospace, monospace;
+ }
+
+ body {
+ font-family: var(--font-sans);
+ background: var(--color-paper);
+ color: var(--color-ink);
+ min-height: 100vh;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ padding: 3rem 2rem;
+ }
+
+ .frame { max-width: 1100px; width: 100%; }
+
+ .eyebrow {
+ font-family: var(--font-mono);
+ font-size: 0.66rem;
+ font-weight: 500;
+ letter-spacing: 0.18em;
+ text-transform: uppercase;
+ color: var(--color-muted);
+ margin-bottom: 0.5rem;
+ }
+
+ h1 {
+ font-family: var(--font-serif);
+ font-size: clamp(1.5rem, 2.4vw + 0.75rem, 2rem);
+ font-weight: 400;
+ letter-spacing: -0.02em;
+ line-height: 1.15;
+ color: var(--color-ink);
+ margin-bottom: 1.5rem;
+ }
+
+ svg { width: 100%; min-width: 900px; display: block; }
+ </style>
+</head>
+<body>
+ <div class="frame">
+ <p class="eyebrow">Semantic pattern · Traceable block decomposition</p>
+ <h1>Payment gateway block decomposition</h1>
+
+ <svg viewBox="0 0 1000 320" xmlns="http://www.w3.org/2000/svg" role="img"
+ aria-labelledby="tree-block-decomposition-title tree-block-decomposition-desc">
+ <title id="tree-block-decomposition-title">Payment gateway block decomposition</title>
+ <desc id="tree-block-decomposition-desc">Traceable block decomposition of a payment gateway
+ into card authorization, fraud screening, and settlement ledger, with a stable ID, inputs,
+ outputs, constraints, and an implementation path carried as metadata on each block.</desc>
+ <defs>
+ <pattern id="dots" width="22" height="22" patternUnits="userSpaceOnUse">
+ <circle cx="1" cy="1" r="0.9" fill="rgba(45,49,66,0.10)"/>
+ </pattern>
+ </defs>
+
+ <rect width="100%" height="100%" fill="#f5f5f5"/>
+ <rect width="100%" height="100%" fill="url(#dots)" opacity="0.55"/>
+
+ <!-- Tier tags (left margin) -->
+ <text x="40" y="70" fill="#4f5d75" font-size="8" font-family="'Geist Mono', monospace" letter-spacing="0.18em">TIER 0 · ROOT</text>
+ <text x="40" y="210" fill="#4f5d75" font-size="8" font-family="'Geist Mono', monospace" letter-spacing="0.18em">TIER 1</text>
+
+ <!-- Connectors first (§5 paint order), orthogonal elbow, 1px muted stroke -->
+ <path d="M 500 92 V 130 H 280 V 180" fill="none" stroke="#4f5d75" stroke-width="1"/>
+ <path d="M 500 92 V 180" fill="none" stroke="#4f5d75" stroke-width="1"/>
+ <path d="M 500 92 V 130 H 720 V 180" fill="none" stroke="#4f5d75" stroke-width="1"/>
+
+ <!-- Root: PAY-001 Payment Gateway (coral focal) -->
+ <rect x="420" y="40" width="160" height="52" rx="6" fill="#f5f5f5"/>
+ <rect x="420" y="40" width="160" height="52" rx="6" fill="rgba(235,108,54,0.08)" stroke="#eb6c36" stroke-width="1"
+ data-block-id="PAY-001" data-block-name="Payment Gateway"
+ data-block-output="Settled transaction record"
+ data-block-constraint="Every transaction reaches exactly one terminal state"
+ data-block-impl="src/payments/gateway/"/>
+ <rect x="428" y="46" width="46" height="12" rx="2" fill="transparent" stroke="rgba(235,108,54,0.50)" stroke-width="0.8"/>
+ <text x="451" y="55" fill="#eb6c36" font-size="7" font-family="'Geist Mono', monospace"
+ text-anchor="middle" letter-spacing="0.08em">PAY-001</text>
+ <text x="500" y="70" fill="#2d3142" font-size="12" font-weight="600"
+ font-family="'Geist', sans-serif" text-anchor="middle">Payment Gateway</text>
+ <text x="500" y="86" fill="#4f5d75" font-size="9"
+ font-family="'Geist Mono', monospace" text-anchor="middle">request → settlement</text>
+
+ <!-- Child: PAY-001-01 Card Authorization -->
+ <rect x="200" y="180" width="160" height="52" rx="6" fill="#f5f5f5"/>
+ <rect x="200" y="180" width="160" height="52" rx="6" fill="#ffffff" stroke="#2d3142" stroke-width="1"
+ data-block-id="PAY-001-01" data-block-parent="PAY-001" data-block-name="Card Authorization"
+ data-block-input="Raw card details from checkout"
+ data-block-output="Authorization token or decline"
+ data-block-constraint="Never persists a raw card number"
+ data-block-assumption="Runs behind the PCI-scoped boundary"
+ data-block-impl="src/payments/authorization/"/>
+ <rect x="208" y="186" width="62" height="12" rx="2" fill="transparent" stroke="rgba(45,49,66,0.40)" stroke-width="0.8"/>
+ <text x="239" y="195" fill="#2d3142" font-size="7" font-family="'Geist Mono', monospace"
+ text-anchor="middle" letter-spacing="0.08em">PAY-001-01</text>
+ <text x="280" y="210" fill="#2d3142" font-size="12" font-weight="600"
+ font-family="'Geist', sans-serif" text-anchor="middle">Card Authorization</text>
+ <text x="280" y="226" fill="#4f5d75" font-size="9"
+ font-family="'Geist Mono', monospace" text-anchor="middle">card → token</text>
+
+ <!-- Child: PAY-001-02 Fraud Screening -->
+ <rect x="420" y="180" width="160" height="52" rx="6" fill="#f5f5f5"/>
+ <rect x="420" y="180" width="160" height="52" rx="6" fill="#ffffff" stroke="#2d3142" stroke-width="1"
+ data-block-id="PAY-001-02" data-block-parent="PAY-001" data-block-name="Fraud Screening"
+ data-block-input="Authorization token"
+ data-block-output="Risk score and hold/release decision"
+ data-block-constraint="Blocks release above the configured risk threshold"
+ data-block-impl="src/payments/fraud/"/>
+ <rect x="428" y="186" width="62" height="12" rx="2" fill="transparent" stroke="rgba(45,49,66,0.40)" stroke-width="0.8"/>
+ <text x="459" y="195" fill="#2d3142" font-size="7" font-family="'Geist Mono', monospace"
+ text-anchor="middle" letter-spacing="0.08em">PAY-001-02</text>
+ <text x="500" y="210" fill="#2d3142" font-size="12" font-weight="600"
+ font-family="'Geist', sans-serif" text-anchor="middle">Fraud Screening</text>
+ <text x="500" y="226" fill="#4f5d75" font-size="9"
+ font-family="'Geist Mono', monospace" text-anchor="middle">token → score</text>
+
+ <!-- Child: PAY-001-03 Settlement Ledger -->
+ <rect x="640" y="180" width="160" height="52" rx="6" fill="#f5f5f5"/>
+ <rect x="640" y="180" width="160" height="52" rx="6" fill="#ffffff" stroke="#2d3142" stroke-width="1"
+ data-block-id="PAY-001-03" data-block-parent="PAY-001" data-block-name="Settlement Ledger"
+ data-block-input="Released authorization"
+ data-block-output="Settled transaction record"
+ data-block-constraint="Append-only, no ledger row is ever mutated after write"
+ data-block-impl="src/payments/ledger/"/>
+ <rect x="648" y="186" width="62" height="12" rx="2" fill="transparent" stroke="rgba(45,49,66,0.40)" stroke-width="0.8"/>
+ <text x="679" y="195" fill="#2d3142" font-size="7" font-family="'Geist Mono', monospace"
+ text-anchor="middle" letter-spacing="0.08em">PAY-001-03</text>
+ <text x="720" y="210" fill="#2d3142" font-size="12" font-weight="600"
+ font-family="'Geist', sans-serif" text-anchor="middle">Settlement Ledger</text>
+ <text x="720" y="226" fill="#4f5d75" font-size="9"
+ font-family="'Geist Mono', monospace" text-anchor="middle">release → ledger</text>
+ </svg>
+ </div>
+</body>
+</html>
diff --git a/skills/diagram-design/assets/index.html b/skills/diagram-design/assets/index.html
index 809a0b5..d5f34ed 100644
--- a/skills/diagram-design/assets/index.html
+++ b/skills/diagram-design/assets/index.html
@@ -370,6 +370,9 @@
<button class="tab new" data-type="paved-road-animated" data-single>
<span class="eyebrow">52</span>Secure paved road · animated
</button>
+ <button class="tab new" data-type="tree-block-decomposition">
+ <span class="eyebrow">53</span>Tree · block decomposition
+ </button>
</div>
<div
diff --git a/skills/diagram-design/references/export-registry.md b/skills/diagram-design/references/export-registry.md
new file mode 100644
index 0000000..b150f0f
--- /dev/null
+++ b/skills/diagram-design/references/export-registry.md
@@ -0,0 +1,78 @@
+# Export block registry (`--registry`)
+
+Emit a machine-readable `.registry.json` sidecar of a Traceable block decomposition diagram's `data-block-*` metadata. **Manual only — never run unprompted, and only on `--registry`.**
+
+## Trigger
+
+Load this file when:
+
+- The user invokes `/diagram-design:export-diagram <html-file> --registry` (alone or combined with `--svg-only`/`--png-only`/`--scale`/`--output`).
+- The user asks in natural language for the block metadata, ID list, registry, or traceability data behind a Traceable block decomposition diagram (see [`semantic-patterns.md` § 8](semantic-patterns.md)) as structured data rather than a picture.
+
+This reference governs `--registry` only. SVG/PNG rasterization is a separate procedure — see [`export.md`](export.md). The two can run in the same command invocation but share no logic; treat this as independent, not an extension of that one.
+
+## Scope
+
+The registry captures exactly what's already authored in the source HTML's `data-block-*` attributes (defined in [`semantic-patterns.md` § 8](semantic-patterns.md)) — nothing more. It is a **projection, not a second source of truth**: every value in the JSON must trace back to an attribute value literally present in the file. This procedure never infers, summarizes, or supplements a block's record from diagram text, node position, or its own judgment.
+
+Applies only to diagrams using the Traceable block decomposition pattern (Tree nodes carrying `data-block-id`). Any other diagram — including a plain Tree diagram not using the pattern — has no blocks to extract; see *Edge cases*.
+
+## JSON schema
+
+```json
+{
+ "source": "example-tree-block-decomposition.html",
+ "blocks": [
+ {
+ "id": "PAY-001",
+ "name": "Payment Gateway",
+ "output": "Settled transaction record",
+ "constraint": "Every transaction reaches exactly one terminal state",
+ "impl": "src/payments/gateway/"
+ },
+ {
+ "id": "PAY-001-01",
+ "parent": "PAY-001",
+ "name": "Card Authorization",
+ "input": "Raw card details from checkout",
+ "output": "Authorization token or decline",
+ "constraint": "Never persists a raw card number",
+ "assumption": "Runs behind the PCI-scoped boundary",
+ "impl": "src/payments/authorization/"
+ }
+ ]
+}
+```
+
+- `source` — basename of the HTML file the registry was generated from.
+- `blocks` — one entry per node carrying `data-block-id`, in document order: the order the matched nodes appear in the source file, never re-sorted by parent. A tree authored row by row (every Tier 1 node, then every Tier 2 node) exports in that row order; only a tree authored depth-first exports depth-first.
+- `id`, `name` — always present; every block in the pattern requires both attributes.
+- `parent` — present only for non-root blocks, mirroring `data-block-parent`'s own absent-means-root convention. Omitted, never `null`, for a root block.
+- `input`, `output`, `constraint`, `assumption`, `impl` — present only when the matching `data-block-*` attribute is present on that node. Omit the key entirely rather than writing an empty string.
+
+No other keys, and no generation timestamp: the registry is meant to be regenerated on demand and diffed in version control, and a live-clock field would make two runs over identical source produce different output. Provenance and dating come from git history, not the file's own content.
+
+## Procedure
+
+1. Read the source HTML file.
+2. Find every element carrying a `data-block-id` attribute. Nodes without it aren't part of the pattern — skip them silently, including in a diagram that mixes pattern and non-pattern Tree nodes.
+3. For each matched node, read `data-block-id`, `data-block-parent`, `data-block-name`, `data-block-input`, `data-block-output`, `data-block-constraint`, `data-block-assumption`, `data-block-impl` — whichever are present. Map `data-block-name` to the JSON key `name`; map the rest by dropping the `data-block-` prefix.
+4. Preserve attribute values verbatim — no trimming beyond surrounding whitespace, no case changes, no re-formatting of the `impl` path.
+5. Assemble the `blocks` array in document order, as defined under *JSON schema* above.
+6. Write to `<basename>.registry.json` next to the source (e.g. `example-tree-block-decomposition.html` → `example-tree-block-decomposition.registry.json`). Honour an explicit `--output` path if the user provided one to the parent export command.
+
+## Edge cases
+
+- **No `data-block-id` attributes anywhere in the source**: refuse and tell the user; don't write an empty `{"blocks": []}` file. This is very likely `--registry` requested on a diagram that doesn't use the pattern at all — say so.
+- **Duplicate `data-block-id` values**: emit every matching entry in document order; don't deduplicate or pick one. A duplicate ID is a correctness problem for `scripts/verify-block-registry.py` to catch, not for export to silently resolve.
+- **`data-block-parent` pointing at an ID absent from the file, or a parent cycle**: emit the data exactly as authored, including the broken or cyclic reference. Same reasoning as duplicates — export mirrors the source; `scripts/verify-block-registry.py` is the structural check, and running it is a separate, explicit step, not implied by `--registry` itself.
+- **Source is `assets/index.html`** (the gallery): refuse, same as the SVG/PNG path — ask which specific diagram file.
+- **`--registry` combined with `--svg-only` or `--png-only`**: independent outputs — produce the registry JSON in addition to whichever raster/vector format was requested. `--registry` has no interaction with `--scale`; it produces no image.
+
+## What this never does
+
+- Validates ID uniqueness, parent resolution, or cycles. That's `scripts/verify-block-registry.py` — run it as its own step, not implied by export.
+- Correlates a block's metadata against its drawn position or connector geometry. Out of scope for the registry entirely, not just deferred — the JSON is a metadata projection, not a geometry audit.
+- Writes a generation timestamp, tool version, or any field not literally sourced from a `data-block-*` attribute.
+- Modifies the source HTML.
+- Auto-emits `.registry.json` without `--registry` explicitly passed. Manual on every call, same as SVG/PNG export.
diff --git a/skills/diagram-design/references/semantic-patterns.md b/skills/diagram-design/references/semantic-patterns.md
index b12e39d..97ae1e0 100644
--- a/skills/diagram-design/references/semantic-patterns.md
+++ b/skills/diagram-design/references/semantic-patterns.md
@@ -15,6 +15,7 @@ Use one primary pattern per figure. A second pattern may supply at most one supp
| Which routes cross a trust boundary and which routes are blocked | **Secure paved road** | Architecture |
| Which controls apply at each enforcement surface | **Governance / control catalog** | Layer stack |
| How defenses reduce risk and what risk remains | **Compensating security layers** | Layer stack |
+| Which sub-elements a system decomposes into, each independently citable and traced to its implementation | **Traceable block decomposition** | Tree |
## 1. Fan-in queue / bottleneck
@@ -114,6 +115,22 @@ Use one primary pattern per figure. A second pattern may supply at most one supp
**Nearest visual type:** **Layer stack**; use **Nested** when containment boundaries, rather than ordered compensation, carry the meaning.
+## 8. Traceable block decomposition
+
+**Selection triggers:** A system or product must decompose into addressable, individually citable sub-elements — each with a stable identifier a reader (or a compliance, audit, or IP record) can point at directly, not a name alone. The reader needs to trace a specific block to its parent, to what it consumes and produces, and to the code that implements it. This describes *structure* (what the system is made of), not a process — for a sequence of actions, choose a pattern that routes to Flowchart or Swimlane instead.
+
+**Required primitives:** A stable dotted ID per block (e.g. `PAY-001-02`), shown as a compact badge using the existing node-box type-tag chip (SKILL.md §6 "Node box — full pattern") — never as a separate connector-adjacent label. A noun-phrase block name — the structural element itself ("Fraud Screening"), not an action performed on it — in the node's existing name slot. Parent-child structure is Tree's own elbow connector; this pattern adds no new connector semantics or connector labels. At most one short inbound and one short outbound flow-port label per block, in the existing Geist Mono sublabel slot, shown only when both fit without crowding the name — omit by default. Every block's full record — inputs, outputs, constraints, assumptions, and an implementation path — lives in `data-block-*` attributes on the node (`data-block-id`, `data-block-parent`, `data-block-name`, and terse `data-block-input` / `-output` / `-constraint` / `-assumption` / `-impl` values) and, for anything longer than a short phrase, in the sidecar registry (see `export-registry.md`) — never as additional visible diagram text.
+
+**Complexity budget:** Tree's own root+3-tier / 5-per-level caps and the global 9-node ceiling apply as-is — this pattern does not raise them. A hierarchy that needs more splits into a linked set of diagrams, one per subsystem, each independently traceable; the sidecar registry is the layer that reassembles the full graph across files. At most one in/out port-label pair per block when shown at all; constraints and assumptions are never rendered as visible text, only carried in metadata.
+
+**Anti-patterns:** Four-sided ICOM boxes with Input/Control/Output/Mechanism arrows on every side — that is IDEF0's grammar, not this pattern's, and it does not fit Tree's connector rules. Drawing input/output arrows between siblings or cousins — that is a dependency graph's job; route to that type instead if cross-block flow must be drawn. Verb-phrase block names — name the structural element, not an action; if a block is genuinely an activity, it likely belongs in a companion Flowchart or Swimlane diagram, not this tree. An ID badge with no matching `data-block-id`, or a rename not mirrored in the registry. Treating the visible diagram as the complete record — it is a bounded view; the registry is the source of truth for anything not drawn. Labeling the tree connector itself with an ID or name — Tree has no connector-label convention today and this pattern must not invent one.
+
+**Static fallback:** This pattern has no animated form — it is always static; bespoke interaction (click-to-expand, filter-by-ID) is out of this skill's scope entirely (see ADR 0001). Every ID badge, block name, and any shown port label must be legible in the single rendered frame.
+
+**Nearest visual type:** **Tree** — Nested's single-chain containment cannot show two children of one parent; Dependency graph permits multi-parent nodes and cycles this pattern must forbid; Architecture's zones are flat, capped at 3, and explicitly route overflow to Swimlane, not to nested grouping.
+
+**A note on provenance, not a claim of compliance:** "block," noun-phrase naming, and "flow port" are SysML Block Definition Diagram vocabulary, used because this pattern documents structure, the thing SysML's naming convention is for (IDEF0's verb-phrase convention documents *functions* instead — the wrong fit here). This is SysML-*informed* vocabulary applied to Tree's existing layout grammar, not a claim of SysML compliance: no OCL constraints, no XMI interchange, no tool-certified conformance, and no IDEF0 compliance either.
+
## Composition rules
- The semantic pattern may specialize status, boundary, queue, or propagation primitives; the selected type still owns page axis, connector grammar, spacing, and type-specific limits.
diff --git a/skills/diagram-design/references/type-tree.md b/skills/diagram-design/references/type-tree.md
index f03baee..e0fd644 100644
--- a/skills/diagram-design/references/type-tree.md
+++ b/skills/diagram-design/references/type-tree.md
@@ -1,6 +1,6 @@
# Tree / Hierarchy
-**Best for:** org charts, dependency trees, taxonomy, file trees, decision breakdowns, skill trees.
+**Best for:** org charts, dependency trees, taxonomy, file trees, decision breakdowns, skill trees. For hierarchical, ID-addressable block decomposition with per-block I/O, constraints, and implementation traceability, load [`semantic-patterns.md`](semantic-patterns.md) § Traceable block decomposition first — it specializes this layout without changing it.
## Layout conventions
- Root at top, children fan out below (or root at left, children to right).