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.

docs(adr): record the visual-type count of 41 in ADR 0002 (#257)

Cathryn Lavery3138f120f6d6
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 85811df..888daca 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
@@ -24,12 +24,12 @@ Behavior is a separate axis. The semantic patterns in `references/semantic-patte
**2026-08-20 — the count is 39.** Polar was admitted under the same escape clause: angle encodes ordered cyclic categories and linear radius encodes one quantitative series, a layout grammar no existing type provides. It shipped the full §10 set, and the counters named above moved 38 → 39 together with the prose.
-**2026-08-31 — the count is 40.** 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 39 → 40 together with the prose.
-
**2026-08-31 — the pattern count is eight.** Traceable block decomposition was added: hierarchical, ID-addressable block decomposition with per-block I/O, constraints, and an implementation-code link, for compliance, audit, or IP-style documentation. It routes to the existing Tree type — SysML-informed vocabulary (block, noun-phrase naming, flow port) applied to Tree's existing layout grammar, not a new grammar and not a claim of SysML or IDEF0 conformance. This is the first amendment to the *pattern* count specifically (every prior amendment above moved the *type* count); the mechanism is the same one-line-plus-routing-row cost this ADR's Decision describes, and `verify-semantic-motion.py`'s `PATTERN_NAMES` list is its enforcement, the same way the type counters enforce the type count. See [ADR 0010](0010-block-registry-metadata-contract.md).
**2026-09-06 — the count is 40.** Waterfall was admitted under the same escape clause: a running total anchored by start/end bars and bridged by signed floating deltas is a layout grammar no existing type provides (bar compares independent categories, the dumbbell states two endpoints without the path, pyramid ranks one funnel, Sankey splits and merges). The per-grammar argument is in [ADR 0011](0011-waterfall-is-a-running-total-grammar.md); it ships the full §10 set, and the counters named above move 39 → 40 together with the prose.
**2026-09-15 — the pattern count is nine.** Lifecycle phase map was added for one subject's progress through primary phases, waits, retries, cancellation, and terminal outcomes. It routes to the existing State Machine type and adds banding plus a tighter nine-state/ten-transition budget, not a new layout grammar. Request and message lifecycles remain Sequence diagrams under ADR 0007. See [issue #226](https://github.com/cathrynlavery/diagram-design/issues/226).
+**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.
+
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/scripts/test-verify-semantic-motion.py b/scripts/test-verify-semantic-motion.py
index 3ebf20d..68789e7 100644
--- a/scripts/test-verify-semantic-motion.py
+++ b/scripts/test-verify-semantic-motion.py
@@ -228,6 +228,106 @@ def main() -> int:
finally:
module.SKILL = original_skill
+
+ # semantic-patterns.md states the visual-type count in its opening line; it
+ # must agree with the counters.
+ original_patterns = module.PATTERNS
+ try:
+ with tempfile.TemporaryDirectory(prefix="verify-semantic-motion-patterns-") as temp_dir:
+ stale_patterns = Path(temp_dir) / "semantic-patterns.md"
+ count = module.VISUAL_TYPE_COUNT
+ stale_patterns.write_text(
+ original_patterns.read_text(encoding="utf-8").replace(
+ f"the {count} visual types", f"the {count - 1} visual types", 1
+ ),
+ encoding="utf-8",
+ )
+ module.PATTERNS = stale_patterns
+ errors = module.verify_markdown()
+ if not any("semantic-patterns.md must name" in e for e in errors):
+ raise AssertionError(f"a stale type count in semantic-patterns.md was accepted: {errors}")
+ # A later paragraph that still names the right count must not
+ # stand in for a stale opening paragraph.
+ stale_opening = Path(temp_dir) / "semantic-patterns-stale-opening.md"
+ stale_opening.write_text(
+ stale_patterns.read_text(encoding="utf-8")
+ + f"\nThe {count} visual types each have a reference; the {count} visual types count.\n",
+ encoding="utf-8",
+ )
+ module.PATTERNS = stale_opening
+ errors = module.verify_markdown()
+ if not any("semantic-patterns.md must name" in e for e in errors):
+ raise AssertionError(f"a stale opening paragraph was accepted: {errors}")
+ print("OK: semantic-patterns.md must state the enforced visual-type count")
+ finally:
+ module.PATTERNS = original_patterns
+
+ # ADR 0002 must record the visual-type count the counters enforce, in date order.
+ original_adr = module.ADR_0002
+ try:
+ with tempfile.TemporaryDirectory(prefix="verify-semantic-motion-adr-") as temp_dir:
+ adr_text = original_adr.read_text(encoding="utf-8")
+ if module.verify_type_count_record():
+ raise AssertionError(
+ f"shipped ADR 0002 failed: {module.verify_type_count_record()}"
+ )
+ amendments = [
+ line for line in adr_text.splitlines()
+ if line.startswith("**") and " the count is " in line
+ ]
+ stale = Path(temp_dir) / "adr-stale.md"
+ stale.write_text(adr_text.replace(amendments[-1], ""), encoding="utf-8")
+ module.ADR_0002 = stale
+ errors = module.verify_type_count_record()
+ if not any("latest amendment records the visual-type count" in e for e in errors):
+ raise AssertionError(f"stale ADR 0002 count was accepted: {errors}")
+ out_of_order = Path(temp_dir) / "adr-order.md"
+ out_of_order.write_text(
+ adr_text.replace(amendments[0], amendments[0].replace("**2026-", "**2027-", 1)),
+ encoding="utf-8",
+ )
+ module.ADR_0002 = out_of_order
+ errors = module.verify_type_count_record()
+ if not any("not in date order" in e for e in errors):
+ raise AssertionError(f"out-of-order ADR 0002 amendments were accepted: {errors}")
+ untitled = Path(temp_dir) / "adr-untitled.md"
+ untitled.write_text(
+ adr_text.replace(
+ amendments[-1],
+ amendments[-1].replace("the count is ", "New type admitted, ", 1),
+ ),
+ encoding="utf-8",
+ )
+ module.ADR_0002 = untitled
+ errors = module.verify_type_count_record()
+ if not any("title it 'the count is N'" in e for e in errors):
+ raise AssertionError(f"an unreadable amendment title was accepted: {errors}")
+ last = amendments[-1]
+ last_date = last[2:12]
+ for label, replacement, needle in (
+ ("short date", last.replace(last_date, "2026-10-1", 1), "not a YYYY-MM-DD date"),
+ ("impossible date", last.replace(last_date, "2026-13-01", 1), "not a real date"),
+ (
+ "nonsense pattern count",
+ last.replace("the count is", "the pattern count is", 1).replace(
+ "is " + str(module.VISUAL_TYPE_COUNT), "is banana", 1
+ ),
+ "title it 'the count is N'",
+ ),
+ ):
+ broken = Path(temp_dir) / f"adr-{label.replace(' ', '-')}.md"
+ broken.write_text(adr_text.replace(last, replacement), encoding="utf-8")
+ module.ADR_0002 = broken
+ errors = module.verify_type_count_record()
+ if not any(needle in e for e in errors):
+ raise AssertionError(f"ADR 0002 {label} was accepted: {errors}")
+ print(
+ "OK: ADR 0002 must record the enforced visual-type count, in date order, "
+ "with readable amendment titles"
+ )
+ finally:
+ module.ADR_0002 = original_adr
+
# A duplicated HTML/SVG id in the animated example must be rejected.
with tempfile.TemporaryDirectory(prefix="verify-semantic-motion-example-") as temp_dir:
source = module.EXAMPLE.read_text(encoding="utf-8")
diff --git a/scripts/verify-semantic-motion.py b/scripts/verify-semantic-motion.py
index 82fe3b9..42271d2 100644
--- a/scripts/verify-semantic-motion.py
+++ b/scripts/verify-semantic-motion.py
@@ -7,6 +7,7 @@ Uses only the Python standard library and never executes example JavaScript.
from __future__ import annotations
import argparse
+import datetime
import os
import re
import shutil
@@ -25,6 +26,7 @@ GIT_ROOT = ROOT
PATTERNS = ROOT / "skills/diagram-design/references/semantic-patterns.md"
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
@@ -185,6 +187,62 @@ def section(markdown: str, heading: str, next_heading: str | None) -> str:
return markdown[start:] if end < 0 else markdown[start:end]
+NUMBER_WORDS = (
+ "one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve|thirteen|"
+ "fourteen|fifteen|sixteen|seventeen|eighteen|nineteen|twenty"
+)
+
+def verify_type_count_record() -> list[str]:
+ """ADR 0002 is the authority for the visual-type count; the counter follows it.
+
+ Every dated amendment is titled "the count is N" or "the pattern count is
+ <n>", amendments are in date order, and the newest "the count is N" must name
+ VISUAL_TYPE_COUNT, so a PR cannot move the counter without recording the
+ admission.
+ """
+ errors: list[str] = []
+ adr = ADR_0002.read_text(encoding="utf-8")
+ # Find every bold paragraph that opens with a digit before judging its
+ # form, so a malformed date cannot hide an amendment from the check.
+ amendments = re.findall(
+ r"^\*\*(\d[\d-]*\d)\s+\S+\s+(.+?)\.\*\*", adr, re.MULTILINE
+ )
+ dates: list[str] = []
+ for date, _title in amendments:
+ if not re.fullmatch(r"\d{4}-\d{2}-\d{2}", date):
+ errors.append(f"ADR 0002 amendment date {date!r} is not a YYYY-MM-DD date")
+ continue
+ try:
+ datetime.date(int(date[:4]), int(date[5:7]), int(date[8:]))
+ except ValueError:
+ errors.append(f"ADR 0002 amendment date {date!r} is not a real date")
+ continue
+ dates.append(date)
+ counts: list[tuple[str, int]] = []
+ for date, title in amendments:
+ count = re.fullmatch(r"the count is (\d+)", title)
+ if count:
+ counts.append((date, int(count.group(1))))
+ elif not re.fullmatch(rf"the pattern count is (?:\d+|{NUMBER_WORDS})", title):
+ errors.append(
+ f"ADR 0002 amendment dated {date} is titled {title!r}; title it "
+ "'the count is N' (or 'the pattern count is N' for a semantic "
+ "pattern) so the counters can be checked against it"
+ )
+ if dates != sorted(dates):
+ errors.append(f"ADR 0002 amendments are not in date order: {', '.join(dates)}")
+ if not counts:
+ errors.append("ADR 0002 records no visual-type count amendment")
+ elif counts[-1][1] != VISUAL_TYPE_COUNT:
+ errors.append(
+ f"ADR 0002's latest amendment records the visual-type count as {counts[-1][1]}, "
+ f"but the counters say {VISUAL_TYPE_COUNT}; add an amendment titled "
+ f"'the count is {VISUAL_TYPE_COUNT}' as the last entry, dated on or after "
+ f"{max(dates) if dates else 'the newest amendment'}"
+ )
+ return errors
+
+
SKILL_PATH_IN_REPO = "skills/diagram-design/SKILL.md"
@@ -280,6 +338,20 @@ def verify_markdown() -> list[str]:
f"visual-type guide must preserve {VISUAL_TYPE_COUNT} rows; found {len(visual_rows)}"
)
+ opening = next(
+ (
+ block
+ for block in re.split(r"\n\s*\n", patterns)
+ if block.strip() and not block.lstrip().startswith("#")
+ ),
+ "",
+ )
+ if f"the {VISUAL_TYPE_COUNT} visual types" not in opening:
+ errors.append(
+ f"semantic-patterns.md must name the {VISUAL_TYPE_COUNT} visual types in its "
+ "opening paragraph, matching the counters"
+ )
+
for index, name in enumerate(PATTERN_NAMES, 1):
if name not in skill:
errors.append(f"SKILL.md does not route semantic pattern: {name}")
@@ -313,6 +385,7 @@ def verify_markdown() -> list[str]:
for term in required_animation_terms:
if term not in animation:
errors.append(f"animation.md is missing contract term {term!r}")
+ errors.extend(verify_type_count_record())
return errors
diff --git a/skills/diagram-design/references/semantic-patterns.md b/skills/diagram-design/references/semantic-patterns.md
index 9130ebb..159ed51 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 40 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 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.
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.