qualia-framework 5.5.0 → 5.8.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 (31) hide show
  1. package/README.md +17 -13
  2. package/agents/research-synthesizer.md +4 -1
  3. package/agents/researcher.md +6 -1
  4. package/agents/visual-evaluator.md +1 -1
  5. package/bin/install.js +6 -6
  6. package/bin/slop-detect.mjs +1 -1
  7. package/docs/onboarding.html +623 -0
  8. package/guide.md +5 -6
  9. package/hooks/session-start.js +1 -1
  10. package/package.json +1 -1
  11. package/skills/qualia-discuss/SKILL.md +106 -6
  12. package/skills/qualia-feature/SKILL.md +216 -0
  13. package/skills/qualia-milestone/SKILL.md +73 -1
  14. package/skills/qualia-new/SKILL.md +52 -25
  15. package/skills/qualia-optimize/SKILL.md +1 -1
  16. package/skills/{qualia-polish-loop → qualia-polish}/REFERENCE.md +5 -5
  17. package/skills/qualia-polish/SKILL.md +13 -4
  18. package/skills/{qualia-polish-loop → qualia-polish}/scripts/loop.mjs +2 -2
  19. package/skills/{qualia-polish-loop → qualia-polish}/scripts/playwright-capture.mjs +1 -1
  20. package/skills/qualia-road/SKILL.md +10 -11
  21. package/templates/project-discovery.md +83 -0
  22. package/templates/project.md +7 -0
  23. package/tests/bin.test.sh +74 -62
  24. package/tests/slop-detect.test.sh +2 -2
  25. package/skills/qualia-polish-loop/SKILL.md +0 -201
  26. package/skills/qualia-prd/SKILL.md +0 -199
  27. package/skills/qualia-quick/SKILL.md +0 -44
  28. package/skills/qualia-task/SKILL.md +0 -98
  29. /package/skills/{qualia-polish-loop → qualia-polish}/fixtures/broken.html +0 -0
  30. /package/skills/{qualia-polish-loop → qualia-polish}/fixtures/clean.html +0 -0
  31. /package/skills/{qualia-polish-loop → qualia-polish}/scripts/score.mjs +0 -0
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: qualia-discuss
3
- description: "Aggressive alignment interview before planning a phase asks ONE question at a time, proposes a recommended answer with each, walks every branch of the decision tree until resolved. Updates .planning/CONTEXT.md inline as terms crystallize and writes ADRs for hard-to-reverse decisions. Output: .planning/phase-{N}-context.md (locked input the planner honors). Use BEFORE /qualia-plan for high-stakes phases (regulatory, auth, payments, multi-tenant, architectural forks), or when the user says 'discuss', 'grill me', 'stress test this plan', 'wait let's think about this one', 'I'm not sure how to approach this'."
3
+ description: "Alignment interview. Two modes. PROJECT MODE (default, no args) is the non-technical kickoff before /qualia-new 8 questions for demo projects, 14 for full projects, output is .planning/project-discovery.md. PHASE MODE (with N arg, e.g. /qualia-discuss 2) is the technical aggressive grilling before /qualia-plan N one question at a time with recommended answer, output is .planning/phase-{N}-context.md. Trigger phrases: 'discuss', 'kickoff interview', 'grill me', 'stress test this plan', 'wait let's think about this one', 'I'm not sure how to approach this'."
4
4
  allowed-tools:
5
5
  - Bash
6
6
  - Read
@@ -11,24 +11,124 @@ allowed-tools:
11
11
  - AskUserQuestion
12
12
  ---
13
13
 
14
- # /qualia-discuss — Alignment Interview Before Planning
14
+ # /qualia-discuss — Alignment Interview
15
+
16
+ Two modes. The skill picks one based on whether an arg is passed.
17
+
18
+ | Arg | Mode | When | Output |
19
+ |-----|------|------|--------|
20
+ | (none) | **PROJECT MODE** | Kickoff, before `/qualia-new`. Non-technical, audience-facing. | `.planning/project-discovery.md` |
21
+ | `N` (e.g. `2`) | **PHASE MODE** | Before `/qualia-plan N`. Technical, aggressive grilling. | `.planning/phase-{N}-context.md` |
22
+
23
+ ## Mode routing
24
+
25
+ ```bash
26
+ if [ -z "$1" ] || ! [[ "$1" =~ ^[0-9]+$ ]]; then
27
+ MODE="project"
28
+ else
29
+ MODE="phase"
30
+ PHASE_N="$1"
31
+ fi
32
+ ```
33
+
34
+ If `MODE=project` → jump to **PROJECT MODE** section below.
35
+ If `MODE=phase` → jump to **PHASE MODE** section below.
36
+
37
+ ---
38
+
39
+ # PROJECT MODE — Kickoff Interview (no args)
40
+
41
+ The non-technical conversation that runs at the very start of `/qualia-new`, BEFORE any roadmapping or research. Captures what the client wants, who it's for, brand voice, and constraints — in the client's own words.
42
+
43
+ Hard rule: **never go technical here.** No "Should we use Supabase or Postgres?". The technical decisions happen in PHASE MODE, per phase. This mode is for the human shape of the project.
44
+
45
+ ## When PROJECT MODE runs
46
+
47
+ - Triggered automatically by `/qualia-new` after Step 0 banner, BEFORE journey generation.
48
+ - Or invoked manually (e.g. on a brownfield project that already has code but no discovery doc).
49
+
50
+ ## Process — PROJECT MODE
51
+
52
+ ### P1. Detect project type (or accept it from `/qualia-new`)
53
+
54
+ If `/qualia-new` already asked the Demo vs Full gate, it passes the type in as `PROJECT_TYPE=demo` or `PROJECT_TYPE=full` via env or arg. Otherwise ask first:
55
+
56
+ - header: "Project shape"
57
+ - question: "Is this a demo (single shippable milestone, sales conversation, ~1 to 2 weeks) or a full project (multi-milestone arc to Handoff)?"
58
+ - options: ["Demo", "Full project"]
59
+
60
+ This is the only fork. Demo runs §1-§8 of the discovery template. Full project runs all 14 questions.
61
+
62
+ ### P2. Banner and open
63
+
64
+ ```bash
65
+ node ~/.claude/bin/qualia-ui.js banner discuss-project
66
+ ```
67
+
68
+ Say: **"Eight quick questions for the demo path"** or **"Fourteen questions to shape the full project — we'll move fast"** depending on type.
69
+
70
+ ### P3. One question at a time, copy from `templates/project-discovery.md`
71
+
72
+ For each question §1..§8 (demo) or §1..§14 (full), ask in plain language. Format:
73
+
74
+ ```
75
+ **Question {N}/{total}:** {question text from template}
76
+
77
+ ({one-line clarifier showing the kind of answer that helps)
78
+ ```
79
+
80
+ NO "my recommendation" line in PROJECT MODE — this is open discovery, not technical grilling. Wait for the user's answer. Don't paraphrase back; capture verbatim. If the answer is too thin, ask one follow-up max, then move on.
81
+
82
+ Allowed `[Enter]` defaults exist on §2, §3, §5 only (inferred from project type). All other questions require an answer.
83
+
84
+ ### P4. Write `.planning/project-discovery.md`
85
+
86
+ Fill the template at `~/.claude/qualia-templates/project-discovery.md` with the user's verbatim answers. Set frontmatter `project_type` and `discovered_at`.
87
+
88
+ ### P5. Hand back to `/qualia-new`
89
+
90
+ ```bash
91
+ git add .planning/project-discovery.md
92
+ git commit -m "docs: project discovery interview ($PROJECT_TYPE)"
93
+ node ~/.claude/bin/qualia-ui.js ok "Discovery captured — back to /qualia-new"
94
+ ```
95
+
96
+ If invoked standalone (not from `/qualia-new`), end with:
97
+
98
+ ```bash
99
+ node ~/.claude/bin/qualia-ui.js end "DISCOVERY CAPTURED" "/qualia-new"
100
+ ```
101
+
102
+ If invoked inline by `/qualia-new`, return control silently — `/qualia-new` continues from Step 2.
103
+
104
+ ## Rules — PROJECT MODE
105
+
106
+ 1. **Never technical.** No stack questions, no architecture forks. Those are PHASE MODE.
107
+ 2. **Verbatim capture.** Don't translate the client's words into framework-speak. The client's exact phrasing is the input to PRODUCT.md voice and CONTEXT.md glossary.
108
+ 3. **One question, one answer, move on.** No batching. No drilling deeper than one follow-up.
109
+ 4. **Demo stops at §8.** Don't ask demo clients milestone-arc questions — they don't have an arc yet.
110
+ 5. **Anti-references are required.** If the user can't name three sites this should NOT look like, the design will end up generic. Push back once, then capture whatever they give you.
111
+
112
+ ---
113
+
114
+ # PHASE MODE — Pre-Plan Grilling (`/qualia-discuss N`)
15
115
 
16
116
  Surface and lock the decisions, trade-offs, and constraints that must inform a phase plan. Output: `.planning/phase-{N}-context.md` (locked input). Side effects: `.planning/CONTEXT.md` gains new terms; `.planning/decisions/` may gain ADRs.
17
117
 
18
- ## When to use
118
+ ## When PHASE MODE runs
19
119
  - Regulated domains (legal, medical, financial) where wrong choices have legal cost
20
120
  - Phases with architectural forks ("auth via middleware or RLS?")
21
121
  - Phases with external dependencies you want to lock first
22
122
  - User says "wait, let's think about this one"
23
123
 
24
- ## The four grilling rules
124
+ ## The four grilling rules (PHASE MODE)
25
125
 
26
126
  1. **One question at a time.** Wait for the answer before asking the next. Never batch.
27
127
  2. **Propose your recommended answer first.** Format every question as `Question / Recommendation / Trade-offs`. The user accepts, edits, or rejects — way faster than open interview.
28
128
  3. **If the codebase can answer, explore instead of asking.** Don't make the user say what `git grep` could tell you.
29
129
  4. **Walk every branch.** When the user picks A over B, the next question is the one that A makes load-bearing. Resolve dependencies one-by-one until the tree is fully traversed.
30
130
 
31
- ## Process
131
+ ## Process — PHASE MODE
32
132
 
33
133
  ### 1. Load substrate
34
134
 
@@ -108,7 +208,7 @@ git commit -m "docs(phase-{N}): lock context, glossary terms, ADRs"
108
208
  node ~/.claude/bin/qualia-ui.js end "PHASE {N} CONTEXT LOCKED" "/qualia-plan {N}"
109
209
  ```
110
210
 
111
- ## Rules
211
+ ## Rules — PHASE MODE
112
212
 
113
213
  1. **One session, one phase.** Don't discuss phases 1 and 2 in the same invocation.
114
214
  2. **Locked decisions are NON-NEGOTIABLE.** The planner honors them exactly. Don't lock what you're unsure of — defer it instead.
@@ -0,0 +1,216 @@
1
+ ---
2
+ name: qualia-feature
3
+ description: "Auto-scoped single feature build. Picks inline (≤1 trivial file, no spawn) or fresh builder spawn (1-5 logic files, atomic commit) automatically from the task description. Refuses and routes to /qualia-plan for 5+ files or full phases. Replaces /qualia-quick and /qualia-task. Flags: --force-spawn forces a builder, --force-inline forces inline. Trigger phrases: 'build this one thing', 'add a component', 'implement this feature', 'quick fix', 'small change', 'tweak', 'hot fix', 'one-line fix', 'typo', 'config tweak', 'qualia-feature'."
4
+ allowed-tools:
5
+ - Bash
6
+ - Read
7
+ - Write
8
+ - Edit
9
+ - Grep
10
+ - Glob
11
+ - Agent
12
+ - AskUserQuestion
13
+ ---
14
+
15
+ # /qualia-feature — Auto-scoped Single Feature
16
+
17
+ One command for everything between a typo and a phase. Auto-detects scope from the task description and picks the right execution path. No more guessing whether to use `/qualia-quick` or `/qualia-task`.
18
+
19
+ ## Usage
20
+
21
+ `/qualia-feature` — describe interactively
22
+ `/qualia-feature {description}` — run with description directly
23
+ `/qualia-feature --force-spawn {description}` — force a fresh builder spawn (even if auto would inline)
24
+ `/qualia-feature --force-inline {description}` — force inline path (even if auto would spawn)
25
+
26
+ ## When to use
27
+
28
+ - One feature outside a planned phase
29
+ - A bug fix, typo, config tweak, or one-line change
30
+ - A 1-5 file feature, component, API route, or integration
31
+ - A refactor of a single module
32
+
33
+ ## When NOT to use
34
+
35
+ - 5+ files or multiple subsystems touched → `/qualia-plan`
36
+ - Part of a planned phase → `/qualia-build`
37
+ - Investigating a symptom you can't name yet → `/qualia-debug`
38
+ - Optimization or polish pass → `/qualia-optimize` or `/qualia-polish`
39
+
40
+ ## Process
41
+
42
+ ### 1. Capture description
43
+
44
+ If invoked without args, ask: **"What do you want to build?"**
45
+
46
+ Wait for free-text answer. Don't paraphrase back. Capture the user's exact phrasing — it feeds both the auto-scope classifier and the eventual commit message.
47
+
48
+ ### 2. Auto-detect scope
49
+
50
+ Classify the description into one of three buckets:
51
+
52
+ | Bucket | Heuristic | Path |
53
+ |--------|-----------|------|
54
+ | **inline** | Typo, comment edit, 1-line config change, single-word rename, dead-code removal, copy edit, link fix, version bump, single emoji/icon swap | Direct work, no spawn |
55
+ | **spawn** | Add a component, add an API route, add a small migration + UI, implement a single feature, fix a non-trivial bug, refactor a module under 5 files | Fresh builder spawn |
56
+ | **refuse** | "Build the dashboard", "implement payments", "ship the auth system", "add a checkout flow", any description that names a multi-step workflow or 5+ subsystems | Refuse, route to `/qualia-plan` |
57
+
58
+ **Inline signals** (any one is sufficient):
59
+ - "fix typo", "fix the comment", "rename X to Y", "remove unused", "update copy", "change the link", "bump version"
60
+ - Description fits in one short sentence and names one specific micro-change
61
+ - The action is reversible by a single `git revert`
62
+
63
+ **Spawn signals** (any one is sufficient):
64
+ - "add a", "implement", "build", "create" + a single noun (component, route, page, table, form, modal, hook, util, migration)
65
+ - Description names a single feature with multiple touch points (e.g. "add a feedback form" → migration + API + UI = 3-4 files, but still one cohesive thing)
66
+ - The work needs a fresh context to avoid contaminating the current conversation
67
+
68
+ **Refuse signals** (any one is sufficient):
69
+ - "build the X system", "implement the entire Y", "add complete Z support"
70
+ - Description names a multi-milestone capability (auth, payments, search, admin panel) without a tight slice
71
+ - Estimated touch ≥ 5 files OR ≥ 1 day
72
+
73
+ ### 3. Announce the route + escape hatch
74
+
75
+ Show the user what was detected. Always offer the escape hatch:
76
+
77
+ ```bash
78
+ node ~/.claude/bin/qualia-ui.js banner feature
79
+ node ~/.claude/bin/qualia-ui.js info "Detected scope: {inline|spawn|refuse}"
80
+ node ~/.claude/bin/qualia-ui.js info "Reason: {one-line rationale}"
81
+ ```
82
+
83
+ Then:
84
+
85
+ - header: "Scope detected"
86
+ - question: "Auto-scope says {bucket}. Proceed, or override?"
87
+ - options:
88
+ - "Proceed with {bucket}"
89
+ - "Force inline" (only shown if bucket != inline)
90
+ - "Force spawn" (only shown if bucket != spawn)
91
+ - "Route to /qualia-plan" (only shown if bucket != refuse)
92
+ - "Re-describe"
93
+
94
+ If `--force-spawn` or `--force-inline` was passed on the command line, skip this gate entirely and execute the forced path.
95
+
96
+ ### 4. Execute the inline path
97
+
98
+ For inline scope:
99
+
100
+ 1. Read the file(s) that need to change (one read per file, no spawning).
101
+ 2. Make the edit directly using Edit/Write.
102
+ 3. Run `npx tsc --noEmit` if TypeScript and the change touches typed code; skip otherwise.
103
+ 4. Atomic commit with a clear conventional-commit message:
104
+
105
+ ```bash
106
+ git add {specific files}
107
+ git commit -m "fix: {description}"
108
+ ```
109
+
110
+ 5. Record in state:
111
+
112
+ ```bash
113
+ node ~/.claude/bin/state.js transition --to note --notes "{brief description}" --tasks-done 1
114
+ ```
115
+
116
+ 6. End with:
117
+
118
+ ```bash
119
+ node ~/.claude/bin/qualia-ui.js end "FEATURE SHIPPED (inline)"
120
+ ```
121
+
122
+ ### 5. Execute the spawn path
123
+
124
+ For spawn scope:
125
+
126
+ 1. Build a quick task spec (don't write to a file, just confirm with user):
127
+
128
+ ```bash
129
+ node ~/.claude/bin/qualia-ui.js info "What: {what to build}"
130
+ node ~/.claude/bin/qualia-ui.js info "Files: {files to create/modify, comma list}"
131
+ node ~/.claude/bin/qualia-ui.js info "Done: {observable acceptance criteria, 1-3 bullets}"
132
+ ```
133
+
134
+ Ask: **"Good to build?"** Wait for confirmation.
135
+
136
+ 2. Spawn the builder:
137
+
138
+ ```
139
+ Agent(subagent_type="qualia-builder", description="Feature: {short title}")
140
+ prompt: |
141
+ Read your role: @~/.claude/agents/builder.md
142
+
143
+ <task>
144
+ {task description verbatim from user}
145
+ </task>
146
+
147
+ <files>
148
+ {files to create/modify}
149
+ </files>
150
+
151
+ <acceptance_criteria>
152
+ {1-3 observable bullets}
153
+ </acceptance_criteria>
154
+
155
+ <context>
156
+ Read .planning/PROJECT.md if it exists.
157
+ Read .planning/CONTEXT.md if it exists (domain glossary).
158
+ Follow rules/security.md, rules/frontend.md, rules/deployment.md as applicable.
159
+ Atomic commit. Run npx tsc --noEmit before commit.
160
+ </context>
161
+ ```
162
+
163
+ 3. After the builder returns, verify:
164
+ - `npx tsc --noEmit` exits 0 (rerun the builder up to 2x if it failed self-verify, per the v5.5.0 auto-heal pattern).
165
+ - Quick smoke test if applicable.
166
+ - Confirm the commit was made: `git log --oneline -1` shows the feature.
167
+
168
+ 4. Report:
169
+
170
+ ```bash
171
+ node ~/.claude/bin/qualia-ui.js divider
172
+ node ~/.claude/bin/qualia-ui.js ok "Feature: {description}"
173
+ node ~/.claude/bin/qualia-ui.js ok "Files: {files changed}"
174
+ node ~/.claude/bin/qualia-ui.js ok "Commit: {commit hash}"
175
+ node ~/.claude/bin/qualia-ui.js end "FEATURE SHIPPED (spawn)"
176
+ ```
177
+
178
+ 5. Record in state:
179
+
180
+ ```bash
181
+ node ~/.claude/bin/state.js transition --to note --notes "{description}" --tasks-done 1
182
+ ```
183
+
184
+ ### 6. Execute the refuse path
185
+
186
+ For refuse scope, do NOT build. Explain why and route:
187
+
188
+ ```bash
189
+ node ~/.claude/bin/qualia-ui.js warn "This is too big for /qualia-feature (5+ files or multi-step workflow)."
190
+ node ~/.claude/bin/qualia-ui.js info "Reason: {one-line — e.g. 'description names the entire auth system, not a slice'}"
191
+ node ~/.claude/bin/qualia-ui.js end "ROUTED" "/qualia-plan"
192
+ ```
193
+
194
+ If the user is sure it's small and the classifier got it wrong, they can re-invoke with `--force-spawn`.
195
+
196
+ ## Auto-scope examples
197
+
198
+ | Description | Detected | Why |
199
+ |-------------|----------|-----|
200
+ | "fix the typo in the hero copy" | inline | typo + 1 file |
201
+ | "rename `userId` to `user_id` in auth.ts" | inline | rename in 1 file |
202
+ | "bump next from 16.0.3 to 16.0.4" | inline | version bump, 1 file |
203
+ | "add a Feedback button that opens a modal" | spawn | single feature, 2-4 files |
204
+ | "add a GET /api/health route returning ok" | spawn | 1 route, but worth a fresh context for test pass |
205
+ | "implement Stripe subscription checkout" | refuse | multi-file + webhooks + admin = phase |
206
+ | "build the dashboard" | refuse | names a multi-page surface |
207
+ | "add the admin user-management page" | refuse | usually 5+ files (table, modals, API, RLS, types) |
208
+
209
+ ## Rules
210
+
211
+ 1. **Auto-scope is confident by default, with two escape hatches.** Trust the classifier; use `--force-spawn` or `--force-inline` when it guesses wrong. Don't waste a question on "which path?" — propose and let the user override.
212
+ 2. **Inline is genuinely fresh-context-free.** No subagent spawn for inline work — the current Claude does it directly. That's the whole speed advantage over `/qualia-task`.
213
+ 3. **Spawn means atomic.** One feature, one commit, one acceptance criteria block. No grab-bag commits that touch four unrelated things.
214
+ 4. **Refuse means refuse.** When a description is phase-sized, route to `/qualia-plan`, don't try to fit it in. The auto-classifier is the gate that protects the work from sprawling.
215
+ 5. **STATE.md via state.js only.** Never edit STATE.md or tracking.json by hand. Both paths record through `state.js transition`.
216
+ 6. **Follow rules/* on every path.** Security, frontend, deployment rules apply equally to inline and spawn. Read-before-write is non-negotiable.
@@ -38,6 +38,77 @@ node ~/.claude/bin/state.js check
38
38
 
39
39
  If either fires (without `--force`), stop and show the error. The user must verify remaining phases first (or add `--force` for explicit bypass on a preview/demo milestone).
40
40
 
41
+ ### 1b. Demo-Extension Branch (v5.6)
42
+
43
+ Detect if this is a demo project closing its only milestone:
44
+
45
+ ```bash
46
+ PROJECT_TYPE=$(grep -E "^project_type:" .planning/PROJECT.md | head -1 | awk '{print $2}')
47
+ MILESTONE_COUNT=$(grep -cE "^## Milestone " .planning/JOURNEY.md 2>/dev/null || echo 0)
48
+ ```
49
+
50
+ If `PROJECT_TYPE=demo` AND `MILESTONE_COUNT=1`, the demo's one milestone is closing — there is no "next milestone" in the file. Ask the conversion question:
51
+
52
+ - header: "Demo shipped — what next?"
53
+ - question: "The demo milestone is done. Did the client sign? If yes, extend this into a full project (regenerate JOURNEY.md as a multi-milestone arc to Handoff). If no, this project closes here."
54
+ - options:
55
+ - "Client signed — extend to full project"
56
+ - "Demo only — close here, project is done"
57
+ - "Pause" — don't close yet, decide later
58
+
59
+ **If "Client signed — extend to full project":**
60
+
61
+ 1. Update `.planning/PROJECT.md` frontmatter: `project_type: full`.
62
+ 2. Run a brief discovery top-up — invoke `/qualia-discuss` in PROJECT MODE, but only ask §9-§14 (the full-project-only questions). This adds the milestone arc, compliance, integrations, content ownership, handoff team, and budget shape.
63
+ 3. Spawn the roadmapper in `extend-to-full` mode (see prompt below). It reads the existing single milestone (now M1), the updated discovery, and produces a full JOURNEY.md with M2..M{N-1} sketches plus the Handoff milestone.
64
+ 4. Then proceed with the standard close-milestone flow (Steps 2-9) — M1 closes, M2 opens, the user is asked to continue.
65
+
66
+ Roadmapper prompt for the extension:
67
+
68
+ ```
69
+ Agent(prompt="
70
+ Read your role: @~/.claude/agents/roadmapper.md
71
+
72
+ <mode>extend-demo-to-full</mode>
73
+ <existing_journey>.planning/JOURNEY.md</existing_journey>
74
+ <discovery>.planning/project-discovery.md</discovery>
75
+
76
+ <task>
77
+ The existing JOURNEY.md has 1 milestone (the demo, now M1 and shipped). Extend it
78
+ into a 2-5 milestone arc to Handoff:
79
+
80
+ - Keep M1 exactly as-is (it shipped).
81
+ - Add M2..M{N-1} based on §9 of project-discovery.md (the milestone-arc question
82
+ the user answered when converting from demo).
83
+ - Append a Handoff milestone (fixed 4 phases: Polish, Content + SEO, Final QA,
84
+ Handoff).
85
+ - Update REQUIREMENTS.md to add REQ-IDs for the new milestones.
86
+ - Do NOT regenerate ROADMAP.md here — that happens in Step 7 of /qualia-milestone
87
+ when M2 opens.
88
+
89
+ Mark M2..M{N-1} as sketched, not fully detailed. The user gets full detail per
90
+ milestone when /qualia-milestone opens each one.
91
+ </task>
92
+ ", subagent_type=\"qualia-roadmapper\", description=\"Extend demo to full project\")
93
+ ```
94
+
95
+ **If "Demo only — close here":** treat the demo as a shipped-and-done project. Skip Steps 2-9 of the normal flow. Just run:
96
+
97
+ ```bash
98
+ node ~/.claude/bin/state.js close-milestone --force
99
+ node ~/.claude/bin/qualia-ui.js end "DEMO SHIPPED" "/qualia-report"
100
+ ```
101
+
102
+ In `--auto` mode, inline-invoke `/qualia-report` and stop.
103
+
104
+ **If "Pause":** stop, show:
105
+
106
+ ```bash
107
+ node ~/.claude/bin/qualia-ui.js info "Demo milestone left open. Run /qualia-milestone again when you decide."
108
+ ```
109
+
110
+ If the demo branch did NOT fire (full project, or demo with multiple milestones already after extension), continue to Step 2.
111
+
41
112
  ### 2. Banner + Confirm
42
113
 
43
114
  ```bash
@@ -206,4 +277,5 @@ node ~/.claude/bin/qualia-ui.js end "M{N} CLOSED · M{N+1} OPEN" "/qualia-plan 1
206
277
  3. **Archive, don't delete.** Old phase work stays accessible via `.planning/archive/`.
207
278
  4. **New milestone = fresh phase numbering.** First phase of the new milestone is Phase 1, not Phase {N+1}.
208
279
  5. **ERP sync aware.** tracking.json milestones[] gets a summary entry on close — the ERP reads this to render the tree.
209
- 6. **Handoff is the final milestone.** If the current milestone IS Handoff, there is no "next" — route to `/qualia-report` and the project is done.
280
+ 6. **Handoff is the final milestone (full projects).** If the current milestone IS Handoff, there is no "next" — route to `/qualia-report` and the project is done.
281
+ 7. **Demo closes via the demo-extension branch (Step 1b).** A demo's single milestone closing triggers the "client signed?" question. The framework never silently auto-extends a demo without asking — the conversion is a real business decision.
@@ -58,27 +58,41 @@ test -d .git && echo "HAS_GIT"
58
58
  test -f .planning/codebase/README.md && echo "ALREADY_MAPPED"
59
59
  ```
60
60
 
61
- If existing code is detected AND not already mapped, ask the user whether to run `/qualia-map` inline first. If yes, invoke the `qualia-map` skill inline, wait for completion, then continue to Step 1.
61
+ If existing code is detected AND not already mapped, ask the user whether to run `/qualia-map` inline first. If yes, invoke the `qualia-map` skill inline, wait for completion, then continue to Step 0.6.
62
62
 
63
- ### Step 1. Deep Questioning
63
+ ### Step 0.6. Project Type Gate (Demo vs Full)
64
64
 
65
- Load the questioning methodology:
65
+ The single most important fork in the workflow. Demo and Full produce different journeys, different research depth, different milestone counts.
66
66
 
67
- ```bash
68
- cat ~/.claude/qualia-references/questioning.md 2>/dev/null
69
- ```
67
+ - header: "Project shape"
68
+ - question: "Is this a demo (single shippable milestone, sales conversation) or a full project (multi-milestone arc to Handoff)?"
69
+ - options:
70
+ - "Demo" — one shippable milestone, real backend, no mocks. Built to win a client conversation, extensible via `/qualia-milestone` if they sign.
71
+ - "Full project" — the full multi-milestone arc to Handoff. 2-5 milestones planned upfront.
72
+
73
+ Store the answer as `PROJECT_TYPE=demo` or `PROJECT_TYPE=full`. It drives Steps 1, 8, and 10.
70
74
 
71
- Follow the thread. Challenge vagueness. Make abstract concrete. Check the 4-item mental checklist (what, why, who, done).
75
+ **Demo design philosophy is non-negotiable:** real backend always, DESIGN.md mandatory, slop-detect hard-block. Speed comes from skipping multi-milestone planning, NEVER from skipping design quality or mocking the backend.
72
76
 
73
- Use `AskUserQuestion` for forks with 2-4 concrete interpretations. Use free text when you want them to think freely.
77
+ ### Step 1. Mandatory Discovery Interview (PROJECT MODE)
74
78
 
75
- **Decision gate**when you could write a clear PROJECT.md:
79
+ Invoke `/qualia-discuss` inline in PROJECT MODE non-technical kickoff interview. 8 questions for demo, 14 for full project. Pass `PROJECT_TYPE` so the discuss skill skips the type question.
80
+
81
+ This step REPLACES the old free-form "deep questioning" loop. The discuss skill captures answers verbatim into `.planning/project-discovery.md`, which seeds PROJECT.md, PRODUCT.md, CONTEXT.md, and (for full projects) JOURNEY.md milestone names.
82
+
83
+ ```bash
84
+ # Inline-invoke qualia-discuss in PROJECT MODE
85
+ # (no phase number arg = PROJECT MODE; PROJECT_TYPE env tells it which question set)
86
+ PROJECT_TYPE=$PROJECT_TYPE qualia-discuss
87
+ ```
88
+
89
+ After the interview returns, `.planning/project-discovery.md` exists with the user's answers. Read it. Confirm understanding:
76
90
 
77
91
  - header: "Ready?"
78
- - question: "I understand what you're building. Create PROJECT.md and move forward?"
79
- - options: ["Create PROJECT.md", "Keep exploring"]
92
+ - question: "I have what I need to write PROJECT.md and move forward. Continue?"
93
+ - options: ["Continue", "More questions"]
80
94
 
81
- Loop until "Create PROJECT.md".
95
+ If "More questions": re-invoke `/qualia-discuss` for additional rounds. Otherwise continue.
82
96
 
83
97
  ### Step 2. Detect Project Type
84
98
 
@@ -216,11 +230,16 @@ node ~/.claude/bin/qualia-ui.js banner research
216
230
  mkdir -p .planning/research
217
231
  ```
218
232
 
219
- Say: **"Running 4 parallel research agents (stack, features, architecture, pitfalls)..."**
233
+ **Research scope branches on `PROJECT_TYPE`:**
234
+
235
+ - **Demo** (`PROJECT_TYPE=demo`): pass `<scope>quick</scope>` to all 4 researchers AND the synthesizer. Each researcher gets a 3-call budget instead of 8. The synthesizer produces a single-milestone suggestion (no Handoff, no multi-milestone arc). Total research time drops roughly 3x with no loss of correctness on the demo path — the depth was wasted when there's only one milestone to ship.
236
+ - **Full project** (`PROJECT_TYPE=full`): standard scope, 8-call budget per researcher, full milestone-arc synthesis.
220
237
 
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.
238
+ Say: **"Running 4 parallel research agents (stack, features, architecture, pitfalls)..."** (demo: append "— quick scope").
222
239
 
223
- **After all 4 complete, spawn synthesizer.** See REFERENCE.md section "Synthesizer prompt" for the verbatim prompt template.
240
+ Spawn 4 researchers in parallel (single message, 4 Agent tool calls). See REFERENCE.md section "Researcher prompts (4 dimensions)" for the verbatim prompt templates. Include `<scope>quick</scope>` in each prompt when `PROJECT_TYPE=demo`.
241
+
242
+ **After all 4 complete, spawn synthesizer.** See REFERENCE.md section "Synthesizer prompt" for the verbatim prompt template. Include `<scope>quick</scope>` when `PROJECT_TYPE=demo`.
224
243
 
225
244
  **Commit:**
226
245
  ```bash
@@ -258,7 +277,12 @@ Gather any additional requirements the user wants that research missed.
258
277
  node ~/.claude/bin/qualia-ui.js banner roadmap
259
278
  ```
260
279
 
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.
280
+ **Roadmapper output branches on `PROJECT_TYPE`:**
281
+
282
+ - **Demo** (`PROJECT_TYPE=demo`): roadmapper produces a 1-milestone JOURNEY.md (the demo milestone, 2-4 phases) plus a matching REQUIREMENTS.md and a fully-detailed ROADMAP.md. No "Handoff" milestone is appended — the demo is its own complete artifact. The journey-tree at Step 11 shows a single rung; the "extend to full project" branch is handled later by `/qualia-milestone` if the client signs.
283
+ - **Full project** (`PROJECT_TYPE=full`): roadmapper produces the standard 2-5 milestone arc ending in Handoff. Milestone 1 fully detailed, M2..M{N-1} sketched (unless `--full-detail`).
284
+
285
+ Spawn the roadmapper with `<project_type>$PROJECT_TYPE</project_type>` in the prompt. If the user passed `--full-detail`, include `<full_detail>true</full_detail>` so the roadmapper writes complete phase detail for ALL milestones (full project only; demo always has full detail because there's only one milestone). See REFERENCE.md section "Roadmapper prompt" for the verbatim prompt template.
262
286
 
263
287
  ### Step 11. Present the Journey (single view)
264
288
 
@@ -366,12 +390,15 @@ Do NOT use `--quick` for: client projects, anything with compliance stakes, anyt
366
390
 
367
391
  ## Rules
368
392
 
369
- 1. **Research runs automatically.** No permission ask. Only `--quick` skips it. This is a v4 invariant.
370
- 2. **The journey includes Handoff.** Every project's final milestone is literally named "Handoff" with 4 standard phases. The roadmapper enforces this.
371
- 3. **Single approval gate.** One gate for the whole journey. Not per-milestone, not per-phase.
372
- 4. **Milestone count: 2-5.** Hard floor 2, hard ceiling 5. Bigger projects defer remainder to post-handoff v2.
373
- 5. **Milestone 1 is fully detailed.** M2..M{N-1} are sketched. Detail fills in when each milestone opens.
374
- 6. **STATE.md through state.js.** Never edit STATE.md or tracking.json by hand.
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.
393
+ 1. **Project type is the first fork.** Step 0.6 asks Demo vs Full Project. Every downstream step branches on this. Don't skip it, don't infer it.
394
+ 2. **Discovery interview is mandatory (v5.6).** Step 1 always invokes `/qualia-discuss` in PROJECT MODE. No free-form questioning loop, no "I'll just sketch PROJECT.md from the user's first message." The interview is 8 questions for demo, 14 for full project.
395
+ 3. **Research runs automatically.** No permission ask. Only `--quick` skips it. Demo path uses `<scope>quick</scope>` (3-call budget per researcher); full project uses standard 8-call budget.
396
+ 4. **Demo design philosophy is non-negotiable.** Real backend always, DESIGN.md mandatory, slop-detect hard-block. Speed comes from skipping multi-milestone planning, never from skipping design quality or mocking the backend. A demo that uses mock data is not a Qualia demo.
397
+ 5. **Demos are 1 milestone, full projects are 2-5.** Demo journeys have no "Handoff" — the demo IS the artifact. Full projects always end in Handoff (fixed 4 phases). The journey-tree adapts to both shapes.
398
+ 6. **The full-project journey includes Handoff.** Every full project's final milestone is literally named "Handoff" with 4 standard phases. The roadmapper enforces this.
399
+ 7. **Single approval gate.** One gate for the whole journey. Not per-milestone, not per-phase.
400
+ 8. **Milestone 1 is fully detailed (full projects).** M2..M{N-1} are sketched. Detail fills in when each milestone opens. Demos are always fully detailed because they're 1 milestone.
401
+ 9. **STATE.md through state.js.** Never edit STATE.md or tracking.json by hand.
402
+ 10. **Inline skill invocation.** When Step 0.5 offers `/qualia-map` or Step 1 invokes `/qualia-discuss`, invoke it inline — don't exit.
403
+ 11. **CONTEXT.md is mandatory.** Every project gets a domain glossary at `.planning/CONTEXT.md`. Seeded from the discovery interview answers. Loaded by every road agent. Kept terse.
404
+ 12. **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.
@@ -146,7 +146,7 @@ Collect all 3 proposals. Present to the user as a side-by-side table:
146
146
  | 2 | ... | ... | ... | ... |
147
147
  | 3 | ... | ... | ... | ... |
148
148
 
149
- User picks `1`, `2`, `3`, or `hybrid` (with notes on which elements from which proposals to combine). The synthesizer then writes a "Refactor RFC" to `.planning/REFACTOR-{slug}.md` and optionally opens a GH issue (mirrors `/qualia-prd` flow).
149
+ User picks `1`, `2`, `3`, or `hybrid` (with notes on which elements from which proposals to combine). The synthesizer then writes a "Refactor RFC" to `.planning/REFACTOR-{slug}.md` and optionally opens a GH issue.
150
150
 
151
151
  **Why parallel + radically different**: a single deepening proposal anchors on the first idea the LLM has. Three parallel proposals with diverse design constraints surface trade-offs the user can see at a glance — and the human's "taste" dominates the choice rather than the agent's first instinct. Empirically (Matt Pocock + Qualia internal testing) this produces dramatically better refactor RFCs than a single-pass proposal.
152
152
 
@@ -1,4 +1,4 @@
1
- # REFERENCE — /qualia-polish-loop
1
+ # REFERENCE — /qualia-polish --loop
2
2
 
3
3
  Verbatim agent prompts and operational details. Loaded on demand by SKILL.md, not carried in the system prompt. Per progressive-disclosure discipline (Matt Pocock): the agent reads SKILL.md first, then this file when it needs the spawn templates.
4
4
 
@@ -104,7 +104,7 @@ Agent({
104
104
  Role: @~/.claude/agents/builder.md
105
105
 
106
106
  <phase_context>
107
- You are inside /qualia-polish-loop iteration {N}. The vision evaluator scored
107
+ You are inside /qualia-polish --loop iteration {N}. The vision evaluator scored
108
108
  the {dim} dimension at {score}. Your single task: fix that one dimension.
109
109
 
110
110
  <design>
@@ -133,7 +133,7 @@ the {dim} dimension at {score}. Your single task: fix that one dimension.
133
133
  2. Make the MINIMUM edit to fix this one dimension. Do not refactor. Do not change logic. Do not touch state management. Do not change copy unless this is a microcopy issue.
134
134
  3. Use design tokens from DESIGN.md. Do not invent new color values, font names, or spacing.
135
135
  4. After the edit, commit via the orchestrator (slop-detect-gated):
136
- node ~/.claude/skills/qualia-polish-loop/scripts/loop.mjs commit-fix --state {STATE} --file {file} --slug {dim}-{short-keyword}
136
+ node ~/.claude/skills/qualia-polish/scripts/loop.mjs commit-fix --state {STATE} --file {file} --slug {dim}-{short-keyword}
137
137
  If slop-detect blocks (exit 2), READ the slop output and re-edit. If you cannot fix without violating slop-detect, return BLOCKED with the conflict.
138
138
  5. Return DONE with: file modified, lines changed, slop-detect: pass, commit: {sha}.
139
139
  </task>
@@ -260,6 +260,6 @@ This is intentional. Most visual regressions Fawzi has documented in `/insights`
260
260
 
261
261
  - Cross-browser rendering checks (Firefox / WebKit) — Chromium-only, per `qualia-polish` Stage 4 precedent
262
262
  - Accessibility audits beyond what the rubric scores — use `/qualia-polish` Stage 3 (Lighthouse + axe) for that
263
- - Performance regressions — use `/qualia-polish-loop` only after Lighthouse score passes
263
+ - Performance regressions — use `/qualia-polish --loop` only after Lighthouse score passes
264
264
  - Reference-image-only mode (compare to a target screenshot without a brief) — currently the brief is required; reference is supplemental
265
- - Multi-page sweeps — one URL per invocation; chain `/qualia-polish-loop` per route for site-wide passes
265
+ - Multi-page sweeps — one URL per invocation; chain `/qualia-polish --loop` per route for site-wide passes