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: add architecture delta diagrams (#241)

Inference_643cd8f87023
diff --git a/.claude-plugin/marketplace.json b/.claude-plugin/marketplace.json
index c52ba92..f67f0c0 100644
--- a/.claude-plugin/marketplace.json
+++ b/.claude-plugin/marketplace.json
@@ -1,7 +1,7 @@
{
"name": "diagram-design",
"metadata": {
- "description": "Architecture, IT current-state, flowchart, sequence, state machine, ER/data model, timeline, swimlane, quadrant, radar/spider, polar chart, loop, nested, tree, org chart, layer stack, Venn, pyramid/funnel, bar, waterfall, treemap, heatmap, line, Gantt, scatter, high-level, process, medallion, data flow, DP integration, DP security matrix, Sankey, fishbone, Wardley map, kanban, user journey, deployment, dependency graph, UML class, story map, database schema, lifecycle phase map, HTML/SVG/PNG."
+ "description": "Architecture, architecture delta, IT current-state, flowchart, sequence, state machine, ER/data model, timeline, swimlane, quadrant, radar/spider, polar chart, loop, nested, tree, org chart, layer stack, Venn, pyramid/funnel, bar, waterfall, treemap, heatmap, line, Gantt, scatter, high-level, process, medallion, data flow, DP integration, DP security matrix, Sankey, fishbone, Wardley map, kanban, user journey, deployment, dependency graph, UML class, story map, database schema, lifecycle phases."
},
"owner": {
"name": "Cathryn Lavery"
diff --git a/.claude-plugin/plugin.json b/.claude-plugin/plugin.json
index eedf4f1..9d3ff2b 100644
--- a/.claude-plugin/plugin.json
+++ b/.claude-plugin/plugin.json
@@ -1,6 +1,6 @@
{
"name": "diagram-design",
- "description": "Create architecture, IT current-state, flowchart, sequence, state machine, ER/data model, timeline, swimlane, quadrant, radar/spider, polar chart, loop, nested, tree, org chart, layer stack, Venn, pyramid/funnel, bar, waterfall, treemap, heatmap, line, Gantt, scatter, high-level, process, medallion, data flow, DP integration, DP security matrix, Sankey, fishbone, Wardley map, kanban, user journey, deployment, dependency graph, UML class, story map, database schema, lifecycle phase maps. SVG/PNG.",
+ "description": "Architecture, architecture delta, IT current-state, flowchart, sequence, state machine, ER/data model, timeline, swimlane, quadrant, radar/spider, polar chart, loop, nested, tree, org chart, layer stack, Venn, pyramid/funnel, bar, waterfall, treemap, heatmap, line, Gantt, scatter, high-level, process, medallion, data flow, DP integration, DP security matrix, Sankey, fishbone, Wardley map, kanban, user journey, deployment, dependency graph, UML class, story map, database schema, lifecycle phases.",
"version": "2.6.47",
"author": {
"name": "Cathryn Lavery",
diff --git a/.codex-plugin/plugin.json b/.codex-plugin/plugin.json
index 85e10e2..1c0b0a6 100644
--- a/.codex-plugin/plugin.json
+++ b/.codex-plugin/plugin.json
@@ -1,6 +1,6 @@
{
"name": "diagram-design",
- "description": "Create architecture, IT current-state, flowchart, sequence, state machine, ER/data model, timeline, swimlane, quadrant, radar/spider, polar chart, loop, nested, tree, org chart, layer stack, Venn, pyramid/funnel, bar, waterfall, treemap, heatmap, line, Gantt, scatter, high-level, process, medallion, data flow, DP integration, DP security matrix, Sankey, fishbone, Wardley map, kanban, user journey, deployment, dependency graph, UML class, story map, database schema, lifecycle phase maps. SVG/PNG.",
+ "description": "Architecture, architecture delta, IT current-state, flowchart, sequence, state machine, ER/data model, timeline, swimlane, quadrant, radar/spider, polar chart, loop, nested, tree, org chart, layer stack, Venn, pyramid/funnel, bar, waterfall, treemap, heatmap, line, Gantt, scatter, high-level, process, medallion, data flow, DP integration, DP security matrix, Sankey, fishbone, Wardley map, kanban, user journey, deployment, dependency graph, UML class, story map, database schema, lifecycle phases.",
"version": "2.6.47",
"author": {
"name": "Cathryn Lavery",
@@ -26,7 +26,7 @@
"interface": {
"displayName": "Diagram Design",
"shortDescription": "Editorial HTML/SVG diagrams",
- "longDescription": "Create branded architecture, IT current-state, flowchart, sequence, state machine, ER/data model, timeline, swimlane, quadrant, radar/spider, polar chart (polar/radial lollipop), loop/flywheel, nested, tree, org chart, layer stack, Venn, pyramid/funnel, treemap, heatmap, bar, waterfall, line, Gantt and scatter charts, high-level, process, medallion, data flow, DP integration, DP security matrix, Sankey, fishbone, Wardley map, kanban, user journey, deployment, dependency graph, UML class, story map, or database schema diagrams as standalone HTML/SVG/PNG. Redraw .drawio/.drawio.png/.drawio.svg, Mermaid .mmd, or Excalidraw .excalidraw sources at a chosen size/detail; onboard brand tokens from a website; add lifecycle phase maps, semantic patterns, callouts, accessible motion, or sketchy/hand-drawn styling.",
+ "longDescription": "Create branded architecture, architecture delta, IT current-state, flowchart, sequence, state machine, ER/data model, timeline, swimlane, quadrant, radar/spider, polar chart (polar/radial lollipop), loop/flywheel, nested, tree, org chart, layer stack, Venn, pyramid/funnel, treemap, heatmap, bar, waterfall, line, Gantt and scatter charts, high-level, process, medallion, data flow, DP integration, DP security matrix, Sankey, fishbone, Wardley map, kanban, user journey, deployment, dependency graph, UML class, story map, or database schema diagrams as standalone HTML/SVG/PNG. Redraw .drawio/.drawio.png/.drawio.svg, Mermaid .mmd, or Excalidraw .excalidraw sources at a chosen size/detail; onboard brand tokens from a website; add lifecycle phase maps, semantic patterns, callouts, accessible motion, or sketchy/hand-drawn styling.",
"developerName": "LittleMight",
"category": "Productivity",
"capabilities": [
diff --git a/.factory-plugin/plugin.json b/.factory-plugin/plugin.json
index eedf4f1..9d3ff2b 100644
--- a/.factory-plugin/plugin.json
+++ b/.factory-plugin/plugin.json
@@ -1,6 +1,6 @@
{
"name": "diagram-design",
- "description": "Create architecture, IT current-state, flowchart, sequence, state machine, ER/data model, timeline, swimlane, quadrant, radar/spider, polar chart, loop, nested, tree, org chart, layer stack, Venn, pyramid/funnel, bar, waterfall, treemap, heatmap, line, Gantt, scatter, high-level, process, medallion, data flow, DP integration, DP security matrix, Sankey, fishbone, Wardley map, kanban, user journey, deployment, dependency graph, UML class, story map, database schema, lifecycle phase maps. SVG/PNG.",
+ "description": "Architecture, architecture delta, IT current-state, flowchart, sequence, state machine, ER/data model, timeline, swimlane, quadrant, radar/spider, polar chart, loop, nested, tree, org chart, layer stack, Venn, pyramid/funnel, bar, waterfall, treemap, heatmap, line, Gantt, scatter, high-level, process, medallion, data flow, DP integration, DP security matrix, Sankey, fishbone, Wardley map, kanban, user journey, deployment, dependency graph, UML class, story map, database schema, lifecycle phases.",
"version": "2.6.47",
"author": {
"name": "Cathryn Lavery",
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 9d775c2..4b99a54 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -400,6 +400,16 @@ jobs:
id: beeswarm_tests
run: python scripts/test-verify-beeswarm.py
+ - name: Verify architecture delta snapshots and ledger
+ if: always()
+ id: architecture_delta
+ run: python scripts/verify-architecture-delta.py --all
+
+ - name: Verify architecture delta checker
+ if: always()
+ id: architecture_delta_tests
+ run: python scripts/test-verify-architecture-delta.py
+
- name: Verify tone claims against the ramps they describe
if: always()
id: skin_polarity
@@ -510,6 +520,8 @@ jobs:
echo "| Bump Checker | ${{ steps.bump_tests.outcome == 'success' && '✅ Passed' || (steps.bump_tests.outcome == 'skipped' && '⏭️ Skipped' || '❌ Failed') }} |" >> $GITHUB_STEP_SUMMARY
echo "| Beeswarm Positions & Packing | ${{ steps.beeswarm.outcome == 'success' && '✅ Passed' || (steps.beeswarm.outcome == 'skipped' && '⏭️ Skipped' || '❌ Failed') }} |" >> $GITHUB_STEP_SUMMARY
echo "| Beeswarm Checker | ${{ steps.beeswarm_tests.outcome == 'success' && '✅ Passed' || (steps.beeswarm_tests.outcome == 'skipped' && '⏭️ Skipped' || '❌ Failed') }} |" >> $GITHUB_STEP_SUMMARY
+ echo "| Architecture Delta Snapshots & Ledger | ${{ steps.architecture_delta.outcome == 'success' && '✅ Passed' || (steps.architecture_delta.outcome == 'skipped' && '⏭️ Skipped' || '❌ Failed') }} |" >> $GITHUB_STEP_SUMMARY
+ echo "| Architecture Delta Checker | ${{ steps.architecture_delta_tests.outcome == 'success' && '✅ Passed' || (steps.architecture_delta_tests.outcome == 'skipped' && '⏭️ Skipped' || '❌ Failed') }} |" >> $GITHUB_STEP_SUMMARY
echo "| Tone Claim vs Ramp Polarity | ${{ steps.skin_polarity.outcome == 'success' && '✅ Passed' || (steps.skin_polarity.outcome == 'skipped' && '⏭️ Skipped' || '❌ Failed') }} |" >> $GITHUB_STEP_SUMMARY
echo "| Skin Polarity Checker | ${{ steps.skin_polarity_tests.outcome == 'success' && '✅ Passed' || (steps.skin_polarity_tests.outcome == 'skipped' && '⏭️ Skipped' || '❌ Failed') }} |" >> $GITHUB_STEP_SUMMARY
echo "| Primitive Icons & Documentation | ${{ steps.icons.outcome == 'success' && '✅ Passed' || (steps.icons.outcome == 'skipped' && '⏭️ Skipped' || '❌ Failed') }} |" >> $GITHUB_STEP_SUMMARY
diff --git a/.maintainer-policy.json b/.maintainer-policy.json
index 873cca6..55cee75 100644
--- a/.maintainer-policy.json
+++ b/.maintainer-policy.json
@@ -72,6 +72,8 @@
"python3 scripts/test-export-svg-standalone.py",
"python3 scripts/verify-geometry.py --all",
"python3 scripts/test-verify-geometry.py",
+ "python3 scripts/verify-architecture-delta.py --all",
+ "python3 scripts/test-verify-architecture-delta.py",
"python3 scripts/verify-block-registry.py --all",
"python3 scripts/test-verify-block-registry.py",
"python3 scripts/verify-treemap.py --all",
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 245df50..44bf79a 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -8,7 +8,7 @@ Please read [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md) first. All contributions ar
## What this project is
-Diagram Design is an agent skill (Claude Code, Codex, Factory Droid, Pi) that produces editorial-quality diagrams as self-contained HTML files. The repo is documentation-first: `skills/diagram-design/SKILL.md` is the index, each of the 41 visual types has its own reference file, and the extractor scripts in `skills/diagram-design/scripts/` turn draw.io, Mermaid, and Excalidraw sources into a structured IR.
+Diagram Design is an agent skill (Claude Code, Codex, Factory Droid, Pi) that produces editorial-quality diagrams as self-contained HTML files. The repo is documentation-first: `skills/diagram-design/SKILL.md` is the index, each of the 42 visual types has its own reference file, and the extractor scripts in `skills/diagram-design/scripts/` turn draw.io, Mermaid, and Excalidraw sources into a structured IR.
See [README.md](README.md) for the full picture, including the design system and the import/export flows.
@@ -62,6 +62,8 @@ Every validation gate below must pass before a PR is ready. They also run automa
| Standalone SVG export carries CSS and namespaces defs IDs | `python3 scripts/test-export-svg-standalone.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` |
+| Architecture delta snapshots preserve identity, ledger coverage, signatures, positions, and relationship endpoints | `python3 scripts/verify-architecture-delta.py --all` |
+| Architecture delta checker behaves (pass + adversarial cases) | `python3 scripts/test-verify-architecture-delta.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` |
@@ -144,6 +146,8 @@ python3 scripts/test-plugin-package.py \
&& python3 scripts/test-export-svg-standalone.py \
&& python3 scripts/verify-geometry.py --all \
&& python3 scripts/test-verify-geometry.py \
+ && python3 scripts/verify-architecture-delta.py --all \
+ && python3 scripts/test-verify-architecture-delta.py \
&& python3 scripts/verify-block-registry.py --all \
&& python3 scripts/test-verify-block-registry.py \
&& python3 scripts/verify-treemap.py --all \
@@ -177,7 +181,7 @@ python3 scripts/test-plugin-package.py \
- **`verify-plugin-package.py`:** if it reports a version change, drop the manifest edits from your branch — versions are bumped on `main` after merge, never in a PR. If packaging validation fails, keep all native marketplaces pointed at the repository root and keep the shared skill at `skills/diagram-design/SKILL.md`.
- **`lint-skin.py`:** the failure message names the file, line, and category (`color`, `font-family`, `a11y`, `external-asset`, `pure-black`, `script`). Colors must come from the palette in `skills/diagram-design/references/style-guide.md`; fonts from the allowed list; diagrams must satisfy the accessible SVG contract (see below). The linter also requires the SHA-pinned controller from `template-motion.html` verbatim and rejects remote resources, CSS `@import`, non-fragment CSS `url()`, event handlers, `srcdoc`, executable URLs, and extra scripts.
- **`verify-*.py`:** the extractor's real behavior no longer matches its fixture or the documentation, or the reference/command/prompt wiring drifted. Fix the source of truth — do not widen a test to avoid a failure.
-- **`verify-screenshot-freshness.py`:** a canonical minimal-light example or its committed PNG changed without a synchronized catalog refresh. Before the first regeneration, install the renderer with `python3 -m pip install playwright && python3 -m playwright install chromium`. Then run `python3 scripts/render-canonical-screenshots.py`, inspect all 40 renders, and commit the updated PNGs plus `docs/screenshots/manifest.json`. The gate hashes example sources in their canonical LF form, so a checkout that converts LF to CRLF still passes; `scripts/test-verify-screenshot-freshness.py` covers that case, real source drift, and raw PNG digests.
+- **`verify-screenshot-freshness.py`:** a canonical minimal-light example or its committed PNG changed without a synchronized catalog refresh. Before the first regeneration, install the renderer with `python3 -m pip install playwright && python3 -m playwright install chromium`. Then run `python3 scripts/render-canonical-screenshots.py`, inspect all 42 renders, and commit the updated PNGs plus `docs/screenshots/manifest.json`. The gate hashes example sources in their canonical LF form, so a checkout that converts LF to CRLF still passes; `scripts/test-verify-screenshot-freshness.py` covers that case, real source drift, and raw PNG digests.
- **`build-readme-thumbs.py --check`:** a README preview is missing, stale, corrupt, the wrong size, orphaned, or no longer links to its full PNG. Install the pinned renderer with `python3 -m pip install Pillow==12.1.1`, run `python3 scripts/build-readme-thumbs.py`, inspect the preview changes, and commit the WebPs plus `docs/screenshots/thumbs/manifest.json`.
- **`verify-marimekko.py`:** a column is drawn off its category's share of the width, a segment off its series' share of the column, the columns do not share one plot height or one gutter, segments leave a gap or overlap, a series changes order between columns, a second segment wears the accent, anything positions a segment or a bound label from a `transform` attribute, an inline `style`, or a `<style>` rule, or a label, caption or key disagrees with the rect it binds. Fix the geometry or the declaration so they state one thing — never widen a column or pad a segment to fit a label, and never drop a category or a series to tidy the grid.
- **`verify-slopegraph.py`:** the two axes disagree about scale or origin, or an endpoint is drawn somewhere other than where its own declared value belongs. Fix the coordinate, never the label — and never move a point to stop two endpoint labels colliding, because crowded labels mean the values really are close.
@@ -188,6 +192,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-architecture-delta.py`:** a stable ID, snapshot membership, status, signature, position, endpoint, or ledger target disagrees with the declared migration. Follow `type-architecture-delta.md`: record every changed object in the center ledger, retain unchanged positions on matching grids, and distinguish CHANGED, MOVED, and REWIRED by what actually differs. Fix the diagram and metadata together; never suppress the ledger entry to hide an unaccounted change.
- **`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.
diff --git a/README.md b/README.md
index 91d6185..2ffa8a2 100644
--- a/README.md
+++ b/README.md
@@ -105,12 +105,14 @@ Every visual type ships in three static variants: minimal light, minimal dark, a
</tr>
<tr>
<td align="center" width="33%"><a href="docs/screenshots/waterfall.png"><img src="docs/screenshots/thumbs/waterfall.webp" alt="Waterfall"></a><br><b>Waterfall</b><br><sub>Running total + signed bridges</sub></td>
- <td align="center" width="33%"></td>
+ <td align="center" width="33%"><a href="docs/screenshots/architecture-delta.png"><img src="docs/screenshots/thumbs/architecture-delta.webp" alt="Architecture delta"></a><br><b>Architecture delta</b><br><sub>Before · Changes · After topology</sub></td>
<td align="center" width="33%"></td>
</tr>
</table>
-The v2.5.10 release added the final ten types above. Compare their light, dark, and full-editorial variants in the [30-variant contact sheet](.github/pr-previews/editorial-diagrams-2.5.10.jpg).
+Architecture delta compares synchronized topologies through a Before · Changes · After ledger of added, removed, changed, moved, and rewired objects. See its [reference](skills/diagram-design/references/type-architecture-delta.md) and [order-fulfilment example](skills/diagram-design/assets/example-architecture-delta.html). Attribute-only comparisons remain tables; a single snapshot uses Architecture.
+
+The v2.5.10 release added ten layout grammars. Compare their light, dark, and full-editorial variants in the [30-variant contact sheet](.github/pr-previews/editorial-diagrams-2.5.10.jpg).
**Browse the live gallery:** [cathrynlavery.github.io/diagram-design](https://cathrynlavery.github.io/diagram-design/) — or open [`skills/diagram-design/assets/index.html`](skills/diagram-design/assets/index.html) locally to flip through every diagram with light / dark / full-editorial tabs.
@@ -428,6 +430,7 @@ diagram-design/
│ │ ├── export.md — SVG / PNG export + sizing
│ │ ├── export-registry.md — block-metadata JSON sidecar export
│ │ ├── type-architecture.md
+│ │ ├── type-architecture-delta.md
│ │ ├── type-flowchart.md
│ │ ├── type-sequence.md
│ │ ├── type-state.md
@@ -573,6 +576,7 @@ At startup, the agent sees only the skill name and description. When a request m
|---|---|
| "Make me a flowchart" | `SKILL.md` + `references/type-flowchart.md` |
| "Build an architecture diagram" | `SKILL.md` + `references/type-architecture.md` |
+| "Show what was added, removed, changed, moved, or rewired in this migration" | `SKILL.md` + `references/type-architecture-delta.md` |
| "Compare why these two policy requests differ" | `SKILL.md` + `references/semantic-patterns.md` + `references/type-flowchart.md` |
| "Animate that policy trace" | Prior selection + `references/animation.md` |
| "Onboard this skill to my site" | `SKILL.md` + `references/onboarding.md` + `references/style-guide.md` |
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 888daca..da17612 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
@@ -32,4 +32,6 @@ Behavior is a separate axis. The semantic patterns in `references/semantic-patte
**2026-09-19 — the count is 41.** Heatmap was admitted under the same escape clause: a rectangular grid of cells where fill opacity encodes a quantitative value across two categorical axes is a layout grammar no existing type provides (bar encodes with length along one axis, scatter with position on two quantitative axes, treemap with area). It shipped the full §10 set (three example variants, type reference, verifier, adversarial tests, gallery tab), and the two counters named above moved 40 → 41 together with the prose; it merged after Waterfall, which had already taken 40.
+**2026-09-29 — the count is 42.** Synchronized Before · Changes · After topologies with stable identities and an exact change ledger constitute a new layout grammar under the same escape clause. It ships the full §10 set and moves the canonical counters 41 → 42 together; see [ADR 0012](0012-architecture-delta.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/0012-architecture-delta.md b/docs/adr/0012-architecture-delta.md
new file mode 100644
index 0000000..32dc316
--- /dev/null
+++ b/docs/adr/0012-architecture-delta.md
@@ -0,0 +1,40 @@
+# ADR 0012 — Architecture delta synchronizes two topologies and their change ledger
+
+**Status:** accepted
+
+## Context
+
+[Issue #227](https://github.com/cathrynlavery/diagram-design/issues/227) asks for structural change between two system snapshots: added, removed, changed, moved, and rewired objects. ADR 0002 permits a new visual type only when its layout grammar is new.
+
+Architecture arranges one topology; it has no rule preserving identity or coordinates across two states. A comparison table aligns attributes but does not constrain nodes and relationships. Sequence and Timeline explain order in time rather than two matched topologies. A semantic overlay on any one of these would leave the essential synchronization unspecified.
+
+The new grammar is **Before · Changes · After**: two equal local grids joined by an exact, object-addressable change ledger. The unchanged positions and stable identities are part of what the drawing asserts, rather than optional editorial choices.
+
+## Decision
+
+Add **Architecture delta** as a canonical visual type with a routed reference, three order-fulfilment example variants, gallery entry, selection and budget rows, discovery hooks, canonical screenshot and thumbnail, and an executable public HTML contract. Counts move together with the current canonical catalog. The issue's requested merge sequencing behind Heatmap #164 and Unit grid #198 remains a release-integration concern; this decision does not claim those types have already landed or reserve their ordinal positions.
+
+The contract uses one `svg[data-diagram="architecture-delta"]`, two `g[data-snapshot]` groups, and matching `data-grid` declarations. Only snapshot groups may translate geometry, establishing panel origins while preserving directly comparable local component positions. Every component group and relationship path carries a stable `data-object-id`, a `data-kind`, a nonempty `data-signature`, and explicit `data-status` tokens. Components expose their actual rectangle through `data-role="bounds"`; relationships declare ordered `data-from` / `data-to` IDs and draw endpoints on those components' perimeters.
+
+Status describes a difference, not an author-selected decoration:
+
+- **ADDED** and **REMOVED** follow actual membership in After and Before respectively.
+- **CHANGED** requires different semantic signatures on the retained ID.
+- **MOVED** requires different local x/y coordinates on a retained component.
+- **REWIRED** requires a different ordered endpoint pair on a retained relationship.
+- **Unchanged** preserves the applicable semantic and geometric values. A path may reroute to follow a moved endpoint component without changing relationship identity or connectivity.
+
+A retained object uses the same status set in both snapshots. `changed moved` and `changed rewired` are permitted combinations; presence/absence states and `unchanged` are exclusive. Each declared difference has exactly one visible ledger text entry keyed by `(data-target, data-change)`. A two-change object has two ledger entries. The budget is eight unique components, ten unique relationships, and eight ledger entries across the entire comparison.
+
+Text plus shape/dash differences carries each state; color is secondary and the existing skin's accent remains editorial. No new status palette or exceptions to the accessible SVG contract are introduced.
+
+`scripts/verify-architecture-delta.py` enforces the contract with the stdlib HTML parser. The parser recognizes real attributes and inherited snapshot membership rather than searching tag strings. It fails closed on malformed/empty declarations, ambiguous membership, duplicate identity or metadata, unsupported transforms, non-finite geometry, hidden/nonrendering metadata carriers, missing or extra ledger coverage, and inconsistent signatures, positions, or endpoints. `scripts/test-verify-architecture-delta.py` includes valid alternate grids and panel origins, composite changes, all three shipped variants, and adversarial cases for every differential rule, in the spirit of ADR 0005.
+
+## Consequences
+
+- Adding this grammar requires the complete new-type shipping set and synchronized catalog/count changes; it does not expand the semantic-pattern count.
+- Matching positions mean an author cannot independently tidy either topology after comparison. A real relocation needs an explicit `MOVED` record.
+- A semantic signature is an authored canonical description, not a hash of SVG markup. It excludes layout, styling, snapshot, status, identity, and endpoints so that separate change categories remain meaningful.
+- The verifier establishes internal agreement, not the truth of an external system. It cannot infer whether an author omitted a real component or lied in a signature. Labels, redundant status treatments, intermediate connector clearance, complex CSS/rendering behavior, and desktop/mobile readability still need the existing lint/render gates and visual review.
+- The SKILL.md byte cap remains 40,000 bytes with at least 500 bytes of headroom for this addition. Detailed contract prose belongs in the routed reference, preserving trigger vocabulary in the index.
+- Manifest versions stay untouched; the eventual release uses the existing automated release process. No dependency's unmerged ordinal or version is fabricated to make this addition appear integrated ahead of its requested sequence.
diff --git a/docs/screenshots/architecture-delta.png b/docs/screenshots/architecture-delta.png
new file mode 100644
index 0000000..25fe98d
Binary files /dev/null and b/docs/screenshots/architecture-delta.png differ
diff --git a/docs/screenshots/manifest.json b/docs/screenshots/manifest.json
index 5a08556..936ccae 100644
--- a/docs/screenshots/manifest.json
+++ b/docs/screenshots/manifest.json
@@ -20,6 +20,15 @@
"width": 2400,
"height": 1154
},
+ {
+ "slug": "architecture-delta",
+ "source": "skills/diagram-design/assets/example-architecture-delta.html",
+ "screenshot": "docs/screenshots/architecture-delta.png",
+ "source_sha256": "a8b9b1e1f27caba825f5335e1026dec2f32deb60c7e3a83730bc2183aaf56b52",
+ "screenshot_sha256": "f7c4dbfd20d85cd426a32a368664416d6260f7878c6f7920e6a2724271bbf185",
+ "width": 2400,
+ "height": 1362
+ },
{
"slug": "it-state",
"source": "skills/diagram-design/assets/example-it-state.html",
diff --git a/docs/screenshots/thumbs/architecture-delta.webp b/docs/screenshots/thumbs/architecture-delta.webp
new file mode 100644
index 0000000..85c164f
Binary files /dev/null and b/docs/screenshots/thumbs/architecture-delta.webp differ
diff --git a/docs/screenshots/thumbs/manifest.json b/docs/screenshots/thumbs/manifest.json
index 900c73b..f668aa9 100644
--- a/docs/screenshots/thumbs/manifest.json
+++ b/docs/screenshots/thumbs/manifest.json
@@ -6,6 +6,15 @@
"resample": "LANCZOS"
},
"entries": [
+ {
+ "thumb": "architecture-delta.webp",
+ "source": "docs/screenshots/architecture-delta.png",
+ "source_sha256": "f7c4dbfd20d85cd426a32a368664416d6260f7878c6f7920e6a2724271bbf185",
+ "width": 600,
+ "height": 340,
+ "quality": 82,
+ "thumb_sha256": "d72f3048c14d0d23c99a5a18daab4dbe2aa5367c6c468124889160151c182d71"
+ },
{
"thumb": "architecture.webp",
"source": "docs/screenshots/architecture.png",
diff --git a/scripts/build-readme-thumbs.py b/scripts/build-readme-thumbs.py
index ffdfe54..e849f29 100644
--- a/scripts/build-readme-thumbs.py
+++ b/scripts/build-readme-thumbs.py
@@ -4,7 +4,7 @@ README.md renders the screenshots in `docs/screenshots/`. The originals are
2400-2800px wide because they are the artifacts people download and inspect,
but the README grid paints them at 252 CSS px and the three inline figures at
838 CSS px. Serving the originals means several MB and hundreds of MB of
-decoded bitmap for one page of thumbnails, and a burst of 40 oversized
+decoded bitmap for one page of thumbnails, and a burst of oversized
requests loses races: individual previews stall in flight and paint blank with
no broken-image icon.
diff --git a/scripts/render-canonical-screenshots.py b/scripts/render-canonical-screenshots.py
index feaff52..540bbc7 100644
--- a/scripts/render-canonical-screenshots.py
+++ b/scripts/render-canonical-screenshots.py
@@ -1,5 +1,5 @@
#!/usr/bin/env python3
-"""Render the 41 canonical minimal-light examples and record their digests."""
+"""Render the 42 canonical minimal-light examples and record their digests."""
from __future__ import annotations
@@ -22,8 +22,8 @@ from screenshot_catalog import (
def main() -> int:
slugs = canonical_slugs()
- if len(slugs) != 41 or len(slugs) != len(set(slugs)):
- raise SystemExit(f"expected 41 unique canonical types; found {len(slugs)}")
+ if len(slugs) != 42 or len(slugs) != len(set(slugs)):
+ raise SystemExit(f"expected 42 unique canonical types; found {len(slugs)}")
SCREENSHOT_DIR.mkdir(parents=True, exist_ok=True)
entries: list[dict[str, object]] = []
@@ -57,7 +57,7 @@ def main() -> int:
"height": height,
}
)
- print(f"[{index:02d}/41] {slug}: {width}x{height}")
+ print(f"[{index:02d}/{len(slugs)}] {slug}: {width}x{height}")
browser.close()
payload = {
diff --git a/scripts/test-maintainer-policy.py b/scripts/test-maintainer-policy.py
index 043c5b7..010f678 100644
--- a/scripts/test-maintainer-policy.py
+++ b/scripts/test-maintainer-policy.py
@@ -69,6 +69,8 @@ REQUIRED_COMMANDS = {
"python3 scripts/test-verify-beeswarm.py",
"python3 scripts/verify-skin-polarity.py --all",
"python3 scripts/test-verify-skin-polarity.py",
+ "python3 scripts/verify-architecture-delta.py --all",
+ "python3 scripts/test-verify-architecture-delta.py",
"python3 scripts/lint-render.py --self-test",
"python3 scripts/lint-render.py --all",
}
diff --git a/scripts/test-verify-architecture-delta.py b/scripts/test-verify-architecture-delta.py
new file mode 100644
index 0000000..738b124
--- /dev/null
+++ b/scripts/test-verify-architecture-delta.py
@@ -0,0 +1,334 @@
+#!/usr/bin/env python3
+"""Adversarial and legal Architecture delta fixtures (ADR 0005).
+
+Synthetic fixtures exercise the public contract independently of the shipped
+layout; all three published variants and CLI discovery are checked as well.
+Run: python3 scripts/test-verify-architecture-delta.py
+"""
+
+from __future__ import annotations
+
+import importlib.util
+import os
+import subprocess
+import sys
+import tempfile
+import unittest
+from pathlib import Path
+
+ROOT = Path(__file__).resolve().parent.parent
+CHECKER = ROOT / "scripts/verify-architecture-delta.py"
+SPEC = importlib.util.spec_from_file_location("architecture_delta_verifier", CHECKER)
+checker = importlib.util.module_from_spec(SPEC)
+sys.modules[SPEC.name] = checker
+SPEC.loader.exec_module(checker)
+
+
+def component(identity, status, signature, x, y, size=40):
+ return (f'<g data-kind="component" data-object-id="{identity}" data-status="{status}" '
+ f'data-signature="{signature}"><rect data-role="bounds" x="{x}" y="{y}" '
+ f'width="{size}" height="{size}"/><text>{identity}</text></g>')
+
+
+def relationship(identity, status, source, target, path, signature="message:v1"):
+ return (f'<path data-kind="relationship" data-object-id="{identity}" data-status="{status}" '
+ f'data-signature="{signature}" data-from="{source}" data-to="{target}" d="{path}"/>')
+
+
+def fixture(pitch=4):
+ """All five change kinds, seven ledger entries, and a rerouted stable edge."""
+ parts = ['<html><head><style>svg {width:100%;height:auto} body {margin:0}</style></head><body>',
+ '<svg data-diagram="architecture-delta" viewBox="0 0 760 180">']
+ for state, origin in (("before", 0), ("after", 500)):
+ after = state == "after"
+ parts.append(f'<g data-snapshot="{state}" data-grid="240 160 {pitch}" transform="translate({origin} 0)">')
+ parts.append(relationship("request", "unchanged", "client", "api", "M40 20 H80"))
+ parts.append(relationship("submit", "rewired", "api", "queue" if after else "old", "M120 20 H160"))
+ parts.append(relationship("queued" if after else "delivery", "added" if after else "removed",
+ "queue" if after else "old", "worker", f'M180 40 V60 H{100 if after else 20} V80'))
+ parts.append(relationship("write", "unchanged", "worker", "db", f'M{120 if after else 40} 100 H160'))
+ parts.append(component("client", "unchanged", "web:v1", 0, 0))
+ parts.append(component("api", "changed", "api:v2" if after else "api:v1", 80, 0))
+ parts.append(component("queue" if after else "old", "added" if after else "removed", "dispatch:v1", 160, 0))
+ parts.append(component("worker", "moved", "worker:v1", 80 if after else 0, 80))
+ parts.append(component("db", "unchanged", "db:v1", 160, 80))
+ parts.append('</g>')
+ for index, (change, target) in enumerate((
+ ("REMOVED", "old"), ("ADDED", "queue"), ("CHANGED", "api"), ("MOVED", "worker"),
+ ("REWIRED", "submit"), ("REMOVED", "delivery"), ("ADDED", "queued"),
+ )):
+ parts.append(f'<text data-change="{change}" data-target="{target}" x="280" y="{20 + index * 20}">'
+ f'{change} {target}: migration detail</text>')
+ parts.append('</svg></body></html>')
+ return "\n".join(parts)
+
+
+GOOD = fixture()
+SYNTHETIC_PATH = Path("synthetic-architecture-delta.html")
+
+
+class ContractTests(unittest.TestCase):
+ def clean(self, source):
+ self.assertEqual(checker.check_source(SYNTHETIC_PATH, source), [])
+
+ def rejects(self, source, reason):
+ self.assertNotEqual(source, GOOD, "fixture mutation did not apply")
+ findings = checker.check_source(SYNTHETIC_PATH, source)
+ self.assertTrue(findings, "invalid diagram accepted")
+ self.assertIn(reason, "\n".join(findings))
+
+ def test_synthetic_and_alternate_pitch(self):
+ self.clean(GOOD)
+ self.clean(fixture(pitch=8))
+
+ def test_alternate_panel_translation_is_not_a_move(self):
+ self.clean(GOOD.replace('translate(0 0)', 'translate(20, 40)').replace('translate(500 0)', 'translate(540, 40)'))
+
+ def test_comments_entities_and_tspans(self):
+ source = GOOD.replace('</svg>', '<!-- <g data-object-id="bogus"/> --></svg>')
+ source = source.replace('web:v1', 'web:&gt;v1')
+ source = source.replace('ADDED queue: migration detail', '<tspan>ADDED</tspan><tspan> queue: migration detail</tspan>')
+ self.clean(source)
+
+ def test_unquoted_attributes_and_number_syntax(self):
+ self.clean(GOOD.replace('data-status="unchanged"', 'DATA-STATUS=unchanged').replace('x="80"', "x='8.e1'"))
+
+ def test_changed_and_moved_together(self):
+ source = GOOD.replace('data-object-id="worker" data-status="moved"', 'data-object-id="worker" data-status="changed moved"')
+ # Only the after occurrence receives a new semantic signature.
+ before, after = source.split('data-snapshot="after"', 1)
+ after = after.replace('data-signature="worker:v1"', 'data-signature="worker:v2"', 1)
+ source = before + 'data-snapshot="after"' + after
+ source = source.replace('</svg>', '<text data-change="CHANGED" data-target="worker">CHANGED worker version</text></svg>')
+ self.clean(source)
+
+ def test_changed_and_rewired_together(self):
+ source = GOOD.replace('data-object-id="submit" data-status="rewired"', 'data-object-id="submit" data-status="changed rewired"')
+ before, after = source.split('data-snapshot="after"', 1)
+ after = after.replace('data-object-id="submit" data-status="changed rewired" data-signature="message:v1"',
+ 'data-object-id="submit" data-status="changed rewired" data-signature="message:v2"')
+ source = before + 'data-snapshot="after"' + after
+ source = source.replace('</svg>', '<text data-change="CHANGED" data-target="submit">CHANGED transport version</text></svg>')
+ self.clean(source)
+
+ def test_curved_orthogonal_path(self):
+ self.clean(GOOD.replace('M180 40 V60 H20 V80', 'M180 40 V52 Q180 60 172 60 H28 Q20 60 20 68 V80'))
+
+ def test_empty_and_missing_declarations(self):
+ for attribute, value, reason in (
+ ('data-object-id', 'client', 'data-object-id'),
+ ('data-kind', 'component', 'data-kind'),
+ ('data-status', 'unchanged', 'data-status'),
+ ('data-signature', 'web:v1', 'data-signature'),
+ ):
+ for replacement in ('', f'{attribute}=""', attribute):
+ with self.subTest(attribute=attribute, replacement=replacement):
+ self.rejects(GOOD.replace(f'{attribute}="{value}"', replacement, 1), reason)
+
+ def test_duplicate_object_id(self):
+ self.rejects(GOOD.replace('data-object-id="client"', 'data-object-id="api"', 1), 'duplicate object ID')
+
+ def test_path_metadata_cannot_disappear(self):
+ original = relationship('request', 'unchanged', 'client', 'api', 'M40 20 H80')
+ self.rejects(GOOD.replace(original, '<path d="M40 20 H80"/>'), 'missing relationship metadata')
+ self.rejects(GOOD.replace('<text>client</text></g>', '<text>client</text></g><path d="M40 20 H80"/>', 1), 'missing relationship metadata')
+
+ def test_duplicate_attribute(self):
+ self.rejects(GOOD.replace('data-object-id="client"', 'data-object-id="client" DATA-OBJECT-ID="ignored"', 1), 'duplicate attributes')
+
+ def test_whitespace_and_multiple_ids(self):
+ for value in (' client', 'client ', 'client api', '12client'):
+ self.rejects(GOOD.replace('data-object-id="client"', f'data-object-id="{value}"', 1), 'data-object-id')
+
+ def test_wrong_or_duplicate_statuses(self):
+ for value in ('UNCHANGED', 'moved moved', 'unchanged moved', 'added changed', 'unknown', 'rewired'):
+ with self.subTest(value=value):
+ self.rejects(GOOD.replace('data-object-id="client" data-status="unchanged"', f'data-object-id="client" data-status="{value}"', 1), 'status')
+
+ def test_relationship_cannot_be_moved(self):
+ self.rejects(GOOD.replace('data-object-id="write" data-status="unchanged"', 'data-object-id="write" data-status="moved"', 1), 'data-status')
+
+ def test_added_removed_membership(self):
+ for old, new, reason in (
+ ('data-object-id="queue" data-status="added"', 'data-object-id="queue" data-status="removed"', 'after-only'),
+ ('data-object-id="old" data-status="removed"', 'data-object-id="old" data-status="added"', 'before-only'),
+ ('data-object-id="client" data-status="unchanged"', 'data-object-id="client" data-status="added"', 'retained statuses'),
+ ):
+ self.rejects(GOOD.replace(old, new), reason)
+
+ def test_missing_snapshot_membership(self):
+ extra = component('outsider', 'added', 'extra:v1', 0, 0)
+ self.rejects(GOOD.replace('</svg>', extra + '</svg>'), 'exactly one snapshot')
+
+ def test_nested_snapshot_and_object(self):
+ self.rejects(GOOD.replace('data-snapshot="before"', 'data-snapshot="before"').replace(
+ '<g data-kind="component" data-object-id="client"', '<g data-snapshot="after"><g data-kind="component" data-object-id="client"', 1), 'exactly two snapshots')
+ nested = component('nested', 'added', 'extra:v1', 0, 0)
+ self.rejects(GOOD.replace('<text>client</text>', nested + '<text>client</text>', 1), 'cannot be nested')
+
+ def test_missing_root_and_snapshots(self):
+ self.rejects(GOOD.replace('data-diagram="architecture-delta"', ''), 'exactly one svg')
+ self.rejects(GOOD.replace('data-snapshot="before"', 'data-snapshot="past"'), 'exactly two snapshots')
+ self.rejects('<svg data-diagram="architecture-delta"></svg>', 'exactly two snapshots')
+
+ def test_malformed_markup(self):
+ self.rejects(GOOD.replace('</g>', '</path>', 1), 'malformed SVG')
+ self.rejects(GOOD.replace('</svg></body></html>', ''), 'unclosed SVG')
+
+ def test_retained_kind_mismatch(self):
+ replacement = relationship('client', 'unchanged', 'api', 'db', 'M100 40 V60 H180 V80', signature='web:v1')
+ source = GOOD.replace(component('client', 'unchanged', 'web:v1', 0, 0), replacement, 1)
+ self.rejects(source, 'changed kind')
+
+ def test_changed_signatures_both_directions(self):
+ self.rejects(GOOD.replace('api:v2', 'api:v1'), 'CHANGED signature mismatch')
+ self.rejects(GOOD.replace('web:v1', 'web:v2', 1), 'CHANGED signature mismatch')
+
+ def test_move_both_directions(self):
+ self.rejects(GOOD.replace(component('worker', 'moved', 'worker:v1', 80, 80), component('worker', 'moved', 'worker:v1', 0, 80)), 'MOVED position mismatch')
+ self.rejects(GOOD.replace(component('client', 'unchanged', 'web:v1', 0, 0), component('client', 'unchanged', 'web:v1', 4, 0), 1), 'MOVED position mismatch')
+
+ def test_size_cannot_change_silently(self):
+ self.rejects(GOOD.replace('width="40"', 'width="44"', 1), 'size changed without CHANGED')
+
+ def test_rewire_both_directions(self):
+ self.rejects(GOOD.replace('data-object-id="submit" data-status="rewired"', 'data-object-id="submit" data-status="unchanged"'), 'REWIRED endpoints mismatch')
+ self.rejects(GOOD.replace('data-object-id="request" data-status="unchanged"', 'data-object-id="request" data-status="rewired"'), 'REWIRED endpoints mismatch')
+
+ def test_missing_and_dangling_endpoints(self):
+ for value in ('missing', '', 'request', 'old'):
+ self.rejects(GOOD.replace('data-to="queue"', f'data-to="{value}"'), 'endpoint')
+ self.rejects(GOOD.replace('data-to="api"', '', 1), 'endpoint ID')
+
+ def test_drawn_endpoints_match_declared_nodes(self):
+ for path in ('M40 20 H72', 'M48 20 H80', 'M20 20 H100', 'M40 20 H160'):
+ self.rejects(GOOD.replace('M40 20 H80', path, 1), 'perimeter')
+
+ def test_matching_grids(self):
+ self.rejects(GOOD.replace('data-grid="240 160 4"', 'data-grid="248 160 4"', 1), 'grids must match')
+ for value in ('', '240 160', '240 160 0', '240 160 -4', '240 160 NaN', '240 160 3', '1e309 160 4', '240 160 1e-309'):
+ self.rejects(GOOD.replace('data-grid="240 160 4"', f'data-grid="{value}"', 1), 'data-grid')
+
+ def test_bounds_are_finite_positive_in_grid(self):
+ for old, new in (('width="40"', 'width="0"'), ('width="40"', 'width="-4"'),
+ ('x="80"', 'x="81"'), ('x="80"', 'x="240"'),
+ ('x="80"', 'x="NaN"'), ('y="80"', 'y="1e999"'), ('x="80"', '')):
+ self.rejects(GOOD.replace(old, new, 1), 'component bounds')
+
+ def test_bounds_declared_once_on_direct_rect(self):
+ self.rejects(GOOD.replace('data-role="bounds"', '', 1), 'direct rect')
+ self.rejects(GOOD.replace('<rect data-role="bounds"', '<ellipse data-role="bounds"', 1), 'direct rect')
+ self.rejects(GOOD.replace('<text>client</text>', '<rect data-role="bounds"/><text>client</text>', 1), 'direct rect')
+ self.rejects(GOOD.replace('</svg>', '<rect data-role="bounds"/></svg>'), 'direct child of a component')
+
+ def test_panel_transform_and_order(self):
+ for value in ('', 'scale(2)', 'translate(500 0) scale(2)', 'translate(NaN 0)', 'translate(500 4)', 'translate(200 0)'):
+ self.rejects(GOOD.replace('translate(500 0)', value), 'panel' if value in ('translate(500 4)', 'translate(200 0)') else 'translat')
+ self.rejects(GOOD.replace('data-object-id="client"', 'transform="translate(4 0)" data-object-id="client"', 1), 'only snapshot translations')
+
+ def test_css_geometry_overrides(self):
+ for declaration in ('transform:translateX(4px)', 'translate:4px 0', 'x:4px', 'width:80px', 'height:80px'):
+ self.rejects(GOOD.replace('<rect data-role="bounds"', f'<rect style="{declaration}" data-role="bounds"', 1), 'CSS geometry')
+ self.rejects(GOOD.replace('</style>', f'rect {{{declaration}}}</style>'), 'CSS geometry')
+ self.rejects(GOOD.replace('</style>', r'rect {tr\61nsform:translateX(4px)}</style>'), 'escaped CSS')
+ for declaration in ('/**/transform:translate(32px,0)', r'tr\61nsform:translate(32px,0)',
+ '/**/width:20px', r'w\69 dth:20px'):
+ self.rejects(GOOD.replace('<rect data-role="bounds"', f'<rect style="{declaration}" data-role="bounds"', 1), 'CSS')
+
+ def test_hidden_metadata_carriers(self):
+ for attribute in ('display="none"', 'visibility="hidden"', 'opacity="0"', 'hidden', 'aria-hidden="true"',
+ 'style="/**/display:none !important"', 'style="opacity:0%"', 'style="visibility:collapse"'):
+ self.rejects(GOOD.replace('data-object-id="client"', f'{attribute} data-object-id="client"', 1), 'must not be hidden')
+ self.rejects(GOOD.replace('data-change="ADDED"', f'{attribute} data-change="ADDED"', 1), 'must not be hidden')
+ for rule in ('g {display:none}', '[data-change] {visibility:hidden}', 'rect {opacity:0}'):
+ self.rejects(GOOD.replace('</style>', rule + '</style>'), 'CSS must not hide')
+ self.clean(GOOD.replace('</style>', '.scroll-hint {display:none}</style>'))
+
+ def test_nonrendering_metadata(self):
+ original = component('client', 'unchanged', 'web:v1', 0, 0)
+ for tag in ('defs', 'symbol', 'mask', 'pattern', 'template', 'title'):
+ with self.subTest(tag=tag):
+ source = GOOD.replace(original, f'<{tag}>{original}</{tag}>', 1)
+ # HTMLParser versions expose title contents as nodes or text.
+ if tag == 'title':
+ self.assertRegex(
+ '\n'.join(checker.check_source(SYNTHETIC_PATH, source)),
+ r'nonrendering containers|dangling relationship endpoint',
+ )
+ else:
+ self.rejects(source, 'nonrendering containers')
+
+ def test_animation_use_and_nested_svg(self):
+ for extra in ('<animate attributeName="x"/>', '<animateTransform/>', '<use href="#client"/>', '<svg/>'):
+ self.rejects(GOOD.replace('</svg>', extra + '</svg>'), 'unsupported')
+
+ def test_path_grammar_fails_closed(self):
+ for value in ('', 'm40 20 h40', 'M40 20 H', 'M40 NaN H80', 'M40 20 H80 Z', 'M40 20 M80 20', 'M40 20 H800', 'M40 20 H1e309',
+ 'M,40 20 H80', 'M40,,20 H80', 'M40 20, H80', 'M40 20 H80,'):
+ self.rejects(GOOD.replace('M40 20 H80', value, 1), 'relationship geometry')
+
+ def test_ledger_coverage(self):
+ self.rejects(GOOD.replace('data-target="api"', 'data-target="client"'), 'missing ledger coverage')
+ self.rejects(GOOD.replace('data-target="api"', 'data-target="missing"'), 'unexpected ledger coverage')
+ self.rejects(GOOD.replace('data-change="CHANGED"', 'data-change="MOVED"'), 'missing ledger coverage')
+ self.rejects(GOOD.replace('data-target="api"', 'data-target="api worker"'), 'single target ID')
+
+ def test_ledger_cannot_claim_unchanged(self):
+ self.rejects(GOOD.replace('</svg>', '<text data-change="UNCHANGED" data-target="client">UNCHANGED client</text></svg>'), 'invalid ledger change')
+
+ def test_ledger_text_and_membership(self):
+ self.rejects(GOOD.replace('CHANGED api: migration detail', 'MOVED api: migration detail'), 'ledger text')
+ self.rejects(GOOD.replace('CHANGED api: migration detail', 'CHANGED'), 'ledger text')
+ self.rejects(GOOD.replace('<text>client</text>', '<text data-change="ADDED" data-target="queue">ADDED queue</text>', 1), 'outside both snapshots')
+ self.rejects(GOOD.replace('</html>', '<text data-change="ADDED" data-target="queue">ADDED queue</text></html>'), 'in the diagram')
+
+ def test_duplicate_ledger(self):
+ self.rejects(GOOD.replace('</svg>', '<text data-change="ADDED" data-target="queue">ADDED queue</text></svg>'), 'duplicate ledger entry')
+
+ def test_component_budget(self):
+ source = GOOD
+ for identity in ('six', 'seven', 'eight'):
+ source = source.replace('<text>client</text></g>', f'<text>client</text></g>{component(identity, "unchanged", identity, 0, 120)}')
+ self.rejects(source, 'component budget')
+
+ def test_relationship_budget(self):
+ source = GOOD
+ for index in range(6):
+ source = source.replace('<text>client</text></g>', '<text>client</text></g>' + relationship(f'extra{index}', 'unchanged', 'client', 'api', 'M40 20 H80'))
+ self.rejects(source, 'relationship budget')
+
+ def test_ledger_budget(self):
+ extra = ''.join(f'<text data-change="ADDED" data-target="extra{i}">ADDED extra</text>' for i in range(2))
+ self.rejects(GOOD.replace('</svg>', extra + '</svg>'), 'ledger budget')
+
+ def test_all_shipped_variants(self):
+ for suffix in ('', '-dark', '-full'):
+ path = ROOT / f'skills/diagram-design/assets/example-architecture-delta{suffix}.html'
+ with self.subTest(variant=suffix):
+ self.assertTrue(path.is_file(), f'missing shipped variant: {path.name}')
+ source = path.read_text(encoding='utf-8')
+ self.assertEqual(checker.check_source(path, source), [])
+ for status in ('ADDED', 'REMOVED', 'CHANGED', 'MOVED', 'REWIRED'):
+ self.assertIn(f'data-change="{status}"', source)
+
+ def test_cli_discovery_and_failures(self):
+ env = {**os.environ, 'PYTHONIOENCODING': 'utf-8'}
+ for args in ([], ['--all']):
+ result = subprocess.run([sys.executable, str(CHECKER), *args], capture_output=True, text=True, env=env)
+ self.assertEqual(result.returncode, 0, result.stdout + result.stderr)
+ self.assertIn('3 file(s)', result.stdout)
+ with tempfile.TemporaryDirectory() as directory:
+ path = Path(directory) / 'diagram.html'
+ path.write_text(GOOD, encoding='utf-8')
+ result = subprocess.run([sys.executable, str(CHECKER), str(path)], capture_output=True, text=True, env=env)
+ self.assertEqual(result.returncode, 0, result.stdout + result.stderr)
+ path.write_text(GOOD.replace('data-signature="web:v1"', 'data-signature=""', 1), encoding='utf-8')
+ result = subprocess.run([sys.executable, str(CHECKER), str(path)], capture_output=True, text=True, env=env)
+ self.assertEqual(result.returncode, 1)
+ path.unlink()
+ result = subprocess.run([sys.executable, str(CHECKER), str(path)], capture_output=True, text=True, env=env)
+ self.assertEqual(result.returncode, 2)
+
+
+if __name__ == '__main__':
+ unittest.main(verbosity=2)
diff --git a/scripts/test-verify-docs-sync.py b/scripts/test-verify-docs-sync.py
index 99b8a5b..88b4b8b 100644
--- a/scripts/test-verify-docs-sync.py
+++ b/scripts/test-verify-docs-sync.py
@@ -725,8 +725,40 @@ def check_size_preset_surfaces(verify) -> None:
print("OK size presets: every size-selection surface names the output-spec presets")
+def check_architecture_delta_discovery(verify) -> None:
+ """A topology comparison must remain discoverable apart from Architecture."""
+ shipped = verify.SKILL.read_text(encoding="utf-8")
+ description = verify.frontmatter_description(shipped)
+ if "architecture delta" not in description.casefold():
+ raise AssertionError("the shipped skill lacks Architecture delta discovery")
+ if "Architecture delta" not in verify.selection_table_types(shipped):
+ raise AssertionError("Architecture delta must be a canonical selection-table row")
+ with tempfile.TemporaryDirectory(prefix="verify-docs-sync-delta-") as temporary:
+ skill = Path(temporary) / "SKILL.md"
+ original_skill = verify.SKILL
+ try:
+ verify.SKILL = skill
+ skill.write_text(shipped, encoding="utf-8")
+ errors: list[str] = []
+ verify.check_description(errors)
+ if errors:
+ raise AssertionError(f"shipped discovery vocabulary failed: {errors}")
+ skill.write_text(
+ shipped.replace(description, description.replace("architecture delta, ", ""), 1),
+ encoding="utf-8",
+ )
+ errors = []
+ verify.check_description(errors)
+ if len(errors) != 1 or "type 'Architecture delta'" not in errors[0]:
+ raise AssertionError(f"missing Architecture delta hook was not rejected: {errors}")
+ finally:
+ verify.SKILL = original_skill
+ print("OK Architecture delta: canonical routing requires its own discovery hook")
+
+
def main() -> int:
verify = load_verify_module()
+ check_architecture_delta_discovery(verify)
# Keep real routing vocabulary in the fixtures so the size check cannot
# accidentally replace the existing lexical-hook validation.
@@ -757,6 +789,30 @@ def main() -> int:
raise AssertionError(f"manifest size boundary failed: {errors}")
path.write_text(original, encoding="utf-8")
+ # Architecture alone must not accidentally satisfy Architecture delta.
+ # Mutate each native discovery surface independently, including Codex's
+ # long description; a correct hook elsewhere cannot hide this omission.
+ for relative, keys in verify.MANIFEST_DESCRIPTIONS:
+ path = root / relative
+ original = path.read_text(encoding="utf-8")
+ for key in keys:
+ document = json.loads(original)
+ container = (
+ document["interface"] if key == "longDescription"
+ else document["metadata"] if "metadata" in document
+ else document
+ )
+ before = container[key]
+ container[key] = before.replace("architecture delta, ", "")
+ if container[key] == before:
+ raise AssertionError(f"{relative} {key} lacks Architecture delta")
+ path.write_text(json.dumps(document), encoding="utf-8")
+ errors = []
+ verify.check_manifest_descriptions(errors, root)
+ if len(errors) != 1 or "type 'Architecture delta'" not in errors[0]:
+ raise AssertionError(f"missing delta hook was not rejected: {errors}")
+ path.write_text(original, encoding="utf-8")
+
codex = root / ".codex-plugin/plugin.json"
document = json.loads(codex.read_text(encoding="utf-8"))
document["interface"]["longDescription"] = short + " More detail." * 50
@@ -1524,7 +1580,7 @@ diagram-design/
# the two added phrasings must not start rejecting them. The last four
# are the shapes those phrasings would overmatch without their
# single-digit floor: `2-type` and `all 3 diagrams` are ordinary prose
- # in a repository that ships 40 types, and this gate blocks a pull
+ # in a repository that ships 42 types, and this gate blocks a pull
# request, so rejecting them is worse than missing a stale count. The
# two-digit cases prove the guard is contextual rather than relying on
# a numeral-length heuristic.
diff --git a/scripts/test-verify-motion.py b/scripts/test-verify-motion.py
index 926b1f8..57b6d91 100644
--- a/scripts/test-verify-motion.py
+++ b/scripts/test-verify-motion.py
@@ -509,7 +509,7 @@ def main() -> int:
missing_guide = directory / "missing-guide.md"
missing_guide.write_text(
original_skill.read_text(encoding="utf-8").replace(
- "### Visual-type guide (41)", "### Visual guide"
+ f"### Visual-type guide ({semantic_module.VISUAL_TYPE_COUNT})", "### Visual guide"
),
encoding="utf-8",
)
@@ -517,7 +517,7 @@ def main() -> int:
markdown_errors = semantic_module.verify_markdown()
finally:
semantic_module.SKILL = original_skill
- if not any("must contain the 41-row visual-type guide" in error for error in markdown_errors):
+ if not any(f"must contain the {semantic_module.VISUAL_TYPE_COUNT}-row visual-type guide" in error for error in markdown_errors):
raise AssertionError(f"missing visual-guide anchor was accepted: {markdown_errors}")
print("OK: missing visual-type guide anchor is rejected")
diff --git a/scripts/verify-architecture-delta.py b/scripts/verify-architecture-delta.py
new file mode 100644
index 0000000..340664c
--- /dev/null
+++ b/scripts/verify-architecture-delta.py
@@ -0,0 +1,539 @@
+#!/usr/bin/env python3
+"""Verify the public Architecture delta HTML contract using only the stdlib.
+
+Checks identity, snapshot membership, shared local grids, declared semantic and
+geometric changes, relationship endpoints, and exact ledger coverage. Panel
+translations are excluded from movement; object transforms and CSS geometry
+overrides are refused. This verifies authored declarations, not whether their
+semantic signatures accurately describe an external system.
+
+Usage: python3 scripts/verify-architecture-delta.py [--all | FILE ...]
+No arguments and --all check every shipped architecture-delta example.
+Exit: 0 clean, 1 contract findings, 2 unreadable input/usage.
+"""
+
+from __future__ import annotations
+
+import argparse
+import math
+import re
+import sys
+from dataclasses import dataclass, field
+from html.parser import HTMLParser
+from pathlib import Path
+
+ROOT = Path(__file__).resolve().parent.parent
+ASSET_DIR = ROOT / "skills/diagram-design/assets"
+NUMBER = r"[-+]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][-+]?\d+)?"
+NUMBER_RE = re.compile(NUMBER)
+ID_RE = re.compile(r"[A-Za-z][A-Za-z0-9_.:-]*\Z")
+TRANSLATE_RE = re.compile(rf"translate\(\s*({NUMBER})[\s,]+({NUMBER})\s*\)\Z")
+OBJECT_ATTRS = {"data-kind", "data-object-id", "data-status", "data-signature", "data-from", "data-to"}
+LEDGER_ATTRS = {"data-change", "data-target"}
+STATUSES = {"unchanged", "added", "removed", "changed", "moved", "rewired"}
+CSS_MOVES = re.compile(
+ r"(?:^|[;{])\s*(?:-(?:webkit|moz|ms|o)-)?"
+ r"(?:transform|translate|rotate|scale|x|y|cx|cy|r|rx|ry|d|"
+ r"offset(?:-(?:path|distance|position|anchor|rotate))?)\s*:", re.I)
+CSS_SIZE = re.compile(r"(?:^|[;{])\s*(?:width|height)\s*:", re.I)
+VOID = {"area", "base", "br", "col", "embed", "hr", "img", "input", "link", "meta", "param", "source", "track", "wbr"}
+EPS = 1e-6
+ENDPOINT_TOLERANCE = 2.0
+MAX_COORDINATE = 1e7
+NONRENDERING = {"defs", "symbol", "clippath", "mask", "pattern", "marker", "template", "script", "style", "title", "desc", "metadata"}
+
+
+@dataclass(eq=False)
+class Node:
+ tag: str
+ attrs: dict[str, str]
+ line: int
+ parent: Node | None = None
+ children: list[Node] = field(default_factory=list)
+ content: list[str | Node] = field(default_factory=list)
+ duplicates: set[str] = field(default_factory=set)
+
+ def text(self) -> str:
+ return "".join(part.text() if isinstance(part, Node) else part for part in self.content)
+
+ def ancestors(self):
+ parent = self.parent
+ while parent is not None:
+ yield parent
+ parent = parent.parent
+
+
+class Scanner(HTMLParser):
+ """HTML parsing honors unquoted attrs, entities, comments and raw style text.
+
+ SVG must be properly nested; silently repairing malformed SVG would assign
+ objects to snapshots differently from a browser. Repeated attributes are
+ retained first (browser semantics) and additionally rejected.
+ """
+
+ def __init__(self):
+ super().__init__(convert_charrefs=True)
+ self.root = Node("document", {}, 1)
+ self.stack = [self.root]
+ self.nodes: list[Node] = []
+ self.errors: list[str] = []
+
+ def handle_starttag(self, tag, attrs):
+ values = {}
+ duplicates = set()
+ for name, value in attrs:
+ if name in values:
+ duplicates.add(name)
+ values.setdefault(name, value or "")
+ node = Node(tag, values, self.getpos()[0], self.stack[-1], duplicates=duplicates)
+ self.stack[-1].children.append(node)
+ self.stack[-1].content.append(node)
+ self.nodes.append(node)
+ if tag not in VOID:
+ self.stack.append(node)
+
+ def handle_startendtag(self, tag, attrs):
+ self.handle_starttag(tag, attrs)
+ if tag not in VOID:
+ self.handle_endtag(tag)
+
+ def handle_endtag(self, tag):
+ indexes = [i for i, node in enumerate(self.stack) if node.tag == tag]
+ in_svg = any(node.tag == "svg" for node in self.stack)
+ if not indexes:
+ if in_svg:
+ self.errors.append(f"line {self.getpos()[0]}: malformed SVG closing tag {tag}")
+ return
+ index = indexes[-1]
+ if in_svg and index != len(self.stack) - 1:
+ self.errors.append(f"line {self.getpos()[0]}: malformed SVG nesting at {tag}")
+ del self.stack[index:]
+
+ def handle_data(self, data):
+ self.stack[-1].content.append(data)
+
+ def finish(self, source):
+ self.feed(source)
+ self.close()
+ if any(node.tag == "svg" for node in self.stack):
+ self.errors.append("unclosed SVG or snapshot")
+
+
+def number(raw: str) -> float:
+ if not NUMBER_RE.fullmatch(raw.strip()):
+ raise ValueError("missing, malformed or non-finite number")
+ value = float(raw)
+ if not math.isfinite(value) or abs(value) > MAX_COORDINATE:
+ raise ValueError("number must be finite and within 10,000,000 units")
+ return value
+
+
+def numbers(raw: str, count: int) -> tuple[float, ...]:
+ parts = raw.split()
+ if len(parts) != count:
+ raise ValueError(f"expected {count} space-separated numbers")
+ return tuple(number(part) for part in parts)
+
+
+def on_grid(value: float, pitch: float) -> bool:
+ ratio = value / pitch
+ return math.isfinite(ratio) and abs(ratio - round(ratio)) <= EPS
+
+
+def within(node: Node, ancestor: Node) -> bool:
+ return node is ancestor or ancestor in node.ancestors()
+
+
+def clean_css(raw: str) -> str:
+ return re.sub(r"/\*.*?\*/", "", raw, flags=re.S)
+
+
+def hiding_values(values: dict[str, str]) -> bool:
+ values = {key: re.sub(r"\s*!important\s*$", "", value, flags=re.I).strip().lower()
+ for key, value in values.items()}
+ if values.get("display") == "none" or values.get("visibility") in {"hidden", "collapse"}:
+ return True
+ if values.get("content-visibility") == "hidden":
+ return True
+ opacity = values.get("opacity", "").removesuffix("%")
+ return bool(NUMBER_RE.fullmatch(opacity) and float(opacity) <= 0)
+
+
+def css_hides(raw: str) -> bool:
+ # Treat any explicit hiding declaration as a finding. This conservative
+ # rule does not need to implement the CSS cascade or !important priority.
+ return any(hiding_values({match.group(1).lower(): match.group(2)})
+ for match in re.finditer(r"(?:^|;)\s*([\w-]+)\s*:\s*([^;]*)", clean_css(raw)))
+
+
+def path_points(raw: str) -> list[tuple[float, float]]:
+ """Absolute, open M/L/H/V/Q/C paths; include control points for grid bounds.
+
+ A single M is required. Implicit argument groups are supported (the SVG
+ number grammar includes exponents and sign-delimited numbers). Closing or
+ relative commands cannot silently change the endpoint we verify.
+ """
+ tokens = re.findall(rf"{NUMBER}|[A-Za-z]", raw)
+ residue = re.sub(rf"{NUMBER}|[A-Za-z]|[\s,]", "", raw)
+ if (re.search(r",\s*,|[A-Za-z]\s*,|,\s*[A-Za-z]", raw)
+ or raw.strip().startswith(",") or raw.strip().endswith(",")):
+ raise ValueError("relationship path has malformed coordinate separators")
+ if residue or not tokens or tokens[0] != "M":
+ raise ValueError("relationship path must start with absolute M")
+ points = []
+ index, command = 0, ""
+ current = (0.0, 0.0)
+ arity = {"M": 2, "L": 2, "H": 1, "V": 1, "Q": 4, "C": 6}
+ while index < len(tokens):
+ if tokens[index].isalpha():
+ command = tokens[index]
+ index += 1
+ if command not in arity or (command == "M" and points):
+ raise ValueError("relationship path supports one M followed by absolute L/H/V/Q/C only")
+ if not command:
+ raise ValueError("relationship path has no command")
+ count = arity[command]
+ if index + count > len(tokens):
+ raise ValueError("relationship path has incomplete coordinates")
+ values = [number(token) for token in tokens[index:index + count]]
+ index += count
+ if command == "H":
+ current = (values[0], current[1])
+ points.append(current)
+ elif command == "V":
+ current = (current[0], values[0])
+ points.append(current)
+ else:
+ pairs = list(zip(values[::2], values[1::2]))
+ points.extend(pairs)
+ current = pairs[-1]
+ if command == "M":
+ command = "L"
+ if len(points) < 2:
+ raise ValueError("relationship path requires a drawn segment")
+ return points
+
+
+def on_perimeter(point, bounds):
+ x, y = point
+ left, top, width, height = bounds
+ right, bottom = left + width, top + height
+ t = ENDPOINT_TOLERANCE
+ return ((left - t <= x <= right + t and min(abs(y - top), abs(y - bottom)) <= t)
+ or (top - t <= y <= bottom + t and min(abs(x - left), abs(x - right)) <= t))
+
+
+def selector_may_match(selector: str, node: Node) -> bool:
+ """Conservative last-compound filter for CSS width/height on SVG objects.
+
+ Responsive `svg {width:100%}` and ordinary HTML sizing remain legal; rules
+ that might size a verified shape, including pseudo classes, are rejected.
+ """
+ last = re.split(r"\s+|[>+~]", selector.strip())[-1]
+ if not last:
+ return True
+ # Functional pseudo-classes can contain arbitrary selectors. Fail closed.
+ if ":" in last or "\\" in last or "[" in last:
+ return True
+ tag = re.match(r"^[\w|-]+", last)
+ if tag and tag.group().split("|")[-1] != node.tag:
+ return False
+ ids = re.findall(r"#([\w-]+)", last)
+ classes = re.findall(r"\.([\w-]+)", last)
+ return (all(value == node.attrs.get("id") for value in ids)
+ and set(classes) <= set(node.attrs.get("class", "").split()))
+
+
+@dataclass
+class Object:
+ node: Node
+ kind: str
+ id: str
+ status: set[str]
+ signature: str
+ bounds: tuple[float, ...] | None = None
+ endpoints: tuple[str, str] | None = None
+ points: list[tuple[float, float]] | None = None
+
+
+def check_source(path: Path, source: str) -> list[str]:
+ scanner = Scanner()
+ scanner.finish(source)
+ findings = []
+
+ def fail(node, message):
+ findings.append(f"{path.name}:{node.line}: {message}")
+
+ roots = [node for node in scanner.nodes if node.attrs.get("data-diagram") == "architecture-delta"]
+ if len(roots) != 1 or roots[0].tag != "svg":
+ fail(scanner.root, 'require exactly one svg data-diagram="architecture-delta"')
+ return findings
+ root = roots[0]
+ findings.extend(f"{path.name}: {error}" for error in scanner.errors)
+ for node in scanner.nodes:
+ if within(node, root) and node.duplicates:
+ fail(node, f"duplicate attributes: {', '.join(sorted(node.duplicates))}")
+ # An ancestor transform changes both panel scale and the measured local
+ # geometry. Only each snapshot's one translation is part of this grammar.
+ snapshots = [node for node in scanner.nodes if "data-snapshot" in node.attrs]
+ states = [node.attrs["data-snapshot"] for node in snapshots]
+ if sorted(states) != ["after", "before"]:
+ fail(root, "require exactly two snapshots named before and after")
+ grids = {}
+ origins = {}
+ by_snapshot = {}
+ for snapshot in snapshots:
+ state = snapshot.attrs["data-snapshot"]
+ if snapshot.tag != "g" or snapshot.parent is not root:
+ fail(snapshot, "snapshot must be a direct g child of the diagram SVG")
+ try:
+ grid = numbers(snapshot.attrs.get("data-grid", ""), 3)
+ if min(grid) <= 0 or grid[2] > min(grid[:2]):
+ raise ValueError("grid width, height and pitch must be positive")
+ if not all(on_grid(value, grid[2]) for value in grid[:2]):
+ raise ValueError("grid dimensions must be multiples of pitch")
+ grids[state] = grid
+ except ValueError as error:
+ fail(snapshot, f"invalid data-grid: {error}")
+ match = TRANSLATE_RE.fullmatch(snapshot.attrs.get("transform", "").strip())
+ if match is None:
+ fail(snapshot, "snapshot transform must be one translate(x y)")
+ else:
+ try:
+ origins[state] = tuple(number(part) for part in match.groups())
+ except ValueError as error:
+ fail(snapshot, f"invalid panel translation: {error}")
+ by_snapshot[snapshot] = {}
+ if len(grids) == 2 and grids.get("before") != grids.get("after"):
+ fail(root, "snapshot grids must match in width, height and pitch")
+ if len(origins) == 2 and "before" in grids and "after" in grids:
+ before, after = origins.get("before"), origins.get("after")
+ if before and after and (after[0] < before[0] + grids["before"][0] or before[1] != after[1]):
+ fail(root, "Before and After panels must be separated left-to-right on one baseline")
+
+ protected = [node for node in scanner.nodes if within(node, root)] + list(root.ancestors())
+ visible = set()
+ for node in scanner.nodes:
+ if (OBJECT_ATTRS | LEDGER_ATTRS | {"data-snapshot"}).intersection(node.attrs) or node.attrs.get("data-role") == "bounds":
+ visible.add(node)
+ visible.update(node.ancestors())
+ for node in protected:
+ if "transform" in node.attrs and node not in snapshots:
+ fail(node, "only snapshot translations may transform verified geometry")
+ inline = clean_css(node.attrs.get("style", ""))
+ if "\\" in inline or CSS_MOVES.search(inline):
+ fail(node, "CSS geometry overrides or escaped inline CSS are unsupported")
+ if node.tag in {"animate", "animatemotion", "animatetransform", "set", "use", "foreignobject"}:
+ fail(node, f"{node.tag} is unsupported in a static architecture delta")
+ if node.tag == "svg" and node is not root and within(node, root):
+ fail(node, "nested SVG viewports are unsupported")
+ for node in visible:
+ if node.tag in NONRENDERING:
+ fail(node, "snapshot objects and ledger cannot be placed in nonrendering containers")
+ if "hidden" in node.attrs or node.attrs.get("aria-hidden", "").lower() == "true" or hiding_values(node.attrs) or css_hides(node.attrs.get("style", "")):
+ fail(node, "snapshot objects and ledger must not be hidden")
+ bounds_nodes = [node for node in scanner.nodes if within(node, root) and node.attrs.get("data-role") == "bounds"]
+ for node in bounds_nodes:
+ if node.parent is None or node.parent.attrs.get("data-kind") != "component":
+ fail(node, "bounds rect must be a direct child of a component")
+ if CSS_SIZE.search(clean_css(node.attrs.get("style", ""))):
+ fail(node, "CSS geometry overrides are unsupported on bounds")
+ for style in [node for node in scanner.nodes if node.tag == "style"]:
+ css = clean_css(style.text())
+ # CSS escapes could disguise transform or geometry property names.
+ if "\\" in css or CSS_MOVES.search(css):
+ fail(style, "CSS geometry overrides or escaped CSS are unsupported")
+ for selectors, declarations in re.findall(r"([^{}]+)\{([^{}]*)\}", css):
+ if css_hides(declarations) and any(
+ selector_may_match(selector, node)
+ for selector in selectors.split(",") for node in visible
+ ):
+ fail(style, "CSS must not hide snapshot objects or ledger")
+ if CSS_SIZE.search(declarations) and any(
+ selector_may_match(selector, bound)
+ for selector in selectors.split(",") for bound in bounds_nodes
+ ):
+ fail(style, "CSS geometry overrides are unsupported on bounds")
+
+ objects = []
+ for node in scanner.nodes:
+ if (node.tag == "path" and any(within(node, snapshot) for snapshot in snapshots)
+ and not any(ancestor.attrs.get("data-kind") == "component" or ancestor.tag in NONRENDERING
+ for ancestor in node.ancestors())
+ and node.attrs.get("data-kind") != "relationship"):
+ fail(node, "snapshot connector path is missing relationship metadata")
+ if not OBJECT_ATTRS.intersection(node.attrs):
+ continue
+ owners = [snapshot for snapshot in snapshots if within(node, snapshot)]
+ if len(owners) != 1 or not within(node, root):
+ fail(node, "object must belong to exactly one snapshot")
+ continue
+ owner = owners[0]
+ if any(OBJECT_ATTRS.intersection(ancestor.attrs) for ancestor in node.ancestors() if ancestor is not node):
+ fail(node, "objects cannot be nested inside another object")
+ kind = node.attrs.get("data-kind", "")
+ identity = node.attrs.get("data-object-id", "")
+ raw_status = node.attrs.get("data-status", "").split()
+ status = set(raw_status)
+ signature = node.attrs.get("data-signature", "")
+ if kind not in {"component", "relationship"} or node.tag != {"component": "g", "relationship": "path"}.get(kind):
+ fail(node, "data-kind must be component on g or relationship on path")
+ if not ID_RE.fullmatch(identity):
+ fail(node, "missing or malformed data-object-id")
+ allowed = STATUSES - ({"rewired"} if kind == "component" else {"moved"})
+ if not status or not status <= allowed or len(status) != len(raw_status):
+ fail(node, "missing, duplicate or invalid data-status tokens")
+ if len(status) > 1 and status.intersection({"unchanged", "added", "removed"}):
+ fail(node, "unchanged, added and removed statuses must be exclusive")
+ if not signature.strip():
+ fail(node, "missing or blank data-signature")
+ if identity in by_snapshot[owner]:
+ fail(node, f"duplicate object ID {identity!r} within snapshot")
+ obj = Object(node, kind, identity, status, signature)
+ by_snapshot[owner][identity] = obj
+ objects.append(obj)
+ grid = grids.get(owner.attrs["data-snapshot"])
+ if kind == "component":
+ bounds = [child for child in node.children if child.attrs.get("data-role") == "bounds"]
+ if len(bounds) != 1 or bounds[0].tag != "rect":
+ fail(node, "component requires exactly one direct rect data-role=bounds")
+ else:
+ try:
+ obj.bounds = tuple(number(bounds[0].attrs.get(key, "")) for key in ("x", "y", "width", "height"))
+ x, y, width, height = obj.bounds
+ if width <= 0 or height <= 0 or min(x, y) < 0:
+ raise ValueError("bounds must have nonnegative position and positive size")
+ if grid:
+ if x + width > grid[0] + EPS or y + height > grid[1] + EPS:
+ raise ValueError("bounds exceed local grid")
+ if not all(on_grid(value, grid[2]) for value in obj.bounds):
+ raise ValueError("bounds must align to grid pitch")
+ except ValueError as error:
+ fail(node, f"invalid component bounds: {error}")
+ if "data-from" in node.attrs or "data-to" in node.attrs:
+ fail(node, "components cannot declare relationship endpoints")
+ elif kind == "relationship":
+ obj.endpoints = (node.attrs.get("data-from", ""), node.attrs.get("data-to", ""))
+ if not all(ID_RE.fullmatch(value) for value in obj.endpoints):
+ fail(node, "missing or malformed relationship endpoint ID")
+ try:
+ obj.points = path_points(node.attrs.get("d", ""))
+ if grid and any(not (-EPS <= x <= grid[0] + EPS and -EPS <= y <= grid[1] + EPS) for x, y in obj.points):
+ raise ValueError("relationship path exceeds local grid")
+ except ValueError as error:
+ fail(node, f"invalid relationship geometry: {error}")
+
+ for snapshot, members in by_snapshot.items():
+ if not any(obj.kind == "component" for obj in members.values()):
+ fail(snapshot, "snapshot must contain at least one component")
+ for obj in members.values():
+ if obj.kind != "relationship" or obj.endpoints is None:
+ continue
+ for index, identity in enumerate(obj.endpoints):
+ endpoint = members.get(identity)
+ if endpoint is None or endpoint.kind != "component":
+ fail(obj.node, f"dangling relationship endpoint {identity!r}: must resolve to a component in this snapshot")
+ elif endpoint.bounds and obj.points and not on_perimeter(obj.points[0 if index == 0 else -1], endpoint.bounds):
+ fail(obj.node, f"drawn relationship endpoint does not meet component {identity!r} perimeter")
+
+ before = next((members for snapshot, members in by_snapshot.items() if snapshot.attrs["data-snapshot"] == "before"), {})
+ after = next((members for snapshot, members in by_snapshot.items() if snapshot.attrs["data-snapshot"] == "after"), {})
+ expected = set()
+ for identity in before.keys() | after.keys():
+ old, new = before.get(identity), after.get(identity)
+ obj = new or old
+ if old is None:
+ if new.status != {"added"}:
+ fail(new.node, f"after-only object {identity!r} must be added")
+ elif new is None:
+ if old.status != {"removed"}:
+ fail(old.node, f"before-only object {identity!r} must be removed")
+ else:
+ if old.kind != new.kind:
+ fail(new.node, f"retained object {identity!r} changed kind")
+ if old.status != new.status or old.status.intersection({"added", "removed"}):
+ fail(new.node, f"retained object {identity!r} must have matching retained statuses")
+ if (old.signature != new.signature) != ("changed" in new.status):
+ fail(new.node, f"CHANGED signature mismatch for {identity!r}: signatures differ iff changed")
+ if old.kind == new.kind == "component" and old.bounds and new.bounds:
+ if (old.bounds[:2] != new.bounds[:2]) != ("moved" in new.status):
+ fail(new.node, f"MOVED position mismatch for {identity!r}: local positions differ iff moved")
+ if old.bounds[2:] != new.bounds[2:] and "changed" not in new.status:
+ fail(new.node, f"component size changed without CHANGED for {identity!r}")
+ if old.kind == new.kind == "relationship" and (old.endpoints != new.endpoints) != ("rewired" in new.status):
+ fail(new.node, f"REWIRED endpoints mismatch for {identity!r}: endpoints differ iff rewired")
+ expected.update((identity, status.upper()) for status in obj.status - {"unchanged"})
+ component_ids = {obj.id for obj in objects if obj.kind == "component"}
+ relationship_ids = {obj.id for obj in objects if obj.kind == "relationship"}
+ if len(component_ids) > 8:
+ fail(root, "component budget exceeded: maximum 8 unique components")
+ if len(relationship_ids) > 10:
+ fail(root, "relationship budget exceeded: maximum 10 unique relationships")
+ if not relationship_ids:
+ fail(root, "architecture delta requires at least one relationship")
+
+ entries = [node for node in scanner.nodes if LEDGER_ATTRS.intersection(node.attrs)]
+ actual = set()
+ for entry in entries:
+ change, target = entry.attrs.get("data-change", ""), entry.attrs.get("data-target", "")
+ if entry.tag != "text" or not within(entry, root) or any(within(entry, snapshot) for snapshot in snapshots):
+ fail(entry, "ledger entry must be text in the diagram, outside both snapshots")
+ if change not in {"ADDED", "REMOVED", "CHANGED", "MOVED", "REWIRED"} or not ID_RE.fullmatch(target):
+ fail(entry, "invalid ledger change or single target ID")
+ if not re.match(rf"^{re.escape(change)}\b", entry.text().strip()) or entry.text().strip() == change:
+ fail(entry, "ledger text must begin with its uppercase change and explain it")
+ key = (target, change)
+ if key in actual:
+ fail(entry, f"duplicate ledger entry {change} {target}")
+ actual.add(key)
+ if not entries or len(entries) > 8:
+ fail(root, "ledger budget requires 1-8 entries")
+ for target, change in sorted(expected - actual):
+ fail(root, f"missing ledger coverage: {change} {target}")
+ for target, change in sorted(actual - expected):
+ fail(root, f"unexpected ledger coverage: {change} {target}")
+ return findings
+
+
+def looks_like_delta(path: Path, source: str) -> bool:
+ scanner = Scanner()
+ scanner.finish(source)
+ return ("architecture-delta" in path.stem.lower()
+ or any(node.attrs.get("data-diagram") == "architecture-delta"
+ or "data-snapshot" in node.attrs or "data-object-id" in node.attrs
+ for node in scanner.nodes))
+
+
+def main() -> int:
+ parser = argparse.ArgumentParser(description=__doc__)
+ parser.add_argument("paths", nargs="*", help="HTML files to check")
+ parser.add_argument("--all", action="store_true", help="check every shipped architecture delta")
+ args = parser.parse_args()
+ if args.all and args.paths:
+ parser.error("use --all or explicit paths, not both")
+ targets = sorted(ASSET_DIR.glob("example-*.html")) if args.all or not args.paths else [Path(value) for value in args.paths]
+ checked, findings = 0, []
+ for path in targets:
+ try:
+ source = path.read_text(encoding="utf-8")
+ except (OSError, UnicodeError) as error:
+ print(f"error: cannot read {path}: {error}", file=sys.stderr)
+ return 2
+ if not looks_like_delta(path, source):
+ continue
+ checked += 1
+ findings.extend(check_source(path, source))
+ if not checked:
+ print("error: no architecture delta diagrams found", file=sys.stderr)
+ return 1
+ for finding in findings:
+ print(finding)
+ if findings:
+ print(f"{len(findings)} architecture delta finding(s) across {checked} file(s).")
+ return 1
+ print(f"OK architecture delta: {checked} file(s); identities, grids, changes, endpoints and ledger coverage agree.")
+ return 0
+
+
+if __name__ == "__main__":
+ raise SystemExit(main())
diff --git a/scripts/verify-docs-sync.py b/scripts/verify-docs-sync.py
index 6487bcc..bcbf0bc 100644
--- a/scripts/verify-docs-sync.py
+++ b/scripts/verify-docs-sync.py
@@ -65,7 +65,7 @@ ONBOARDING_REFERENCE = ROOT / "skills/diagram-design/references/onboarding.md"
LINE_DARK_EXAMPLE = ROOT / "skills/diagram-design/assets/example-line-dark.html"
OUTPUT_SPEC_REFERENCE = ROOT / "skills/diagram-design/references/output-spec.md"
VARIANTS = ("", "-dark", "-full")
-VISUAL_TYPE_COUNT = 41
+VISUAL_TYPE_COUNT = 42
AGENT_SKILLS_DESCRIPTION_MAX = 1024
PLUGIN_DESCRIPTION_MAX = 500
# Types whose selection-table name differs from its description vocabulary.
diff --git a/scripts/verify-screenshot-freshness.py b/scripts/verify-screenshot-freshness.py
index 09f28dd..b8f4481 100644
--- a/scripts/verify-screenshot-freshness.py
+++ b/scripts/verify-screenshot-freshness.py
@@ -21,8 +21,8 @@ from screenshot_catalog import (
def main() -> int:
errors: list[str] = []
slugs = canonical_slugs()
- if len(slugs) != 41 or len(slugs) != len(set(slugs)):
- errors.append(f"expected 41 unique canonical types; found {len(slugs)}")
+ if len(slugs) != 42 or len(slugs) != len(set(slugs)):
+ errors.append(f"expected 42 unique canonical types; found {len(slugs)}")
if not MANIFEST.is_file():
errors.append("docs/screenshots/manifest.json is missing")
@@ -97,7 +97,7 @@ def main() -> int:
for error in errors:
print(f" - {error}")
return 1
- print("OK screenshot freshness: 41 canonical sources and PNG digests match")
+ print("OK screenshot freshness: 42 canonical sources and PNG digests match")
return 0
diff --git a/scripts/verify-semantic-motion.py b/scripts/verify-semantic-motion.py
index 42271d2..d08803e 100644
--- a/scripts/verify-semantic-motion.py
+++ b/scripts/verify-semantic-motion.py
@@ -28,7 +28,7 @@ ANIMATION = ROOT / "skills/diagram-design/references/animation.md"
EXAMPLE = ROOT / "skills/diagram-design/assets/example-policy-trace-animated.html"
ADR_0002 = ROOT / "docs/adr/0002-semantic-patterns-do-not-expand-the-taxonomy.md"
MAX_SKILL_BYTES = 40_000
-VISUAL_TYPE_COUNT = 41
+VISUAL_TYPE_COUNT = 42
PATTERN_NAMES = (
"Fan-in queue / bottleneck",
diff --git a/skills/diagram-design/SKILL.md b/skills/diagram-design/SKILL.md
index e1461fe..71d6ac8 100644
--- a/skills/diagram-design/SKILL.md
+++ b/skills/diagram-design/SKILL.md
@@ -1,6 +1,6 @@
---
name: diagram-design
-description: Create branded architecture, IT current-state, flowchart, sequence, state machine, ER/data model, timeline, swimlane, quadrant, radar/spider, polar chart (polar/radial lollipop), loop/flywheel, nested, tree, org chart, layer stack, Venn, pyramid/funnel, treemap, heatmap, bar, waterfall, line, Gantt and scatter charts, high-level, process, medallion, data flow, DP integration, DP security matrix, Sankey, fishbone, Wardley map, kanban, user journey, deployment, dependency graph, UML class, story map, or database schema diagrams as HTML/SVG/PNG, with .drawio and .excalidraw import support, plus lifecycle phase maps and onboarding guidance.
+description: Create branded architecture, architecture delta, IT current-state, flowchart, sequence, state machine, ER/data model, timeline, swimlane, quadrant, radar/spider, polar chart (polar/radial lollipop), loop/flywheel, nested, tree, org chart, layer stack, Venn, pyramid/funnel, treemap, heatmap, bar, waterfall, line, Gantt and scatter charts, high-level, process, medallion, data flow, DP integration, DP security matrix, Sankey, fishbone, Wardley map, kanban, user journey, deployment, dependency graph, UML class, story map, or database schema diagrams as HTML/SVG/PNG, with .drawio and .excalidraw import support, plus lifecycle phase maps and onboarding guidance.
license: MIT
metadata:
version: "2.6"
@@ -10,7 +10,7 @@ metadata:
Create diagrams as self-contained HTML files with inline SVG and an editorial design system.
-Forty-one visual types. Semantic patterns describe behavior; type references describe layout.
+Forty-two visual types. Semantic patterns describe behavior; type references describe layout.
---
@@ -49,13 +49,13 @@ Applied to schematics:
## 2. When to Use
-Use for any of the 41 visual types (§3) when a reader will learn more from a visual than from prose, a table, or a bulleted list.
+Use for any of the 42 visual types (§3) when a reader will learn more from a visual than from prose, a table, or a bulleted list.
**Don't use for:**
- Quick unicode diagrams → use **wiretext**.
- Lists of things → table or bullets.
-- Simple before/after → table.
+- Attribute-only before/after → table; topology changes → Architecture delta.
- One-shape "diagrams" → just write the sentence.
Before drawing, ask: *Would the reader learn more from this than from a well-written paragraph?* If no, don't draw.
@@ -80,11 +80,12 @@ When behavior, state, enforcement, or risk carries the meaning, first load [`ref
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.
-### Visual-type guide (41)
+### Visual-type guide (42)
| If you're showing… | Use | Reference |
|---|---|---|
-| Components + connections in a system | **Architecture** | [type-architecture.md](references/type-architecture.md) |
+| Components + connections in one system snapshot | **Architecture** | [type-architecture.md](references/type-architecture.md) |
+| Structural change between synchronized Before / After topologies, with a Changes ledger | **Architecture delta** | [type-architecture-delta.md](references/type-architecture-delta.md) |
| Legacy IT landscape by phase or department; shows the *before* state | **IT current-state** | [type-it-state.md](references/type-it-state.md) |
| Decision logic with branches | **Flowchart** | [type-flowchart.md](references/type-flowchart.md) |
| Time-ordered messages between actors | **Sequence** | [type-sequence.md](references/type-sequence.md) |
diff --git a/skills/diagram-design/assets/example-architecture-delta-dark.html b/skills/diagram-design/assets/example-architecture-delta-dark.html
new file mode 100644
index 0000000..0b1da51
--- /dev/null
+++ b/skills/diagram-design/assets/example-architecture-delta-dark.html
@@ -0,0 +1,193 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="UTF-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <title>Order fulfilment · Architecture delta</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-rule: rgba(245,245,245,0.12);
+ --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); color: var(--color-ink); background: var(--color-paper); min-height: 100vh; padding: 3rem 2rem; display: flex; align-items: center; justify-content: center; }
+ .frame { width: 100%; max-width: 1200px; min-width: 0; margin: 0 auto; }
+ .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, 2rem); line-height: 1.1; font-weight: 400; letter-spacing: -0.02em; margin-bottom: 1.75rem; }
+ .subtitle { max-width: 64ch; font-size: 0.9375rem; line-height: 1.6; color: var(--color-muted); margin-bottom: 2rem; }
+ .diagram-container { width: 100%; overflow-x: auto; }
+ .diagram-container:focus-visible { outline: 2px solid var(--color-muted); outline-offset: 4px; }
+ svg { display: block; width: 100%; min-width: 1100px; }
+ .scroll-hint { display: none; margin: 1rem 0 0; font-size: 0.8125rem; color: var(--color-muted); }
+ @media (max-width: 700px) { body { padding: 2rem 1rem; } .scroll-hint { display: block; } }
+ </style>
+</head>
+<body>
+ <main class="frame">
+ <p class="eyebrow">Architecture delta · Diagram Design</p>
+ <h1>Order fulfilment, before and after</h1>
+
+ <div class="diagram-container" role="region" aria-label="Before, changes, and after architecture comparison; scroll horizontally on narrow screens" tabindex="0">
+ <svg viewBox="0 0 1200 680" xmlns="http://www.w3.org/2000/svg" data-diagram="architecture-delta" role="img" aria-labelledby="architecture-delta-dark-title architecture-delta-dark-desc">
+ <title id="architecture-delta-dark-title">Order fulfilment, before and after</title>
+ <desc id="architecture-delta-dark-desc">A durable order queue replaces the legacy dispatcher, Orders API changes from v1 to v2, the fulfilment worker moves without changing implementation, and the storefront and database stay unchanged, with seven component and relationship changes listed between both snapshots.</desc>
+ <defs>
+ <marker id="architecture-delta-dark-arrow" markerWidth="8" markerHeight="6" refX="8" refY="3" orient="auto" markerUnits="userSpaceOnUse"><polygon points="0 0, 8 3, 0 6" fill="#bfc0c0"/></marker>
+ </defs>
+ <rect width="1200" height="680" fill="#2d3142"/>
+ <text x="24" y="28" fill="#f5f5f5" font-size="14" font-family="'Geist', sans-serif" font-weight="600">Before</text>
+ <text x="24" y="52" fill="#bfc0c0" font-size="10" font-family="'Geist', sans-serif" >Synchronous dispatch · v1</text>
+ <text x="424" y="28" fill="#f5f5f5" font-size="14" font-family="'Geist', sans-serif" font-weight="600">Changes</text>
+ <text x="424" y="52" fill="#bfc0c0" font-size="10" font-family="'Geist', sans-serif" >Four components · three relationships</text>
+ <text x="840" y="28" fill="#f5f5f5" font-size="14" font-family="'Geist', sans-serif" font-weight="600">After</text>
+ <text x="840" y="52" fill="#bfc0c0" font-size="10" font-family="'Geist', sans-serif" >Queued fulfilment · v2</text>
+ <path d="M 392 8 V 576 M 808 8 V 576" stroke="rgba(245,245,245,0.12)" stroke-width="1"/>
+ <g data-snapshot="before" transform="translate(24 96)" data-grid="336 480 4">
+<!-- Relationships precede components; endpoints meet the declared bounds. -->
+<path data-kind="relationship" data-object-id="r1" data-status="unchanged" data-signature="https:create" data-from="storefront" data-to="api" d="M 168 64 V 96" fill="none" stroke="#bfc0c0" stroke-width="1.2" marker-end="url(#architecture-delta-dark-arrow)"/>
+<path data-kind="relationship" data-object-id="r2" data-status="rewired" data-signature="submit-order" data-from="api" data-to="legacy" d="M 168 160 V 192" fill="none" stroke="#bfc0c0" stroke-width="1.2" stroke-dasharray="8 3 2 3" marker-end="url(#architecture-delta-dark-arrow)"/>
+<path data-kind="relationship" data-object-id="r3" data-status="removed" data-signature="dispatch" data-from="legacy" data-to="worker" d="M 168 256 V 272 Q 168 280 160 280 H 88 Q 80 280 80 288 V 304" fill="none" stroke="#bfc0c0" stroke-width="1.2" stroke-dasharray="4 4" marker-end="url(#architecture-delta-dark-arrow)"/>
+<path data-kind="relationship" data-object-id="r5" data-status="unchanged" data-signature="write-order" data-from="worker" data-to="db" d="M 80 368 V 384 Q 80 392 88 392 H 160 Q 168 392 168 400 V 416" fill="none" stroke="#bfc0c0" stroke-width="1.2" marker-end="url(#architecture-delta-dark-arrow)"/>
+<rect x="176" y="72" width="92" height="16" rx="2" fill="#2d3142"/>
+<text x="180" y="84" fill="#bfc0c0" font-size="8" font-family="'Geist Mono', monospace" >r1 · HTTPS</text>
+<rect x="176" y="168" width="92" height="16" rx="2" fill="#2d3142"/>
+<text x="180" y="180" fill="#bfc0c0" font-size="8" font-family="'Geist Mono', monospace" >r2 · REWIRED</text>
+<rect x="176" y="260" width="92" height="16" rx="2" fill="#2d3142"/>
+<text x="180" y="272" fill="#bfc0c0" font-size="8" font-family="'Geist Mono', monospace" >r3 · REMOVED</text>
+<rect x="176" y="396" width="68" height="16" rx="2" fill="#2d3142"/>
+<text x="180" y="408" fill="#bfc0c0" font-size="8" font-family="'Geist Mono', monospace" >r5 · SQL</text>
+<g data-kind="component" data-object-id="storefront" data-status="unchanged" data-signature="web:v1">
+<rect data-role="bounds" x="96" y="0" width="144" height="64" rx="6" fill="#393e53" stroke="#bfc0c0" stroke-width="1.2"/>
+<text x="108" y="15" fill="#bfc0c0" font-size="7.5" font-family="'Geist Mono', monospace" >= storefront · UNCHANGED</text>
+<text x="108" y="36" fill="#f5f5f5" font-size="12" font-family="'Geist', sans-serif" font-weight="600">Storefront</text>
+<text x="108" y="53" fill="#bfc0c0" font-size="9" font-family="'Geist Mono', monospace" >web:v1</text>
+</g>
+<g data-kind="component" data-object-id="api" data-status="changed" data-signature="orders:v1">
+<rect data-role="bounds" x="96" y="96" width="144" height="64" rx="6" fill="rgba(240,138,89,0.10)" stroke="#f08a59" stroke-width="1.2"/>
+<path d="M 97 108 V 148" fill="none" stroke="#f08a59" stroke-width="3"/>
+<text x="108" y="111" fill="#bfc0c0" font-size="7.5" font-family="'Geist Mono', monospace" >~ api · CHANGED</text>
+<text x="108" y="132" fill="#f5f5f5" font-size="12" font-family="'Geist', sans-serif" font-weight="600">Orders API</text>
+<text x="108" y="149" fill="#bfc0c0" font-size="9" font-family="'Geist Mono', monospace" >/orders · v1</text>
+</g>
+<g data-kind="component" data-object-id="legacy" data-status="removed" data-signature="dispatcher:v1">
+<rect data-role="bounds" x="96" y="192" width="144" height="64" rx="6" fill="#393e53" stroke="#bfc0c0" stroke-width="1.2" stroke-dasharray="4 4"/>
+<text x="108" y="207" fill="#bfc0c0" font-size="7.5" font-family="'Geist Mono', monospace" >− legacy · REMOVED</text>
+<text x="108" y="228" fill="#f5f5f5" font-size="12" font-family="'Geist', sans-serif" font-weight="600">Legacy dispatcher</text>
+<text x="108" y="245" fill="#bfc0c0" font-size="9" font-family="'Geist Mono', monospace" >dispatcher:v1</text>
+</g>
+<g data-kind="component" data-object-id="worker" data-status="moved" data-signature="fulfilment:v1">
+<rect data-role="bounds" x="8" y="304" width="144" height="64" rx="6" fill="#393e53" stroke="#bfc0c0" stroke-width="1.2" stroke-dasharray="1 4" stroke-linecap="round"/>
+<text x="20" y="319" fill="#bfc0c0" font-size="7.5" font-family="'Geist Mono', monospace" >↔ worker · MOVED</text>
+<text x="20" y="340" fill="#f5f5f5" font-size="12" font-family="'Geist', sans-serif" font-weight="600">Fulfilment worker</text>
+<text x="20" y="357" fill="#bfc0c0" font-size="9" font-family="'Geist Mono', monospace" >fulfilment:v1</text>
+</g>
+<g data-kind="component" data-object-id="db" data-status="unchanged" data-signature="orders:postgres">
+<rect data-role="bounds" x="96" y="416" width="144" height="64" rx="6" fill="#393e53" stroke="#bfc0c0" stroke-width="1.2"/>
+<text x="108" y="431" fill="#bfc0c0" font-size="7.5" font-family="'Geist Mono', monospace" >= db · UNCHANGED</text>
+<text x="108" y="452" fill="#f5f5f5" font-size="12" font-family="'Geist', sans-serif" font-weight="600">Orders database</text>
+<text x="108" y="469" fill="#bfc0c0" font-size="9" font-family="'Geist Mono', monospace" >PostgreSQL</text>
+</g>
+<text x="192" y="332" fill="#bfc0c0" font-size="12" font-family="'Geist', sans-serif" >Same worker,</text>
+<text x="192" y="352" fill="#bfc0c0" font-size="12" font-family="'Geist', sans-serif" >moves right →</text>
+</g>
+ <text x="424" y="110" fill="#bfc0c0" font-size="9" font-family="'Geist Mono', monospace" >01</text>
+<text x="456" y="108" data-change="CHANGED" data-target="api" fill="#bfc0c0" font-size="8" font-family="'Geist Mono', monospace" letter-spacing="0.06em">CHANGED · api<tspan x="456" y="131" fill="#f5f5f5" font-size="12" font-family="'Geist', sans-serif" letter-spacing="0">Orders API v1 → v2</tspan></text>
+<path d="M 456 148 H 776" stroke="rgba(245,245,245,0.12)" stroke-width="0.8"/>
+<text x="424" y="170" fill="#bfc0c0" font-size="9" font-family="'Geist Mono', monospace" >02</text>
+<text x="456" y="168" data-change="REMOVED" data-target="legacy" fill="#bfc0c0" font-size="8" font-family="'Geist Mono', monospace" letter-spacing="0.06em">REMOVED · legacy<tspan x="456" y="191" fill="#f5f5f5" font-size="12" font-family="'Geist', sans-serif" letter-spacing="0">Retire legacy dispatcher</tspan></text>
+<path d="M 456 208 H 776" stroke="rgba(245,245,245,0.12)" stroke-width="0.8"/>
+<text x="424" y="230" fill="#bfc0c0" font-size="9" font-family="'Geist Mono', monospace" >03</text>
+<text x="456" y="228" data-change="ADDED" data-target="queue" fill="#bfc0c0" font-size="8" font-family="'Geist Mono', monospace" letter-spacing="0.06em">ADDED · queue<tspan x="456" y="251" fill="#f5f5f5" font-size="12" font-family="'Geist', sans-serif" letter-spacing="0">Introduce durable order queue</tspan></text>
+<path d="M 456 268 H 776" stroke="rgba(245,245,245,0.12)" stroke-width="0.8"/>
+<text x="424" y="290" fill="#bfc0c0" font-size="9" font-family="'Geist Mono', monospace" >04</text>
+<text x="456" y="288" data-change="MOVED" data-target="worker" fill="#bfc0c0" font-size="8" font-family="'Geist Mono', monospace" letter-spacing="0.06em">MOVED · worker<tspan x="456" y="311" fill="#f5f5f5" font-size="12" font-family="'Geist', sans-serif" letter-spacing="0">Fulfilment worker: left → right</tspan></text>
+<path d="M 456 328 H 776" stroke="rgba(245,245,245,0.12)" stroke-width="0.8"/>
+<text x="424" y="350" fill="#bfc0c0" font-size="9" font-family="'Geist Mono', monospace" >05</text>
+<text x="456" y="348" data-change="REWIRED" data-target="r2" fill="#bfc0c0" font-size="8" font-family="'Geist Mono', monospace" letter-spacing="0.06em">REWIRED · r2<tspan x="456" y="371" fill="#f5f5f5" font-size="12" font-family="'Geist', sans-serif" letter-spacing="0">Orders API: dispatcher → queue</tspan></text>
+<path d="M 456 388 H 776" stroke="rgba(245,245,245,0.12)" stroke-width="0.8"/>
+<text x="424" y="410" fill="#bfc0c0" font-size="9" font-family="'Geist Mono', monospace" >06</text>
+<text x="456" y="408" data-change="REMOVED" data-target="r3" fill="#bfc0c0" font-size="8" font-family="'Geist Mono', monospace" letter-spacing="0.06em">REMOVED · r3<tspan x="456" y="431" fill="#f5f5f5" font-size="12" font-family="'Geist', sans-serif" letter-spacing="0">Dispatcher → worker</tspan></text>
+<path d="M 456 448 H 776" stroke="rgba(245,245,245,0.12)" stroke-width="0.8"/>
+<text x="424" y="470" fill="#bfc0c0" font-size="9" font-family="'Geist Mono', monospace" >07</text>
+<text x="456" y="468" data-change="ADDED" data-target="r4" fill="#bfc0c0" font-size="8" font-family="'Geist Mono', monospace" letter-spacing="0.06em">ADDED · r4<tspan x="456" y="491" fill="#f5f5f5" font-size="12" font-family="'Geist', sans-serif" letter-spacing="0">Queue → worker</tspan></text>
+<text x="424" y="544" fill="#bfc0c0" font-size="8" font-family="'Geist Mono', monospace" letter-spacing="0.14em">PRESERVED</text>
+<text x="424" y="564" fill="#bfc0c0" font-size="11" font-family="'Geist', sans-serif" >Storefront · database · r1 · r5</text>
+ <g data-snapshot="after" transform="translate(840 96)" data-grid="336 480 4">
+<!-- Relationships precede components; endpoints meet the declared bounds. -->
+<path data-kind="relationship" data-object-id="r1" data-status="unchanged" data-signature="https:create" data-from="storefront" data-to="api" d="M 168 64 V 96" fill="none" stroke="#bfc0c0" stroke-width="1.2" marker-end="url(#architecture-delta-dark-arrow)"/>
+<path data-kind="relationship" data-object-id="r2" data-status="rewired" data-signature="submit-order" data-from="api" data-to="queue" d="M 168 160 V 192" fill="none" stroke="#bfc0c0" stroke-width="1.2" stroke-dasharray="8 3 2 3" marker-end="url(#architecture-delta-dark-arrow)"/>
+<path data-kind="relationship" data-object-id="r4" data-status="added" data-signature="deliver" data-from="queue" data-to="worker" d="M 168 256 V 272 Q 168 280 176 280 H 248 Q 256 280 256 288 V 304" fill="none" stroke="#bfc0c0" stroke-width="2" marker-end="url(#architecture-delta-dark-arrow)"/>
+<path data-kind="relationship" data-object-id="r5" data-status="unchanged" data-signature="write-order" data-from="worker" data-to="db" d="M 256 368 V 384 Q 256 392 248 392 H 176 Q 168 392 168 400 V 416" fill="none" stroke="#bfc0c0" stroke-width="1.2" marker-end="url(#architecture-delta-dark-arrow)"/>
+<rect x="176" y="72" width="92" height="16" rx="2" fill="#2d3142"/>
+<text x="180" y="84" fill="#bfc0c0" font-size="8" font-family="'Geist Mono', monospace" >r1 · HTTPS</text>
+<rect x="176" y="168" width="92" height="16" rx="2" fill="#2d3142"/>
+<text x="180" y="180" fill="#bfc0c0" font-size="8" font-family="'Geist Mono', monospace" >r2 · REWIRED</text>
+<rect x="68" y="260" width="92" height="16" rx="2" fill="#2d3142"/>
+<text x="156" y="272" fill="#bfc0c0" font-size="8" font-family="'Geist Mono', monospace" text-anchor="end">r4 · ADDED</text>
+<rect x="92" y="396" width="68" height="16" rx="2" fill="#2d3142"/>
+<text x="156" y="408" fill="#bfc0c0" font-size="8" font-family="'Geist Mono', monospace" text-anchor="end">r5 · SQL</text>
+<g data-kind="component" data-object-id="storefront" data-status="unchanged" data-signature="web:v1">
+<rect data-role="bounds" x="96" y="0" width="144" height="64" rx="6" fill="#393e53" stroke="#bfc0c0" stroke-width="1.2"/>
+<text x="108" y="15" fill="#bfc0c0" font-size="7.5" font-family="'Geist Mono', monospace" >= storefront · UNCHANGED</text>
+<text x="108" y="36" fill="#f5f5f5" font-size="12" font-family="'Geist', sans-serif" font-weight="600">Storefront</text>
+<text x="108" y="53" fill="#bfc0c0" font-size="9" font-family="'Geist Mono', monospace" >web:v1</text>
+</g>
+<g data-kind="component" data-object-id="api" data-status="changed" data-signature="orders:v2">
+<rect data-role="bounds" x="96" y="96" width="144" height="64" rx="6" fill="rgba(240,138,89,0.10)" stroke="#f08a59" stroke-width="1.2"/>
+<path d="M 97 108 V 148" fill="none" stroke="#f08a59" stroke-width="3"/>
+<text x="108" y="111" fill="#bfc0c0" font-size="7.5" font-family="'Geist Mono', monospace" >~ api · CHANGED</text>
+<text x="108" y="132" fill="#f5f5f5" font-size="12" font-family="'Geist', sans-serif" font-weight="600">Orders API</text>
+<text x="108" y="149" fill="#bfc0c0" font-size="9" font-family="'Geist Mono', monospace" >/orders · v2</text>
+</g>
+<g data-kind="component" data-object-id="queue" data-status="added" data-signature="orders:durable:v1">
+<rect data-role="bounds" x="96" y="192" width="144" height="64" rx="6" fill="#393e53" stroke="#bfc0c0" stroke-width="1.2"/>
+<rect x="100" y="196" width="136" height="56" rx="4" fill="none" stroke="#bfc0c0" stroke-width="0.8"/>
+<text x="108" y="207" fill="#bfc0c0" font-size="7.5" font-family="'Geist Mono', monospace" >+ queue · ADDED</text>
+<text x="108" y="228" fill="#f5f5f5" font-size="12" font-family="'Geist', sans-serif" font-weight="600">Order queue</text>
+<text x="108" y="245" fill="#bfc0c0" font-size="9" font-family="'Geist Mono', monospace" >durable · at-least-once</text>
+</g>
+<g data-kind="component" data-object-id="worker" data-status="moved" data-signature="fulfilment:v1">
+<rect data-role="bounds" x="184" y="304" width="144" height="64" rx="6" fill="#393e53" stroke="#bfc0c0" stroke-width="1.2" stroke-dasharray="1 4" stroke-linecap="round"/>
+<text x="196" y="319" fill="#bfc0c0" font-size="7.5" font-family="'Geist Mono', monospace" >↔ worker · MOVED</text>
+<text x="196" y="340" fill="#f5f5f5" font-size="12" font-family="'Geist', sans-serif" font-weight="600">Fulfilment worker</text>
+<text x="196" y="357" fill="#bfc0c0" font-size="9" font-family="'Geist Mono', monospace" >fulfilment:v1</text>
+</g>
+<g data-kind="component" data-object-id="db" data-status="unchanged" data-signature="orders:postgres">
+<rect data-role="bounds" x="96" y="416" width="144" height="64" rx="6" fill="#393e53" stroke="#bfc0c0" stroke-width="1.2"/>
+<text x="108" y="431" fill="#bfc0c0" font-size="7.5" font-family="'Geist Mono', monospace" >= db · UNCHANGED</text>
+<text x="108" y="452" fill="#f5f5f5" font-size="12" font-family="'Geist', sans-serif" font-weight="600">Orders database</text>
+<text x="108" y="469" fill="#bfc0c0" font-size="9" font-family="'Geist Mono', monospace" >PostgreSQL</text>
+</g>
+<text x="16" y="332" fill="#bfc0c0" font-size="12" font-family="'Geist', sans-serif" >Same worker,</text>
+<text x="16" y="352" fill="#bfc0c0" font-size="12" font-family="'Geist', sans-serif" >new placement.</text>
+</g>
+ <path d="M 24 608 H 1176" stroke="rgba(245,245,245,0.12)" stroke-width="1"/>
+<rect x="24" y="624" width="20" height="16" rx="3" fill="none" stroke="#bfc0c0" stroke-width="1"/>
+<text x="56" y="636" fill="#bfc0c0" font-size="11" font-family="'Geist', sans-serif" >= Unchanged</text>
+<rect x="220" y="624" width="20" height="16" rx="3" fill="none" stroke="#bfc0c0" stroke-width="1"/>
+<rect x="224" y="628" width="12" height="8" rx="1" fill="none" stroke="#bfc0c0" stroke-width="0.8"/>
+<text x="252" y="636" fill="#bfc0c0" font-size="11" font-family="'Geist', sans-serif" >+ Added</text>
+<rect x="416" y="624" width="20" height="16" rx="3" fill="none" stroke="#bfc0c0" stroke-width="1" stroke-dasharray="4 4"/>
+<text x="448" y="636" fill="#bfc0c0" font-size="11" font-family="'Geist', sans-serif" >− Removed</text>
+<rect x="612" y="624" width="20" height="16" rx="3" fill="none" stroke="#bfc0c0" stroke-width="1"/>
+<path d="M 613 628 V 636" stroke="#bfc0c0" stroke-width="3"/>
+<text x="644" y="636" fill="#bfc0c0" font-size="11" font-family="'Geist', sans-serif" >~ Changed</text>
+<rect x="808" y="624" width="20" height="16" rx="3" fill="none" stroke="#bfc0c0" stroke-width="1" stroke-dasharray="1 4" stroke-linecap="round"/>
+<text x="840" y="636" fill="#bfc0c0" font-size="11" font-family="'Geist', sans-serif" >↔ Moved</text>
+<path d="M 1004 632 H 1024" fill="none" stroke="#bfc0c0" stroke-width="1.2" stroke-dasharray="8 3 2 3" marker-end="url(#architecture-delta-dark-arrow)"/>
+<text x="1036" y="636" fill="#bfc0c0" font-size="11" font-family="'Geist', sans-serif" >⇢ Rewired</text>
+<text x="24" y="660" fill="#bfc0c0" font-size="9" font-family="'Geist', sans-serif" >IDs persist across snapshots. Dashed and dotted strokes encode change, not protocol.</text>
+<text x="1176" y="660" fill="#bfc0c0" font-size="9" font-family="'Geist Mono', monospace" text-anchor="end">6 components · 5 relationships · 7 changes</text>
+ </svg>
+ </div>
+ <p class="scroll-hint">Scroll the diagram horizontally to compare both snapshots and the change ledger.</p>
+ </main>
+</body>
+</html>
diff --git a/skills/diagram-design/assets/example-architecture-delta-full.html b/skills/diagram-design/assets/example-architecture-delta-full.html
new file mode 100644
index 0000000..af7d219
--- /dev/null
+++ b/skills/diagram-design/assets/example-architecture-delta-full.html
@@ -0,0 +1,210 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="UTF-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <title>Order fulfilment · Architecture delta</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-rule: rgba(45,49,66,0.12);
+ --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); color: var(--color-ink); background: var(--color-paper); min-height: 100vh; padding: 3rem 2rem; }
+ .frame { width: 100%; max-width: 1200px; min-width: 0; margin: 0 auto; }
+ .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); line-height: 1.1; font-weight: 400; letter-spacing: -0.02em; margin-bottom: 0.75rem; }
+ .subtitle { max-width: 64ch; font-size: 0.9375rem; line-height: 1.6; color: var(--color-muted); margin-bottom: 2rem; }
+ .diagram-container { width: 100%; overflow-x: auto; }
+ .diagram-container:focus-visible { outline: 2px solid var(--color-muted); outline-offset: 4px; }
+ svg { display: block; width: 100%; min-width: 1100px; }
+ .scroll-hint { display: none; margin: 1rem 0 0; font-size: 0.8125rem; color: var(--color-muted); }
+ @media (max-width: 700px) { body { padding: 2rem 1rem; } .scroll-hint { display: block; } }
+
+ .notes { display: grid; grid-template-columns: 1.2fr 1fr; gap: 2rem; border-top: 1px solid var(--color-rule); padding-top: 1.75rem; margin-top: 2rem; }
+ .notes h2 { font-size: 0.875rem; font-weight: 600; margin-bottom: 0.625rem; }
+ .notes p { font-size: 0.8125rem; line-height: 1.65; color: var(--color-muted); max-width: 58ch; }
+ .footer { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 0.5rem; margin-top: 2rem; font-family: var(--font-mono); font-size: 0.66rem; color: var(--color-muted); }
+ @media (max-width: 700px) { .notes { grid-template-columns: 1fr; gap: 1.5rem; } }
+ </style>
+</head>
+<body>
+ <main class="frame">
+ <p class="eyebrow">Architecture delta · Diagram Design</p>
+ <h1>Order fulfilment, before and after</h1>
+ <p class="subtitle">A durable queue replaces direct dispatch. Stable identities reveal exactly what changes, what moves, and what stays the same.</p>
+ <div class="diagram-container" role="region" aria-label="Before, changes, and after architecture comparison; scroll horizontally on narrow screens" tabindex="0">
+ <svg viewBox="0 0 1200 680" xmlns="http://www.w3.org/2000/svg" data-diagram="architecture-delta" role="img" aria-labelledby="architecture-delta-full-title architecture-delta-full-desc">
+ <title id="architecture-delta-full-title">Order fulfilment, before and after</title>
+ <desc id="architecture-delta-full-desc">A durable order queue replaces the legacy dispatcher, Orders API changes from v1 to v2, the fulfilment worker moves without changing implementation, and the storefront and database stay unchanged, with seven component and relationship changes listed between both snapshots.</desc>
+ <defs>
+ <marker id="architecture-delta-full-arrow" markerWidth="8" markerHeight="6" refX="8" refY="3" orient="auto" markerUnits="userSpaceOnUse"><polygon points="0 0, 8 3, 0 6" fill="#4f5d75"/></marker>
+ </defs>
+ <rect width="1200" height="680" fill="#f5f5f5"/>
+ <text x="24" y="28" fill="#2d3142" font-size="14" font-family="'Geist', sans-serif" font-weight="600">Before</text>
+ <text x="24" y="52" fill="#4f5d75" font-size="10" font-family="'Geist', sans-serif" >Synchronous dispatch · v1</text>
+ <text x="424" y="28" fill="#2d3142" font-size="14" font-family="'Geist', sans-serif" font-weight="600">Changes</text>
+ <text x="424" y="52" fill="#4f5d75" font-size="10" font-family="'Geist', sans-serif" >Four components · three relationships</text>
+ <text x="840" y="28" fill="#2d3142" font-size="14" font-family="'Geist', sans-serif" font-weight="600">After</text>
+ <text x="840" y="52" fill="#4f5d75" font-size="10" font-family="'Geist', sans-serif" >Queued fulfilment · v2</text>
+ <path d="M 392 8 V 576 M 808 8 V 576" stroke="rgba(45,49,66,0.12)" stroke-width="1"/>
+ <g data-snapshot="before" transform="translate(24 96)" data-grid="336 480 4">
+<!-- Relationships precede components; endpoints meet the declared bounds. -->
+<path data-kind="relationship" data-object-id="r1" data-status="unchanged" data-signature="https:create" data-from="storefront" data-to="api" d="M 168 64 V 96" fill="none" stroke="#4f5d75" stroke-width="1.2" marker-end="url(#architecture-delta-full-arrow)"/>
+<path data-kind="relationship" data-object-id="r2" data-status="rewired" data-signature="submit-order" data-from="api" data-to="legacy" d="M 168 160 V 192" fill="none" stroke="#4f5d75" stroke-width="1.2" stroke-dasharray="8 3 2 3" marker-end="url(#architecture-delta-full-arrow)"/>
+<path data-kind="relationship" data-object-id="r3" data-status="removed" data-signature="dispatch" data-from="legacy" data-to="worker" d="M 168 256 V 272 Q 168 280 160 280 H 88 Q 80 280 80 288 V 304" fill="none" stroke="#4f5d75" stroke-width="1.2" stroke-dasharray="4 4" marker-end="url(#architecture-delta-full-arrow)"/>
+<path data-kind="relationship" data-object-id="r5" data-status="unchanged" data-signature="write-order" data-from="worker" data-to="db" d="M 80 368 V 384 Q 80 392 88 392 H 160 Q 168 392 168 400 V 416" fill="none" stroke="#4f5d75" stroke-width="1.2" marker-end="url(#architecture-delta-full-arrow)"/>
+<rect x="176" y="72" width="92" height="16" rx="2" fill="#f5f5f5"/>
+<text x="180" y="84" fill="#4f5d75" font-size="8" font-family="'Geist Mono', monospace" >r1 · HTTPS</text>
+<rect x="176" y="168" width="92" height="16" rx="2" fill="#f5f5f5"/>
+<text x="180" y="180" fill="#4f5d75" font-size="8" font-family="'Geist Mono', monospace" >r2 · REWIRED</text>
+<rect x="176" y="260" width="92" height="16" rx="2" fill="#f5f5f5"/>
+<text x="180" y="272" fill="#4f5d75" font-size="8" font-family="'Geist Mono', monospace" >r3 · REMOVED</text>
+<rect x="176" y="396" width="68" height="16" rx="2" fill="#f5f5f5"/>
+<text x="180" y="408" fill="#4f5d75" font-size="8" font-family="'Geist Mono', monospace" >r5 · SQL</text>
+<g data-kind="component" data-object-id="storefront" data-status="unchanged" data-signature="web:v1">
+<rect data-role="bounds" x="96" y="0" width="144" height="64" rx="6" fill="#ffffff" stroke="#4f5d75" stroke-width="1.2"/>
+<text x="108" y="15" fill="#4f5d75" font-size="7.5" font-family="'Geist Mono', monospace" >= storefront · UNCHANGED</text>
+<text x="108" y="36" fill="#2d3142" font-size="12" font-family="'Geist', sans-serif" font-weight="600">Storefront</text>
+<text x="108" y="53" fill="#4f5d75" font-size="9" font-family="'Geist Mono', monospace" >web:v1</text>
+</g>
+<g data-kind="component" data-object-id="api" data-status="changed" data-signature="orders:v1">
+<rect data-role="bounds" x="96" y="96" width="144" height="64" rx="6" fill="rgba(235,108,54,0.08)" stroke="#eb6c36" stroke-width="1.2"/>
+<path d="M 97 108 V 148" fill="none" stroke="#eb6c36" stroke-width="3"/>
+<text x="108" y="111" fill="#4f5d75" font-size="7.5" font-family="'Geist Mono', monospace" >~ api · CHANGED</text>
+<text x="108" y="132" fill="#2d3142" font-size="12" font-family="'Geist', sans-serif" font-weight="600">Orders API</text>
+<text x="108" y="149" fill="#4f5d75" font-size="9" font-family="'Geist Mono', monospace" >/orders · v1</text>
+</g>
+<g data-kind="component" data-object-id="legacy" data-status="removed" data-signature="dispatcher:v1">
+<rect data-role="bounds" x="96" y="192" width="144" height="64" rx="6" fill="#ffffff" stroke="#4f5d75" stroke-width="1.2" stroke-dasharray="4 4"/>
+<text x="108" y="207" fill="#4f5d75" font-size="7.5" font-family="'Geist Mono', monospace" >− legacy · REMOVED</text>
+<text x="108" y="228" fill="#2d3142" font-size="12" font-family="'Geist', sans-serif" font-weight="600">Legacy dispatcher</text>
+<text x="108" y="245" fill="#4f5d75" font-size="9" font-family="'Geist Mono', monospace" >dispatcher:v1</text>
+</g>
+<g data-kind="component" data-object-id="worker" data-status="moved" data-signature="fulfilment:v1">
+<rect data-role="bounds" x="8" y="304" width="144" height="64" rx="6" fill="#ffffff" stroke="#4f5d75" stroke-width="1.2" stroke-dasharray="1 4" stroke-linecap="round"/>
+<text x="20" y="319" fill="#4f5d75" font-size="7.5" font-family="'Geist Mono', monospace" >↔ worker · MOVED</text>
+<text x="20" y="340" fill="#2d3142" font-size="12" font-family="'Geist', sans-serif" font-weight="600">Fulfilment worker</text>
+<text x="20" y="357" fill="#4f5d75" font-size="9" font-family="'Geist Mono', monospace" >fulfilment:v1</text>
+</g>
+<g data-kind="component" data-object-id="db" data-status="unchanged" data-signature="orders:postgres">
+<rect data-role="bounds" x="96" y="416" width="144" height="64" rx="6" fill="#ffffff" stroke="#4f5d75" stroke-width="1.2"/>
+<text x="108" y="431" fill="#4f5d75" font-size="7.5" font-family="'Geist Mono', monospace" >= db · UNCHANGED</text>
+<text x="108" y="452" fill="#2d3142" font-size="12" font-family="'Geist', sans-serif" font-weight="600">Orders database</text>
+<text x="108" y="469" fill="#4f5d75" font-size="9" font-family="'Geist Mono', monospace" >PostgreSQL</text>
+</g>
+<text x="192" y="332" fill="#4f5d75" font-size="12" font-family="'Geist', sans-serif" >Same worker,</text>
+<text x="192" y="352" fill="#4f5d75" font-size="12" font-family="'Geist', sans-serif" >moves right →</text>
+</g>
+ <text x="424" y="110" fill="#4f5d75" font-size="9" font-family="'Geist Mono', monospace" >01</text>
+<text x="456" y="108" data-change="CHANGED" data-target="api" fill="#4f5d75" font-size="8" font-family="'Geist Mono', monospace" letter-spacing="0.06em">CHANGED · api<tspan x="456" y="131" fill="#2d3142" font-size="12" font-family="'Geist', sans-serif" letter-spacing="0">Orders API v1 → v2</tspan></text>
+<path d="M 456 148 H 776" stroke="rgba(45,49,66,0.12)" stroke-width="0.8"/>
+<text x="424" y="170" fill="#4f5d75" font-size="9" font-family="'Geist Mono', monospace" >02</text>
+<text x="456" y="168" data-change="REMOVED" data-target="legacy" fill="#4f5d75" font-size="8" font-family="'Geist Mono', monospace" letter-spacing="0.06em">REMOVED · legacy<tspan x="456" y="191" fill="#2d3142" font-size="12" font-family="'Geist', sans-serif" letter-spacing="0">Retire legacy dispatcher</tspan></text>
+<path d="M 456 208 H 776" stroke="rgba(45,49,66,0.12)" stroke-width="0.8"/>
+<text x="424" y="230" fill="#4f5d75" font-size="9" font-family="'Geist Mono', monospace" >03</text>
+<text x="456" y="228" data-change="ADDED" data-target="queue" fill="#4f5d75" font-size="8" font-family="'Geist Mono', monospace" letter-spacing="0.06em">ADDED · queue<tspan x="456" y="251" fill="#2d3142" font-size="12" font-family="'Geist', sans-serif" letter-spacing="0">Introduce durable order queue</tspan></text>
+<path d="M 456 268 H 776" stroke="rgba(45,49,66,0.12)" stroke-width="0.8"/>
+<text x="424" y="290" fill="#4f5d75" font-size="9" font-family="'Geist Mono', monospace" >04</text>
+<text x="456" y="288" data-change="MOVED" data-target="worker" fill="#4f5d75" font-size="8" font-family="'Geist Mono', monospace" letter-spacing="0.06em">MOVED · worker<tspan x="456" y="311" fill="#2d3142" font-size="12" font-family="'Geist', sans-serif" letter-spacing="0">Fulfilment worker: left → right</tspan></text>
+<path d="M 456 328 H 776" stroke="rgba(45,49,66,0.12)" stroke-width="0.8"/>
+<text x="424" y="350" fill="#4f5d75" font-size="9" font-family="'Geist Mono', monospace" >05</text>
+<text x="456" y="348" data-change="REWIRED" data-target="r2" fill="#4f5d75" font-size="8" font-family="'Geist Mono', monospace" letter-spacing="0.06em">REWIRED · r2<tspan x="456" y="371" fill="#2d3142" font-size="12" font-family="'Geist', sans-serif" letter-spacing="0">Orders API: dispatcher → queue</tspan></text>
+<path d="M 456 388 H 776" stroke="rgba(45,49,66,0.12)" stroke-width="0.8"/>
+<text x="424" y="410" fill="#4f5d75" font-size="9" font-family="'Geist Mono', monospace" >06</text>
+<text x="456" y="408" data-change="REMOVED" data-target="r3" fill="#4f5d75" font-size="8" font-family="'Geist Mono', monospace" letter-spacing="0.06em">REMOVED · r3<tspan x="456" y="431" fill="#2d3142" font-size="12" font-family="'Geist', sans-serif" letter-spacing="0">Dispatcher → worker</tspan></text>
+<path d="M 456 448 H 776" stroke="rgba(45,49,66,0.12)" stroke-width="0.8"/>
+<text x="424" y="470" fill="#4f5d75" font-size="9" font-family="'Geist Mono', monospace" >07</text>
+<text x="456" y="468" data-change="ADDED" data-target="r4" fill="#4f5d75" font-size="8" font-family="'Geist Mono', monospace" letter-spacing="0.06em">ADDED · r4<tspan x="456" y="491" fill="#2d3142" font-size="12" font-family="'Geist', sans-serif" letter-spacing="0">Queue → worker</tspan></text>
+<text x="424" y="544" fill="#4f5d75" font-size="8" font-family="'Geist Mono', monospace" letter-spacing="0.14em">PRESERVED</text>
+<text x="424" y="564" fill="#4f5d75" font-size="11" font-family="'Geist', sans-serif" >Storefront · database · r1 · r5</text>
+ <g data-snapshot="after" transform="translate(840 96)" data-grid="336 480 4">
+<!-- Relationships precede components; endpoints meet the declared bounds. -->
+<path data-kind="relationship" data-object-id="r1" data-status="unchanged" data-signature="https:create" data-from="storefront" data-to="api" d="M 168 64 V 96" fill="none" stroke="#4f5d75" stroke-width="1.2" marker-end="url(#architecture-delta-full-arrow)"/>
+<path data-kind="relationship" data-object-id="r2" data-status="rewired" data-signature="submit-order" data-from="api" data-to="queue" d="M 168 160 V 192" fill="none" stroke="#4f5d75" stroke-width="1.2" stroke-dasharray="8 3 2 3" marker-end="url(#architecture-delta-full-arrow)"/>
+<path data-kind="relationship" data-object-id="r4" data-status="added" data-signature="deliver" data-from="queue" data-to="worker" d="M 168 256 V 272 Q 168 280 176 280 H 248 Q 256 280 256 288 V 304" fill="none" stroke="#4f5d75" stroke-width="2" marker-end="url(#architecture-delta-full-arrow)"/>
+<path data-kind="relationship" data-object-id="r5" data-status="unchanged" data-signature="write-order" data-from="worker" data-to="db" d="M 256 368 V 384 Q 256 392 248 392 H 176 Q 168 392 168 400 V 416" fill="none" stroke="#4f5d75" stroke-width="1.2" marker-end="url(#architecture-delta-full-arrow)"/>
+<rect x="176" y="72" width="92" height="16" rx="2" fill="#f5f5f5"/>
+<text x="180" y="84" fill="#4f5d75" font-size="8" font-family="'Geist Mono', monospace" >r1 · HTTPS</text>
+<rect x="176" y="168" width="92" height="16" rx="2" fill="#f5f5f5"/>
+<text x="180" y="180" fill="#4f5d75" font-size="8" font-family="'Geist Mono', monospace" >r2 · REWIRED</text>
+<rect x="68" y="260" width="92" height="16" rx="2" fill="#f5f5f5"/>
+<text x="156" y="272" fill="#4f5d75" font-size="8" font-family="'Geist Mono', monospace" text-anchor="end">r4 · ADDED</text>
+<rect x="92" y="396" width="68" height="16" rx="2" fill="#f5f5f5"/>
+<text x="156" y="408" fill="#4f5d75" font-size="8" font-family="'Geist Mono', monospace" text-anchor="end">r5 · SQL</text>
+<g data-kind="component" data-object-id="storefront" data-status="unchanged" data-signature="web:v1">
+<rect data-role="bounds" x="96" y="0" width="144" height="64" rx="6" fill="#ffffff" stroke="#4f5d75" stroke-width="1.2"/>
+<text x="108" y="15" fill="#4f5d75" font-size="7.5" font-family="'Geist Mono', monospace" >= storefront · UNCHANGED</text>
+<text x="108" y="36" fill="#2d3142" font-size="12" font-family="'Geist', sans-serif" font-weight="600">Storefront</text>
+<text x="108" y="53" fill="#4f5d75" font-size="9" font-family="'Geist Mono', monospace" >web:v1</text>
+</g>
+<g data-kind="component" data-object-id="api" data-status="changed" data-signature="orders:v2">
+<rect data-role="bounds" x="96" y="96" width="144" height="64" rx="6" fill="rgba(235,108,54,0.08)" stroke="#eb6c36" stroke-width="1.2"/>
+<path d="M 97 108 V 148" fill="none" stroke="#eb6c36" stroke-width="3"/>
+<text x="108" y="111" fill="#4f5d75" font-size="7.5" font-family="'Geist Mono', monospace" >~ api · CHANGED</text>
+<text x="108" y="132" fill="#2d3142" font-size="12" font-family="'Geist', sans-serif" font-weight="600">Orders API</text>
+<text x="108" y="149" fill="#4f5d75" font-size="9" font-family="'Geist Mono', monospace" >/orders · v2</text>
+</g>
+<g data-kind="component" data-object-id="queue" data-status="added" data-signature="orders:durable:v1">
+<rect data-role="bounds" x="96" y="192" width="144" height="64" rx="6" fill="#ffffff" stroke="#4f5d75" stroke-width="1.2"/>
+<rect x="100" y="196" width="136" height="56" rx="4" fill="none" stroke="#4f5d75" stroke-width="0.8"/>
+<text x="108" y="207" fill="#4f5d75" font-size="7.5" font-family="'Geist Mono', monospace" >+ queue · ADDED</text>
+<text x="108" y="228" fill="#2d3142" font-size="12" font-family="'Geist', sans-serif" font-weight="600">Order queue</text>
+<text x="108" y="245" fill="#4f5d75" font-size="9" font-family="'Geist Mono', monospace" >durable · at-least-once</text>
+</g>
+<g data-kind="component" data-object-id="worker" data-status="moved" data-signature="fulfilment:v1">
+<rect data-role="bounds" x="184" y="304" width="144" height="64" rx="6" fill="#ffffff" stroke="#4f5d75" stroke-width="1.2" stroke-dasharray="1 4" stroke-linecap="round"/>
+<text x="196" y="319" fill="#4f5d75" font-size="7.5" font-family="'Geist Mono', monospace" >↔ worker · MOVED</text>
+<text x="196" y="340" fill="#2d3142" font-size="12" font-family="'Geist', sans-serif" font-weight="600">Fulfilment worker</text>
+<text x="196" y="357" fill="#4f5d75" font-size="9" font-family="'Geist Mono', monospace" >fulfilment:v1</text>
+</g>
+<g data-kind="component" data-object-id="db" data-status="unchanged" data-signature="orders:postgres">
+<rect data-role="bounds" x="96" y="416" width="144" height="64" rx="6" fill="#ffffff" stroke="#4f5d75" stroke-width="1.2"/>
+<text x="108" y="431" fill="#4f5d75" font-size="7.5" font-family="'Geist Mono', monospace" >= db · UNCHANGED</text>
+<text x="108" y="452" fill="#2d3142" font-size="12" font-family="'Geist', sans-serif" font-weight="600">Orders database</text>
+<text x="108" y="469" fill="#4f5d75" font-size="9" font-family="'Geist Mono', monospace" >PostgreSQL</text>
+</g>
+<text x="16" y="332" fill="#4f5d75" font-size="12" font-family="'Geist', sans-serif" >Same worker,</text>
+<text x="16" y="352" fill="#4f5d75" font-size="12" font-family="'Geist', sans-serif" >new placement.</text>
+</g>
+ <path d="M 24 608 H 1176" stroke="rgba(45,49,66,0.12)" stroke-width="1"/>
+<rect x="24" y="624" width="20" height="16" rx="3" fill="none" stroke="#4f5d75" stroke-width="1"/>
+<text x="56" y="636" fill="#4f5d75" font-size="11" font-family="'Geist', sans-serif" >= Unchanged</text>
+<rect x="220" y="624" width="20" height="16" rx="3" fill="none" stroke="#4f5d75" stroke-width="1"/>
+<rect x="224" y="628" width="12" height="8" rx="1" fill="none" stroke="#4f5d75" stroke-width="0.8"/>
+<text x="252" y="636" fill="#4f5d75" font-size="11" font-family="'Geist', sans-serif" >+ Added</text>
+<rect x="416" y="624" width="20" height="16" rx="3" fill="none" stroke="#4f5d75" stroke-width="1" stroke-dasharray="4 4"/>
+<text x="448" y="636" fill="#4f5d75" font-size="11" font-family="'Geist', sans-serif" >− Removed</text>
+<rect x="612" y="624" width="20" height="16" rx="3" fill="none" stroke="#4f5d75" stroke-width="1"/>
+<path d="M 613 628 V 636" stroke="#4f5d75" stroke-width="3"/>
+<text x="644" y="636" fill="#4f5d75" font-size="11" font-family="'Geist', sans-serif" >~ Changed</text>
+<rect x="808" y="624" width="20" height="16" rx="3" fill="none" stroke="#4f5d75" stroke-width="1" stroke-dasharray="1 4" stroke-linecap="round"/>
+<text x="840" y="636" fill="#4f5d75" font-size="11" font-family="'Geist', sans-serif" >↔ Moved</text>
+<path d="M 1004 632 H 1024" fill="none" stroke="#4f5d75" stroke-width="1.2" stroke-dasharray="8 3 2 3" marker-end="url(#architecture-delta-full-arrow)"/>
+<text x="1036" y="636" fill="#4f5d75" font-size="11" font-family="'Geist', sans-serif" >⇢ Rewired</text>
+<text x="24" y="660" fill="#4f5d75" font-size="9" font-family="'Geist', sans-serif" >IDs persist across snapshots. Dashed and dotted strokes encode change, not protocol.</text>
+<text x="1176" y="660" fill="#4f5d75" font-size="9" font-family="'Geist Mono', monospace" text-anchor="end">6 components · 5 relationships · 7 changes</text>
+ </svg>
+ </div>
+ <p class="scroll-hint">Scroll the diagram horizontally to compare both snapshots and the change ledger.</p>
+ <section class="notes" aria-label="Migration notes">
+ <article>
+ <h2>The change is in the handoff</h2>
+ <p>Orders API v2 submits to the new durable queue through relationship r2. The queue delivers to the same fulfilment worker through r4; the legacy dispatcher and its dispatch relationship r3 disappear. Queue delivery is at least once, so the worker must retain its existing idempotent order handling.</p>
+ </article>
+ <article>
+ <h2>Movement preserves identity</h2>
+ <p>The worker changes placement, with its implementation unchanged. Its database relationship r5 stays the same even though the connector follows the new position. The shared scale and stable IDs keep a layout move distinct from a semantic change or a rewired relationship.</p>
+ </article>
+ </section>
+ <footer class="footer"><span>Architecture delta · Before → Changes → After</span><span>Example migration · Scope: order fulfilment</span></footer>
+ </main>
+</body>
+</html>
diff --git a/skills/diagram-design/assets/example-architecture-delta.html b/skills/diagram-design/assets/example-architecture-delta.html
new file mode 100644
index 0000000..a062236
--- /dev/null
+++ b/skills/diagram-design/assets/example-architecture-delta.html
@@ -0,0 +1,193 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="UTF-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <title>Order fulfilment · Architecture delta</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-rule: rgba(45,49,66,0.12);
+ --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); color: var(--color-ink); background: var(--color-paper); min-height: 100vh; padding: 3rem 2rem; display: flex; align-items: center; justify-content: center; }
+ .frame { width: 100%; max-width: 1200px; min-width: 0; margin: 0 auto; }
+ .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, 2rem); line-height: 1.1; font-weight: 400; letter-spacing: -0.02em; margin-bottom: 1.75rem; }
+ .subtitle { max-width: 64ch; font-size: 0.9375rem; line-height: 1.6; color: var(--color-muted); margin-bottom: 2rem; }
+ .diagram-container { width: 100%; overflow-x: auto; }
+ .diagram-container:focus-visible { outline: 2px solid var(--color-muted); outline-offset: 4px; }
+ svg { display: block; width: 100%; min-width: 1100px; }
+ .scroll-hint { display: none; margin: 1rem 0 0; font-size: 0.8125rem; color: var(--color-muted); }
+ @media (max-width: 700px) { body { padding: 2rem 1rem; } .scroll-hint { display: block; } }
+ </style>
+</head>
+<body>
+ <main class="frame">
+ <p class="eyebrow">Architecture delta · Diagram Design</p>
+ <h1>Order fulfilment, before and after</h1>
+
+ <div class="diagram-container" role="region" aria-label="Before, changes, and after architecture comparison; scroll horizontally on narrow screens" tabindex="0">
+ <svg viewBox="0 0 1200 680" xmlns="http://www.w3.org/2000/svg" data-diagram="architecture-delta" role="img" aria-labelledby="architecture-delta-title architecture-delta-desc">
+ <title id="architecture-delta-title">Order fulfilment, before and after</title>
+ <desc id="architecture-delta-desc">A durable order queue replaces the legacy dispatcher, Orders API changes from v1 to v2, the fulfilment worker moves without changing implementation, and the storefront and database stay unchanged, with seven component and relationship changes listed between both snapshots.</desc>
+ <defs>
+ <marker id="architecture-delta-arrow" markerWidth="8" markerHeight="6" refX="8" refY="3" orient="auto" markerUnits="userSpaceOnUse"><polygon points="0 0, 8 3, 0 6" fill="#4f5d75"/></marker>
+ </defs>
+ <rect width="1200" height="680" fill="#f5f5f5"/>
+ <text x="24" y="28" fill="#2d3142" font-size="14" font-family="'Geist', sans-serif" font-weight="600">Before</text>
+ <text x="24" y="52" fill="#4f5d75" font-size="10" font-family="'Geist', sans-serif" >Synchronous dispatch · v1</text>
+ <text x="424" y="28" fill="#2d3142" font-size="14" font-family="'Geist', sans-serif" font-weight="600">Changes</text>
+ <text x="424" y="52" fill="#4f5d75" font-size="10" font-family="'Geist', sans-serif" >Four components · three relationships</text>
+ <text x="840" y="28" fill="#2d3142" font-size="14" font-family="'Geist', sans-serif" font-weight="600">After</text>
+ <text x="840" y="52" fill="#4f5d75" font-size="10" font-family="'Geist', sans-serif" >Queued fulfilment · v2</text>
+ <path d="M 392 8 V 576 M 808 8 V 576" stroke="rgba(45,49,66,0.12)" stroke-width="1"/>
+ <g data-snapshot="before" transform="translate(24 96)" data-grid="336 480 4">
+<!-- Relationships precede components; endpoints meet the declared bounds. -->
+<path data-kind="relationship" data-object-id="r1" data-status="unchanged" data-signature="https:create" data-from="storefront" data-to="api" d="M 168 64 V 96" fill="none" stroke="#4f5d75" stroke-width="1.2" marker-end="url(#architecture-delta-arrow)"/>
+<path data-kind="relationship" data-object-id="r2" data-status="rewired" data-signature="submit-order" data-from="api" data-to="legacy" d="M 168 160 V 192" fill="none" stroke="#4f5d75" stroke-width="1.2" stroke-dasharray="8 3 2 3" marker-end="url(#architecture-delta-arrow)"/>
+<path data-kind="relationship" data-object-id="r3" data-status="removed" data-signature="dispatch" data-from="legacy" data-to="worker" d="M 168 256 V 272 Q 168 280 160 280 H 88 Q 80 280 80 288 V 304" fill="none" stroke="#4f5d75" stroke-width="1.2" stroke-dasharray="4 4" marker-end="url(#architecture-delta-arrow)"/>
+<path data-kind="relationship" data-object-id="r5" data-status="unchanged" data-signature="write-order" data-from="worker" data-to="db" d="M 80 368 V 384 Q 80 392 88 392 H 160 Q 168 392 168 400 V 416" fill="none" stroke="#4f5d75" stroke-width="1.2" marker-end="url(#architecture-delta-arrow)"/>
+<rect x="176" y="72" width="92" height="16" rx="2" fill="#f5f5f5"/>
+<text x="180" y="84" fill="#4f5d75" font-size="8" font-family="'Geist Mono', monospace" >r1 · HTTPS</text>
+<rect x="176" y="168" width="92" height="16" rx="2" fill="#f5f5f5"/>
+<text x="180" y="180" fill="#4f5d75" font-size="8" font-family="'Geist Mono', monospace" >r2 · REWIRED</text>
+<rect x="176" y="260" width="92" height="16" rx="2" fill="#f5f5f5"/>
+<text x="180" y="272" fill="#4f5d75" font-size="8" font-family="'Geist Mono', monospace" >r3 · REMOVED</text>
+<rect x="176" y="396" width="68" height="16" rx="2" fill="#f5f5f5"/>
+<text x="180" y="408" fill="#4f5d75" font-size="8" font-family="'Geist Mono', monospace" >r5 · SQL</text>
+<g data-kind="component" data-object-id="storefront" data-status="unchanged" data-signature="web:v1">
+<rect data-role="bounds" x="96" y="0" width="144" height="64" rx="6" fill="#ffffff" stroke="#4f5d75" stroke-width="1.2"/>
+<text x="108" y="15" fill="#4f5d75" font-size="7.5" font-family="'Geist Mono', monospace" >= storefront · UNCHANGED</text>
+<text x="108" y="36" fill="#2d3142" font-size="12" font-family="'Geist', sans-serif" font-weight="600">Storefront</text>
+<text x="108" y="53" fill="#4f5d75" font-size="9" font-family="'Geist Mono', monospace" >web:v1</text>
+</g>
+<g data-kind="component" data-object-id="api" data-status="changed" data-signature="orders:v1">
+<rect data-role="bounds" x="96" y="96" width="144" height="64" rx="6" fill="rgba(235,108,54,0.08)" stroke="#eb6c36" stroke-width="1.2"/>
+<path d="M 97 108 V 148" fill="none" stroke="#eb6c36" stroke-width="3"/>
+<text x="108" y="111" fill="#4f5d75" font-size="7.5" font-family="'Geist Mono', monospace" >~ api · CHANGED</text>
+<text x="108" y="132" fill="#2d3142" font-size="12" font-family="'Geist', sans-serif" font-weight="600">Orders API</text>
+<text x="108" y="149" fill="#4f5d75" font-size="9" font-family="'Geist Mono', monospace" >/orders · v1</text>
+</g>
+<g data-kind="component" data-object-id="legacy" data-status="removed" data-signature="dispatcher:v1">
+<rect data-role="bounds" x="96" y="192" width="144" height="64" rx="6" fill="#ffffff" stroke="#4f5d75" stroke-width="1.2" stroke-dasharray="4 4"/>
+<text x="108" y="207" fill="#4f5d75" font-size="7.5" font-family="'Geist Mono', monospace" >− legacy · REMOVED</text>
+<text x="108" y="228" fill="#2d3142" font-size="12" font-family="'Geist', sans-serif" font-weight="600">Legacy dispatcher</text>
+<text x="108" y="245" fill="#4f5d75" font-size="9" font-family="'Geist Mono', monospace" >dispatcher:v1</text>
+</g>
+<g data-kind="component" data-object-id="worker" data-status="moved" data-signature="fulfilment:v1">
+<rect data-role="bounds" x="8" y="304" width="144" height="64" rx="6" fill="#ffffff" stroke="#4f5d75" stroke-width="1.2" stroke-dasharray="1 4" stroke-linecap="round"/>
+<text x="20" y="319" fill="#4f5d75" font-size="7.5" font-family="'Geist Mono', monospace" >↔ worker · MOVED</text>
+<text x="20" y="340" fill="#2d3142" font-size="12" font-family="'Geist', sans-serif" font-weight="600">Fulfilment worker</text>
+<text x="20" y="357" fill="#4f5d75" font-size="9" font-family="'Geist Mono', monospace" >fulfilment:v1</text>
+</g>
+<g data-kind="component" data-object-id="db" data-status="unchanged" data-signature="orders:postgres">
+<rect data-role="bounds" x="96" y="416" width="144" height="64" rx="6" fill="#ffffff" stroke="#4f5d75" stroke-width="1.2"/>
+<text x="108" y="431" fill="#4f5d75" font-size="7.5" font-family="'Geist Mono', monospace" >= db · UNCHANGED</text>
+<text x="108" y="452" fill="#2d3142" font-size="12" font-family="'Geist', sans-serif" font-weight="600">Orders database</text>
+<text x="108" y="469" fill="#4f5d75" font-size="9" font-family="'Geist Mono', monospace" >PostgreSQL</text>
+</g>
+<text x="192" y="332" fill="#4f5d75" font-size="12" font-family="'Geist', sans-serif" >Same worker,</text>
+<text x="192" y="352" fill="#4f5d75" font-size="12" font-family="'Geist', sans-serif" >moves right →</text>
+</g>
+ <text x="424" y="110" fill="#4f5d75" font-size="9" font-family="'Geist Mono', monospace" >01</text>
+<text x="456" y="108" data-change="CHANGED" data-target="api" fill="#4f5d75" font-size="8" font-family="'Geist Mono', monospace" letter-spacing="0.06em">CHANGED · api<tspan x="456" y="131" fill="#2d3142" font-size="12" font-family="'Geist', sans-serif" letter-spacing="0">Orders API v1 → v2</tspan></text>
+<path d="M 456 148 H 776" stroke="rgba(45,49,66,0.12)" stroke-width="0.8"/>
+<text x="424" y="170" fill="#4f5d75" font-size="9" font-family="'Geist Mono', monospace" >02</text>
+<text x="456" y="168" data-change="REMOVED" data-target="legacy" fill="#4f5d75" font-size="8" font-family="'Geist Mono', monospace" letter-spacing="0.06em">REMOVED · legacy<tspan x="456" y="191" fill="#2d3142" font-size="12" font-family="'Geist', sans-serif" letter-spacing="0">Retire legacy dispatcher</tspan></text>
+<path d="M 456 208 H 776" stroke="rgba(45,49,66,0.12)" stroke-width="0.8"/>
+<text x="424" y="230" fill="#4f5d75" font-size="9" font-family="'Geist Mono', monospace" >03</text>
+<text x="456" y="228" data-change="ADDED" data-target="queue" fill="#4f5d75" font-size="8" font-family="'Geist Mono', monospace" letter-spacing="0.06em">ADDED · queue<tspan x="456" y="251" fill="#2d3142" font-size="12" font-family="'Geist', sans-serif" letter-spacing="0">Introduce durable order queue</tspan></text>
+<path d="M 456 268 H 776" stroke="rgba(45,49,66,0.12)" stroke-width="0.8"/>
+<text x="424" y="290" fill="#4f5d75" font-size="9" font-family="'Geist Mono', monospace" >04</text>
+<text x="456" y="288" data-change="MOVED" data-target="worker" fill="#4f5d75" font-size="8" font-family="'Geist Mono', monospace" letter-spacing="0.06em">MOVED · worker<tspan x="456" y="311" fill="#2d3142" font-size="12" font-family="'Geist', sans-serif" letter-spacing="0">Fulfilment worker: left → right</tspan></text>
+<path d="M 456 328 H 776" stroke="rgba(45,49,66,0.12)" stroke-width="0.8"/>
+<text x="424" y="350" fill="#4f5d75" font-size="9" font-family="'Geist Mono', monospace" >05</text>
+<text x="456" y="348" data-change="REWIRED" data-target="r2" fill="#4f5d75" font-size="8" font-family="'Geist Mono', monospace" letter-spacing="0.06em">REWIRED · r2<tspan x="456" y="371" fill="#2d3142" font-size="12" font-family="'Geist', sans-serif" letter-spacing="0">Orders API: dispatcher → queue</tspan></text>
+<path d="M 456 388 H 776" stroke="rgba(45,49,66,0.12)" stroke-width="0.8"/>
+<text x="424" y="410" fill="#4f5d75" font-size="9" font-family="'Geist Mono', monospace" >06</text>
+<text x="456" y="408" data-change="REMOVED" data-target="r3" fill="#4f5d75" font-size="8" font-family="'Geist Mono', monospace" letter-spacing="0.06em">REMOVED · r3<tspan x="456" y="431" fill="#2d3142" font-size="12" font-family="'Geist', sans-serif" letter-spacing="0">Dispatcher → worker</tspan></text>
+<path d="M 456 448 H 776" stroke="rgba(45,49,66,0.12)" stroke-width="0.8"/>
+<text x="424" y="470" fill="#4f5d75" font-size="9" font-family="'Geist Mono', monospace" >07</text>
+<text x="456" y="468" data-change="ADDED" data-target="r4" fill="#4f5d75" font-size="8" font-family="'Geist Mono', monospace" letter-spacing="0.06em">ADDED · r4<tspan x="456" y="491" fill="#2d3142" font-size="12" font-family="'Geist', sans-serif" letter-spacing="0">Queue → worker</tspan></text>
+<text x="424" y="544" fill="#4f5d75" font-size="8" font-family="'Geist Mono', monospace" letter-spacing="0.14em">PRESERVED</text>
+<text x="424" y="564" fill="#4f5d75" font-size="11" font-family="'Geist', sans-serif" >Storefront · database · r1 · r5</text>
+ <g data-snapshot="after" transform="translate(840 96)" data-grid="336 480 4">
+<!-- Relationships precede components; endpoints meet the declared bounds. -->
+<path data-kind="relationship" data-object-id="r1" data-status="unchanged" data-signature="https:create" data-from="storefront" data-to="api" d="M 168 64 V 96" fill="none" stroke="#4f5d75" stroke-width="1.2" marker-end="url(#architecture-delta-arrow)"/>
+<path data-kind="relationship" data-object-id="r2" data-status="rewired" data-signature="submit-order" data-from="api" data-to="queue" d="M 168 160 V 192" fill="none" stroke="#4f5d75" stroke-width="1.2" stroke-dasharray="8 3 2 3" marker-end="url(#architecture-delta-arrow)"/>
+<path data-kind="relationship" data-object-id="r4" data-status="added" data-signature="deliver" data-from="queue" data-to="worker" d="M 168 256 V 272 Q 168 280 176 280 H 248 Q 256 280 256 288 V 304" fill="none" stroke="#4f5d75" stroke-width="2" marker-end="url(#architecture-delta-arrow)"/>
+<path data-kind="relationship" data-object-id="r5" data-status="unchanged" data-signature="write-order" data-from="worker" data-to="db" d="M 256 368 V 384 Q 256 392 248 392 H 176 Q 168 392 168 400 V 416" fill="none" stroke="#4f5d75" stroke-width="1.2" marker-end="url(#architecture-delta-arrow)"/>
+<rect x="176" y="72" width="92" height="16" rx="2" fill="#f5f5f5"/>
+<text x="180" y="84" fill="#4f5d75" font-size="8" font-family="'Geist Mono', monospace" >r1 · HTTPS</text>
+<rect x="176" y="168" width="92" height="16" rx="2" fill="#f5f5f5"/>
+<text x="180" y="180" fill="#4f5d75" font-size="8" font-family="'Geist Mono', monospace" >r2 · REWIRED</text>
+<rect x="68" y="260" width="92" height="16" rx="2" fill="#f5f5f5"/>
+<text x="156" y="272" fill="#4f5d75" font-size="8" font-family="'Geist Mono', monospace" text-anchor="end">r4 · ADDED</text>
+<rect x="92" y="396" width="68" height="16" rx="2" fill="#f5f5f5"/>
+<text x="156" y="408" fill="#4f5d75" font-size="8" font-family="'Geist Mono', monospace" text-anchor="end">r5 · SQL</text>
+<g data-kind="component" data-object-id="storefront" data-status="unchanged" data-signature="web:v1">
+<rect data-role="bounds" x="96" y="0" width="144" height="64" rx="6" fill="#ffffff" stroke="#4f5d75" stroke-width="1.2"/>
+<text x="108" y="15" fill="#4f5d75" font-size="7.5" font-family="'Geist Mono', monospace" >= storefront · UNCHANGED</text>
+<text x="108" y="36" fill="#2d3142" font-size="12" font-family="'Geist', sans-serif" font-weight="600">Storefront</text>
+<text x="108" y="53" fill="#4f5d75" font-size="9" font-family="'Geist Mono', monospace" >web:v1</text>
+</g>
+<g data-kind="component" data-object-id="api" data-status="changed" data-signature="orders:v2">
+<rect data-role="bounds" x="96" y="96" width="144" height="64" rx="6" fill="rgba(235,108,54,0.08)" stroke="#eb6c36" stroke-width="1.2"/>
+<path d="M 97 108 V 148" fill="none" stroke="#eb6c36" stroke-width="3"/>
+<text x="108" y="111" fill="#4f5d75" font-size="7.5" font-family="'Geist Mono', monospace" >~ api · CHANGED</text>
+<text x="108" y="132" fill="#2d3142" font-size="12" font-family="'Geist', sans-serif" font-weight="600">Orders API</text>
+<text x="108" y="149" fill="#4f5d75" font-size="9" font-family="'Geist Mono', monospace" >/orders · v2</text>
+</g>
+<g data-kind="component" data-object-id="queue" data-status="added" data-signature="orders:durable:v1">
+<rect data-role="bounds" x="96" y="192" width="144" height="64" rx="6" fill="#ffffff" stroke="#4f5d75" stroke-width="1.2"/>
+<rect x="100" y="196" width="136" height="56" rx="4" fill="none" stroke="#4f5d75" stroke-width="0.8"/>
+<text x="108" y="207" fill="#4f5d75" font-size="7.5" font-family="'Geist Mono', monospace" >+ queue · ADDED</text>
+<text x="108" y="228" fill="#2d3142" font-size="12" font-family="'Geist', sans-serif" font-weight="600">Order queue</text>
+<text x="108" y="245" fill="#4f5d75" font-size="9" font-family="'Geist Mono', monospace" >durable · at-least-once</text>
+</g>
+<g data-kind="component" data-object-id="worker" data-status="moved" data-signature="fulfilment:v1">
+<rect data-role="bounds" x="184" y="304" width="144" height="64" rx="6" fill="#ffffff" stroke="#4f5d75" stroke-width="1.2" stroke-dasharray="1 4" stroke-linecap="round"/>
+<text x="196" y="319" fill="#4f5d75" font-size="7.5" font-family="'Geist Mono', monospace" >↔ worker · MOVED</text>
+<text x="196" y="340" fill="#2d3142" font-size="12" font-family="'Geist', sans-serif" font-weight="600">Fulfilment worker</text>
+<text x="196" y="357" fill="#4f5d75" font-size="9" font-family="'Geist Mono', monospace" >fulfilment:v1</text>
+</g>
+<g data-kind="component" data-object-id="db" data-status="unchanged" data-signature="orders:postgres">
+<rect data-role="bounds" x="96" y="416" width="144" height="64" rx="6" fill="#ffffff" stroke="#4f5d75" stroke-width="1.2"/>
+<text x="108" y="431" fill="#4f5d75" font-size="7.5" font-family="'Geist Mono', monospace" >= db · UNCHANGED</text>
+<text x="108" y="452" fill="#2d3142" font-size="12" font-family="'Geist', sans-serif" font-weight="600">Orders database</text>
+<text x="108" y="469" fill="#4f5d75" font-size="9" font-family="'Geist Mono', monospace" >PostgreSQL</text>
+</g>
+<text x="16" y="332" fill="#4f5d75" font-size="12" font-family="'Geist', sans-serif" >Same worker,</text>
+<text x="16" y="352" fill="#4f5d75" font-size="12" font-family="'Geist', sans-serif" >new placement.</text>
+</g>
+ <path d="M 24 608 H 1176" stroke="rgba(45,49,66,0.12)" stroke-width="1"/>
+<rect x="24" y="624" width="20" height="16" rx="3" fill="none" stroke="#4f5d75" stroke-width="1"/>
+<text x="56" y="636" fill="#4f5d75" font-size="11" font-family="'Geist', sans-serif" >= Unchanged</text>
+<rect x="220" y="624" width="20" height="16" rx="3" fill="none" stroke="#4f5d75" stroke-width="1"/>
+<rect x="224" y="628" width="12" height="8" rx="1" fill="none" stroke="#4f5d75" stroke-width="0.8"/>
+<text x="252" y="636" fill="#4f5d75" font-size="11" font-family="'Geist', sans-serif" >+ Added</text>
+<rect x="416" y="624" width="20" height="16" rx="3" fill="none" stroke="#4f5d75" stroke-width="1" stroke-dasharray="4 4"/>
+<text x="448" y="636" fill="#4f5d75" font-size="11" font-family="'Geist', sans-serif" >− Removed</text>
+<rect x="612" y="624" width="20" height="16" rx="3" fill="none" stroke="#4f5d75" stroke-width="1"/>
+<path d="M 613 628 V 636" stroke="#4f5d75" stroke-width="3"/>
+<text x="644" y="636" fill="#4f5d75" font-size="11" font-family="'Geist', sans-serif" >~ Changed</text>
+<rect x="808" y="624" width="20" height="16" rx="3" fill="none" stroke="#4f5d75" stroke-width="1" stroke-dasharray="1 4" stroke-linecap="round"/>
+<text x="840" y="636" fill="#4f5d75" font-size="11" font-family="'Geist', sans-serif" >↔ Moved</text>
+<path d="M 1004 632 H 1024" fill="none" stroke="#4f5d75" stroke-width="1.2" stroke-dasharray="8 3 2 3" marker-end="url(#architecture-delta-arrow)"/>
+<text x="1036" y="636" fill="#4f5d75" font-size="11" font-family="'Geist', sans-serif" >⇢ Rewired</text>
+<text x="24" y="660" fill="#4f5d75" font-size="9" font-family="'Geist', sans-serif" >IDs persist across snapshots. Dashed and dotted strokes encode change, not protocol.</text>
+<text x="1176" y="660" fill="#4f5d75" font-size="9" font-family="'Geist Mono', monospace" text-anchor="end">6 components · 5 relationships · 7 changes</text>
+ </svg>
+ </div>
+ <p class="scroll-hint">Scroll the diagram horizontally to compare both snapshots and the change ledger.</p>
+ </main>
+</body>
+</html>
diff --git a/skills/diagram-design/assets/index.html b/skills/diagram-design/assets/index.html
index a21496f..cf11721 100644
--- a/skills/diagram-design/assets/index.html
+++ b/skills/diagram-design/assets/index.html
@@ -391,6 +391,9 @@
<button class="tab new" data-type="import-excalidraw" data-single>
<span class="eyebrow">54</span>Import · Excalidraw
</button>
+ <button class="tab new" data-type="architecture-delta">
+ <span class="eyebrow">55</span>Architecture delta
+ </button>
</div>
<div
diff --git a/skills/diagram-design/references/layout-budget.md b/skills/diagram-design/references/layout-budget.md
index e794a92..8a635a3 100644
--- a/skills/diagram-design/references/layout-budget.md
+++ b/skills/diagram-design/references/layout-budget.md
@@ -21,6 +21,7 @@ These are the per-type limits. The universal rows in SKILL.md §7 (9 nodes, 12 a
| Limit | Rule |
|---|---|
+| Max unique components / relationships / ledger entries (architecture delta) | 8 / 10 / 8 |
| Max lifelines (sequence) | 5 |
| Max combined fragments (sequence) | 1 (default); 2 only if each is single-region `opt`/`loop` |
| Max `alt` regions (sequence) | 2 |
diff --git a/skills/diagram-design/references/onboarding.md b/skills/diagram-design/references/onboarding.md
index da4c0f7..ccb129d 100644
--- a/skills/diagram-design/references/onboarding.md
+++ b/skills/diagram-design/references/onboarding.md
@@ -161,7 +161,7 @@ Write the new tokens to `style-guide.md`. Suggest running the `/regenerate-examp
After onboarding, the user should:
-1. Open `assets/index.html` (gallery) and confirm the new palette feels coherent across all 40 types.
+1. Open `assets/index.html` (gallery) and confirm the new palette feels coherent across all 42 types.
2. If any type looks off, they usually need to tune `muted` (often too dark or too light against the new `paper`).
---
diff --git a/skills/diagram-design/references/semantic-patterns.md b/skills/diagram-design/references/semantic-patterns.md
index 54d1113..17cd5bc 100644
--- a/skills/diagram-design/references/semantic-patterns.md
+++ b/skills/diagram-design/references/semantic-patterns.md
@@ -1,6 +1,6 @@
# Semantic patterns
-Semantic patterns describe **what a system does**; the 41 visual types describe **how information is arranged**. Choose a pattern first when behavior, state, enforcement, or risk is load-bearing, then use its nearest visual type as the layout grammar. If no pattern matches, choose a visual type directly.
+Semantic patterns describe **what a system does**; the 42 visual types describe **how information is arranged**. Choose a pattern first when behavior, state, enforcement, or risk is load-bearing, then use its nearest visual type as the layout grammar. If no pattern matches, choose a visual type directly.
Use one primary pattern per figure. A second pattern may supply at most one supporting primitive; if both need full treatment, split overview and detail. Labels and outcomes must remain complete in a static frame.
diff --git a/skills/diagram-design/references/type-architecture-delta.md b/skills/diagram-design/references/type-architecture-delta.md
new file mode 100644
index 0000000..e418fb6
--- /dev/null
+++ b/skills/diagram-design/references/type-architecture-delta.md
@@ -0,0 +1,143 @@
+# Architecture delta
+
+**Best for:** explaining a system migration, service extraction, infrastructure redesign, or integration change through two synchronized topology snapshots. Show which components and relationships survive, appear, disappear, change their properties, move, or reconnect.
+
+**Not this type:**
+
+- One system snapshot → **Architecture** (`type-architecture.md`).
+- Attribute-only differences without a topology story → a **comparison table**. Two versions of a configuration do not need two node maps.
+- Requests over time → **Sequence** (`type-sequence.md`); deployment phases → **Timeline** (`type-timeline.md`). A delta has exactly two states and does not establish migration order, downtime, or causality.
+- Host/container placement in one environment → **Deployment** (`type-deployment.md`).
+
+## Layout conventions
+
+- **Three panels, one reading order: Before · Changes · After.** Both topology panels use the same width, height, and internal grid pitch. The center panel is a short change ledger, not a third topology. Name the two snapshots with meaningful versions or dates.
+- **Keep the mental map stable.** Start by copying the Before coordinates into After. Move a retained component only when its movement is part of the story and receives a `MOVED` entry. Do not independently run a layout algorithm on each panel.
+- **Panel positions are not component positions.** Put each snapshot in one SVG `<g transform="translate(x y)">`; write component bounds and relationship paths in local coordinates. The Before and After origins share one y-coordinate, with the ledger occupying the horizontal gap.
+- **Shared grid:** use a 4px pitch by default. Every component's local x, y, width, and height is a multiple of that pitch. The shipped example uses two `336 480 4` grids; scale the overall SVG responsively without changing their local geometry.
+- **Budget:** at most **8 unique components**, **10 unique relationships**, and **8 ledger entries** across the complete comparison. A retained ID counts once, not once per snapshot. A component that is both changed and moved consumes two ledger entries. Split larger migrations into named subsystems or phases; never drop edges to fit.
+- **Connectors:** use Architecture's rounded orthogonal routing and port rules. In this type, even straight connectors are `<path>` elements so relationship identity and endpoints have one grammar. Draw paths before components. A stable relationship may take a different route to meet a moved component without becoming `REWIRED`.
+- **Nodes:** print the same stable ID in both states along with the human-readable name. Treat names, responsibilities, implementation versions, and protocols as semantic attributes; identities survive a rename when the underlying object survives.
+- **Ledger:** one brief entry per `(object ID, change)` pair. Begin with the uppercase change word, name the object, and state the actual difference. Do not describe unchanged objects in the ledger. Keep a readable text measure, with wrapped `<tspan>` lines when needed.
+- **Responsive presentation:** preserve the three-panel comparison on small screens with an accessible horizontal scroll region and a visible scroll hint. Do not compress labels until they become illegible or stack snapshots into independently scaled pictures. Print and export keep the whole comparison.
+
+## Change vocabulary and redundant encoding
+
+Color is secondary. Every change is readable from text plus a shape or line treatment; unchanged objects remain quiet context. Use the existing skin tokens and reserve the accent for the editorial focus, rather than assigning five status colors.
+
+| State | Meaning | Non-color treatment |
+|---|---|---|
+| `unchanged` | Same identity, semantics, position, and endpoints | Plain solid outline; no ledger entry |
+| `added` / **ADDED** | Present only in After | `+` badge or plus-shaped marker; solid outline |
+| `removed` / **REMOVED** | Present only in Before | `−` badge and dashed outline/path |
+| `changed` / **CHANGED** | Retained object whose semantic signature differs | `Δ` badge or inset rule, plus an explicit old → new ledger description |
+| `moved` / **MOVED** | Retained component whose local x or y differs | Direction/position marker and a ledger entry naming the relocation |
+| `rewired` / **REWIRED** | Retained relationship whose ordered source/target IDs differ | Distinct dash treatment or endpoint marker, with old → new endpoints written in the ledger |
+
+Do not use a missing After node to stand for a removal without a `REMOVED` entry. Do not substitute an `ADDED` edge for a `REWIRED` edge just to avoid explaining endpoint identity. A replacement component gets a new stable ID and separate removal/addition entries; its location alone cannot establish continuity.
+
+## Public HTML metadata contract
+
+This is the authoring and validation surface, not a serialization inferred from visible labels. All attributes below are required where applicable; empty, boolean, duplicate, or malformed declarations are findings. IDs are case-sensitive and match `[A-Za-z][A-Za-z0-9_.:-]*`; they contain no whitespace.
+
+### Diagram and snapshots
+
+The file has exactly one `<svg data-diagram="architecture-delta">`. Keep the standard accessible SVG title/description contract. Two direct child `<g>` elements declare `data-snapshot="before"` and `data-snapshot="after"`. Each has:
+
+- `data-grid="<width> <height> <pitch>"`: the same three positive finite numbers in both panels. Width and height are multiples of pitch.
+- `transform="translate(<x> <y>)"`: exactly one finite two-number translation, solely for the panel origin. Comma-separated translations are also accepted.
+
+Snapshot membership is inherited from the enclosing group. An object cannot be outside both snapshots, in nested snapshots, or nested inside another object. Other geometry transforms, nested SVG viewports, SVG animation, `<use>`, and foreign objects are outside this static grammar. Do not put objects or ledger entries in `<defs>`, `<symbol>`, templates, or other nonrendering containers.
+
+### Components
+
+Each component is a `<g>` declaring:
+
+| Attribute | Contract |
+|---|---|
+| `data-kind="component"` | Identifies a component group |
+| `data-object-id` | Stable object identity, unique within each snapshot |
+| `data-status` | One lowercase state or the space-separated combination `changed moved` |
+| `data-signature` | Nonempty semantic signature; see the signature rules below |
+
+The group contains exactly one **direct** `<rect data-role="bounds">` with explicit finite numeric `x`, `y`, `width`, and `height`. Position is nonnegative, size is positive, and the rectangle stays inside its local grid. All four values align with grid pitch. These are the actual drawn node bounds, not a hidden proxy rectangle.
+
+### Relationships
+
+Each relationship is a `<path>` with `data-kind="relationship"`, `data-object-id`, `data-status`, `data-signature`, and `data-from` / `data-to`. Its stable ID is separate from component IDs. Both endpoints resolve to component IDs in the **same snapshot**. Endpoint order is directional: swapping source and target is a rewire.
+
+Every path inside a snapshot and outside a component is a relationship and must carry the complete metadata. Decorative paths belong inside their component, or outside the snapshot for panel rules and ledger separators. Deleting all metadata from a connector must not make it disappear from validation.
+
+Relationship statuses are `unchanged`, `added`, `removed`, `changed`, `rewired`, or the combination `changed rewired`. `moved` applies to components only; `rewired` applies to relationships only. `unchanged`, `added`, and `removed` cannot be combined with any other token.
+
+The `d` attribute is one absolute `M` followed by absolute `L`, `H`, `V`, `Q`, or `C` segments. Implicit repeated coordinate groups are accepted. Relative commands, additional subpaths, closed paths, arcs, missing coordinates, and non-finite coordinates fail closed. Use orthogonal lines and quadratic corners for the standard layout; cubic segments are available for a small crossing bridge. Endpoints and control points remain inside the local grid. The path's start meets the source rectangle's perimeter and its end meets the target's perimeter, within 2px for stroke/arrow-cap rounding.
+
+### Status and signature rules
+
+- An ID present only in Before is exactly `removed`; an ID present only in After is exactly `added`.
+- A retained ID keeps its kind and the same status set in both snapshots. Never recycle a component ID for a relationship or vice versa.
+- A signature differs **if and only if** the retained object is `changed`. Construct it deterministically from the semantic attributes you want to compare, such as `orders-api:v2;mode=enqueue` or `protocol=https;operation=create-order`. Include a changed display name if renaming is part of the story. Preserve attribute order and spelling when values are unchanged.
+- Signatures exclude the object ID, snapshot, status, coordinates, visual styles, and relationship endpoints. These have their own checks. A movement or rewire alone must not change the signature.
+- A retained component's local `(x,y)` differs **if and only if** it is `moved`. A width/height change additionally requires `changed` and a changed signature. A changed signature alone does not require different bounds.
+- A retained relationship's ordered `(data-from,data-to)` pair differs **if and only if** it is `rewired`. Its path may reroute while that pair stays the same, for example when an endpoint component moves.
+- Numeric declarations are finite and have absolute values no larger than 10,000,000; unit suffixes, percentages, and CSS calculations are not coordinate declarations.
+
+### Ledger
+
+Each entry is a visible SVG `<text>` outside both snapshots, with `data-change="ADDED|REMOVED|CHANGED|MOVED|REWIRED"` and `data-target="<one object ID>"`. Its rendered text begins with the same uppercase word and continues with an explanation. Descendant `<tspan>` text is included when checking the wording; put the metadata on the outer `<text>` only.
+
+The ledger is an exact set of `(target, change)` pairs implied by object statuses. There are no missing entries, duplicate pairs, unknown targets, or entries for unchanged objects. The same target can have two entries only when it declares two changes. Every diagram contains at least one ledger entry, at least one component in each snapshot, and at least one relationship overall.
+
+### Worked metadata pattern
+
+This excerpt shows one changed component; a complete diagram also needs its other components, relationships, and accessible SVG title/description.
+
+```svg
+<svg data-diagram="architecture-delta" viewBox="0 0 1000 400">
+ <g data-snapshot="before" data-grid="320 320 4" transform="translate(24 64)">
+ <g data-kind="component" data-object-id="orders" data-status="changed"
+ data-signature="orders-api:v1;mode=dispatch">
+ <rect data-role="bounds" x="80" y="96" width="144" height="64"/>
+ <text x="96" y="120">orders · direct dispatch</text>
+ </g>
+ </g>
+ <g data-snapshot="after" data-grid="320 320 4" transform="translate(656 64)">
+ <g data-kind="component" data-object-id="orders" data-status="changed"
+ data-signature="orders-api:v2;mode=enqueue">
+ <rect data-role="bounds" x="80" y="96" width="144" height="64"/>
+ <text x="96" y="120">orders · enqueue</text>
+ </g>
+ </g>
+ <text data-change="CHANGED" data-target="orders" x="376" y="176">
+ <tspan>CHANGED orders</tspan>
+ <tspan x="376" dy="20">Direct dispatch → enqueue</tspan>
+ </text>
+</svg>
+```
+
+## Verification and its boundaries
+
+Run `python3 scripts/verify-architecture-delta.py --all` (or pass explicit HTML paths) and `python3 scripts/test-verify-architecture-delta.py`. No arguments also checks shipped examples. The stdlib HTML parser reads real attributes, including unquoted values and entities, ignores comments, and rejects malformed SVG nesting. Synthetic fixtures prove both legal cases and adversarial changes independently of the shipped coordinates; the light, dark, and full variants are checked too.
+
+The verifier enforces the declared structure, differential semantics, grid/bounds geometry, drawn relationship endpoints, budgets, and exact ledger coverage. It rejects CSS transforms/position overrides, CSS sizing that could change bounds, escaped CSS declarations, explicit hidden objects/ledger, and common CSS hiding rules. Ordinary responsive sizing of the outer SVG remains legal.
+
+It is **not** a browser renderer or a proof of the source system. Authors remain responsible for honest signatures, labels matching those signatures, readable shape/dash treatments, and an accurate migration story. Exotic CSS cascade/variable effects, clipping and occlusion, connector crossings, intermediate segment clearance, ledger placement, and screen-reader quality still require the normal skin, accessibility, geometry, and rendered-layout gates plus desktop/mobile visual review. Keep semantic geometry in the SVG attributes instead of making CSS part of the data model.
+
+## Anti-patterns
+
+- Two independently arranged snapshots that manufacture apparent movement.
+- A center ledger that says only “updated” without naming the object and difference.
+- Color-only statuses or a separate bright color for every kind of change.
+- Unchanged node positions drifting to make room, with no `MOVED` entry.
+- Semantic edits hidden behind an unchanged signature, or all signatures regenerated just because the snapshot changed.
+- Redrawing an edge to a different component while keeping its endpoint metadata unchanged.
+- Counting retained objects twice to justify dropping other objects from the comparison.
+- Treating this comparison as an executable migration plan. Ordering, rollback, availability, and data consistency need their own explanation.
+
+## Examples
+
+- `assets/example-architecture-delta.html` — minimal light order-fulfilment migration; all five change kinds.
+- `assets/example-architecture-delta-dark.html` — minimal dark, identical IDs, signatures, topology, and coordinates.
+- `assets/example-architecture-delta-full.html` — full editorial treatment of the same migration.
+
+The example retains the storefront and order store, changes the order API to enqueue work, removes the legacy dispatcher, adds a durable order queue, moves the fulfilment worker, and rewires order submission. Stable relationships follow the worker's new location while preserving their IDs and endpoint semantics.