Skip to content

Commit 4285ec2

Browse files
mpstatonclaude
andcommitted
Merge pull request #82 — federated design system Phase 0/1
Brings in the instrumentation and colour tier that had been stranded on one laptop since 2026-08-01: scripts/design-drift.mjs, the Phase 1 theme.css, the shell's FOUC guard, the strategy-curator focus fix, and the four context-v documents the handoff depends on. Issue #81. package.json was the only conflict, exactly as predicted when that issue was raised: Phase 0 adds design:drift and design:contrast, and the turbo removal had rewritten the surrounding scripts. Both sets kept; the turbo-free `pnpm -r build` survives. token-baseline.css regenerated against the Phase 1 theme — the A20 floor grows from 24 registrations to 35, picking up --color-border-strong, --focus-ring, the unified warn dialect, --color-surface-2, --color-bg-elevated, --color-link, --color-thread, --color-accent-warm, --fx-popover-shadow, and the deprecated --color-bg alias. `pnpm tokens:check` caught the staleness before the regeneration, which is what it exists for: the generated floor cannot silently drift from the theme it is derived from. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019a8tSPbFdvF1pKtADnWyDg
2 parents be4303c + fa44eb0 commit 4285ec2

14 files changed

Lines changed: 1142 additions & 28 deletions

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,3 +62,4 @@ history.txt
6262
# GRAPH_REPORT.md, AST cache, manifest). Rebuild with `graphify --update`.
6363
# Corpus scope is committed in .graphifyignore, not here.
6464
graphify-out/
65+
tools/

apps/strategy-curator/src/app.css

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@
9494
.sc-app .sc-value { color: var(--color-text); }
9595
.sc-app .sc-muted { color: var(--color-text-muted); }
9696
.sc-app .sc-mini { font-size: 12px; }
97-
.sc-app .sc-mono { font-family: var(--font__mono, ui-monospace, monospace); }
97+
.sc-app .sc-mono { font-family: var(--font-mono); }
9898
.sc-app .sc-pad { padding: 1rem; }
9999

100100
/* ---- inputs / buttons ---- */
@@ -109,9 +109,9 @@
109109
padding: 0.35rem 0.5rem;
110110
width: 100%;
111111
}
112-
.sc-app input:focus,
113-
.sc-app textarea:focus,
114-
.sc-app select:focus { outline: none; border-color: var(--color-field-focus); box-shadow: var(--fx-accent-glow); }
112+
.sc-app input:focus-visible,
113+
.sc-app textarea:focus-visible,
114+
.sc-app select:focus-visible { outline: none; border-color: var(--color-accent); box-shadow: var(--focus-ring); }
115115

116116
/* Saved-confirmation pulse: border glows green on commit, then fades back. */
117117
@keyframes sc-save-flash {

context-v/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ Subdirectories appear as content arrives:
2222
- `reminders/` — short notes future-you will be glad past-you wrote
2323
- `explorations/` — open questions, partially-answered
2424
- `issues/` — known problems, not yet fixed
25+
- `loops/` — repeatable fidelity sweep procedures. See `loops/references/` for supporting rationale.
2526

2627
The splash at `splash/` renders every `.md` in this tree (and `changelog/`)
2728
on push to `main`.
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
---
2+
title: "Design Language Audit — July 2026"
3+
lede: "The hand-counted baseline audit that measured the state of augment-it's CSS before the design system shipped. Superseded as the counting mechanism by design-drift.mjs."
4+
date_created: 2026-07-16
5+
date_modified: 2026-08-01
6+
semantic_version: 0.0.1.0
7+
status: Superseded
8+
superseded_by: "scripts/design-drift.mjs"
9+
tags:
10+
- Audit
11+
- Design-System
12+
- Historical
13+
---
14+
15+
# Design Language Audit — July 2026
16+
17+
## Status: Superseded
18+
19+
**This document is superseded as the counting mechanism.** The drift script
20+
(`scripts/design-drift.mjs`) is now the source of truth. Where the script and
21+
this document disagree, the script is right. Every disagreement was in the
22+
direction this document's own lede predicted: understated.
23+
24+
This document remains in the record as the baseline measurement — the state
25+
of the product before Phases 0 and 1 landed. It is the "before" column in the
26+
verification table in the Phase 1 handoff.
27+
28+
## The July 2026 baseline
29+
30+
Measured by hand against the full codebase on 2026-07-16, before any token
31+
work began.
32+
33+
### What was measured
34+
35+
- 74 stylesheets across 16 remotes plus the shell
36+
- 432 font-size declarations (35 distinct sizes)
37+
- 158 button rule-sets across 13 recipes
38+
- 34 badge treatments
39+
- 6 spinner implementations with 4 different @keyframes names
40+
- 30 box-shadow declarations (47% hardcoded, none mode-reactive)
41+
- 25 z-index values spanning 0→200 with no scheme
42+
- 99 unnamespaced selectors leaking across remote boundaries
43+
- 33 dead fallback colours (fallbacks for tokens defined since May)
44+
- 43 `--color-bg` declarations painting nothing on the live deploy
45+
- 10 `outline: none` sites
46+
- 123 native `title=` attributes (7 accessible)
47+
- 11 product-wide accessibility defects
48+
49+
### Key findings that shaped Phases 0 and 1
50+
51+
1. **The ramps lied.** `--color__graphite-700` was darker than `-900` on three
52+
of six greyscale ramps. Step numbers did not track luminance. This became
53+
gate A19, resolved in Phase 1.
54+
55+
2. **Five light-mode contrast failures.** `--color-text-muted` at 4.37–4.49:1
56+
fell below 4.5:1 against two surfaces. This was gate R11, resolved in Phase 1.
57+
58+
3. **Four phantom warn dialects.** 22 declarations had independently invented
59+
`--color-warning-*`, `--color-warn`, and other variants for one concept.
60+
61+
4. **Three competing focus treatments.** Zero custom `:focus-visible` rings
62+
across the product.
63+
64+
5. **Federation was a documentation convention.** F1 forbade members from
65+
declaring tokens, but every member imported `theme.css` independently —
66+
the same race condition at runtime.
67+
68+
### What the audit missed
69+
70+
- The Tier 1 consumption violations (F1a) — three files reading `var(--font__mono)`
71+
directly. The audit grepped `--color__` only.
72+
- The two script bugs (CRLF and argv indexing) that would later produce
73+
confidently wrong output.
74+
- The CRLF frontmatter parse failure that silently emptied the member registry.
75+
76+
These are recorded in the Phase 1 handoff (§4) — they were found by the drift
77+
script that this audit's findings made necessary.
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
---
2+
title: "Sweep — Local & Federated Design System for Fidelity"
3+
lede: "The repeatable procedure for checking a member's CSS against the federal contract. The one sanctioned exception to the two-file rule."
4+
date_created: 2026-08-01
5+
date_modified: 2026-08-01
6+
semantic_version: 0.0.1.0
7+
status: Active
8+
tags:
9+
- Loop
10+
- Design-System
11+
- Fidelity
12+
- Enforcement
13+
---
14+
15+
# Sweep — Local & Federated Design System for Fidelity
16+
17+
## Purpose
18+
19+
This loop checks a single member's CSS surface against the federal token
20+
contract. It catches what the drift script cannot: visual fidelity, token
21+
appropriateness (right token for the right job), and undocumented deviations.
22+
23+
## When to run
24+
25+
**By a developer:** after finishing a feature that touches CSS or adds a
26+
component. After changing a token's value in `packages/theme`. Before a release.
27+
28+
**By an AI coding agent, self-directed:** when the diff touches CSS, Svelte
29+
style blocks, or token references. When the task description mentions colour,
30+
spacing, or typography. When the agent changes a member's `DESIGN.md`. The agent
31+
runs this loop as a *task*, not as a preamble before every edit.
32+
33+
## Procedure
34+
35+
### 1. Read the federal contract
36+
37+
Read `packages/theme/theme.css` — the Tier 1 and Tier 2 blocks only. Note the
38+
tokens available. Read `DESIGN.md` §The federation contract — F1 through F11.
39+
40+
### 2. Read the member's design surface
41+
42+
Read every `.css` and `.svelte` file in the member's `src/` directory. Also
43+
read the member's `DESIGN.md`, including *Deviations* — deviations are declared
44+
exceptions, not bugs to "fix."
45+
46+
### 3. Check each rule
47+
48+
For each federal rule F1–F11, answer: does this member violate it?
49+
50+
Key checks:
51+
- **F1 + F1a:** Grep for `--color__`, `--font__`, `--color-` (member declaring
52+
federal tokens or consuming Tier 1 directly).
53+
- **F3:** Does every selector descend from the member's root class?
54+
- **F4:** Any raw `z-index` number? Should be `var(--z-*)`.
55+
- **F8:** Any `#hex` or raw `box-shadow`? Should be a token.
56+
- **F10:** Does `mount.ts` import `theme.css`? It should not.
57+
58+
### 4. Check token appropriateness
59+
60+
For each token reference, ask: is this the right token for the job?
61+
62+
- `--color-text` for body text, `--color-text-muted` for secondary.
63+
- `--color-accent` for the brand accent, `--color-accent-warm` for emphasis.
64+
- `--color-border` for decorative dividers, `--color-border-strong` for control
65+
boundaries.
66+
- `--color-error-text` for error states, `--color-warn-text` for warnings.
67+
68+
### 5. Record findings
69+
70+
Record every violation with file, line, and rule reference. A deviation already
71+
declared in the member's `DESIGN.md` is not a finding — it is a known exception.
72+
73+
## Hard rules for agents
74+
75+
1. **This loop is a task, not a preamble.** An agent that sweeps before every
76+
small edit has spent its context window on ceremony.
77+
78+
2. **Never self-authorise implement mode.** An agent that finds a violation
79+
*reports* it. Fixing it is a separate task with its own scope.
80+
81+
3. **Diff-scoped, not member-scoped.** When running on a code change, sweep
82+
only the files the change touches plus any files that reference the changed
83+
tokens.
84+
85+
4. **Read the member's Deviations before reporting.** A declared deviation is
86+
not a finding.
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
---
2+
title: "Design System Portal"
3+
lede: "Specification for the portal that renders the federated design system — the swatch page, the token catalogue, the member index."
4+
date_created: 2026-08-01
5+
date_modified: 2026-08-01
6+
semantic_version: 0.0.1.0
7+
status: Draft
8+
tags:
9+
- Design-System
10+
- Portal
11+
- Swatch-Page
12+
- Phase-2a
13+
---
14+
15+
# Design System Portal
16+
17+
## 1. Purpose
18+
19+
The portal is the single surface where every federal token can be seen — in all
20+
three modes, on one page, against every surface it will ever sit on. It is the
21+
answer to "nothing has been seen in a browser."
22+
23+
## 2. Two jobs
24+
25+
1. **The swatch page (Phase 2a, P0).** Render every Tier-2 token against every
26+
surface, in all three modes. A stylesheet and a loop.
27+
28+
2. **The token catalogue (Phase 2a, post-P0).** The full federal vocabulary,
29+
with resolved values per mode, the member index, and the deviation registry.
30+
Generated from `design-manifest.json`.
31+
32+
## 3. Phase 2a — P0 swatch page
33+
34+
### The bare minimum
35+
36+
A single page at `apps/docs-portal` with one stylesheet and one loop.
37+
38+
```svelte
39+
{#each tokens as token}
40+
<div class="swatch-row">
41+
<span class="token-name">{token.name}</span>
42+
{#each surfaces as surface}
43+
<div class="swatch" style="background: var({surface}); color: var({token.name})">
44+
{token.name}
45+
</div>
46+
{/each}
47+
</div>
48+
{/each}
49+
```
50+
51+
The token list comes from `design-manifest.json`. The surface list is:
52+
`--color-background`, `--color-surface`, `--color-surface-2`,
53+
`--color-surface-raised`, `--color-bg-elevated`.
54+
55+
### Mode toggle
56+
57+
Three buttons cycling `data-mode` on `<html>`. The portal imports `mode-switcher`
58+
from `@augment-it/theme`.
59+
60+
### What it proves
61+
62+
- Every token resolves in all three modes
63+
- No token disappears on a surface (P2, P3)
64+
- Contrast numbers are visible in context
65+
- Phase 2 can pick typography, spacing and radius values by eye
66+
67+
## 4. Portal v1 (post-P0)
68+
69+
### Pages
70+
71+
| Page | Source |
72+
|---|---|
73+
| Token catalogue | `design-manifest.json` |
74+
| Member index | `design-manifest.json` |
75+
| Deviation registry | `design-manifest.json` |
76+
| Contrast matrix | `design-drift --contrast --json` |
77+
78+
### Generation
79+
80+
The portal build runs `design-drift --json` and reads `design-manifest.json`.
81+
Nothing is hand-maintained. The manifest is generated from the frontmatter of
82+
the 20 documents.
83+
84+
## 5. Deployment
85+
86+
The portal lives at `apps/docs-portal`. It is one more federation remote —
87+
it mounts into the shell like any other member. It imports `theme.css` and
88+
`mode-switcher`, and its `mount.ts` follows F10 (no theme import in the
89+
federated mount).
90+
91+
## 6. Why the portal is load-bearing
92+
93+
The swatch page is the only surface where every token's rendered appearance
94+
can be verified. Until it exists, "108/108 contrast pairs pass" is a number
95+
in a terminal — accurate, but not eye-verified. The portal closes that gap
96+
for colour in Phase 2a, and for typography, spacing and radius in Phase 2.

0 commit comments

Comments
 (0)