chompyy 0.0.0-stage → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (178) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +252 -2
  3. package/THIRD_PARTY_NOTICES.md +59 -0
  4. package/dist/appstate.js +116 -0
  5. package/dist/away.js +314 -0
  6. package/dist/blueprint.js +91 -0
  7. package/dist/board.js +186 -0
  8. package/dist/claudesettings.js +23 -0
  9. package/dist/cli.js +861 -0
  10. package/dist/coldstart.js +207 -0
  11. package/dist/config.js +89 -0
  12. package/dist/costs.js +162 -0
  13. package/dist/duration.js +36 -0
  14. package/dist/gate.js +69 -0
  15. package/dist/history.js +308 -0
  16. package/dist/home.js +34 -0
  17. package/dist/livequota.js +92 -0
  18. package/dist/macapp.js +57 -0
  19. package/dist/pacing.js +189 -0
  20. package/dist/picture.js +117 -0
  21. package/dist/projects.js +114 -0
  22. package/dist/quota.js +153 -0
  23. package/dist/report.js +136 -0
  24. package/dist/review.js +173 -0
  25. package/dist/runner.js +357 -0
  26. package/dist/taste.js +507 -0
  27. package/dist/triggers.js +182 -0
  28. package/dist/vendor/codeburn/claude.js +255 -0
  29. package/dist/vendor/codeburn/security.js +260 -0
  30. package/dist/vendor/codeburn/types.js +1 -0
  31. package/dist/verify.js +131 -0
  32. package/dist/workspace.js +80 -0
  33. package/package.json +48 -4
  34. package/skills/away/SKILL.md +26 -0
  35. package/skills/eat-tokens/SKILL.md +18 -0
  36. package/skills/later/SKILL.md +20 -0
  37. package/skills/taste/SKILL.md +19 -0
  38. package/vendor/diagram-design/LICENSE +21 -0
  39. package/vendor/diagram-design/SKILL.md +399 -0
  40. package/vendor/diagram-design/UPSTREAM.md +18 -0
  41. package/vendor/diagram-design/assets/example-arc-diagram.html +111 -0
  42. package/vendor/diagram-design/assets/example-architecture-containment.html +205 -0
  43. package/vendor/diagram-design/assets/example-architecture-delta.html +193 -0
  44. package/vendor/diagram-design/assets/example-architecture.html +183 -0
  45. package/vendor/diagram-design/assets/example-axonometric-plan-campus.html +108 -0
  46. package/vendor/diagram-design/assets/example-axonometric-plan-coffee-shop.html +121 -0
  47. package/vendor/diagram-design/assets/example-axonometric-plan-warehouse.html +127 -0
  48. package/vendor/diagram-design/assets/example-axonometric-plan.html +114 -0
  49. package/vendor/diagram-design/assets/example-bar.html +129 -0
  50. package/vendor/diagram-design/assets/example-beeswarm.html +384 -0
  51. package/vendor/diagram-design/assets/example-box-plot.html +127 -0
  52. package/vendor/diagram-design/assets/example-bubble.html +147 -0
  53. package/vendor/diagram-design/assets/example-bump.html +142 -0
  54. package/vendor/diagram-design/assets/example-data-flow.html +143 -0
  55. package/vendor/diagram-design/assets/example-datalake.html +269 -0
  56. package/vendor/diagram-design/assets/example-db-schema.html +302 -0
  57. package/vendor/diagram-design/assets/example-dependency.html +224 -0
  58. package/vendor/diagram-design/assets/example-deployment.html +190 -0
  59. package/vendor/diagram-design/assets/example-dp-integration.html +81 -0
  60. package/vendor/diagram-design/assets/example-dp-security-matrix.html +88 -0
  61. package/vendor/diagram-design/assets/example-er.html +202 -0
  62. package/vendor/diagram-design/assets/example-event-modeling.html +64 -0
  63. package/vendor/diagram-design/assets/example-exploded-ai-stack.html +85 -0
  64. package/vendor/diagram-design/assets/example-exploded-keyboard.html +84 -0
  65. package/vendor/diagram-design/assets/example-exploded-phone.html +83 -0
  66. package/vendor/diagram-design/assets/example-exploded-unboxing.html +84 -0
  67. package/vendor/diagram-design/assets/example-exploded.html +83 -0
  68. package/vendor/diagram-design/assets/example-fishbone.html +152 -0
  69. package/vendor/diagram-design/assets/example-flowchart.html +163 -0
  70. package/vendor/diagram-design/assets/example-gantt.html +137 -0
  71. package/vendor/diagram-design/assets/example-heatmap.html +224 -0
  72. package/vendor/diagram-design/assets/example-high-level-vertical.html +325 -0
  73. package/vendor/diagram-design/assets/example-high-level.html +301 -0
  74. package/vendor/diagram-design/assets/example-import-drawio.html +185 -0
  75. package/vendor/diagram-design/assets/example-import-excalidraw.html +70 -0
  76. package/vendor/diagram-design/assets/example-import-mermaid.html +70 -0
  77. package/vendor/diagram-design/assets/example-import-plantuml.html +107 -0
  78. package/vendor/diagram-design/assets/example-it-state.html +128 -0
  79. package/vendor/diagram-design/assets/example-journey.html +148 -0
  80. package/vendor/diagram-design/assets/example-kanban.html +174 -0
  81. package/vendor/diagram-design/assets/example-layers.html +123 -0
  82. package/vendor/diagram-design/assets/example-line.html +111 -0
  83. package/vendor/diagram-design/assets/example-loop.html +100 -0
  84. package/vendor/diagram-design/assets/example-marimekko.html +148 -0
  85. package/vendor/diagram-design/assets/example-medallion.html +159 -0
  86. package/vendor/diagram-design/assets/example-nested.html +136 -0
  87. package/vendor/diagram-design/assets/example-org-chart.html +45 -0
  88. package/vendor/diagram-design/assets/example-polar.html +116 -0
  89. package/vendor/diagram-design/assets/example-process.html +64 -0
  90. package/vendor/diagram-design/assets/example-pyramid.html +119 -0
  91. package/vendor/diagram-design/assets/example-quadrant-consultant.html +166 -0
  92. package/vendor/diagram-design/assets/example-quadrant.html +135 -0
  93. package/vendor/diagram-design/assets/example-radar.html +139 -0
  94. package/vendor/diagram-design/assets/example-requirement-traceability.html +122 -0
  95. package/vendor/diagram-design/assets/example-ridgeline.html +104 -0
  96. package/vendor/diagram-design/assets/example-sankey.html +150 -0
  97. package/vendor/diagram-design/assets/example-sbgn.html +213 -0
  98. package/vendor/diagram-design/assets/example-scatter.html +141 -0
  99. package/vendor/diagram-design/assets/example-sequence-oauth.html +227 -0
  100. package/vendor/diagram-design/assets/example-sequence.html +222 -0
  101. package/vendor/diagram-design/assets/example-service-blueprint.html +185 -0
  102. package/vendor/diagram-design/assets/example-slopegraph.html +119 -0
  103. package/vendor/diagram-design/assets/example-state-lifecycle.html +92 -0
  104. package/vendor/diagram-design/assets/example-state.html +147 -0
  105. package/vendor/diagram-design/assets/example-steps.html +78 -0
  106. package/vendor/diagram-design/assets/example-story-map.html +184 -0
  107. package/vendor/diagram-design/assets/example-streamgraph.html +99 -0
  108. package/vendor/diagram-design/assets/example-swimlane.html +172 -0
  109. package/vendor/diagram-design/assets/example-timeline.html +135 -0
  110. package/vendor/diagram-design/assets/example-tree-block-decomposition.html +151 -0
  111. package/vendor/diagram-design/assets/example-tree.html +173 -0
  112. package/vendor/diagram-design/assets/example-treemap.html +107 -0
  113. package/vendor/diagram-design/assets/example-uml-class.html +188 -0
  114. package/vendor/diagram-design/assets/example-unit-grid.html +141 -0
  115. package/vendor/diagram-design/assets/example-venn.html +110 -0
  116. package/vendor/diagram-design/assets/example-wardley.html +153 -0
  117. package/vendor/diagram-design/assets/example-waterfall.html +129 -0
  118. package/vendor/diagram-design/assets/template-dark.html +99 -0
  119. package/vendor/diagram-design/assets/template.html +100 -0
  120. package/vendor/diagram-design/references/layout-budget.md +103 -0
  121. package/vendor/diagram-design/references/output-spec.md +277 -0
  122. package/vendor/diagram-design/references/primitive-annotation.md +36 -0
  123. package/vendor/diagram-design/references/primitive-sketchy.md +43 -0
  124. package/vendor/diagram-design/references/primitives-core.md +146 -0
  125. package/vendor/diagram-design/references/semantic-patterns.md +154 -0
  126. package/vendor/diagram-design/references/style-guide.md +234 -0
  127. package/vendor/diagram-design/references/type-architecture-delta.md +143 -0
  128. package/vendor/diagram-design/references/type-architecture.md +117 -0
  129. package/vendor/diagram-design/references/type-axonometric-plan.md +83 -0
  130. package/vendor/diagram-design/references/type-bar.md +108 -0
  131. package/vendor/diagram-design/references/type-data-flow.md +371 -0
  132. package/vendor/diagram-design/references/type-db-schema.md +48 -0
  133. package/vendor/diagram-design/references/type-dependency.md +113 -0
  134. package/vendor/diagram-design/references/type-deployment.md +45 -0
  135. package/vendor/diagram-design/references/type-dp-integration.md +407 -0
  136. package/vendor/diagram-design/references/type-dp-security-matrix.md +379 -0
  137. package/vendor/diagram-design/references/type-er.md +25 -0
  138. package/vendor/diagram-design/references/type-event-modeling.md +36 -0
  139. package/vendor/diagram-design/references/type-exploded.md +115 -0
  140. package/vendor/diagram-design/references/type-fishbone.md +75 -0
  141. package/vendor/diagram-design/references/type-flowchart.md +23 -0
  142. package/vendor/diagram-design/references/type-gantt.md +45 -0
  143. package/vendor/diagram-design/references/type-heatmap.md +80 -0
  144. package/vendor/diagram-design/references/type-high-level.md +470 -0
  145. package/vendor/diagram-design/references/type-it-state.md +468 -0
  146. package/vendor/diagram-design/references/type-journey.md +55 -0
  147. package/vendor/diagram-design/references/type-kanban.md +49 -0
  148. package/vendor/diagram-design/references/type-layers.md +26 -0
  149. package/vendor/diagram-design/references/type-line.md +337 -0
  150. package/vendor/diagram-design/references/type-loop.md +223 -0
  151. package/vendor/diagram-design/references/type-medallion.md +356 -0
  152. package/vendor/diagram-design/references/type-nested.md +22 -0
  153. package/vendor/diagram-design/references/type-org-chart.md +44 -0
  154. package/vendor/diagram-design/references/type-polar.md +136 -0
  155. package/vendor/diagram-design/references/type-process.md +490 -0
  156. package/vendor/diagram-design/references/type-pyramid.md +33 -0
  157. package/vendor/diagram-design/references/type-quadrant.md +81 -0
  158. package/vendor/diagram-design/references/type-radar.md +82 -0
  159. package/vendor/diagram-design/references/type-requirement-traceability.md +45 -0
  160. package/vendor/diagram-design/references/type-sankey.md +75 -0
  161. package/vendor/diagram-design/references/type-sbgn.md +80 -0
  162. package/vendor/diagram-design/references/type-scatter.md +276 -0
  163. package/vendor/diagram-design/references/type-sequence.md +130 -0
  164. package/vendor/diagram-design/references/type-service-blueprint.md +103 -0
  165. package/vendor/diagram-design/references/type-state.md +30 -0
  166. package/vendor/diagram-design/references/type-steps.md +180 -0
  167. package/vendor/diagram-design/references/type-story-map.md +46 -0
  168. package/vendor/diagram-design/references/type-swimlane.md +22 -0
  169. package/vendor/diagram-design/references/type-timeline.md +20 -0
  170. package/vendor/diagram-design/references/type-tree.md +24 -0
  171. package/vendor/diagram-design/references/type-treemap.md +137 -0
  172. package/vendor/diagram-design/references/type-uml-class.md +65 -0
  173. package/vendor/diagram-design/references/type-unit-grid.md +63 -0
  174. package/vendor/diagram-design/references/type-venn.md +26 -0
  175. package/vendor/diagram-design/references/type-wardley.md +39 -0
  176. package/vendor/diagram-design/references/type-waterfall.md +75 -0
  177. package/vendor/diagram-design/scripts/self_check.py +1177 -0
  178. package/vendor/diagram-design/scripts/verify_geometry.py +696 -0
@@ -0,0 +1,154 @@
1
+ # Semantic patterns
2
+
3
+ Semantic patterns describe **what a system does**; the 50 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.
4
+
5
+ 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.
6
+
7
+ ## Routing table
8
+
9
+ | The reader must understand… | Semantic pattern | Nearest visual type |
10
+ |---|---|---|
11
+ | Many arrivals competing for finite service capacity | **Fan-in queue / bottleneck** | Data flow |
12
+ | Repeated questions, inputs, controls, and outputs across stages | **Stage framework with semantic slots** | Process |
13
+ | A loose conversation becoming a durable structured record | **Unstructured input → structured artifact** | Data flow |
14
+ | Why two policy decisions differ and where they first diverge | **Paired policy-evaluation traces** | Flowchart |
15
+ | Which routes cross a trust boundary and which routes are blocked | **Secure paved road** | Architecture |
16
+ | Which controls apply at each enforcement surface | **Governance / control catalog** | Layer stack |
17
+ | How defenses reduce risk and what risk remains | **Compensating security layers** | Layer stack |
18
+ | Which sub-elements a system decomposes into, each independently citable and traced to its implementation | **Traceable block decomposition** | Tree |
19
+ | How one subject progresses through phases, waits, retries, cancellation, and terminal outcomes | **Lifecycle phase map** | State Machine |
20
+
21
+ ## 1. Fan-in queue / bottleneck
22
+
23
+ **Selection triggers:** Several producers converge on one reviewer, service, gate, or constrained resource; the story depends on arrival rate, queue depth, wait, capacity, or backpressure.
24
+
25
+ **Required primitives:** Distinct sources; fanned ingress; an ordered queue with visible slots and count; a capacity/service-rate label; one constrained service point; admitted and deferred/rejected outcomes. Label units (`8/hour`, `3 slots`), not just “high.”
26
+
27
+ **Complexity budget:** ≤5 sources, ≤5 queue slots, one bottleneck, two outcomes, and ≤9 primary nodes. Aggregate excess sources as a named cohort.
28
+
29
+ **Anti-patterns:** Equal-width pipeline that hides contention; arrows merged before they can be traced; capacity implied only by box size; decorative pile-up; animation that changes item order; red alone meaning overloaded.
30
+
31
+ **Static fallback:** Show the representative final queue, numeric count/capacity, bottleneck label, and both outcome paths. A still must reveal why work waits.
32
+
33
+ **Nearest visual type:** **Data flow** by default; use **Process** when service stages, rather than sources, dominate.
34
+
35
+ ## 2. Stage framework with semantic slots
36
+
37
+ **Selection triggers:** A lifecycle or operating model repeats the same semantic questions across stages, commonly Question, Input, Governance, and Output. Cross-stage comparability matters more than message timing.
38
+
39
+ **Required primitives:** Ordered stage headers; a consistent slot grid; explicit empty/not-applicable slots; stage-to-stage handoff; stable slot labels; one primary output per stage. Preserve slot order in every stage.
40
+
41
+ **Complexity budget:** 3–6 stages, 3–4 slot kinds, ≤20 populated cells, ≤2 lines per cell. Split detail when a cell needs prose.
42
+
43
+ **Anti-patterns:** Each stage invents a different internal layout; slot meaning encoded by position with no labels; fake precision from dozens of cells; confusing stage order with ownership lanes; shrinking text to keep one canvas.
44
+
45
+ **Static fallback:** Render the full stage × slot matrix with handoffs and explicit `—` or `Not applicable` entries. Do not depend on staged reveal to teach the schema.
46
+
47
+ **Nearest visual type:** **Process**; use **Swimlane** only when the repeated rows represent owners rather than semantic slots.
48
+
49
+ ## 3. Unstructured input → structured artifact
50
+
51
+ **Selection triggers:** Dialogue, notes, prompts, or a rambling request are elicited, normalized, and written into a durable brief, ticket, record, schema, or other structured artifact.
52
+
53
+ **Required primitives:** Source utterance(s); clarifying questions; extracted field/value pairs; a named transformation; the durable artifact boundary; provenance links from representative statements to fields; missing/unknown state.
54
+
55
+ **Complexity budget:** ≤4 exchanges, ≤6 artifact fields, one transformation, and ≤3 provenance links. Show representative content, not a transcript.
56
+
57
+ **Anti-patterns:** “AI magic” sparkle between two boxes; artifact shown as another chat bubble; fields appearing without sources; inventing certainty for missing facts; typing animation as the only readable copy.
58
+
59
+ **Static fallback:** Show a short source excerpt beside the completed labeled artifact, with at least one provenance mapping and any unknown fields visible.
60
+
61
+ **Nearest visual type:** **Data flow**; use **Process** when elicitation has several ordered gates.
62
+
63
+ ## 4. Paired policy-evaluation traces
64
+
65
+ **Selection triggers:** Two otherwise similar requests reach different outcomes; the reader needs rule-by-rule `PASS`, `FAIL`, `SKIPPED`, or `NOT REACHED` state and the first divergence.
66
+
67
+ **Required primitives:** The same ordered rules on both traces; explicit status text plus symbol/shape; inputs that differ; final outcomes; a labeled first-divergence marker; a distinction between `SKIPPED` (applicable flow intentionally bypassed) and `NOT REACHED` (evaluation stopped earlier).
68
+
69
+ **Complexity budget:** Exactly 2 traces, 3–6 rules, one first divergence, ≤12 status cells, and one outcome per trace. Move rule prose to notes if labels exceed one line.
70
+
71
+ **Anti-patterns:** Comparing two independently ordered flows; green/red dots without words; treating skipped and not-reached as synonyms; highlighting every difference; continuing a denied trace as if downstream rules ran.
72
+
73
+ **Static fallback:** Show all rule states and both outcomes at once; use a persistent bracket/line and label for the first divergence.
74
+
75
+ **Nearest visual type:** **Flowchart** for ordered decision logic; use **Sequence** only when messages between actors and time are also load-bearing.
76
+
77
+ ## 5. Secure paved road
78
+
79
+ **Selection triggers:** A supported architecture creates a bounded route from intake/build to deployment; trust boundaries, privileged moments, permitted ingress, forbidden ingress, and approved versus blocked deploy paths are the point.
80
+
81
+ **Required primitives:** Labeled trust boundaries; actors and identities; permitted ingress with a positive text label; forbidden ingress terminating at the boundary; approved deployment path; blocked bypass path; privileged gate; isolated runtime; audit destination. Use different line styles and stop symbols in addition to color.
82
+
83
+ **Complexity budget:** ≤3 trust zones, ≤8 components, ≤10 paths, ≤2 forbidden paths, and one privileged gate. Split control detail into a catalog figure.
84
+
85
+ **Anti-patterns:** Dashed box called “security” with no route semantics; forbidden arrow crossing into the protected zone; secrets or identity implied but unlabeled; every component styled as trusted; a bypass path that visually rejoins the approved route.
86
+
87
+ **Static fallback:** Render every boundary and both permitted/forbidden routes. Blocked paths must visibly stop before entry or deployment.
88
+
89
+ **Nearest visual type:** **Architecture**.
90
+
91
+ ## 6. Governance / control catalog
92
+
93
+ **Selection triggers:** A control inventory must be understood by where it is enforced: authoring, workspace, merge/CI, deploy/runtime, or another named surface. A single checklist would hide those enforcement points.
94
+
95
+ **Required primitives:** Enforcement-surface groups; named controls; enforcement actor (`code`, `platform`, `human`); timing (`write`, `merge`, `deploy`, `run`); bypassability or exception route; coverage/gap notation.
96
+
97
+ **Complexity budget:** 3–5 surfaces, 3–7 controls per surface, ≤24 controls total, and ≤3 attributes per control. Summarize counts only when the item list exists elsewhere.
98
+
99
+ **Anti-patterns:** 35 tiny pills; grouping by vague themes instead of enforcement point; mixing aspirations with enforced controls; icons without control names; claiming defense-in-depth without showing surface coverage.
100
+
101
+ **Static fallback:** Show the complete grouped catalog with surface headers and text labels for actor and enforcement timing; preserve gaps and exceptions.
102
+
103
+ **Nearest visual type:** **Layer stack**; use **DP security matrix** when role permissions, not enforcement surfaces, are the dominant comparison.
104
+
105
+ ## 7. Compensating security layers
106
+
107
+ **Selection triggers:** No layer is perfect; each defense covers a failure left by the previous layer, and residual risk must visibly narrow, transfer, or remain through the stack.
108
+
109
+ **Required primitives:** Ordered threat/risk input; named defensive layers; each layer's mitigation; explicit limitation or escape; residual-risk carrier between layers; final residual risk and consequence/response. Use labels or decreasing measures, never area alone.
110
+
111
+ **Complexity budget:** 3–5 layers, one primary risk thread, ≤2 mitigations per layer, and one final residual-risk statement. Split multiple unrelated threats into separate figures.
112
+
113
+ **Anti-patterns:** Implying the final layer makes risk zero; equal opaque slabs with no propagation; treating audit as prevention; shrinking shapes without numeric or verbal meaning; reversing prevention/detection/recovery order without explanation.
114
+
115
+ **Static fallback:** Show the complete propagation chain: initial risk → mitigation → escaped risk at every layer → final residual risk and response.
116
+
117
+ **Nearest visual type:** **Layer stack**; use **Nested** when containment boundaries, rather than ordered compensation, carry the meaning.
118
+
119
+ ## 8. Traceable block decomposition
120
+
121
+ **Selection triggers:** A system or product must decompose into addressable, individually citable sub-elements — each with a stable identifier a reader (or a compliance, audit, or IP record) can point at directly, not a name alone. The reader needs to trace a specific block to its parent, to what it consumes and produces, and to the code that implements it. This describes *structure* (what the system is made of), not a process — for a sequence of actions, choose a pattern that routes to Flowchart or Swimlane instead.
122
+
123
+ **Required primitives:** A stable dotted ID per block (e.g. `PAY-001-02`), shown as a compact badge using the existing node-box type-tag chip (SKILL.md §6; markup in [primitives-core.md](primitives-core.md#node-box--full-pattern)) — never as a separate connector-adjacent label. A noun-phrase block name — the structural element itself ("Fraud Screening"), not an action performed on it — in the node's existing name slot. Parent-child structure is Tree's own elbow connector; this pattern adds no new connector semantics or connector labels. At most one short inbound and one short outbound flow-port label per block, in the existing `sublabel` slot, shown only when both fit without crowding the name — omit by default. Every block's full record — inputs, outputs, constraints, assumptions, and an implementation path — lives in `data-block-*` attributes on the node (`data-block-id`, `data-block-parent`, `data-block-name`, and terse `data-block-input` / `-output` / `-constraint` / `-assumption` / `-impl` values) and, for anything longer than a short phrase, in the sidecar registry (see `export-registry.md`) — never as additional visible diagram text.
124
+
125
+ **Complexity budget:** Tree's own root+3-tier / 5-per-level caps and the global 9-node ceiling apply as-is — this pattern does not raise them. A hierarchy that needs more splits into a linked set of diagrams, one per subsystem, each independently traceable; the sidecar registry is the layer that reassembles the full graph across files. At most one in/out port-label pair per block when shown at all; constraints and assumptions are never rendered as visible text, only carried in metadata.
126
+
127
+ **Anti-patterns:** Four-sided ICOM boxes with Input/Control/Output/Mechanism arrows on every side — that is IDEF0's grammar, not this pattern's, and it does not fit Tree's connector rules. Drawing input/output arrows between siblings or cousins — that is a dependency graph's job; route to that type instead if cross-block flow must be drawn. Verb-phrase block names — name the structural element, not an action; if a block is genuinely an activity, it likely belongs in a companion Flowchart or Swimlane diagram, not this tree. An ID badge with no matching `data-block-id`, or a rename not mirrored in the registry. Treating the visible diagram as the complete record — it is a bounded view; the registry is the source of truth for anything not drawn. Labeling the tree connector itself with an ID or name — Tree has no connector-label convention today and this pattern must not invent one.
128
+
129
+ **Static fallback:** This pattern has no animated form — it is always static; bespoke interaction (click-to-expand, filter-by-ID) is out of this skill's scope entirely (see ADR 0001). Every ID badge, block name, and any shown port label must be legible in the single rendered frame.
130
+
131
+ **Nearest visual type:** **Tree** — Nested's single-chain containment cannot show two children of one parent; Dependency graph permits multi-parent nodes and cycles this pattern must forbid; Architecture's zones are flat, capped at 3, and explicitly route overflow to Swimlane, not to nested grouping.
132
+
133
+ **A note on provenance, not a claim of compliance:** "block," noun-phrase naming, and "flow port" are SysML Block Definition Diagram vocabulary, used because this pattern documents structure, the thing SysML's naming convention is for (IDEF0's verb-phrase convention documents *functions* instead — the wrong fit here). This is SysML-*informed* vocabulary applied to Tree's existing layout grammar, not a claim of SysML compliance: no OCL constraints, no XMI interchange, no tool-certified conformance, and no IDEF0 compliance either.
134
+
135
+ ## 9. Lifecycle phase map
136
+
137
+ **Selection triggers:** One subject advances through a small set of named phases, while waits, retries, cancellation, recovery, and terminal outcomes are as important as the happy path. Use this for the subject's lifecycle, not for messages exchanged between actors.
138
+
139
+ **Required primitives:** A left-to-right primary phase rail; 4–5 ordered phase states; a separate interruption/recovery band for waits or retries; a separate terminal-outcome band; labeled transitions; distinct terminal state boxes for cancellation and failure when both can occur. Those labeled boxes are sufficient terminal outcomes; optional start/end pseudo-state markers follow the State Machine reference and count toward the transition budget.
140
+
141
+ **Complexity budget:** 4–5 primary phases, ≤2 supporting wait/recovery states, ≤2 terminal states, ≤9 states, and ≤10 transitions. Split lifecycle overview from dense guard logic once either ceiling is reached.
142
+
143
+ **Anti-patterns:** Actor lifelines or message arrows disguised as phases; a request/response exchange that belongs in Sequence; every guard and event from the underlying implementation; interruption states placed on the primary rail; cancellation and failure collapsed into one color-only state; a retry loop with no labeled re-entry point.
144
+
145
+ **Static fallback:** Show the complete primary rail, every supporting state, both terminal outcomes, and all labeled transitions in one frame. Position and band labels must distinguish progress, interruption/recovery, and termination without relying on color.
146
+
147
+ **Nearest visual type:** **State Machine**. Use **Sequence** when actor messages or request timing carry the story; use ordinary **State Machine** without this pattern when dense transition logic and guards matter more than one subject's progress.
148
+
149
+ ## Composition rules
150
+
151
+ - The semantic pattern may specialize status, boundary, queue, or propagation primitives; the selected type still owns page axis, connector grammar, spacing, and type-specific limits.
152
+ - Apply the stricter of the pattern budget and visual-type budget. Semantic cells/statuses are not permission to exceed the nine-node overview target.
153
+ - Use stable text for states and outcomes. Color, motion, and position reinforce meaning but never carry it alone.
154
+ - Optional animation is a presentation layer, not another pattern. Load [`animation.md`](animation.md) only when motion is requested or materially clarifies ordered change.
@@ -0,0 +1,234 @@
1
+ # Style Guide
2
+
3
+ > **Chompyy skin.** This copy is customized for Chompyy (cream paper, chocolate ink, one baked-edge accent). It is not the shipped default, so the first-time style gate does not apply. Contrast: light accent 5.28:1, soft 5.80:1, muted 6.62:1, link 6.06:1 on `#faf3e8`; dark accent 8.24:1, soft 7.08:1, muted 9.90:1, link 7.64:1 on `#1e1915`.
4
+
5
+ **The single source of truth for colors, typography, and tokens.** Every diagram draws from this — not from hex values inlined in other reference files. If you want to change the visual skin of Diagram Design, change this file.
6
+
7
+ Default skin is a cool editorial palette — white-smoke paper, jet-black ink, burnt-tangerine accent, blue-slate muted. It's designed to look good out of the box; swap these values (or run [`onboarding.md`](onboarding.md)) and every new diagram inherits the new skin without touching any type-specific logic.
8
+
9
+ To generate your own from a website URL, see [`onboarding.md`](onboarding.md).
10
+
11
+ ---
12
+
13
+ ## Tokens
14
+
15
+ ### Semantic roles
16
+
17
+ Every token is referred to by **semantic role**, not by its hex value. Type references (`type-*.md`) and SKILL.md say `accent`, not `#bf4520`.
18
+
19
+ | Role | Purpose | Chompyy (light) | Chompyy (dark) |
20
+ |---|---|---|---|
21
+ | `paper` | Page background, default node fill | `#faf3e8` (cream) | `#1e1915` (roast) |
22
+ | `paper-2` | Diagram container bg, secondary fill | `#f2e8d9` | `#2a231d` |
23
+ | `ink` | Primary text, primary stroke | `#3a2a1f` (chocolate) | `#f6eee3` |
24
+ | `ink-strong` | High-contrast text on warm accent fills | `#111111` | `#111111` |
25
+ | `muted` | Secondary text, default arrow stroke | `#6b5141` | `#d0c1af` |
26
+ | `soft` | Sublabels, boundary labels | `#735a48` | `#b5a28f` |
27
+ | `rule` | Hairline borders | `rgba(58,42,31,0.12)` | `rgba(246,238,227,0.12)` |
28
+ | `rule-solid` | Stronger borders, baselines | `#ddd0bd` | `rgba(208,193,175,0.25)` |
29
+ | `accent` | Focal / 1–2 max per diagram | `#a8481c` (baked edge) | `#f0a066` |
30
+ | `accent-tint` | Fill for accent-bordered boxes | `rgba(168,72,28,0.08)` | `rgba(240,160,102,0.10)` |
31
+ | `link` | HTTP/API calls, external arrows | `#2e5aa8` | `#86aee6` |
32
+
33
+ > **Brand palette source:** this skin maps to a five-color brand palette: `jet-black #2d3142`, `silver #bfc0c0`, `white-smoke #f5f5f5`, `atomic-tangerine`, `blue-slate #4f5d75`. The light `accent` is not the raw brand tangerine. Raw atomic-tangerine reads 2.86:1 on `paper`, too faint for an arrow or a label, so the skin uses `#bf4520`, the same hue darkened until it clears 4.5:1 as text. The `soft`, `rule`, and `link` tokens are derived (a darker slate, ink at opacity, and a saturated variant in the blue-slate hue family) to cover roles the brand palette doesn't name directly. Every derived value is held to the contrast contract below.
34
+
35
+ ### Contrast contract
36
+
37
+ Every token must clear the threshold for each role it plays, against the background it actually sits on, in both skins. `scripts/verify-contrast.py` computes the WCAG 2.x ratio for every row above against the `paper` of its skin (`ink-strong` against the 0.85 `accent` fill it labels) and fails CI when one falls short.
38
+
39
+ | Use | Minimum vs. its actual background |
40
+ |---|---|
41
+ | Regular text, including any `soft`, `link`, or `accent` used as text | 4.5:1 |
42
+ | Large text (24px+, or 18.7px+ at weight 600+) | 3:1 |
43
+ | Essential non-text marks: lines, arrows, borders, focus outlines, data points | 3:1 against the adjacent color |
44
+ | Decorative rules and translucent tints (`rule`, `rule-solid`, `paper-2`, `accent-tint`, fills at opacity) | No minimum, but never the only carrier of meaning |
45
+
46
+ - **A token used in several roles must pass each one.** `accent` is a stroke in one place and a label in another, so it is held to 4.5:1, not the 3:1 its strokes alone would need. Don't assume a token is non-text because it usually is.
47
+ - **Translucent colors are composited first.** An `rgba()` fill or stroke is blended over `paper` before its ratio is measured. A value that clears the bar at full strength can fail at 0.5 opacity.
48
+ - **Surfaces other than `paper` cost contrast.** Inside an `accent-tint` box or on `paper-2` every ratio drops. Measure text placed there against that surface, not against `paper`.
49
+ - **Current defaults:** light `accent` 4.71:1, `soft` 5.34:1, `link` 6.13:1, `muted` 6.11:1 on `#f5f5f5`; dark `accent` 5.21:1, `soft` 4.78:1, `link` 4.76:1 on `#2d3142`.
50
+
51
+ ### Inversion rule (light → dark)
52
+
53
+ Any `rgba(45,49,66, X)` in light becomes `rgba(245,245,245, X)` in dark. Same opacities, RGB flipped. The accent gets a slight hue-shift brighter to read on dark paper.
54
+
55
+ ### Series palette (multi-series chart types only)
56
+
57
+ A small set of desaturated, editorial-tone colors for chart types that genuinely need to distinguish multiple overlapping entities (currently: **radar**). The "1-focal" rule still holds — `accent` is reserved for the focal series; the palette below covers the rest.
58
+
59
+ | Token | Light | Dark | Notes |
60
+ |---|---|---|---|
61
+ | `series-1` | `#7c8f6f` (sage) | `#9caf8f` | Non-focal series |
62
+ | `series-2` | `#5e7a9b` (dusty-blue) | `#82a0c0` | Non-focal series |
63
+ | `series-3` | `#b8915a` (mustard) | `#d3ad7a` | Non-focal series |
64
+ | `series-4` | `#9c6b50` (rust-brown) | `#b88670` | Non-focal series |
65
+ | `series-5` | `#6e6479` (slate) | `#8d8298` | Non-focal series |
66
+
67
+ Fills sit at `0.18` opacity light, `0.22` dark; strokes use the full color. **Don't backfill these tokens to non-chart types** — architecture, swimlane, etc. continue to use muted-ink variants. The series palette is opt-in for diagrams where overlapping shapes demand distinguishable color, not a license to add color elsewhere.
68
+
69
+ ### Terminal skin (opt-in alternate)
70
+
71
+ A self-contained palette for the terminal-window primitive (see [primitive-terminal.md](primitive-terminal.md)) — a CLI-chrome register for dev-tool posts and technical social cards. It does not replace the default skin above and isn't affected by onboarding; it's a second, fixed skin you opt into per-diagram.
72
+
73
+ | Token | Hex | Purpose |
74
+ |---|---|---|
75
+ | `terminal-page` | `#0a0a0a` | Page background behind the window |
76
+ | `terminal-paper` | `#141414` | Window body, node fill |
77
+ | `terminal-bar` | `#1b1b1b` | Titlebar strip |
78
+ | `terminal-border` | `#2b2b2b` | Window border, hairlines |
79
+ | `terminal-ink` | `#f5f5f5` | Primary text, primary stroke (same white-smoke as default `ink`) |
80
+ | `terminal-muted` | `#9a9a9a` | Secondary text, sublabels, ring stroke |
81
+ | `terminal-soft` | `#5c5c5c` | Tertiary — inactive dots, spokes |
82
+ | `terminal-accent` | `#ff5a36` | The one accent — focal station, prompt sign, active dot |
83
+ | `terminal-accent-tint` | `rgba(255,90,54,0.12)` | Fill for accent-bordered boxes |
84
+
85
+ **1-accent rule still holds.** Everything that isn't `terminal-ink` or `terminal-muted`/`terminal-soft` should be `terminal-accent` — never introduce a second hue.
86
+
87
+ ---
88
+
89
+ ## Typography
90
+
91
+ | Role | Family | Size | Weight | Usage |
92
+ |---|---|---|---|---|
93
+ | `title` | Instrument Serif | 1.75rem | 400 | Page H1 |
94
+ | `node-name` | Geist (sans) | 12px | 600 | Human-readable labels |
95
+ | `sublabel` | Geist Mono | 9px | 400 | Port, protocol, URL, field type |
96
+ | `eyebrow` | Geist Mono | 7–8px | 500, tracked 0.18em, uppercase | Type tags, axis labels |
97
+ | `arrow-label` | Geist Mono | 8px | 400, tracked 0.06em | Arrow annotations |
98
+ | `callout` | Instrument Serif *italic* | 14px | 400 | Editorial asides only |
99
+
100
+ ### Font stack
101
+
102
+ ```html
103
+ <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&family=Noto+Serif:ital@0;1&family=Noto+Sans+KR:wght@400;500;600&family=Noto+Serif+KR:wght@400&family=Noto+Sans+TC:wght@400;500;600&family=Noto+Serif+TC:wght@400&display=swap" rel="stylesheet">
104
+ ```
105
+
106
+ ### Font source
107
+
108
+ The font source decides whether a diagram makes any network request. It is a skin setting, so a saved profile carries it too.
109
+
110
+ Font source: `web`
111
+
112
+ | Value | What ships | Network |
113
+ |---|---|---|
114
+ | `web` (default) | The Google Fonts `<link>` above; text renders in Instrument Serif, Geist, and Geist Mono | One stylesheet request to `fonts.googleapis.com`, plus the font files |
115
+ | `system` | No font `<link>`; every family stack falls through to the platform's own serif, sans, and monospace faces | None |
116
+
117
+ Use `system` when the user asks for offline output, system fonts, or no Google Fonts, or when this line says `system`. In `system` mode:
118
+
119
+ - Omit the font `<link>` (and the export `@import`) entirely. Keep every `font-family` stack as written: each one already ends in a generic family (`serif`, `system-ui, sans-serif`, `ui-monospace, monospace`), so a viewer who has Geist installed still gets it and everyone else gets their system face.
120
+ - Fallback faces have different metrics from Geist, so keep the 8px label padding intact rather than trimming boxes to the Geist measurement.
121
+ - Export with `python3 scripts/export_svg.py <file> --system-fonts`, and verify with `python3 scripts/self_check.py --offline <file>`, which fails if the Google Fonts link is still present.
122
+
123
+ The render linter's default run (`lint-render.py` with network blocked) measures exactly this fallback rendering, so every shipped template and example is already checked in system-font mode.
124
+
125
+ To keep the editorial faces with no network at all, install Instrument Serif, Geist, and Geist Mono locally (all three are SIL Open Font License) and use `system`: the stacks resolve to the installed faces first.
126
+
127
+ ### Korean labels
128
+
129
+ Geist and Instrument Serif carry no Hangul. A Korean `<text>` element extends its own family — never swap the skin:
130
+
131
+ ```svg
132
+ <text font-family="'Geist', 'Noto Sans KR', 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif">결제 서비스</text>
133
+ ```
134
+
135
+ Both Noto faces ship in the font link above, so the web font resolves before any locally installed one and the same file renders identically on macOS, Windows, and a reviewer's browser. The local families follow it for offline viewing. Page titles need the serif equivalent — `'Instrument Serif', 'Noto Serif KR', serif` — or a mixed Latin/Korean title resolves Hangul through the platform's generic serif and the two halves disagree. Google's `css2` endpoint slices Korean by unicode-range, so a diagram with a handful of Korean labels downloads only the slices it touches. The four templates carry both faces because a new diagram may contain Hangul; the shipped Latin-only examples keep the shorter link, since a file with no Hangul has nothing to resolve.
136
+
137
+ **Width budget.** Measure per character, not per script: **every Unicode wide or full-width character costs 1em, every other character costs its face's Latin advance** (0.60em sans, 0.62em mono), and nonspacing/enclosing marks cost nothing. Sum over the string and multiply by the font size for the text width, then add padding and round the box up to the next multiple of 4. `verify-treemap.py` enforces exactly this text width for treemap cell labels. The skill's `scripts/self_check.py` applies the same width, plus any letter-spacing, to text inside a visible box of any type, and fails a label that runs more than 0.3em past the box edge. Padding, rounding, and labels on paper-coloured arrow-label masks are not checked, so those stay yours to hold.
138
+
139
+ Counting by script is the trap. `주문 v2.1` is two full-width syllables and five narrow characters; a formula that tallies Hangul, Latin letters, and spaces silently drops `2`, `.`, and `1` and sizes the box for four of its seven characters. Every rendered character costs something — measure per character, never per script.
140
+
141
+ Three rules follow from Hangul metrics:
142
+
143
+ - **Sublabels stay Latin.** Ports, protocols, field types, and URLs are Latin anyway — keep `Geist Mono` there and don't translate them. Hangul in a 9px mono sublabel is unreadable and has no mono face to fall back to.
144
+ - **Floor of 12px.** Hangul goes muddy below 12px. If a Korean name doesn't fit at 12px, cut the name — don't shrink the type.
145
+ - **Arrow labels, eyebrows, and legend text switch register.** Those slots are 7–8px Geist Mono, uppercase and tracked, which Hangul has neither a face nor legibility for. A Korean label in one of those slots becomes 12px sans at weight 500 with no tracking and no uppercase transform, and its mask rect grows to match (16px tall, width from the budget above, still rounded to a multiple of 4). Latin labels in the same diagram keep the mono treatment.
146
+
147
+ **Load-bearing rule:** Mono is for *technical* content (ports, commands, URLs, field types). Names go in Geist sans. Page title is Instrument Serif. Italic Instrument Serif is reserved for annotation callouts (see [primitive-annotation.md](primitive-annotation.md)). **Never JetBrains Mono** as a blanket "dev" font.
148
+
149
+ ### Traditional Chinese labels
150
+
151
+ Geist and Instrument Serif carry no Han. A Traditional Chinese `<text>` element extends its own family — never swap the skin:
152
+
153
+ ```svg
154
+ <text font-family="'Geist', 'Noto Sans TC', 'PingFang TC', 'Microsoft JhengHei', sans-serif">請求項比對</text>
155
+ ```
156
+
157
+ Both Noto TC faces ship in the font link above, so the web font resolves before any locally installed one and the same file renders identically on macOS, Windows, and a reviewer's browser. The local families follow it for offline viewing. Page titles need the serif equivalent — `'Instrument Serif', 'Noto Serif TC', serif` — or a mixed Latin/Han title resolves Han through the platform's generic serif and the two halves disagree. Google's `css2` endpoint slices Chinese by unicode-range, so a diagram with a handful of Chinese labels downloads only the slices it touches.
158
+
159
+ **Width budget.** The per-character contract above is unchanged: every Unicode wide or full-width character costs 1em, every other character costs its face's Latin advance, and nonspacing marks cost nothing. Full-width punctuation — `()「」,。:` — is wide and costs 1em as well, which is the part most often dropped.
160
+
161
+ Counting by script is the trap. `請求項 v2.1` is three full-width characters and five narrow ones; a formula that tallies Han and Latin letters silently drops `2`, `.`, and `1` and sizes the box for six of its nine characters.
162
+
163
+ Three rules follow from Han metrics, mirroring the Hangul ones:
164
+
165
+ - **Sublabels stay Latin.** Ports, protocols, field types, and URLs are Latin anyway — keep `Geist Mono` there and don't translate them. Han in a 9px mono sublabel is unreadable and has no mono face to fall back to. A sublabel that is prose rather than a value may be Chinese, but it then switches register by the third rule below.
166
+ - **Floor of 12px.** Han packs more strokes than Hangul into the same em box, so the 12px floor binds at least as hard here. If a Chinese name doesn't fit at 12px, cut the name — don't shrink the type.
167
+ - **Arrow labels, eyebrows, and legend text switch register.** Those slots are 7–8px Geist Mono, uppercase and tracked, which Han has neither a face nor legibility for. A Chinese label in one of those slots becomes 12px sans at weight 500 with no tracking and no uppercase transform, and its mask rect grows to match (16px tall, width from the budget above, still rounded to a multiple of 4). Latin labels in the same diagram keep the mono treatment.
168
+
169
+ Simplified Chinese takes the same three rules with the Simplified stack (`'Noto Sans SC'`, `'PingFang SC'`, `'Microsoft YaHei'`). That face does not ship in the link, so Simplified labels still resolve through whatever the viewer has locally.
170
+
171
+ ### Cyrillic labels
172
+
173
+ Geist and Geist Mono ship Cyrillic (`cyrillic` and `cyrillic-ext` on Google Fonts), so names, sublabels, arrow labels, eyebrows, and legend text in Bulgarian, Russian, Ukrainian, or Serbian keep the Latin treatment: same faces, sizes, tracking, and uppercase. There is no register switch: Hangul and Han switch register because Geist Mono has no face for them, and Geist Mono does cover Cyrillic.
174
+
175
+ Instrument Serif carries no Cyrillic. A page title extends its family — `'Instrument Serif', 'Noto Serif', serif` — or a mixed Latin/Cyrillic title resolves Cyrillic through whatever face comes next and the two halves disagree. Noto Serif ships in the font link above, upright and italic, so an italic callout in Cyrillic takes the same stack.
176
+
177
+ **Noto Serif goes ahead of the CJK serifs.** When a stack also lists `'Noto Serif KR'` or `'Noto Serif TC'`, put `'Noto Serif'` ahead of them. Google Fonts slices Cyrillic into those faces as well, so a stack that reaches a CJK face first draws its Cyrillic from it. That is why the templates put `'Noto Serif'` between `'Instrument Serif'` and `'Noto Serif KR'`; Noto Serif has no Hangul or Han, so Korean and Chinese titles pass straight through it.
178
+
179
+ **Width budget.** The per-character contract above is unchanged: every character costs its face's Latin advance (0.60em sans, 0.62em mono). It fits Geist Mono exactly and Geist sans only on average. Geist Mono is monospaced: a Cyrillic glyph advances exactly as far as a Latin one, so sublabels, arrow labels, eyebrows, legend text, and their mask rects are sized as for Latin. Geist sans is not. Its wide Cyrillic letters, capitals and lowercase alike (such as `Ж Ш Щ Ю Ы`, `ж ш щ ы ю`), run well past the 0.60em average: `Шкаф ODF-2` at 12px is budgeted at 72px and draws at about 76. Rounding the box up to a multiple of 4 recovers at most 3px, so it is not the remedy. Leave the overshoot in the box padding and measure a Cyrillic sans name in the browser — `verify-treemap.py` holds the budget, not the drawn width, so it will not catch the overshoot.
180
+
181
+ Counting by script is still the trap. `Шкаф ODF-2` is four Cyrillic letters, a space, three Latin letters, a hyphen, and a digit; a formula that tallies Cyrillic letters, Latin letters, and spaces silently drops `-` and `2` and sizes the box for eight of its ten characters.
182
+
183
+ **Preserve printed labels.** A label the reader matches against a physical thing — a cabinet, a splice closure, a port map — carries the exact printed string. Don't transliterate it and don't re-case it; if one has to sit in an uppercase slot such as an eyebrow, drop the transform for that label rather than re-case the printed string. `Шкаф ODF-2` stays `Шкаф ODF-2`, not `Shkaf ODF-2`.
184
+
185
+ ---
186
+
187
+ ## Stroke, radius, spacing
188
+
189
+ | Token | Value | Use |
190
+ |---|---|---|
191
+ | `stroke-thin` | `0.8` | Tag-box outlines, leaf nodes |
192
+ | `stroke-default` | `1` | Most strokes |
193
+ | `stroke-strong` | `1.2` | Emphasis strokes |
194
+ | `radius-sm` | `4` | Small tags |
195
+ | `radius-md` | `6` | Node boxes |
196
+ | `radius-lg` | `8` | Containers, rings |
197
+ | `grid` | `4` | Every coord, size, and gap is divisible by 4 (hard rule) |
198
+
199
+ ---
200
+
201
+ ## Node type → treatment
202
+
203
+ Semantic role combinations — reference these by name in type specs.
204
+
205
+ | Type | Fill | Stroke |
206
+ |---|---|---|
207
+ | `focal` (1–2 max) | `accent-tint` | `accent` |
208
+ | `backend` | `#ffffff` (white) | `ink` |
209
+ | `store` | `ink @ 0.05` | `muted` |
210
+ | `external` | `ink @ 0.03` | `ink @ 0.30` |
211
+ | `input` | `muted @ 0.10` | `soft` |
212
+ | `optional` | `ink @ 0.02` | `ink @ 0.20` dashed `4,3` |
213
+ | `security` | `accent @ 0.05` | `accent @ 0.50` dashed `4,4` |
214
+
215
+ ---
216
+
217
+ ## Customizing the skin
218
+
219
+ Four options:
220
+
221
+ 1. **Run onboarding** — see [`onboarding.md`](onboarding.md). Drop a URL; the skill extracts the palette + fonts and rewrites this file.
222
+ 2. **Edit by hand** — change the hex values in the tables above. Run the pre-output taste gate afterward to verify the accent still reads as "focal" against the new paper color.
223
+ 3. **Brand handoff** — paste your existing design-token JSON into a new section here and map its tokens to the semantic roles above.
224
+ 4. **Client profiles** — save and switch named skins, or bind one to a project, using [`profiles.md`](profiles.md).
225
+
226
+ ### Constraints (don't break these)
227
+
228
+ - **Contrast**: every text token (`ink`, `muted`, `soft`, `link`, and `accent`) must clear 4.5:1 on `paper`, in both skins. See the [contrast contract](#contrast-contract); `scripts/verify-contrast.py` checks it.
229
+ - **One accent**: pick one color for `accent`. Two accents erases the focal signal.
230
+ - **No rainbow palette**: if your brand ships 8 colors, pick 3 (paper, ink, accent). The rest become `muted` variants.
231
+ - **Serif + sans + mono**: three families, not more. If brand typography is all sans, keep Instrument Serif for `title` and `callout` anyway — the contrast is load-bearing.
232
+ - **Paper is warm-neutral, not pure white**: pure white turns the design sterile. Pick a cream, bone, or light grey with a hint of warmth.
233
+ - **Dot pattern is optional, not default**: the 22×22 dot pattern is an opt-in "dotted paper" variant (good for long-form editorial hero diagrams). The default background is a clean `paper` fill, no pattern. When the pattern is enabled, it should sit at ~10% opacity of `ink` on `paper` — visible but quiet.
234
+ - **Container is clean by default**: the diagram sits directly on the page paper, no secondary container background or border. A framed variant (`paper-2` bg + `rule` border + 8px radius + padding) is available as an opt-in for card-heavy layouts, but don't reach for it by default — the extra chrome fights the figure.
@@ -0,0 +1,143 @@
1
+ # Architecture delta
2
+
3
+ **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.
4
+
5
+ **Not this type:**
6
+
7
+ - One system snapshot → **Architecture** (`type-architecture.md`).
8
+ - Attribute-only differences without a topology story → a **comparison table**. Two versions of a configuration do not need two node maps.
9
+ - 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.
10
+ - Host/container placement in one environment → **Deployment** (`type-deployment.md`).
11
+
12
+ ## Layout conventions
13
+
14
+ - **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.
15
+ - **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.
16
+ - **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.
17
+ - **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.
18
+ - **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.
19
+ - **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`.
20
+ - **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.
21
+ - **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.
22
+ - **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.
23
+
24
+ ## Change vocabulary and redundant encoding
25
+
26
+ 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.
27
+
28
+ | State | Meaning | Non-color treatment |
29
+ |---|---|---|
30
+ | `unchanged` | Same identity, semantics, position, and endpoints | Plain solid outline; no ledger entry |
31
+ | `added` / **ADDED** | Present only in After | `+` badge or plus-shaped marker; solid outline |
32
+ | `removed` / **REMOVED** | Present only in Before | `−` badge and dashed outline/path |
33
+ | `changed` / **CHANGED** | Retained object whose semantic signature differs | `Δ` badge or inset rule, plus an explicit old → new ledger description |
34
+ | `moved` / **MOVED** | Retained component whose local x or y differs | Direction/position marker and a ledger entry naming the relocation |
35
+ | `rewired` / **REWIRED** | Retained relationship whose ordered source/target IDs differ | Distinct dash treatment or endpoint marker, with old → new endpoints written in the ledger |
36
+
37
+ 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.
38
+
39
+ ## Public HTML metadata contract
40
+
41
+ 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.
42
+
43
+ ### Diagram and snapshots
44
+
45
+ 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:
46
+
47
+ - `data-grid="<width> <height> <pitch>"`: the same three positive finite numbers in both panels. Width and height are multiples of pitch.
48
+ - `transform="translate(<x> <y>)"`: exactly one finite two-number translation, solely for the panel origin. Comma-separated translations are also accepted.
49
+
50
+ 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.
51
+
52
+ ### Components
53
+
54
+ Each component is a `<g>` declaring:
55
+
56
+ | Attribute | Contract |
57
+ |---|---|
58
+ | `data-kind="component"` | Identifies a component group |
59
+ | `data-object-id` | Stable object identity, unique within each snapshot |
60
+ | `data-status` | One lowercase state or the space-separated combination `changed moved` |
61
+ | `data-signature` | Nonempty semantic signature; see the signature rules below |
62
+
63
+ 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.
64
+
65
+ ### Relationships
66
+
67
+ 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.
68
+
69
+ 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.
70
+
71
+ 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.
72
+
73
+ 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.
74
+
75
+ ### Status and signature rules
76
+
77
+ - An ID present only in Before is exactly `removed`; an ID present only in After is exactly `added`.
78
+ - 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.
79
+ - 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.
80
+ - 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.
81
+ - 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.
82
+ - 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.
83
+ - Numeric declarations are finite and have absolute values no larger than 10,000,000; unit suffixes, percentages, and CSS calculations are not coordinate declarations.
84
+
85
+ ### Ledger
86
+
87
+ 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.
88
+
89
+ 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.
90
+
91
+ ### Worked metadata pattern
92
+
93
+ This excerpt shows one changed component; a complete diagram also needs its other components, relationships, and accessible SVG title/description.
94
+
95
+ ```svg
96
+ <svg data-diagram="architecture-delta" viewBox="0 0 1000 400">
97
+ <g data-snapshot="before" data-grid="320 320 4" transform="translate(24 64)">
98
+ <g data-kind="component" data-object-id="orders" data-status="changed"
99
+ data-signature="orders-api:v1;mode=dispatch">
100
+ <rect data-role="bounds" x="80" y="96" width="144" height="64"/>
101
+ <text x="96" y="120">orders · direct dispatch</text>
102
+ </g>
103
+ </g>
104
+ <g data-snapshot="after" data-grid="320 320 4" transform="translate(656 64)">
105
+ <g data-kind="component" data-object-id="orders" data-status="changed"
106
+ data-signature="orders-api:v2;mode=enqueue">
107
+ <rect data-role="bounds" x="80" y="96" width="144" height="64"/>
108
+ <text x="96" y="120">orders · enqueue</text>
109
+ </g>
110
+ </g>
111
+ <text data-change="CHANGED" data-target="orders" x="376" y="176">
112
+ <tspan>CHANGED orders</tspan>
113
+ <tspan x="376" dy="20">Direct dispatch → enqueue</tspan>
114
+ </text>
115
+ </svg>
116
+ ```
117
+
118
+ ## Verification and its boundaries
119
+
120
+ 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.
121
+
122
+ 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.
123
+
124
+ 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.
125
+
126
+ ## Anti-patterns
127
+
128
+ - Two independently arranged snapshots that manufacture apparent movement.
129
+ - A center ledger that says only “updated” without naming the object and difference.
130
+ - Color-only statuses or a separate bright color for every kind of change.
131
+ - Unchanged node positions drifting to make room, with no `MOVED` entry.
132
+ - Semantic edits hidden behind an unchanged signature, or all signatures regenerated just because the snapshot changed.
133
+ - Redrawing an edge to a different component while keeping its endpoint metadata unchanged.
134
+ - Counting retained objects twice to justify dropping other objects from the comparison.
135
+ - Treating this comparison as an executable migration plan. Ordering, rollback, availability, and data consistency need their own explanation.
136
+
137
+ ## Examples
138
+
139
+ - `assets/example-architecture-delta.html` — minimal light order-fulfilment migration; all five change kinds.
140
+ - `assets/example-architecture-delta-dark.html` — minimal dark, identical IDs, signatures, topology, and coordinates.
141
+ - `assets/example-architecture-delta-full.html` — full editorial treatment of the same migration.
142
+
143
+ 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.