qualia-framework 3.6.0 → 4.0.3

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 (56) hide show
  1. package/CLAUDE.md +23 -11
  2. package/README.md +96 -51
  3. package/agents/builder.md +25 -14
  4. package/agents/plan-checker.md +29 -16
  5. package/agents/planner.md +33 -24
  6. package/agents/research-synthesizer.md +25 -12
  7. package/agents/roadmapper.md +89 -84
  8. package/agents/verifier.md +11 -2
  9. package/bin/cli.js +18 -13
  10. package/bin/install.js +34 -45
  11. package/bin/qualia-ui.js +267 -1
  12. package/bin/state.js +164 -12
  13. package/bin/statusline.js +4 -1
  14. package/docs/erp-contract.md +12 -0
  15. package/guide.md +85 -22
  16. package/hooks/migration-guard.js +23 -9
  17. package/hooks/pre-compact.js +39 -11
  18. package/hooks/pre-deploy-gate.js +3 -4
  19. package/hooks/pre-push.js +6 -3
  20. package/hooks/session-start.js +8 -8
  21. package/package.json +1 -1
  22. package/rules/frontend.md +5 -13
  23. package/skills/qualia/SKILL.md +8 -1
  24. package/skills/qualia-build/SKILL.md +49 -4
  25. package/skills/qualia-debug/SKILL.md +6 -0
  26. package/skills/qualia-design/SKILL.md +9 -1
  27. package/skills/qualia-discuss/SKILL.md +6 -0
  28. package/skills/qualia-handoff/SKILL.md +92 -12
  29. package/skills/qualia-help/SKILL.md +18 -4
  30. package/skills/qualia-idk/SKILL.md +166 -0
  31. package/skills/qualia-learn/SKILL.md +6 -0
  32. package/skills/qualia-map/SKILL.md +7 -0
  33. package/skills/qualia-milestone/SKILL.md +128 -79
  34. package/skills/qualia-new/SKILL.md +163 -230
  35. package/skills/qualia-optimize/SKILL.md +8 -0
  36. package/skills/qualia-pause/SKILL.md +5 -0
  37. package/skills/qualia-plan/SKILL.md +25 -10
  38. package/skills/qualia-polish/SKILL.md +8 -0
  39. package/skills/qualia-quick/SKILL.md +7 -0
  40. package/skills/qualia-report/SKILL.md +17 -0
  41. package/skills/qualia-research/SKILL.md +7 -0
  42. package/skills/qualia-resume/SKILL.md +3 -0
  43. package/skills/qualia-review/SKILL.md +7 -0
  44. package/skills/qualia-ship/SKILL.md +5 -0
  45. package/skills/qualia-skill-new/SKILL.md +6 -0
  46. package/skills/qualia-task/SKILL.md +8 -1
  47. package/skills/qualia-test/SKILL.md +7 -0
  48. package/skills/qualia-verify/SKILL.md +65 -3
  49. package/templates/help.html +4 -4
  50. package/templates/journey.md +113 -0
  51. package/templates/plan.md +56 -11
  52. package/templates/requirements.md +82 -22
  53. package/templates/roadmap.md +41 -14
  54. package/templates/tracking.json +2 -0
  55. package/tests/hooks.test.sh +5 -5
  56. package/tests/runner.js +381 -7
@@ -1,6 +1,16 @@
1
1
  ---
2
2
  name: qualia-plan
3
3
  description: "Plan the current phase — spawns planner, validates with plan-checker in a revision loop (max 3), optionally runs discuss/research first. Use when ready to plan a phase."
4
+ allowed-tools:
5
+ - Bash
6
+ - Read
7
+ - Write
8
+ - Edit
9
+ - Grep
10
+ - Glob
11
+ - Agent
12
+ - TaskCreate
13
+ - TaskUpdate
4
14
  ---
5
15
 
6
16
  # /qualia-plan — Plan a Phase
@@ -13,6 +23,7 @@ Spawn a planner agent to break the current phase into executable tasks, then val
13
23
  `/qualia-plan {N}` — plan specific phase N
14
24
  `/qualia-plan {N} --gaps` — plan fixes for verification failures
15
25
  `/qualia-plan {N} --skip-check` — skip the plan-checker validation loop (not recommended)
26
+ `/qualia-plan {N} --auto` — plan + auto-chain into `/qualia-build {N} --auto` when done (no human approval between plan and build)
16
27
 
17
28
  ## Process
18
29
 
@@ -153,16 +164,10 @@ Show the remaining issues. Ask:
153
164
 
154
165
  ### 5. Present Final Plan
155
166
 
156
- ```bash
157
- node ~/.claude/bin/qualia-ui.js divider
158
- node ~/.claude/bin/qualia-ui.js ok "Plan ready: {count} tasks across {count} waves"
159
- ```
167
+ Render the story-file dashboard — this is a single command that parses the plan and shows the phase goal, waves, tasks, personas, dependencies, acceptance-criteria counts, and validation counts:
160
168
 
161
- For each wave:
162
169
  ```bash
163
- node ~/.claude/bin/qualia-ui.js wave {wave_num} {wave_total} {task_count}
164
- node ~/.claude/bin/qualia-ui.js task 1 "{task title}"
165
- node ~/.claude/bin/qualia-ui.js task 2 "{task title}"
170
+ node ~/.claude/bin/qualia-ui.js plan-summary .planning/phase-{N}-plan.md
166
171
  ```
167
172
 
168
173
  End with plain text: *"Approve? (yes / adjust)"*
@@ -177,7 +182,17 @@ node ~/.claude/bin/state.js transition --to planned --phase {N}
177
182
 
178
183
  If state.js returns an error, show it and stop. Do NOT manually edit STATE.md or tracking.json.
179
184
 
180
- ### 7. Route
185
+ ### 7. Route (auto-chain aware)
186
+
187
+ **If invoked with `--auto`:** immediately invoke `/qualia-build {N} --auto` inline. The user already approved the whole journey at `/qualia-new` time — no additional approval needed per phase plan.
188
+
189
+ ```bash
190
+ node ~/.claude/bin/qualia-ui.js info "Auto mode — chaining into /qualia-build {N}"
191
+ ```
192
+
193
+ Then invoke the `qualia-build` skill inline with `--auto`.
194
+
195
+ **Otherwise (guided mode):** stop and show the next step:
181
196
 
182
197
  ```bash
183
198
  node ~/.claude/bin/qualia-ui.js end "PHASE {N} PLANNED" "/qualia-build {N}"
@@ -191,7 +206,7 @@ When invoked as `/qualia-plan {N} --gaps`, the planner is in gap-closure mode:
191
206
  2. For each FAIL item, create a targeted fix task:
192
207
  - **Files:** specific files that failed verification
193
208
  - **Action:** specific fix (not "fix auth" — "add session persistence check in src/lib/auth.ts signIn function")
194
- - **Done when:** the exact verification criterion that previously failed, restated
209
+ - **Acceptance Criteria:** the exact verification criterion that previously failed, restated as an observable behavior
195
210
  3. Do NOT re-plan passing items. Do NOT add new features. Gap plans are surgical.
196
211
  4. Write to `.planning/phase-{N}-gaps-plan.md` (separate from original plan)
197
212
  5. All gap tasks are Wave 1 (parallel) unless they share files
@@ -1,6 +1,14 @@
1
1
  ---
2
2
  name: qualia-polish
3
3
  description: "Design and UX pass — anti-AI-slop, genuine craft, responsive, accessible. Run after all phases are verified."
4
+ allowed-tools:
5
+ - Bash
6
+ - Read
7
+ - Write
8
+ - Edit
9
+ - Grep
10
+ - Glob
11
+ - Agent
4
12
  ---
5
13
 
6
14
  # /qualia-polish — Design Pass
@@ -1,6 +1,13 @@
1
1
  ---
2
2
  name: qualia-quick
3
3
  description: "Fast path for small tasks — bug fixes, tweaks, hot fixes. Skips full phase planning. Trigger on 'quick fix', 'small change', 'tweak', 'hot fix', 'one-line fix', 'quick edit', 'small bug'."
4
+ allowed-tools:
5
+ - Bash
6
+ - Read
7
+ - Write
8
+ - Edit
9
+ - Grep
10
+ - Glob
4
11
  ---
5
12
 
6
13
  # /qualia-quick — Quick Task
@@ -1,6 +1,11 @@
1
1
  ---
2
2
  name: qualia-report
3
3
  description: "Generate session report and commit to repo. Mandatory before clock-out."
4
+ allowed-tools:
5
+ - Bash
6
+ - Read
7
+ - Write
8
+ - Edit
4
9
  ---
5
10
 
6
11
  # /qualia-report — Session Report
@@ -92,6 +97,9 @@ SUBMITTED_AT=$(date -u +%Y-%m-%dT%H:%M:%SZ)
92
97
  # Only upload if ERP is enabled
93
98
  if [ "$ERP_ENABLED" = "true" ]; then
94
99
  # Build structured JSON payload from tracking.json (matches ERP contract /api/v1/reports)
100
+ # v4: include milestone_name, milestones[], team_id, project_id, git_remote,
101
+ # session_started_at, last_pushed_at, build_count, deploy_count — the ERP
102
+ # uses these to render the project tree (milestone → phases → unphased) correctly.
95
103
  PAYLOAD=$(node -e "
96
104
  const fs = require('fs');
97
105
  const t = JSON.parse(fs.readFileSync('.planning/tracking.json', 'utf8'));
@@ -104,8 +112,13 @@ if [ "$ERP_ENABLED" = "true" ]; then
104
112
  } catch {}
105
113
  console.log(JSON.stringify({
106
114
  project: t.project || require('path').basename(process.cwd()),
115
+ project_id: t.project_id || '',
116
+ team_id: t.team_id || '',
117
+ git_remote: t.git_remote || '',
107
118
  client: t.client || '',
108
119
  milestone: t.milestone || 1,
120
+ milestone_name: t.milestone_name || '',
121
+ milestones: Array.isArray(t.milestones) ? t.milestones : [],
109
122
  phase: t.phase,
110
123
  phase_name: t.phase_name,
111
124
  total_phases: t.total_phases,
@@ -114,7 +127,11 @@ if [ "$ERP_ENABLED" = "true" ]; then
114
127
  tasks_total: t.tasks_total || 0,
115
128
  verification: t.verification || 'pending',
116
129
  gap_cycles: (t.gap_cycles || {})[String(t.phase)] || 0,
130
+ build_count: t.build_count || 0,
131
+ deploy_count: t.deploy_count || 0,
117
132
  deployed_url: t.deployed_url || '',
133
+ session_started_at: t.session_started_at || '',
134
+ last_pushed_at: t.last_pushed_at || '',
118
135
  lifetime: t.lifetime || {},
119
136
  commits: commits,
120
137
  notes: notes,
@@ -1,6 +1,13 @@
1
1
  ---
2
2
  name: qualia-research
3
3
  description: "Deep-research a niche domain or library BEFORE planning a specific phase. Spawns the researcher agent with Context7/WebFetch access. Writes to .planning/phase-{N}-research.md."
4
+ allowed-tools:
5
+ - Bash
6
+ - Read
7
+ - Write
8
+ - Agent
9
+ - WebFetch
10
+ - WebSearch
4
11
  ---
5
12
 
6
13
  # /qualia-research — Per-Phase Deep Research
@@ -1,6 +1,9 @@
1
1
  ---
2
2
  name: qualia-resume
3
3
  description: "Restore context from a previous session. Reads .continue-here.md or STATE.md, summarizes where you left off, routes to next action. Trigger on 'resume', 'continue', 'pick up where I left off', 'what was I doing'."
4
+ allowed-tools:
5
+ - Bash
6
+ - Read
4
7
  ---
5
8
 
6
9
  # /qualia-resume — Resume Work
@@ -1,6 +1,13 @@
1
1
  ---
2
2
  name: qualia-review
3
3
  description: "Production audit with scored diagnostics. Runs real commands, scores findings by severity. Trigger on 'review', 'audit', 'code review', 'security check', 'production check'."
4
+ allowed-tools:
5
+ - Bash
6
+ - Read
7
+ - Write
8
+ - Grep
9
+ - Glob
10
+ - Agent
4
11
  ---
5
12
 
6
13
  # /qualia-review — Production Audit
@@ -1,6 +1,11 @@
1
1
  ---
2
2
  name: qualia-ship
3
3
  description: "Deploy to production — quality gates, commit, push, deploy, verify. Use when ready to go live."
4
+ allowed-tools:
5
+ - Bash
6
+ - Read
7
+ - Write
8
+ - Edit
4
9
  ---
5
10
 
6
11
  # /qualia-ship — Deploy
@@ -1,6 +1,12 @@
1
1
  ---
2
2
  name: qualia-skill-new
3
3
  description: "Author a new Qualia skill or agent. Use when the user says 'create a new skill', 'add a skill', 'I want to build a skill', 'make this a reusable command', 'turn this into a skill'. Generates the SKILL.md, registers it in the right location, and optionally ships to the framework repo."
4
+ allowed-tools:
5
+ - Bash
6
+ - Read
7
+ - Write
8
+ - Edit
9
+ - AskUserQuestion
4
10
  ---
5
11
 
6
12
  # /qualia-skill-new — Author a New Skill
@@ -1,6 +1,13 @@
1
1
  ---
2
2
  name: qualia-task
3
3
  description: "Build a single task — more structured than /qualia-quick, lighter than /qualia-build. Spawns a fresh builder agent for one focused task."
4
+ allowed-tools:
5
+ - Bash
6
+ - Read
7
+ - Write
8
+ - Edit
9
+ - Agent
10
+ - AskUserQuestion
4
11
  ---
5
12
 
6
13
  # /qualia-task — Single Task Builder
@@ -61,7 +68,7 @@ Agent(subagent_type: "qualia-builder")
61
68
 
62
69
  Task: {task description}
63
70
  Files: {files to create/modify}
64
- Done when: {completion criteria}
71
+ Acceptance Criteria: {observable completion criteria, 1-3 bullet points}
65
72
 
66
73
  Context: Read PROJECT.md if it exists. Follow all rules (security, frontend, deployment).
67
74
  ```
@@ -1,6 +1,13 @@
1
1
  ---
2
2
  name: qualia-test
3
3
  description: "Generate or run tests for client projects. Trigger on 'write tests', 'add tests', 'test this', 'run tests', 'test coverage', 'need tests for'."
4
+ allowed-tools:
5
+ - Bash
6
+ - Read
7
+ - Write
8
+ - Edit
9
+ - Grep
10
+ - Glob
4
11
  ---
5
12
 
6
13
  # /qualia-test — Test Generator
@@ -1,6 +1,14 @@
1
1
  ---
2
2
  name: qualia-verify
3
3
  description: "Goal-backward verification — checks if the phase ACTUALLY works, not just if tasks completed. Spawns verifier agent."
4
+ allowed-tools:
5
+ - Bash
6
+ - Read
7
+ - Write
8
+ - Edit
9
+ - Grep
10
+ - Glob
11
+ - Agent
4
12
  ---
5
13
 
6
14
  # /qualia-verify — Verify a Phase
@@ -10,6 +18,7 @@ Spawn a verifier agent to check if the phase goal was achieved. Does NOT trust b
10
18
  ## Usage
11
19
  `/qualia-verify` — verify the current built phase
12
20
  `/qualia-verify {N}` — verify specific phase
21
+ `/qualia-verify {N} --auto` — verify + auto-chain: PASS → next phase (or milestone close); FAIL → gap closure; gap limit → halt with escalation
13
22
 
14
23
  ## Process
15
24
 
@@ -99,11 +108,64 @@ node ~/.claude/bin/qualia-ui.js end "PHASE {N} GAPS FOUND" "/qualia-plan {N} --g
99
108
  ```bash
100
109
  node ~/.claude/bin/state.js transition --to verified --phase {N} --verification {pass|fail}
101
110
  ```
102
- If PASS and more phases: state.js auto-advances to the next phase.
103
- If FAIL and gap_cycles >= 2: state.js returns GAP_CYCLE_LIMIT — tell the employee to escalate.
104
- If FAIL and gap_cycles < 2: proceed to `/qualia-plan {N} --gaps`.
111
+ If PASS and more phases in this milestone: state.js auto-advances to the next phase.
112
+ If FAIL and gap_cycles >= limit: state.js returns GAP_CYCLE_LIMIT — escalate.
113
+ If FAIL and gap_cycles < limit: proceed to `/qualia-plan {N} --gaps`.
105
114
  Do NOT manually edit STATE.md or tracking.json — state.js handles both.
106
115
 
116
+ After state transition, capture the new state for auto-chain routing:
117
+
118
+ ```bash
119
+ NEW_STATE=$(node ~/.claude/bin/state.js check)
120
+ # Parse: .phase (new current phase), .total_phases, .status, .verification
121
+ # Also read .planning/JOURNEY.md to know if this was the last phase of a milestone
122
+ ```
123
+
124
+ ### 4b. Route (auto-chain aware)
125
+
126
+ **In `--auto` mode**, the router decides the next step based on verify result + journey position:
127
+
128
+ | Result | Journey position | Action |
129
+ |---|---|---|
130
+ | PASS | More phases remain in current milestone | Inline invoke `/qualia-plan {N+1} --auto` |
131
+ | PASS | Last phase of current milestone (not Handoff) | Inline invoke `/qualia-milestone --auto` |
132
+ | PASS | Last phase of Handoff milestone | Inline invoke `/qualia-ship`, then `/qualia-handoff`, then `/qualia-report` |
133
+ | FAIL | gap_cycles < limit | Inline invoke `/qualia-plan {N} --gaps --auto` |
134
+ | FAIL | gap_cycles >= limit | **HALT** — show escalation message, require human intervention |
135
+
136
+ Detect "last phase of current milestone":
137
+ ```bash
138
+ # tracking.json.milestone gives current milestone number
139
+ # .planning/JOURNEY.md describes phases per milestone
140
+ # If the just-verified phase's number == total phases of current milestone → last phase
141
+ ```
142
+
143
+ Detect "last phase of Handoff milestone":
144
+ ```bash
145
+ # If the current milestone's name in JOURNEY.md is "Handoff" AND this was its last phase
146
+ ```
147
+
148
+ **Halt case (gap cycle limit)** — stop auto-chain and show:
149
+
150
+ ```bash
151
+ node ~/.claude/bin/qualia-ui.js fail "Phase {N} has failed verification {cycles} times — gap limit reached"
152
+ node ~/.claude/bin/qualia-ui.js warn "Human intervention required. Options:"
153
+ echo " 1. Re-plan this phase from scratch: /qualia-plan {N}"
154
+ echo " 2. Adjust the roadmap — phase scope may be wrong"
155
+ echo " 3. Escalate to Fawzi (for EMPLOYEE role)"
156
+ ```
157
+
158
+ **Default (guided mode)** behavior is unchanged — show the next command and stop:
159
+
160
+ ```bash
161
+ # PASS
162
+ node ~/.claude/bin/qualia-ui.js end "PHASE {N} VERIFIED" "/qualia-plan {N+1}"
163
+ # (or "/qualia-milestone" if last phase of milestone, "/qualia-polish" if overall last phase)
164
+
165
+ # FAIL
166
+ node ~/.claude/bin/qualia-ui.js end "PHASE {N} GAPS FOUND" "/qualia-plan {N} --gaps"
167
+ ```
168
+
107
169
  ### 5. Passive Knowledge Capture (on FAIL)
108
170
 
109
171
  When verification fails, after showing the gaps, ask the user:
@@ -291,13 +291,13 @@
291
291
  </head>
292
292
  <body>
293
293
 
294
- <div class="version-pill">v3.6.0</div>
294
+ <div class="version-pill">{{VERSION}}</div>
295
295
 
296
296
  <div class="header">
297
297
  <div class="header-content">
298
298
  <h1><span>Qualia</span> Framework</h1>
299
299
  <p>Plan, build, verify, ship. The AI-powered workflow for Qualia Solutions.</p>
300
- <div class="version">v3.6.0 &middot; 26 skills</div>
300
+ <div class="version">{{VERSION}} &middot; 26 skills</div>
301
301
  </div>
302
302
  </div>
303
303
 
@@ -430,7 +430,7 @@
430
430
  <div class="cmd"><span class="cmd-name">qualia-framework install</span><span class="cmd-desc">Install or reinstall the framework.</span></div>
431
431
  <div class="cmd"><span class="cmd-name">qualia-framework update</span><span class="cmd-desc">Update to the latest version.</span></div>
432
432
  <div class="cmd"><span class="cmd-name">qualia-framework version</span><span class="cmd-desc">Show installed version + check for updates.</span></div>
433
- <div class="cmd"><span class="cmd-name">qualia-framework migrate</span><span class="cmd-desc">Upgrade v2 settings to v3.</span></div>
433
+ <div class="cmd"><span class="cmd-name">qualia-framework migrate</span><span class="cmd-desc">Upgrade legacy settings.json to the current hook layout.</span></div>
434
434
  <div class="cmd"><span class="cmd-name">qualia-framework analytics</span><span class="cmd-desc">Hook telemetry, verification pass rates, gap cycles.</span></div>
435
435
  <div class="cmd"><span class="cmd-name">qualia-framework team</span><span class="cmd-desc">List, add, or remove team members.</span></div>
436
436
  <div class="cmd"><span class="cmd-name">qualia-framework traces</span><span class="cmd-desc">View recent hook activity.</span></div>
@@ -536,7 +536,7 @@
536
536
  <div class="footer">
537
537
  <strong>Welcome to the future with Qualia.</strong><br>
538
538
  Qualia Solutions &mdash; Nicosia, Cyprus
539
- <span class="footer-version">qualia-framework v3.6.0 &middot; 26 skills</span>
539
+ <span class="footer-version">qualia-framework {{VERSION}} &middot; 26 skills</span>
540
540
  </div>
541
541
 
542
542
  </body>
@@ -0,0 +1,113 @@
1
+ ---
2
+ project: "{Project Name}"
3
+ total_milestones: {N}
4
+ current_milestone: 1
5
+ created: {date}
6
+ ---
7
+
8
+ # {Project Name} — Journey
9
+
10
+ The full arc from kickoff to client handoff. Every milestone. Every exit criterion.
11
+ This file is the **North Star** — all planning downstream must stay architecturally
12
+ consistent with it.
13
+
14
+ ## Mission
15
+
16
+ {one-paragraph description of what this project delivers and for whom}
17
+
18
+ ## The Path ({N} milestones to handoff)
19
+
20
+ ```
21
+ M1 ─── M2 ─── M3 ─── ... ─── M{N} (Handoff)
22
+
23
+ └── [CURRENT]
24
+ ```
25
+
26
+ ---
27
+
28
+ ## Milestone 1 · {Name} [CURRENT]
29
+
30
+ **Why now:** {one-sentence reason this is the first release — what foundation it lays}
31
+
32
+ **Exit criteria** (what "shipped" means for M1):
33
+ - {observable outcome 1}
34
+ - {observable outcome 2}
35
+ - {observable outcome 3}
36
+
37
+ **Phases:**
38
+ 1. **{Phase Name}** — {one-line goal}
39
+ 2. **{Phase Name}** — {one-line goal}
40
+ 3. **{Phase Name}** — {one-line goal}
41
+
42
+ **Requirements covered:** {REQ-IDs — e.g. AUTH-01, AUTH-02, CORE-01}
43
+
44
+ **Research flags:** {any phases that may need deeper research during planning}
45
+
46
+ ---
47
+
48
+ ## Milestone 2 · {Name}
49
+
50
+ **Why now:** {plain-language reason this follows M1}
51
+
52
+ **Exit criteria:**
53
+ - {observable outcome 1}
54
+ - {observable outcome 2}
55
+
56
+ **Phases:**
57
+ 1. **{Phase Name}** — {one-line goal}
58
+ 2. **{Phase Name}** — {one-line goal}
59
+ 3. **{Phase Name}** — {one-line goal}
60
+
61
+ **Requirements covered:** {REQ-IDs}
62
+
63
+ ---
64
+
65
+ ## Milestone 3 · {Name}
66
+
67
+ **Why now:** {reason}
68
+
69
+ **Exit criteria:**
70
+ - {outcome}
71
+ - {outcome}
72
+
73
+ **Phases:**
74
+ 1. **{Phase Name}** — {one-line goal}
75
+ 2. **{Phase Name}** — {one-line goal}
76
+
77
+ **Requirements covered:** {REQ-IDs}
78
+
79
+ ---
80
+
81
+ ## Milestone {N} · Handoff [FINAL]
82
+
83
+ **Why now:** Production-ready for real users and client takeover.
84
+
85
+ **Exit criteria:**
86
+ - Deployed on production domain with HTTP 200 + auth flow verified
87
+ - Client has credentials, runbook, and recorded walkthrough
88
+ - `.planning/archive/` contains every milestone's verification reports
89
+ - ERP `lifetime.milestones_completed` reflects this milestone
90
+
91
+ **Phases (standard for every project):**
92
+ 1. **Polish** — design pass, responsive, accessibility, empty/error states
93
+ 2. **Content + SEO** — real copy, metadata, sitemap, robots, analytics
94
+ 3. **Final QA** — full-flow test, cross-browser, edge cases, `/qualia-review`
95
+ 4. **Handoff** — credentials doc, client walkthrough, domain transfer, support clause
96
+
97
+ **Requirements covered:** {REQ-IDs — typically ops/quality/handoff categories}
98
+
99
+ ---
100
+
101
+ ## Rules for This Journey
102
+
103
+ 1. **Hard ceiling: 5 milestones.** If the project needs more, defer to a v2 release after handoff.
104
+ 2. **Hard floor: 2 milestones.** Anything smaller should use `/qualia-new --quick` instead.
105
+ 3. **The final milestone is always Handoff.** Same 4 phases every project. Never negotiable.
106
+ 4. **Milestones ≥ 2 phases OR are a shipped release gate.** A 1-phase milestone is a phase, not a milestone.
107
+ 5. **Numbering is contiguous.** No skipped milestone numbers.
108
+ 6. **Progressive detail is OK.** M1 is fully detailed (ready for `/qualia-plan`). M2..M{N-1} have phase names + one-line goals. Full phase detail gets written by roadmapper when the milestone opens.
109
+ 7. **Exit criteria are observable.** "User can do X" not "Feature Y works."
110
+
111
+ ---
112
+
113
+ *Last updated: {date}*
package/templates/plan.md CHANGED
@@ -7,36 +7,81 @@ waves: {count}
7
7
 
8
8
  # Phase {N}: {Name}
9
9
 
10
- Goal: {what must be true when done}
10
+ **Goal:** {what must be TRUE when this phase is done}
11
+
12
+ **Why this phase:** {one sentence — what this unlocks for the user or the product}
13
+
14
+ ---
11
15
 
12
16
  ## Task 1 — {title}
17
+
13
18
  **Wave:** 1
14
- **Files:** {files to create or modify}
15
- **Action:** {exactly what to build}
19
+ **Persona:** {optional: security | architect | ux | frontend | backend | performance | none}
20
+ **Files:** {specific absolute paths — e.g. `src/lib/auth.ts`, `src/app/login/page.tsx`}
21
+ **Depends on:** {task numbers (e.g. "Task 0"), or "none"}
22
+
23
+ **Why:**
24
+ {one-sentence rationale — what problem this solves, what would break without it. Not "implement auth" but "Session persistence is the #1 abandonment trigger in onboarding — verification emails are wasted without it."}
25
+
26
+ **Acceptance Criteria:**
27
+ - {observable user-facing behavior 1}
28
+ - {observable user-facing behavior 2}
29
+ - {observable user-facing behavior 3}
30
+
31
+ **Action:**
32
+ {concrete steps the builder follows — specific function names, imports, patterns. Not "add auth" but "Add `signInWithPassword()` call in `handleSubmit`, validate email with Zod schema, redirect to `/dashboard` on success."}
33
+
34
+ **Validation:** (builder self-check before commit)
35
+ - `{exact command 1}` → expected output
36
+ - `{exact command 2}` → expected output
37
+
16
38
  **Context:** Read @{file references}
17
- **Done when:** {observable, testable criterion}
39
+
40
+ ---
18
41
 
19
42
  ## Task 2 — {title}
43
+
20
44
  **Wave:** 1
45
+ **Persona:** {optional}
21
46
  **Files:** {files}
22
- **Action:** {what to build}
23
- **Done when:** {criterion}
47
+ **Depends on:** {none | Task N}
48
+
49
+ **Why:**
50
+ {one-sentence rationale}
51
+
52
+ **Acceptance Criteria:**
53
+ - {user-facing behavior}
54
+
55
+ **Action:**
56
+ {steps}
57
+
58
+ **Validation:**
59
+ - `{command}` → expected
60
+
61
+ **Context:** Read @{files}
62
+
63
+ ---
24
64
 
25
65
  ## Success Criteria
66
+
67
+ Phase-level truths — what must be observable when this phase is done.
68
+
26
69
  - [ ] {truth 1 — what the user can do}
27
70
  - [ ] {truth 2}
28
71
  - [ ] {truth 3}
29
72
 
30
73
  ## Verification Contract
31
74
 
75
+ Machine-executable checks the verifier runs verbatim. One per task minimum.
76
+
32
77
  ### Contract for Task 1 — {title}
33
78
  **Check type:** {file-exists | grep-match | command-exit | behavioral}
34
- **Command:** `{exact command the verifier will run}`
35
- **Expected:** {what the output should be}
36
- **Fail if:** {what constitutes failure}
79
+ **Command:** `{exact command}`
80
+ **Expected:** {output}
81
+ **Fail if:** {failure condition}
37
82
 
38
83
  ### Contract for Task 2 — {title}
39
- **Check type:** {file-exists | grep-match | command-exit | behavioral}
84
+ **Check type:** {type}
40
85
  **Command:** `{exact command}`
41
- **Expected:** {expected output}
86
+ **Expected:** {output}
42
87
  **Fail if:** {failure condition}