@nusoft/nuos-build-catalogue 0.22.0 → 0.23.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.
@@ -39,6 +39,10 @@ const PROTOCOL_FILES = [
39
39
  'wu-new.md',
40
40
  'persona-new.md',
41
41
  'plan-orientation.md',
42
+ 'plan-architecture.md',
43
+ 'plan-uiux.md',
44
+ 'plan-maps.md',
45
+ 'plan-initial-wu.md',
42
46
  'build-wu.md',
43
47
  ];
44
48
  /**
@@ -52,6 +56,10 @@ const PROTOCOL_DESCRIPTIONS = {
52
56
  'wu-new': 'File a new work unit through a guided plain-English conversation',
53
57
  'persona-new': 'File a new persona by walking the seven dimensions conversationally',
54
58
  'plan-orientation': 'Phase A of planning — project description, tech stack, personas, the horizon map',
59
+ 'plan-architecture': 'Phase B of planning — name the major modules and define what each one provides',
60
+ 'plan-uiux': 'Phase C of planning — enumerate every surface and build the complete design system',
61
+ 'plan-maps': 'Phase D of planning — map the journey from here to done with phases and near-term plan',
62
+ 'plan-initial-wu': 'Phase E of planning — file the first 5–10 work units ordered by dependency',
55
63
  'build-wu': 'Orchestrate a swarm of agents to build one work unit end-to-end',
56
64
  };
57
65
  const TOOLS = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nusoft/nuos-build-catalogue",
3
- "version": "0.22.0",
3
+ "version": "0.23.0",
4
4
  "description": "NuOS build-catalogue tooling: semantic search (WU 110) + migration runner that lifts markdown artefacts into JSON-backed workflow records (WU 111, Phase G).",
5
5
  "type": "module",
6
6
  "bin": {
@@ -51,13 +51,25 @@ For the classified pattern, list the subtasks each agent will handle. Write this
51
51
 
52
52
  A typical full-feature decomposition:
53
53
 
54
- 1. **Architect**: design the contract surface this WU produces; file a decision if a non-obvious choice exists; write the design brief in WU notes
54
+ 1. **Architect**: design the contract surface this WU produces — **using design-it-twice** (see below); file a decision for the chosen approach; write the design brief in WU notes
55
55
  2. **Coder**: implement against architect's brief; matches existing code idioms; smallest change that satisfies acceptance criteria
56
56
  3. **Tester**: writes one test per acceptance criterion + failure-path tests; runs them
57
57
  4. **Reviewer**: reads coder + tester output against spec, design system, decisions; flags drift
58
58
 
59
59
  Skip steps when context allows — implementation-only WUs skip the architect; bug-fix WUs use debugger instead of architect.
60
60
 
61
+ ### Design-it-twice (required for every architect pass)
62
+
63
+ The architect step is **not a single-pass activity**. Before the architect's brief is written and before the coder is spawned, the architect must:
64
+
65
+ 1. **Produce two fundamentally different designs** for the contract surface — not variations of the same approach, but structurally different choices. Examples of structural difference: one design uses a state machine, the other uses event sourcing; one design puts logic in the module, the other pushes it to the caller; one design is synchronous, the other asynchronous.
66
+ 2. **Write both designs into the WU notes**, including: what each optimises for, what it trades away, what breaks if you choose it.
67
+ 3. **Pick one and state why** — specifically, what the winning design handles better than the losing design doesn't.
68
+
69
+ Only after this comparison is documented should the coder be spawned. The spawn prompt to the architect must explicitly request two designs: *"Produce two structurally different designs for [contract surface]. Write both into the WU notes with their tradeoffs. Then commit to one with a stated reason."*
70
+
71
+ A single-design architect pass is drift — the failure mode where an agent satisfices on the first plausible idea. The design-it-twice step is what catches blind spots before they reach code. Skipping it saves 10 minutes and costs hours in rework.
72
+
61
73
  ## Step 4 — Spawn the agents
62
74
 
63
75
  Use Claude Code's **Task tool**. Each spawn names the agent (`subagent_type`), the model (from `methodfile.json`'s `swarm.models` block — usually leave as default), and the precise input.
@@ -0,0 +1,99 @@
1
+ # plan-architecture
2
+
3
+ You are running **Phase B of the planning arc** — Architecture & Contracts. Phase A gave you a project description, tech stack, personas, and a horizon map. Phase B names the major pieces of the system and defines what each one promises to the others.
4
+
5
+ By the end of this session the operator should have:
6
+
7
+ - 3–7 module files in `docs/build/architecture/`
8
+ - One contract file per module in `docs/build/contracts/`
9
+ - Decisions filed for every non-obvious technology or structural choice
10
+ - The Phase B row in STATE.md's Planning progress table flipped to `✅ complete`
11
+
12
+ The whole session takes about 60–90 minutes. **The operator is most likely a domain expert, not a software engineer.** Plain English throughout. A "module" is just a major piece with one clear responsibility. A "contract" is the plain-English promise that piece makes to everything else.
13
+
14
+ ---
15
+
16
+ ## How to lead this conversation
17
+
18
+ - **Lead the operator; don't quiz them.** Walk them through naming each piece, one at a time.
19
+ - **Write each module and contract as the conversation produces it.** Don't accumulate and write at the end.
20
+ - **If a technology choice surfaces, file a decision immediately.** Saying "we'll use PostgreSQL" in conversation and not filing it is drift.
21
+ - **Refer to the horizon map.** The modules are the mechanism that gets to the destination — check every module earns its place by pointing at something in the map.
22
+
23
+ ---
24
+
25
+ ## Step 1 — Read the context (2 min)
26
+
27
+ Before starting, read:
28
+ - `docs/build/maps/01-the-horizon.md` — the destination
29
+ - `docs/build/personas/` — who the system serves
30
+ - `methodfile.json`'s `techStack` section — if `defined: true`, modules must be grounded in the actual stack
31
+
32
+ Then open with:
33
+
34
+ > "We've got the project oriented — you've described what you're building, who it's for, and where it's heading. Now let's name the major pieces. Not the code, not the screens — just the chunks of functionality that each have one clear job. Most projects have between three and seven. Some examples: 'the thing that handles payments', 'the thing that manages user accounts', 'the thing that sends notifications'. We'll name them in your words, and I'll write each one down."
35
+
36
+ ## Step 2 — Name the modules (30–45 min)
37
+
38
+ Ask:
39
+
40
+ > "What are the major pieces of this system? Take your time. Start with the one that feels most central."
41
+
42
+ **For each module, ask three follow-up questions** (in conversation, not as a list):
43
+
44
+ 1. *"What does it do — in one sentence?"*
45
+ 2. *"What does it need from the rest of the system to do its job?"* (dependencies)
46
+ 3. *"What does it produce or make available for everything else?"* (what it provides)
47
+
48
+ When you have the shape of a module, **write it immediately** as `docs/build/architecture/<module-name>.md` and its contract as `docs/build/contracts/<module-name>.md`. Use the templates at `docs/build/architecture/module-template.md` and `docs/build/contracts/contract-template.md`. Show the file path to the operator as you create it.
49
+
50
+ After each module, ask: *"Is there another major piece, or does that cover the main shape of the system?"*
51
+
52
+ **Completeness check:** when the operator seems done, look at the horizon map. Is there anything the map needs that no module provides? Surface it:
53
+
54
+ > "Looking at the horizon map — [X] is supposed to happen, but none of the modules we've named clearly owns it. Is that covered by one of these, or is there a piece we've missed?"
55
+
56
+ **Tech choices:** if the operator implies a technology choice ("it stores user data", "it sends emails", "it calls the payment API"), treat it as a potential decision. Ask: *"You mentioned [X] — have you decided how you'll handle that? If so, let's file it as a decision now."* File it as `docs/build/decisions/D-NNN-<slug>.md`.
57
+
58
+ ## Step 3 — Review the module map (5 min)
59
+
60
+ When all modules are named, surface the full picture:
61
+
62
+ > "Here's what we've got: [list modules with one-sentence summaries]. The dependency flow reads: [describe how they connect]. Does that match how you think about the system?"
63
+
64
+ Adjust anything the operator wants to rename, merge, or split. Re-file as needed.
65
+
66
+ ## Step 4 — Open questions (5 min)
67
+
68
+ Scan the conversation for anything the operator wasn't sure about. File each as Q-NNN in `docs/build/open-questions/`. Flag which ones affect Phase C (UI/UX) — those surface assumptions about the user-facing layer that Phase C will resolve.
69
+
70
+ ## Step 5 — Close (2 min)
71
+
72
+ Update STATE.md:
73
+ - Phase B row → `✅ complete (YYYY-MM-DD)`
74
+ - Phase C row → `🟡 next`
75
+ - Refresh "Last updated"
76
+
77
+ Tell the operator:
78
+
79
+ > "You've got the architecture substrate:
80
+ >
81
+ > - **[N] modules** in `docs/build/architecture/` — the major pieces
82
+ > - **[N] contracts** in `docs/build/contracts/` — what each piece promises
83
+ > - **[N] decisions** in `docs/build/decisions/` — the choices already made
84
+ > - **STATE.md** updated
85
+ >
86
+ > Next session: **Phase C — UI/UX + Design System** (~60–90 min). We'll name every screen and surface the user touches, then build the complete design language: colours, type, spacing, components, patterns, voice, and accessibility. By the end, the design system is real — no placeholders.
87
+ >
88
+ > Run `/end-of-session` to commit everything."
89
+
90
+ Then run `/end-of-session`.
91
+
92
+ ---
93
+
94
+ ## What to do if it goes off-track
95
+
96
+ - **Operator wants to define screens already:** redirect. *"We'll get to the surfaces in Phase C. Right now we're just naming the pieces that do the work."*
97
+ - **Modules are too granular** (function-level rather than responsibility-level): zoom out. *"That feels like implementation detail. What's the higher-level piece it belongs to?"*
98
+ - **More than 7 modules:** ask if any can be merged. More than 7 usually means either the system is genuinely large (valid) or the abstraction level is off (common).
99
+ - **Operator says "I don't know" about dependencies:** file it as Q-NNN and continue. The contract can note the uncertainty.
@@ -0,0 +1,90 @@
1
+ # plan-initial-wu
2
+
3
+ You are running **Phase E of the planning arc** — Initial Work Units. The planning substrate is complete. Phase E translates the horizon map, architecture, and surfaces into the first set of concrete things to build.
4
+
5
+ By the end of this session:
6
+
7
+ - 5–10 work units are filed in `docs/build/work-units/`
8
+ - They are ordered by dependency: things that other things need are filed (and built) first
9
+ - Each work unit connects to at least one persona and one architecture module
10
+ - The Phase E row in STATE.md is flipped to `✅ complete`
11
+ - STATE.md names the first work unit as `🟡 in flight`
12
+ - `methodfile.json`'s `planning.completedAt` is set to today's date
13
+
14
+ This session takes about 60 minutes. **The operator is most likely a domain expert, not a software engineer.** Plain English throughout.
15
+
16
+ ---
17
+
18
+ ## Step 1 — Read the context (5 min)
19
+
20
+ Before starting, read:
21
+ - `docs/build/maps/02-phases.md` — the phases of work and what each milestone means
22
+ - `docs/build/maps/03-near-term.md` — what's immediately next
23
+ - `docs/build/architecture/` — the modules, for grounding each work unit
24
+ - `docs/build/personas/` — to connect each work unit to a real person
25
+
26
+ Open with:
27
+
28
+ > "We've got the architecture, the design system, and the map. Now let's break the first wave of work into concrete pieces. A work unit is one thing: a feature, a surface, an infrastructure step — whatever has a clear outcome you can check. We'll file between 5 and 10 of them. Each will have an outcome, a walkthrough, and a list of things to check to know it's done. We'll order them so the things everything depends on come first."
29
+
30
+ ## Step 2 — Derive the first work units (30–40 min)
31
+
32
+ Ask:
33
+
34
+ > "Looking at what the near-term map says needs to happen first — what are the individual pieces? Don't list tasks; describe what will *exist and be usable* when each piece is done."
35
+
36
+ For each work unit, **switch to the `wu-new` protocol** (invoke `/wu-new` if available; otherwise read `wu-new.md` and follow it). This ensures each work unit is filed correctly with outcome, walkthrough, and acceptance criteria.
37
+
38
+ Between work units, check:
39
+
40
+ > "Does [this WU] depend on anything that isn't filed yet? If so, let's file that dependency first."
41
+
42
+ Aim for 5–10 work units covering the first meaningful phase of Map 2. Don't try to file the entire project — just enough that the swarm can start and the operator can see what's coming.
43
+
44
+ ## Step 3 — Order by dependency (5–10 min)
45
+
46
+ When all work units are filed, look at the full set and ask:
47
+
48
+ > "Which of these can start right now with no dependencies? Which ones need something else to be done first?"
49
+
50
+ Update each work unit file with its dependency links. Update `docs/build/work-units/_index.md` statuses:
51
+ - Anything with unmet dependencies → `🔵 proposed`
52
+ - The first work unit with no unmet dependencies → `🟡 in flight`
53
+
54
+ If multiple work units have no dependencies, pick the one that unblocks the most. Mark that one `🟡 in flight`; leave the others `🔵 proposed` with a note that they can start in parallel.
55
+
56
+ ## Step 4 — Close
57
+
58
+ Update STATE.md:
59
+ - Phase E row → `✅ complete (YYYY-MM-DD)`
60
+ - "Active work unit" → the first `🟡 in flight` work unit handle and title
61
+ - "What is currently in flight" → one sentence describing what the swarm will tackle first
62
+ - Refresh "Last updated"
63
+
64
+ Update `methodfile.json`:
65
+ - Set `planning.completedAt` to today's date (ISO format: YYYY-MM-DD)
66
+
67
+ Tell the operator:
68
+
69
+ > "Planning is done. You have:
70
+ >
71
+ > - **[N] work units** filed and ordered — [first WU title] is first
72
+ > - **The planning arc is complete**
73
+ >
74
+ > Every session from here follows the same loop:
75
+ >
76
+ > `/start-of-session` → work → `/end-of-session`
77
+ >
78
+ > When you're ready to build, run `/build-wu [handle]` — the swarm coordinator reads the work unit, designs the approach (twice — two options, then a pick), spawns the right agents, and runs it to completion.
79
+ >
80
+ > Run `/end-of-session` to commit everything and close the planning arc."
81
+
82
+ Then run `/end-of-session`.
83
+
84
+ ---
85
+
86
+ ## What to do if it goes off-track
87
+
88
+ - **Too many work units:** file the first 5–10 and stop. The rest can be filed in later sessions as Map 3 updates. Trying to file 30 work units in Phase E stalls the arc indefinitely.
89
+ - **Operator wants to skip work unit details:** at minimum get the outcome and 3 acceptance criteria. Without those, the coder has no brief. *"Just a sentence on what exists when it's done, and three yes-or-no checks. That's it."*
90
+ - **Operator wants to start building immediately:** let them. *"Run `/end-of-session` to commit what we have, then `/build-wu [first WU handle]`. The swarm can start with what we've filed."*
@@ -0,0 +1,85 @@
1
+ # plan-maps
2
+
3
+ You are running **Phase D of the planning arc** — Maps. The catalogue now has architecture, contracts, surfaces, and a complete design system. Phase D maps the journey from here to done: the major phases of work, what the world looks like at each milestone, and what is actually happening in the near term.
4
+
5
+ By the end of this session:
6
+
7
+ - Map 2 ("Phases of work") is filed at `docs/build/maps/02-phases.md`
8
+ - Map 3 ("Near-term plan") is filed at `docs/build/maps/03-near-term.md`
9
+ - Each phase in Map 2 has a clear acceptance criterion and a verification gate
10
+ - The Phase D row in STATE.md is flipped to `✅ complete`
11
+
12
+ This session takes about 45 minutes. **The operator is most likely a domain expert, not a software engineer.** Plain English throughout.
13
+
14
+ ---
15
+
16
+ ## Step 1 — Read the context (5 min)
17
+
18
+ Before starting, read:
19
+ - `docs/build/maps/01-the-horizon.md` — the destination
20
+ - `docs/build/work-units/` — any work units already filed (unlikely at this stage, but check)
21
+ - `docs/build/open-questions/_index.md` — any blockers that might affect the timeline
22
+
23
+ Open with:
24
+
25
+ > "We've got the destination, the architecture, and the full design language. Now let's draw the path. Not hour-by-hour detail — the major stages from here to there, what's done at each milestone, and what we're actually working on this week or next. Two maps: one for the whole journey, one for right now."
26
+
27
+ ## Step 2 — Map 2: Phases of work (20–25 min)
28
+
29
+ Ask:
30
+
31
+ > "If you look at the project from start to shipped — what are the major stages? Most projects have three to six. Think about it in terms of what becomes *possible* at each stage, not the tasks inside each stage."
32
+
33
+ For each stage the operator names, ask:
34
+
35
+ 1. *"What's true when this stage ends that wasn't true when it started? What can you demonstrate?"* (→ acceptance criterion)
36
+ 2. *"How would you verify that? Is there something you can run, click, or show?"* (→ verification gate — a specific test, URL, command, or file that proves the stage is done)
37
+
38
+ **Write each phase as a row before moving to the next one.** The map should read as a narrative — a story of progress — not a task list. Use the template at `docs/build/maps/02-template.md`.
39
+
40
+ After all phases are named, ask:
41
+
42
+ > "Does every phase lead naturally to the next? Are there hidden dependencies — places where Phase [N] actually needs something from a later phase?"
43
+
44
+ Write the final map to `docs/build/maps/02-phases.md`. Show the operator.
45
+
46
+ ## Step 3 — Map 3: Near-term plan (10–15 min)
47
+
48
+ Ask:
49
+
50
+ > "Zooming in — what's actually happening right now, or what will be once we file the first work units in Phase E? What's the first concrete thing that needs to exist?"
51
+
52
+ Write Map 3 to `docs/build/maps/03-near-term.md` using `docs/build/maps/03-template.md`. This map is intentionally short-horizon and will be updated frequently. It should name:
53
+
54
+ - What is actively being built (or will be, once Phase E files work units)
55
+ - What is immediately next
56
+ - Any blocker standing between now and the first shipped thing
57
+
58
+ ## Step 4 — Close (5 min)
59
+
60
+ Update STATE.md:
61
+ - Phase D row → `✅ complete (YYYY-MM-DD)`
62
+ - Phase E row → `🟡 next`
63
+ - Refresh "Last updated"
64
+
65
+ Tell the operator:
66
+
67
+ > "The maps are in:
68
+ >
69
+ > - **Map 2** — the full journey from here to done, with acceptance criteria and verification gates per stage
70
+ > - **Map 3** — what's happening right now and what's immediately next
71
+ >
72
+ > Next session: **Phase E — Initial Work Units** (~60 min). We'll file the first 5–10 concrete things to build, ordered by dependency. After that, the planning arc is done and the swarm can start.
73
+ >
74
+ > Run `/end-of-session` to commit everything."
75
+
76
+ Then run `/end-of-session`.
77
+
78
+ ---
79
+
80
+ ## What to do if it goes off-track
81
+
82
+ - **Operator wants to list individual tasks inside phases:** redirect to the outcome shape. *"Let's keep each phase as a destination — what's true, not what's done. The tasks inside each phase become work units in Phase E."*
83
+ - **Operator can't name an acceptance criterion:** help them think from the outside in. *"Imagine showing this stage to someone who's been away for a month. What do you show them? What can they do that they couldn't before?"*
84
+ - **No verification gate comes to mind:** that's a signal the phase boundaries are fuzzy. Tighten the acceptance criterion until a gate becomes obvious.
85
+ - **Operator wants to skip Phase E and start building:** suggest Phase E first. *"Phase E is short — 60 minutes to file the first work units. After that, we know exactly which work unit is first and the swarm can start with a precise brief rather than 'build the project'."*
@@ -0,0 +1,247 @@
1
+ # plan-uiux
2
+
3
+ You are running **Phase C of the planning arc** — UI/UX + Design System. This phase does two things:
4
+
5
+ 1. **Surfaces** — names every page, screen, modal, or command the user ever touches, and defines what each one does.
6
+ 2. **Design system** — builds the shared visual and interaction language those surfaces use: colour tokens, type scale, spacing, radius, motion, components, patterns, voice, and accessibility commitments.
7
+
8
+ By the end of this session:
9
+
10
+ - Every user-facing surface is filed in `docs/build/ui-ux/`
11
+ - The design system is **fully populated** in `docs/build/design-system/` — tokens have real values, components are defined with their variants, patterns are named. **No placeholders.**
12
+ - Decisions are filed for every non-obvious design choice
13
+ - The Phase C row in STATE.md is flipped to `✅ complete`
14
+
15
+ This session takes 60–90 minutes. **The design system is not a nice-to-have.** Every agent that ships UI code — coder, reviewer, tester — reads the design system to know what "correct" looks like. A placeholder design system means every agent invents its own answer and every piece of UI needs a rework pass.
16
+
17
+ ---
18
+
19
+ ## How to lead this conversation
20
+
21
+ - **Walk the user's journey before building the system.** Understand every surface first; the design language emerges from what the surfaces need.
22
+ - **Write surface files and design-system files as the conversation produces them.** Don't batch.
23
+ - **Extract; don't impose.** The design language should come from the operator's intent and the project's character — not from generic defaults.
24
+ - **The design system must be complete before the phase closes.** Colour tokens cannot be `#000000`. Components cannot be "TBD". If the operator says "I don't know the exact colour yet", help them decide now — make a reasoned provisional choice, write it down, and file it as a decision they can supersede later. Provisional is fine. Blank is not.
25
+
26
+ ---
27
+
28
+ ## Step 1 — Read the context (5 min)
29
+
30
+ Before starting, read:
31
+ - `docs/build/personas/` — who uses these surfaces
32
+ - `docs/build/architecture/` — modules; surfaces call into these
33
+ - `docs/build/maps/01-the-horizon.md` — the destination
34
+ - `methodfile.json`'s `techStack` section — platform affects surface types (web vs. native vs. CLI)
35
+
36
+ Open with:
37
+
38
+ > "We've named the architecture — the major pieces and what they do. Now let's design what people actually see and touch. We'll go through every screen or page in your words, and then build the design language behind it: colours, type, spacing, and the building blocks every screen uses. Nothing left blank. Real values, real components — everything an agent needs to build the UI correctly on the first pass."
39
+
40
+ ## Step 2 — Enumerate all surfaces (10–15 min)
41
+
42
+ Ask:
43
+
44
+ > "Walk me through the experience from the very beginning. Someone opens your product for the first time — what do they see? Then what? Keep going until we get to everything."
45
+
46
+ As the operator describes, build a running list of every distinct surface:
47
+ - Full pages / screens
48
+ - Modals and overlays
49
+ - Empty states (often forgotten; usually the worst experience if undesigned)
50
+ - Error states
51
+ - Emails or notifications if the product sends them
52
+ - Admin or back-office surfaces if they exist
53
+ - CLI or command surface if there is one
54
+
55
+ Surface any surfaces that were skipped:
56
+
57
+ > "You mentioned [X] — does that have its own screen? What happens after [action] — is there a confirmation view?"
58
+
59
+ Don't file surface files yet. Build the complete list first.
60
+
61
+ ## Step 3 — Walk each surface (20–30 min)
62
+
63
+ For each surface in the list, ask in conversation:
64
+
65
+ 1. *"Which [persona name] uses this?"*
66
+ 2. *"What are they trying to do when they land here?"*
67
+ 3. *"What does the screen show — walk me through top to bottom."*
68
+ 4. *"What's the primary action — the one thing we most want them to do?"*
69
+ 5. *"What can go wrong — empty data, errors, edge cases?"*
70
+
71
+ **File each surface immediately** at `docs/build/ui-ux/<surface-slug>.md` using `docs/build/ui-ux/surface-template.md`. Mark which architecture module(s) it calls into. Show the file path.
72
+
73
+ ## Step 4 — Extract the design language (20–25 min)
74
+
75
+ When all surfaces are filed, say:
76
+
77
+ > "Now let's build the design language that governs all of them. This is where everything you've described gets translated into a shared set of values — colours, type, spacing — that we can hand to every agent so they're all building the same thing."
78
+
79
+ Walk through the following as conversation. Make provisional decisions wherever the operator isn't sure, and file them as decisions they can supersede.
80
+
81
+ ### Colour tokens
82
+
83
+ Ask:
84
+ > "What's the character of this product? Serious and professional, playful and bright, calm and considered, bold and high-energy? How do you want people to feel when they use it?"
85
+
86
+ Establish and write **real hex or hsl values** for:
87
+ - **Brand primary** — the main action colour (buttons, links, active states)
88
+ - **Brand secondary** — accent colour if needed
89
+ - **Neutral scale** — 5–7 steps: background, surface, border, muted text, body text, heading
90
+ - **Semantic colours** — success, warning, error, info (four colours, real values)
91
+
92
+ Write to `docs/build/design-system/tokens-colour.md`. Show the operator the file before moving on.
93
+
94
+ ### Type scale
95
+
96
+ Ask:
97
+ > "What's the reading experience? Are people scanning data or reading long prose? Mobile-first or desktop-first?"
98
+
99
+ Establish:
100
+ - **Font family** — system stack, a specific Google Font, or custom (real name, not "sans-serif")
101
+ - **Size scale** — xs through 3xl (real rem values, not "small/medium/large")
102
+ - **Weight variants** — regular / medium / semibold / bold (real numeric weights)
103
+ - **Line height** — compact for data, comfortable for prose (real values)
104
+
105
+ Write to `docs/build/design-system/tokens-typography.md`.
106
+
107
+ ### Spacing & layout
108
+
109
+ Ask:
110
+ > "How dense is this? Tight information display, or generous whitespace?"
111
+
112
+ Establish:
113
+ - **Spacing scale** — a consistent step sequence (e.g. 4/8/12/16/20/24/32/40/48/64 px — real values)
114
+ - **Max content width** if applicable
115
+ - **Grid or column structure** if the product uses one
116
+
117
+ Write to `docs/build/design-system/tokens-spacing.md`.
118
+
119
+ ### Radius & elevation
120
+
121
+ Ask:
122
+ > "Sharp corners or rounded? Flat design or layered with shadows and depth?"
123
+
124
+ Establish:
125
+ - **Border radius** — none / sm / md / lg / full with real px values
126
+ - **Shadow scale** — if the product uses depth, 2–4 named shadow levels with real values
127
+
128
+ Write to `docs/build/design-system/tokens-radius-elevation.md`.
129
+
130
+ ### Motion
131
+
132
+ Ask:
133
+ > "Does this product have meaningful transitions — things appearing, sliding, fading? Or is it mostly static?"
134
+
135
+ Establish:
136
+ - **Transition durations** — instant / fast / base / slow (real ms values)
137
+ - **Easing curves** — real CSS easing values
138
+ - **Reduced-motion policy** — what happens when `prefers-reduced-motion` is set
139
+
140
+ Write to `docs/build/design-system/tokens-motion.md`.
141
+
142
+ ## Step 5 — File the components (15–20 min)
143
+
144
+ Look back across all surfaces filed in Step 3. Extract the recurring UI building blocks:
145
+
146
+ > "Looking at the surfaces, the same pieces appear repeatedly: [list what you found — buttons, form fields, cards, navigation, modals, etc.]. These become your component library."
147
+
148
+ For each component define:
149
+ - What it renders
150
+ - Its variants (e.g. Button: primary / secondary / ghost / destructive / disabled)
151
+ - Which tokens it uses
152
+ - Behaviour: hover, focus, loading, error state
153
+
154
+ File each at `docs/build/design-system/components/<component-slug>.md` using `docs/build/design-system/components/_template.md`. Update `docs/build/design-system/components/_index.md`.
155
+
156
+ At a minimum, file:
157
+ - **Button** — most important; every interaction has one
158
+ - **Input / form field** — text, select, checkbox, radio
159
+ - **Card** — almost every product has content cards
160
+ - **Navigation** — header, sidebar, or tab bar (whatever this product uses)
161
+ - **Modal / dialog**
162
+ - Any product-specific components that appear in two or more surfaces
163
+
164
+ ## Step 6 — File the patterns (10 min)
165
+
166
+ Patterns are compositions of components that repeat across surfaces:
167
+
168
+ > "Some combinations appear in multiple places — a form with a submit button, a list of cards with a header, an empty state with a CTA. Naming these prevents each agent from inventing its own."
169
+
170
+ File patterns that appear in two or more surfaces at `docs/build/design-system/patterns/<pattern-slug>.md` using `docs/build/design-system/patterns/_template.md`. Update `docs/build/design-system/patterns/_index.md`.
171
+
172
+ Common patterns:
173
+ - **Form layout** — label + field + validation error + submit button
174
+ - **Empty state** — icon/illustration + heading + body + CTA
175
+ - **Page header** — title + subtitle + primary action
176
+ - **Data table** — sortable columns, row actions, pagination if needed
177
+
178
+ ## Step 7 — Voice and accessibility (10 min)
179
+
180
+ ### Voice
181
+
182
+ Ask:
183
+ > "If the product spoke to users — in buttons, in error messages, in empty states — what would it sound like? Friendly and casual, professional and concise, encouraging and warm?"
184
+
185
+ Establish:
186
+ - Tone (e.g. "direct but warm — never corporate, never cutesy")
187
+ - Vocabulary rules (words to use; words to avoid)
188
+ - Tense and person ("You have N items" vs. "The user has N items")
189
+ - Error message style (apologetic vs. matter-of-fact)
190
+ - CTA writing style ("Get started" vs. "Start for free" vs. "Create account")
191
+
192
+ Write to `docs/build/design-system/voice.md`.
193
+
194
+ ### Accessibility
195
+
196
+ Establish non-negotiables:
197
+ - Colour contrast standard (WCAG AA minimum; state if targeting AAA)
198
+ - Keyboard navigation requirements
199
+ - Screen reader labelling approach
200
+ - Focus indicator style (don't accept "browser default" — name the actual style)
201
+
202
+ Write to `docs/build/design-system/accessibility.md`.
203
+
204
+ ## Step 8 — Check: nothing left blank (5 min)
205
+
206
+ Before closing, verify:
207
+ - Every colour token has a real hex/hsl value — no `#000000` defaults
208
+ - Every type token has a real font name and real rem size
209
+ - Every component is filed with its variants named
210
+ - Voice and accessibility are written prose, not placeholder headings
211
+
212
+ If anything is still a placeholder, resolve it now. This check is non-negotiable — the whole point of Phase C is to produce a real design system, not a skeleton.
213
+
214
+ ## Step 9 — Close
215
+
216
+ Update STATE.md:
217
+ - Phase C row → `✅ complete (YYYY-MM-DD)`
218
+ - Phase D row → `🟡 next`
219
+ - Refresh "Last updated"
220
+
221
+ Tell the operator:
222
+
223
+ > "The design system is done:
224
+ >
225
+ > - **[N] surfaces** in `docs/build/ui-ux/` — every screen defined
226
+ > - **Colour, type, spacing, radius, motion tokens** — real values, ready to use
227
+ > - **[N] components** in `docs/build/design-system/components/` — the building blocks
228
+ > - **[N] patterns** in `docs/build/design-system/patterns/` — recurring compositions
229
+ > - **Voice + accessibility** committed
230
+ >
231
+ > Every agent that builds UI reads this design system. The reviewer will reject output that doesn't conform. That's the mechanism: consistent product instead of random output.
232
+ >
233
+ > Next session: **Phase D — Maps** (~45 min). We'll map the journey from here to done.
234
+ >
235
+ > Run `/end-of-session` to commit everything."
236
+
237
+ Then run `/end-of-session`.
238
+
239
+ ---
240
+
241
+ ## What to do if it goes off-track
242
+
243
+ - **Operator says "I'll decide the colours later":** don't accept it. *"The design system is what stops every agent making up its own answer. Placeholder values mean every UI piece the swarm ships will need a rework pass. Let me suggest something reasonable based on what you've described — you just tell me if I'm wrong."* Make the provisional decision; file it as a decision they can supersede. Move on.
244
+ - **Operator doesn't know component terminology:** use product language. *"The button that logs someone in — what does it look like? What colour is it?"* Extract components from their description.
245
+ - **Too many surfaces:** narrow to surfaces that are genuinely distinct (different layout, different purpose). Modals that follow the same pattern don't need separate files — one modal component covers them.
246
+ - **Mobile-first product:** let the constraint shape the language. Mobile-first means generous tap targets (min 44px), larger base type size, generous spacing. Note it in accessibility.md.
247
+ - **Operator has existing brand guidelines:** ask them to share the primary colour and font. Use those as the starting point; fill the rest of the scale from them.
@@ -16,7 +16,17 @@ Read `docs/build/STATE.md`. Look at the **Planning progress** section:
16
16
 
17
17
  If yes, **switch to the `plan-orientation` protocol** (invoke `/plan-orientation` if available; otherwise read `.claude/commands/plan-orientation.md` and follow it). If no, point them at `docs/build/WELCOME.md` and `docs/build/GLOSSARY.md` so they can read about the catalogue first, then wait.
18
18
 
19
- - If **Phase A is in flight or any phase is mid-progress** (marked `🟡 in flight` in STATE.md's Planning progress section), route the operator back to the relevant `plan-*` protocol to continue planning. Read the most recent session log's "Resume hint" section to know exactly where to pick up.
19
+ - If **any planning phase is in progress or marked `🟡 next`**, route to the appropriate protocol. Read the most recent session log's "Resume hint" to know exactly where to pick up within the phase.
20
+
21
+ | Phase | Protocol |
22
+ |---|---|
23
+ | A — Orientation | `plan-orientation` |
24
+ | B — Architecture & Contracts | `plan-architecture` |
25
+ | C — UI/UX + Design System | `plan-uiux` |
26
+ | D — Maps | `plan-maps` |
27
+ | E — Initial Work Units | `plan-initial-wu` |
28
+
29
+ Invoke the protocol with its slash command (e.g. `/plan-uiux`) if available; otherwise read `.claude/commands/<protocol>.md` and follow it. The "next" phase in STATE.md is the one to route to — if Phase B is `✅ complete` and Phase C is `🟡 next`, invoke `plan-uiux`.
20
30
 
21
31
  - If **all five planning phases are complete**, proceed with the normal session-start steps below.
22
32