qualia-framework 4.4.0 → 5.1.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 (70) hide show
  1. package/AGENTS.md +24 -0
  2. package/CLAUDE.md +12 -63
  3. package/README.md +24 -18
  4. package/agents/builder.md +13 -33
  5. package/agents/plan-checker.md +18 -0
  6. package/agents/planner.md +17 -0
  7. package/agents/verifier.md +70 -0
  8. package/agents/visual-evaluator.md +132 -0
  9. package/bin/cli.js +64 -23
  10. package/bin/install.js +375 -29
  11. package/bin/qualia-ui.js +208 -1
  12. package/bin/slop-detect.mjs +362 -0
  13. package/bin/state.js +218 -2
  14. package/docs/erp-contract.md +5 -0
  15. package/docs/install-redesign-builder-prompt.md +290 -0
  16. package/docs/install-redesign-pilot.md +234 -0
  17. package/docs/playwright-loop-builder-prompt.md +185 -0
  18. package/docs/playwright-loop-design-notes.md +108 -0
  19. package/docs/playwright-loop-pilot-results.md +170 -0
  20. package/docs/playwright-loop-review-2026-05-03.md +65 -0
  21. package/docs/playwright-loop-tester-prompt.md +213 -0
  22. package/docs/reviews/matt-pocock-skills-analysis.md +300 -0
  23. package/guide.md +9 -5
  24. package/hooks/env-empty-guard.js +74 -0
  25. package/hooks/pre-compact.js +19 -9
  26. package/hooks/pre-deploy-gate.js +8 -2
  27. package/hooks/pre-push.js +26 -12
  28. package/hooks/supabase-destructive-guard.js +62 -0
  29. package/hooks/vercel-account-guard.js +91 -0
  30. package/package.json +2 -1
  31. package/rules/design-brand.md +114 -0
  32. package/rules/design-laws.md +148 -0
  33. package/rules/design-product.md +114 -0
  34. package/rules/design-rubric.md +157 -0
  35. package/rules/grounding.md +4 -0
  36. package/skills/qualia-build/SKILL.md +40 -46
  37. package/skills/qualia-discuss/SKILL.md +51 -68
  38. package/skills/qualia-handoff/SKILL.md +1 -0
  39. package/skills/qualia-issues/SKILL.md +151 -0
  40. package/skills/qualia-map/SKILL.md +78 -35
  41. package/skills/qualia-new/REFERENCE.md +139 -0
  42. package/skills/qualia-new/SKILL.md +85 -124
  43. package/skills/qualia-optimize/REFERENCE.md +202 -0
  44. package/skills/qualia-optimize/SKILL.md +72 -237
  45. package/skills/qualia-plan/SKILL.md +58 -65
  46. package/skills/qualia-polish/SKILL.md +180 -136
  47. package/skills/qualia-polish-loop/REFERENCE.md +265 -0
  48. package/skills/qualia-polish-loop/SKILL.md +201 -0
  49. package/skills/qualia-polish-loop/fixtures/broken.html +117 -0
  50. package/skills/qualia-polish-loop/fixtures/clean.html +196 -0
  51. package/skills/qualia-polish-loop/scripts/loop.mjs +302 -0
  52. package/skills/qualia-polish-loop/scripts/playwright-capture.mjs +197 -0
  53. package/skills/qualia-polish-loop/scripts/score.mjs +176 -0
  54. package/skills/qualia-report/SKILL.md +141 -180
  55. package/skills/qualia-research/SKILL.md +28 -33
  56. package/skills/qualia-road/SKILL.md +103 -0
  57. package/skills/qualia-ship/SKILL.md +1 -0
  58. package/skills/qualia-task/SKILL.md +1 -1
  59. package/skills/qualia-test/SKILL.md +50 -2
  60. package/skills/qualia-triage/SKILL.md +152 -0
  61. package/skills/qualia-verify/SKILL.md +63 -104
  62. package/skills/qualia-zoom/SKILL.md +51 -0
  63. package/skills/zoho-workflow/SKILL.md +64 -0
  64. package/templates/CONTEXT.md +36 -0
  65. package/templates/DESIGN.md +229 -435
  66. package/templates/PRODUCT.md +95 -0
  67. package/templates/decisions/ADR-template.md +30 -0
  68. package/tests/bin.test.sh +451 -7
  69. package/tests/state.test.sh +58 -0
  70. package/skills/qualia-design/SKILL.md +0 -169
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: qualia-map
3
- description: "Map an existing codebase to infer architecture, stack, conventions, and what's already built. For brownfield projects — run BEFORE /qualia-new so Validated requirements get inferred from existing code."
3
+ description: "Map an existing codebase to infer architecture, stack, conventions, what's already built, AND adapt Qualia to the repo's existing tracker/labels/glossary conventions (onboarding). For brownfield projects — run BEFORE /qualia-new so Validated requirements get inferred from existing code and Qualia commands respect the repo's existing process."
4
4
  allowed-tools:
5
5
  - Bash
6
6
  - Read
@@ -12,13 +12,13 @@ allowed-tools:
12
12
 
13
13
  # /qualia-map — Codebase Mapping (Brownfield)
14
14
 
15
- Scans an existing repo and produces `.planning/codebase/` architecture, stack, conventions, concerns. Used by `/qualia-new` to infer what's already built and seed Validated requirements.
15
+ Scans existing repo `.planning/codebase/` (architecture, stack, conventions, concerns). `/qualia-new` uses this to infer capabilities and seed Validated reqs.
16
16
 
17
17
  ## When to Use
18
18
 
19
- - Taking over an existing client project
20
- - Adding features to a repo you didn't build
21
- - Before `/qualia-new` on any directory that already has code
19
+ - Taking over existing client project
20
+ - Adding features to repo you didn't build
21
+ - Before `/qualia-new` on any directory with existing code
22
22
 
23
23
  ## Usage
24
24
 
@@ -48,48 +48,72 @@ If `ALREADY_MAPPED`, ask:
48
48
  node ~/.claude/bin/qualia-ui.js banner map
49
49
  ```
50
50
 
51
- ### 3. Spawn Parallel Mapper Agents
51
+ ### 3. Spawn 5 Mapper Agents (parallel)
52
52
 
53
- Map 4 dimensions in parallel for speed. Each writes one file in `.planning/codebase/`:
53
+ Each writes one file in `.planning/codebase/`:
54
54
 
55
55
  ```
56
- Agent 1: Architecture scanner
56
+ Agent 1: Architecture
57
57
  Agent(prompt="
58
- Scan the current codebase and produce .planning/codebase/architecture.md.
58
+ Scan codebase .planning/codebase/architecture.md.
59
59
  Identify: entry points, folder structure, module boundaries, data flow.
60
- Focus on WHAT the codebase does, not HOW to fix it.
60
+ Focus on WHAT, not HOW to fix.
61
61
  ", subagent_type="general-purpose", description="Architecture scan")
62
62
 
63
- Agent 2: Stack detector
63
+ Agent 2: Stack
64
64
  Agent(prompt="
65
- Detect the tech stack. Read package.json, requirements.txt, Gemfile, etc.
66
- Produce .planning/codebase/stack.md listing: runtime, framework, key libraries,
67
- database, hosting, CI. Include version numbers.
65
+ Detect stack from package.json, requirements.txt, Gemfile, etc.
66
+ Output: .planning/codebase/stack.md (runtime, framework, key libs, DB, hosting, CI + versions).
68
67
  ", subagent_type="general-purpose", description="Stack detection")
69
68
 
70
- Agent 3: Conventions analyzer
69
+ Agent 3: Conventions
71
70
  Agent(prompt="
72
- Analyze code style and conventions. Sample 10-15 files across the codebase.
73
- Produce .planning/codebase/conventions.md listing: naming, component patterns,
74
- file organization, import style, test style, commit message format.
71
+ Analyze code style/conventions. Sample 10-15 files.
72
+ Output: .planning/codebase/conventions.md (naming, component patterns, file org, import style, test style, commit format).
75
73
  ", subagent_type="general-purpose", description="Conventions analysis")
76
74
 
77
- Agent 4: Concerns scanner
75
+ Agent 4: Concerns
78
76
  Agent(prompt="
79
- Scan for code quality concerns NOT to fix, just to document.
80
- Look for: TODO/FIXME, deprecated APIs, outdated dependencies, missing tests,
81
- security smells (hardcoded secrets, no input validation).
82
- Produce .planning/codebase/concerns.md.
77
+ Scan quality concerns (document, NOT fix).
78
+ Look for: TODO/FIXME, deprecated APIs, outdated deps, missing tests, security smells.
79
+ Output: .planning/codebase/concerns.md.
83
80
  ", subagent_type="general-purpose", description="Concerns scan")
81
+
82
+ Agent 5: Onboarding adapter
83
+ Agent(prompt="
84
+ Detect existing process so Qualia honors it.
85
+ Output: .planning/codebase/onboarding.md with sections:
86
+
87
+ ## Issue tracker
88
+ - gh repo view --json url 2>/dev/null (GitHub?)
89
+ - Check: gitlab-ci.yml, .gitlab/ (GitLab?)
90
+ - Check: .scratch/, docs/issues/, ISSUES.md (local?)
91
+ - Else: 'none; Qualia uses .planning/decisions/ + tracking.json only'
92
+
93
+ ## Existing labels (only if GH/GL detected)
94
+ - gh label list --json name,description,color 2>/dev/null
95
+ - Map to canonical: bug, enhancement, needs-triage, needs-info, ready-for-agent, ready-for-human, wontfix
96
+ - Output mapping table. Note missing canonical roles.
97
+
98
+ ## Domain docs
99
+ - Check: CONTEXT.md, GLOSSARY.md, docs/glossary.md, docs/domain.md, docs/adr/, doc/architecture/, .architecture/
100
+ - Output: location (or 'none; Qualia creates .planning/CONTEXT.md')
101
+
102
+ ## Existing agent files
103
+ - Check: CLAUDE.md, AGENTS.md, .cursor/, .cursorrules, .aider.conf.yml, .continue/
104
+ - List found. Qualia APPENDs substrate, never overwrites.
105
+
106
+ Terse. Each section < 10 lines. Programmatically parsed.
107
+ ", subagent_type="general-purpose", description="Onboarding adapter")
84
108
  ```
85
109
 
86
- ### 4. Wait for All 4
110
+ ### 4. Wait for All 5
87
111
 
88
- After all 4 agents complete, read the 4 output files.
112
+ All done read 5 outputs.
89
113
 
90
114
  ### 5. Synthesize
91
115
 
92
- Create `.planning/codebase/README.md` one-page summary linking to the 4 dimension files.
116
+ Create `.planning/codebase/README.md` (one-page summary linking dimensions):
93
117
 
94
118
  ```markdown
95
119
  # Codebase Map
@@ -112,7 +136,7 @@ Based on existing code, this project already does:
112
136
  - {capability 2} (evidence: {file path})
113
137
  - {capability 3} (evidence: {file path})
114
138
 
115
- These become **Validated requirements** in PROJECT.md when `/qualia-new` runs.
139
+ These become **Validated reqs** in PROJECT.md when `/qualia-new` runs.
116
140
 
117
141
  ## Dimension Details
118
142
 
@@ -120,8 +144,26 @@ These become **Validated requirements** in PROJECT.md when `/qualia-new` runs.
120
144
  - [Stack](./stack.md)
121
145
  - [Conventions](./conventions.md)
122
146
  - [Concerns](./concerns.md)
147
+ - [Onboarding adapter](./onboarding.md)
148
+
149
+ ## Onboarding adapter snapshot
150
+
151
+ - **Issue tracker:** {from onboarding.md}
152
+ - **Domain docs:** {from onboarding.md}
153
+ - **Existing agent files:** {from onboarding.md}
123
154
  ```
124
155
 
156
+ ### 5.5 Write adapter config (only if onboarding detected something)
157
+
158
+ Read `.planning/codebase/onboarding.md`. Per detected dimension:
159
+
160
+ - Issue tracker → `.planning/agents/tracker.md`
161
+ - Labels → `.planning/agents/labels.md` (canonical mapping)
162
+ - Domain docs at non-default path → `.planning/agents/domain.md`
163
+ - CLAUDE.md/AGENTS.md found → APPEND `## Qualia substrate` (never overwrite)
164
+
165
+ "none" → skip silently, defaults apply.
166
+
125
167
  ### 6. Commit
126
168
 
127
169
  ```bash
@@ -137,16 +179,17 @@ node ~/.claude/bin/qualia-ui.js end "CODEBASE MAPPED" "/qualia-new"
137
179
 
138
180
  ## What `/qualia-new` Does With This
139
181
 
140
- When `/qualia-new` runs AFTER `/qualia-map`, it:
182
+ After `/qualia-map`:
141
183
  1. Reads `.planning/codebase/README.md`
142
184
  2. Extracts Validated capabilities
143
- 3. Pre-populates PROJECT.md with Validated requirements section
144
- 4. Skips questions about things already built
145
- 5. Focuses questioning on NEW capabilities being added
185
+ 3. Pre-populates PROJECT.md Validated reqs
186
+ 4. Skips questions about existing capabilities
187
+ 5. Focuses on NEW capabilities
146
188
 
147
189
  ## Rules
148
190
 
149
- 1. **Non-destructive.** This skill only READS code, never modifies it.
150
- 2. **Four parallel agents.** Don't sequential-scan — parallel is ~4x faster.
151
- 3. **Dimension files are structured.** The orchestrator downstream (`/qualia-new`) reads them programmatically.
152
- 4. **Concerns fixes.** This skill documents concerns. It does NOT fix them. Use `/qualia-optimize` for that.
191
+ 1. **Non-destructive.** Only READS code. Writes to `.planning/codebase/`, `.planning/agents/`, and APPENDs to CLAUDE.md/AGENTS.md.
192
+ 2. **Five parallel agents.** No sequential scan.
193
+ 3. **Dimension files structured.** `/qualia-new` reads programmatically.
194
+ 4. **Concerns not fixes.** Document only. `/qualia-optimize` to fix.
195
+ 5. **Onboarding respects existing process.** GH issues → Qualia uses them. Never overwrite; only append.
@@ -0,0 +1,139 @@
1
+ # /qualia-new Reference Templates
2
+
3
+ Detailed agent-prompt templates and rendering formats referenced by SKILL.md.
4
+ Each section is a verbatim template -- copy it, fill the `{placeholders}`, and spawn.
5
+
6
+ ## Researcher prompts (4 dimensions)
7
+
8
+ Spawn all 4 as parallel `Agent()` calls in a single message. Each uses the same structure with a different `<dimension>`.
9
+
10
+ ```
11
+ Agent(prompt="
12
+ Read your role: @~/.claude/agents/researcher.md
13
+
14
+ <dimension>stack</dimension>
15
+ <domain>{inferred domain from PROJECT.md}</domain>
16
+ <project_context>{PROJECT.md summary}</project_context>
17
+ <milestone_context>multi-milestone -- research must cover scalability through Milestone 3+</milestone_context>
18
+ <output_path>.planning/research/STACK.md</output_path>
19
+ ", subagent_type="qualia-researcher", description="Stack research")
20
+
21
+ Agent(prompt="
22
+ Read your role: @~/.claude/agents/researcher.md
23
+
24
+ <dimension>features</dimension>
25
+ <domain>{inferred domain}</domain>
26
+ <project_context>{PROJECT.md summary}</project_context>
27
+ <milestone_context>multi-milestone -- distinguish v1 table stakes from v2 differentiators</milestone_context>
28
+ <output_path>.planning/research/FEATURES.md</output_path>
29
+ ", subagent_type="qualia-researcher", description="Features research")
30
+
31
+ Agent(prompt="
32
+ Read your role: @~/.claude/agents/researcher.md
33
+
34
+ <dimension>architecture</dimension>
35
+ <domain>{inferred domain}</domain>
36
+ <project_context>{PROJECT.md summary}</project_context>
37
+ <milestone_context>multi-milestone -- Phase 1 foundations must support final-milestone requirements</milestone_context>
38
+ <output_path>.planning/research/ARCHITECTURE.md</output_path>
39
+ ", subagent_type="qualia-researcher", description="Architecture research")
40
+
41
+ Agent(prompt="
42
+ Read your role: @~/.claude/agents/researcher.md
43
+
44
+ <dimension>pitfalls</dimension>
45
+ <domain>{inferred domain}</domain>
46
+ <project_context>{PROJECT.md summary}</project_context>
47
+ <milestone_context>multi-milestone -- flag risks that stall LATER milestones, not just v1</milestone_context>
48
+ <output_path>.planning/research/PITFALLS.md</output_path>
49
+ ", subagent_type="qualia-researcher", description="Pitfalls research")
50
+ ```
51
+
52
+ ## Synthesizer prompt
53
+
54
+ Spawn after all 4 researchers complete.
55
+
56
+ ```
57
+ Agent(prompt="
58
+ Read your role: @~/.claude/agents/research-synthesizer.md
59
+
60
+ Merge the 4 research files at .planning/research/ into .planning/research/SUMMARY.md.
61
+ This is a multi-milestone project -- the SUMMARY must suggest a FULL milestone arc
62
+ (2-5 milestones including Handoff), not just a v1 phase list. Include roadmap
63
+ implications AND handoff implications (what client takeover requires).
64
+ ", subagent_type="qualia-research-synthesizer", description="Synthesize research")
65
+ ```
66
+
67
+ ## Roadmapper prompt
68
+
69
+ Spawn with full-journey mandate. If the user passed `--full-detail`, set `<full_detail>true</full_detail>`.
70
+
71
+ ```
72
+ Agent(prompt="
73
+ Read your role: @~/.claude/agents/roadmapper.md
74
+
75
+ <task>
76
+ Create the FULL JOURNEY for this project:
77
+ - .planning/JOURNEY.md -- all milestones (2-5 including Handoff) with exit criteria
78
+ - .planning/REQUIREMENTS.md -- requirements grouped by milestone
79
+ - .planning/ROADMAP.md -- Milestone 1's phase detail (and ALL milestones if full_detail=true)
80
+
81
+ User-scoped v1 features:
82
+ {list of features selected in Step 9, grouped by category}
83
+
84
+ Template type: {template_type from config.json}
85
+ If set, use ~/.claude/qualia-templates/projects/{type}.md as the milestone arc starting point.
86
+
87
+ <full_detail>{true if --full-detail, else false}</full_detail>
88
+ - false (default): Milestone 1 gets full phase detail; M2..M{N-1} stay as sketches. Detail fills in when each milestone opens via /qualia-milestone.
89
+ - true: every milestone (M1..Handoff) gets full phase-level detail in ROADMAP.md upfront. Useful when the client wants a fully-committed plan at kickoff.
90
+
91
+ The final milestone MUST be named 'Handoff' with the fixed 4 phases
92
+ (Polish, Content + SEO, Final QA, Handoff). Do not omit it.
93
+
94
+ After writing, update STATE.md via:
95
+ node ~/.claude/bin/state.js init \
96
+ --project '{name}' --client '{client}' --type '{type}' \
97
+ --milestone_name '{Milestone 1 name}' \
98
+ --phases '<JSON: Milestone 1 phases only>' \
99
+ --total_phases <count>
100
+ </task>
101
+ ", subagent_type="qualia-roadmapper", description="Create full journey")
102
+ ```
103
+
104
+ ## Journey ladder format
105
+
106
+ The branded journey ladder rendered in Step 11. Use `node ~/.claude/bin/qualia-ui.js journey-tree .planning/JOURNEY.md` for the programmatic version. The manual ASCII fallback format is below.
107
+
108
+ ```
109
+ ## Proposed Journey
110
+
111
+ **{N} milestones to handoff** | **{X} requirements mapped** | All v1 requirements covered
112
+
113
+ +-- Milestone 1 . {Name} [CURRENT]
114
+ | Why now: {one line}
115
+ | Exit: {outcome 1}, {outcome 2}
116
+ | Phases: 1. {name} -> 2. {name} -> 3. {name}
117
+ | Requirements: {REQ-IDs}
118
+ +--
119
+ |
120
+ v
121
+ +-- Milestone 2 . {Name}
122
+ | Why now: {one line}
123
+ | Exit: {outcome 1}, {outcome 2}
124
+ | Phases: 1. {name} -> 2. {name}
125
+ | Requirements: {REQ-IDs}
126
+ +--
127
+ |
128
+ v
129
+ ...
130
+ |
131
+ v
132
+ +-- Milestone {N} . Handoff [FINAL]
133
+ | Exit: Deployed, docs, credentials, walkthrough
134
+ | Phases: 1. Polish -> 2. Content + SEO -> 3. Final QA -> 4. Handoff
135
+ +--
136
+
137
+ Milestone 1 is fully planned. Milestones 2..{N-1} are sketched and will be detailed
138
+ when they open. Milestone {N} (Handoff) uses the standard 4-phase template.
139
+ ```
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: qualia-new
3
- description: "Set up a new project from scratch — deep questioning, ALWAYS-AUTO research, JOURNEY.md with all milestones to handoff, single approval gate, optional auto-chain into building. Use when starting any new client project."
3
+ description: "Set up a new project from scratch — deep questioning, ALWAYS-AUTO research, CONTEXT.md domain glossary seed, decisions/ ADR folder initialized, JOURNEY.md with all milestones to handoff, single approval gate, optional auto-chain into building. Use when starting any new client project."
4
4
  allowed-tools:
5
5
  - Bash
6
6
  - Read
@@ -17,6 +17,12 @@ allowed-tools:
17
17
 
18
18
  # /qualia-new — New Project (Full Journey)
19
19
 
20
+ ## Reference templates
21
+
22
+ Detailed agent-prompt templates and rendering formats live in `REFERENCE.md` (in this same skill folder). When a step below says "see REFERENCE.md section X", read that section before generating the spawn.
23
+
24
+ ---
25
+
20
26
  Initialize a project with the **entire arc mapped from kickoff to handoff**. All milestones defined upfront so the team follows a clear path, not improvising after each ship.
21
27
 
22
28
  ## Flags
@@ -107,6 +113,54 @@ git add .planning/PROJECT.md
107
113
  git commit -m "docs: initialize project"
108
114
  ```
109
115
 
116
+ ### Step 5a. Seed CONTEXT.md and decisions/ (v5.0 — REQUIRED)
117
+
118
+ The domain glossary is the single highest-leverage piece of substrate — every road agent loads it BEFORE PROJECT.md/DESIGN.md. Misalignment is the #1 failure mode in AI coding; CONTEXT.md kills it.
119
+
120
+ ```bash
121
+ # Copy template
122
+ cp ~/.claude/qualia-templates/CONTEXT.md .planning/CONTEXT.md
123
+
124
+ # Initialize ADR folder with the template available for reference
125
+ mkdir -p .planning/decisions
126
+ cp ~/.claude/qualia-templates/decisions/ADR-template.md .planning/decisions/_template.md
127
+ ```
128
+
129
+ Then **seed the glossary from the questioning answers**. For each domain term that came up during Step 1 (Deep Questioning) — entities, actions, statuses, key nouns the user repeatedly said — add an entry to `.planning/CONTEXT.md` under `## Language` with:
130
+ - the term
131
+ - a one-sentence definition
132
+ - an `Avoid:` line listing rejected synonyms (terms the team should NOT use for this concept)
133
+
134
+ If the user used multiple terms for the same thing during questioning, capture the disambiguation under `## Flagged ambiguities` (e.g. "User → AuthUser vs Customer").
135
+
136
+ Replace `{{PROJECT_NAME}}` in CONTEXT.md with the project name.
137
+
138
+ ```bash
139
+ git add .planning/CONTEXT.md .planning/decisions/
140
+ git commit -m "docs: seed CONTEXT.md domain glossary + decisions/ folder"
141
+ ```
142
+
143
+ The glossary stays terse — one sentence per entry. It's loaded into every agent spawn; bloat costs tokens. `/qualia-discuss` will grow it inline as decisions crystallize during phase planning.
144
+
145
+ ### Step 5b. Write PRODUCT.md (v4.5.0 — REQUIRED)
146
+
147
+ `PRODUCT.md` is the "who and why" every road agent reads before designing or building. It is **required** — the planner, builder, and verifier all load it as substrate.
148
+
149
+ Ask the user 5 short questions (one at a time, each with a sensible default they can `[Enter]` past):
150
+
151
+ 1. **Register** — "Is this design IS the product (marketing/landing/portfolio → `brand`) or design SERVES the product (app/admin/dashboard → `product`)?" Default: infer from project type.
152
+ 2. **Three users** — "Name 3 specific humans who will use this. Not personas — real names + their workflow scenario." Default: project type defaults.
153
+ 3. **Brand voice** — "Three adjectives, then one paragraph showing the voice in motion (an error message, a confirmation, an empty state)." Default: derive from PROJECT.md.
154
+ 4. **Anti-references** — "Three sites this should NOT look like, with why." Required, no defaults — anti-references are more useful than positive references.
155
+ 5. **One-sentence differentiation** — "What does someone remember 24 hours after first using this?" Required.
156
+
157
+ Write `.planning/PRODUCT.md` from `templates/PRODUCT.md`, filling the user's answers.
158
+
159
+ ```bash
160
+ git add .planning/PRODUCT.md
161
+ git commit -m "docs: PRODUCT.md — register, users, voice, anti-references"
162
+ ```
163
+
110
164
  ### Step 6. Create config.json
111
165
 
112
166
  ```json
@@ -124,13 +178,31 @@ git commit -m "docs: initialize project"
124
178
 
125
179
  **Note:** `workflow.research` is ALWAYS `true` for v4. It exists for telemetry but is no longer read as a gate.
126
180
 
127
- ### Step 7. Create DESIGN.md (frontend projects)
181
+ ### Step 7. Create DESIGN.md (frontend projects — v4.5.0 OKLCH-first)
128
182
 
129
- If frontend work is involved, generate `.planning/DESIGN.md` from the template with concrete palette, distinctive typography (NEVER Inter/Roboto/system-ui), 8px spacing grid, motion approach, component patterns.
183
+ If frontend work is involved, generate `.planning/DESIGN.md` from `templates/DESIGN.md`. The generation MUST commit to four things upfront (these go in §1 of DESIGN.md):
184
+
185
+ 1. **Aesthetic direction** — pick ONE: `editorial · brutalist · luxury · maximalist · retro-futuristic · organic · terminal-native · sci-fi · pastoral · industrial · ...`. Don't hedge ("modern minimal" is hedging — pick one extreme).
186
+ 2. **Color strategy** — pick ONE: `Restrained · Committed · Full palette · Drenched`. See `rules/design-laws.md` §2.
187
+ 3. **Scene sentence** — one concrete sentence: who uses this, where, ambient light, mood. NOT "observability dashboard" — "SRE glancing at incident severity on a 27-inch monitor at 2am in a dim room." Run the sentence, not the category.
188
+ 4. **Differentiation** — one sentence: what someone remembers 24 hours later.
189
+
190
+ Then fill the rest of DESIGN.md:
191
+ - §2 Color: OKLCH only, no `#000`/`#fff`, neutrals tinted toward brand hue (chroma 0.005-0.015), accent within the chosen strategy
192
+ - §3 Typography: distinctive display + refined body pair. **NEVER** Inter, Roboto, Arial, Helvetica, system-ui, Space Grotesk
193
+ - §4 Spacing: 8px grid + fluid `clamp()` for page padding
194
+ - §5 Components: token-driven button/input/card/table specs
195
+ - §6 Depth: 3-level shadow elevation, OKLCH-tinted (not gray)
196
+ - §7 Motion: easing tokens (ease-out-quart/expo), no bounce, `prefers-reduced-motion` respected
197
+ - §8 Iconography: ONE family
198
+ - §9 Responsive: mobile-first
199
+ - §10 Anti-pattern checklist (the auto-runnable one)
200
+
201
+ Cross-check the result against `rules/design-laws.md` §8 absolute bans BEFORE writing — the design must not propose any banned pattern.
130
202
 
131
203
  ```bash
132
204
  git add .planning/DESIGN.md .planning/config.json
133
- git commit -m "docs: design direction + config"
205
+ git commit -m "docs: DESIGN.md direction commit + OKLCH palette + tokens"
134
206
  ```
135
207
 
136
208
  ### Step 8. Run Research (ALWAYS, no permission ask)
@@ -146,62 +218,9 @@ mkdir -p .planning/research
146
218
 
147
219
  Say: **"Running 4 parallel research agents (stack, features, architecture, pitfalls)..."**
148
220
 
149
- Spawn 4 researchers in parallel (single message, 4 Agent tool calls), with multi-milestone scope:
150
-
151
- ```
152
- Agent(prompt="
153
- Read your role: @~/.claude/agents/researcher.md
154
-
155
- <dimension>stack</dimension>
156
- <domain>{inferred domain from PROJECT.md}</domain>
157
- <project_context>{PROJECT.md summary}</project_context>
158
- <milestone_context>multi-milestone — research must cover scalability through Milestone 3+</milestone_context>
159
- <output_path>.planning/research/STACK.md</output_path>
160
- ", subagent_type="qualia-researcher", description="Stack research")
161
-
162
- Agent(prompt="
163
- Read your role: @~/.claude/agents/researcher.md
164
-
165
- <dimension>features</dimension>
166
- <domain>{inferred domain}</domain>
167
- <project_context>{PROJECT.md summary}</project_context>
168
- <milestone_context>multi-milestone — distinguish v1 table stakes from v2 differentiators</milestone_context>
169
- <output_path>.planning/research/FEATURES.md</output_path>
170
- ", subagent_type="qualia-researcher", description="Features research")
171
-
172
- Agent(prompt="
173
- Read your role: @~/.claude/agents/researcher.md
174
-
175
- <dimension>architecture</dimension>
176
- <domain>{inferred domain}</domain>
177
- <project_context>{PROJECT.md summary}</project_context>
178
- <milestone_context>multi-milestone — Phase 1 foundations must support final-milestone requirements</milestone_context>
179
- <output_path>.planning/research/ARCHITECTURE.md</output_path>
180
- ", subagent_type="qualia-researcher", description="Architecture research")
181
-
182
- Agent(prompt="
183
- Read your role: @~/.claude/agents/researcher.md
184
-
185
- <dimension>pitfalls</dimension>
186
- <domain>{inferred domain}</domain>
187
- <project_context>{PROJECT.md summary}</project_context>
188
- <milestone_context>multi-milestone — flag risks that stall LATER milestones, not just v1</milestone_context>
189
- <output_path>.planning/research/PITFALLS.md</output_path>
190
- ", subagent_type="qualia-researcher", description="Pitfalls research")
191
- ```
192
-
193
- **After all 4 complete, spawn synthesizer:**
221
+ Spawn 4 researchers in parallel (single message, 4 Agent tool calls), with multi-milestone scope. See REFERENCE.md section "Researcher prompts (4 dimensions)" for the verbatim prompt templates.
194
222
 
195
- ```
196
- Agent(prompt="
197
- Read your role: @~/.claude/agents/research-synthesizer.md
198
-
199
- Merge the 4 research files at .planning/research/ into .planning/research/SUMMARY.md.
200
- This is a multi-milestone project — the SUMMARY must suggest a FULL milestone arc
201
- (2-5 milestones including Handoff), not just a v1 phase list. Include roadmap
202
- implications AND handoff implications (what client takeover requires).
203
- ", subagent_type="qualia-research-synthesizer", description="Synthesize research")
204
- ```
223
+ **After all 4 complete, spawn synthesizer.** See REFERENCE.md section "Synthesizer prompt" for the verbatim prompt template.
205
224
 
206
225
  **Commit:**
207
226
  ```bash
@@ -239,40 +258,7 @@ Gather any additional requirements the user wants that research missed.
239
258
  node ~/.claude/bin/qualia-ui.js banner roadmap
240
259
  ```
241
260
 
242
- Spawn the roadmapper with full-journey mandate. If the user passed `--full-detail`, include `<full_detail>true</full_detail>` in the prompt so the roadmapper writes complete phase detail for ALL milestones.
243
-
244
- ```
245
- Agent(prompt="
246
- Read your role: @~/.claude/agents/roadmapper.md
247
-
248
- <task>
249
- Create the FULL JOURNEY for this project:
250
- - .planning/JOURNEY.md — all milestones (2-5 including Handoff) with exit criteria
251
- - .planning/REQUIREMENTS.md — requirements grouped by milestone
252
- - .planning/ROADMAP.md — Milestone 1's phase detail (and ALL milestones if full_detail=true)
253
-
254
- User-scoped v1 features:
255
- {list of features selected in Step 9, grouped by category}
256
-
257
- Template type: {template_type from config.json}
258
- If set, use ~/.claude/qualia-templates/projects/{type}.md as the milestone arc starting point.
259
-
260
- <full_detail>{true if --full-detail, else false}</full_detail>
261
- - false (default): Milestone 1 gets full phase detail; M2..M{N-1} stay as sketches. Detail fills in when each milestone opens via /qualia-milestone.
262
- - true: every milestone (M1..Handoff) gets full phase-level detail in ROADMAP.md upfront. Useful when the client wants a fully-committed plan at kickoff.
263
-
264
- The final milestone MUST be named 'Handoff' with the fixed 4 phases
265
- (Polish, Content + SEO, Final QA, Handoff). Do not omit it.
266
-
267
- After writing, update STATE.md via:
268
- node ~/.claude/bin/state.js init \\
269
- --project '{name}' --client '{client}' --type '{type}' \\
270
- --milestone_name '{Milestone 1 name}' \\
271
- --phases '<JSON: Milestone 1 phases only>' \\
272
- --total_phases <count>
273
- </task>
274
- ", subagent_type="qualia-roadmapper", description="Create full journey")
275
- ```
261
+ Spawn the roadmapper with full-journey mandate. If the user passed `--full-detail`, include `<full_detail>true</full_detail>` in the prompt so the roadmapper writes complete phase detail for ALL milestones. See REFERENCE.md section "Roadmapper prompt" for the verbatim prompt template.
276
262
 
277
263
  ### Step 11. Present the Journey (single view)
278
264
 
@@ -284,37 +270,7 @@ node ~/.claude/bin/qualia-ui.js journey-tree .planning/JOURNEY.md
284
270
 
285
271
  This shows M1..M{N} as a vertical ladder: shipped milestones get a green dot, current gets a teal diamond with `[CURRENT]` tag, future get dim open circles. Handoff gets `[FINAL]` tag. Why-now + phase sketch render under current and final.
286
272
 
287
- Also narrate the one-glance summary:
288
-
289
- ```
290
- ## Proposed Journey
291
-
292
- **{N} milestones to handoff** | **{X} requirements mapped** | All v1 requirements covered ✓
293
-
294
- ┌─ Milestone 1 · {Name} [CURRENT]
295
- │ Why now: {one line}
296
- │ Exit: {outcome 1}, {outcome 2}
297
- │ Phases: 1. {name} → 2. {name} → 3. {name}
298
- │ Requirements: {REQ-IDs}
299
- └─
300
-
301
- ┌─ Milestone 2 · {Name}
302
- │ Why now: {one line}
303
- │ Exit: {outcome 1}, {outcome 2}
304
- │ Phases: 1. {name} → 2. {name}
305
- │ Requirements: {REQ-IDs}
306
- └─
307
-
308
- ...
309
-
310
- ┌─ Milestone {N} · Handoff [FINAL]
311
- │ Exit: Deployed, docs, credentials, walkthrough
312
- │ Phases: 1. Polish → 2. Content + SEO → 3. Final QA → 4. Handoff
313
- └─
314
-
315
- Milestone 1 is fully planned. Milestones 2..{N-1} are sketched and will be detailed
316
- when they open. Milestone {N} (Handoff) uses the standard 4-phase template.
317
- ```
273
+ Also narrate the one-glance summary. See REFERENCE.md section "Journey ladder format" for the ASCII template.
318
274
 
319
275
  ### Step 12. Approval Gate (single — for the whole journey)
320
276
 
@@ -385,6 +341,9 @@ Show summary:
385
341
  | Artifact | Location |
386
342
  |----------------|-----------------------------|
387
343
  | Project | .planning/PROJECT.md |
344
+ | Glossary | .planning/CONTEXT.md |
345
+ | Decisions | .planning/decisions/ |
346
+ | Product | .planning/PRODUCT.md |
388
347
  | Journey | .planning/JOURNEY.md |
389
348
  | Requirements | .planning/REQUIREMENTS.md |
390
349
  | Roadmap (M1) | .planning/ROADMAP.md |
@@ -414,3 +373,5 @@ Do NOT use `--quick` for: client projects, anything with compliance stakes, anyt
414
373
  5. **Milestone 1 is fully detailed.** M2..M{N-1} are sketched. Detail fills in when each milestone opens.
415
374
  6. **STATE.md through state.js.** Never edit STATE.md or tracking.json by hand.
416
375
  7. **Inline skill invocation.** When Step 0.5 offers `/qualia-map`, invoke it inline — don't exit.
376
+ 8. **CONTEXT.md is mandatory (v5.0).** Every project gets a domain glossary at `.planning/CONTEXT.md`. Seeded from questioning answers. Loaded by every road agent. Kept terse.
377
+ 9. **ADRs are scarce.** `.planning/decisions/` exists from day one but only fills with hard-to-reverse, surprising-without-context, real-tradeoff decisions. Cargo-culting ADRs ruins the signal.