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,160 +1,209 @@
1
1
  ---
2
2
  name: qualia-milestone
3
- description: "Close out a completed milestone and prep the next one. Archives the current milestone's artifacts, updates REQUIREMENTS.md to mark v1 requirements Complete, and creates the next milestone roadmap."
3
+ description: "Close the current milestone and open the next one loads the next milestone's scope from JOURNEY.md (no ad-hoc naming). Archives artifacts, marks requirements Complete, regenerates ROADMAP.md for the next milestone."
4
+ allowed-tools:
5
+ - Bash
6
+ - Read
7
+ - Write
8
+ - Edit
9
+ - Agent
4
10
  ---
5
11
 
6
12
  # /qualia-milestone — Milestone Closeout
7
13
 
8
- Use when all feature phases in the current milestone are verified. Archives artifacts, marks requirements Complete, opens a new milestone for the next release.
14
+ Triggered after `/qualia-verify` passes on the LAST phase of the current milestone. Archives the current milestone's artifacts, marks its requirements Complete, and opens the next milestone **scope pulled directly from JOURNEY.md**, not improvised.
9
15
 
10
16
  ## When to Use
11
17
 
12
- - After `/qualia-verify N` passes on the LAST phase of a milestone
13
- - Before starting a v1.5 / v2.0 cycle
18
+ - After `/qualia-verify N` passes on the LAST phase of the current milestone
14
19
  - NOT for individual phase completions — use `/qualia-verify N` for that
20
+ - NOT for starting a brand-new project — use `/qualia-new` for that
15
21
 
16
22
  ## Usage
17
23
 
18
- `/qualia-milestone` — close the current milestone, open the next
24
+ `/qualia-milestone` — close the current milestone, open the next from JOURNEY.md
25
+ `/qualia-milestone --auto` — close + open next, then pause at the milestone boundary to ask "Continue to M{N+1}?" (the one human gate in auto mode beyond initial journey approval)
19
26
 
20
27
  ## Process
21
28
 
22
29
  ### 1. Validate Readiness
23
30
 
24
31
  ```bash
25
- node ~/.claude/bin/state.js check 2>/dev/null
32
+ node ~/.claude/bin/state.js check
26
33
  ```
27
34
 
28
- Check:
29
- - All phases in STATE.md are `status: verified`
30
- - `verification: pass` for every phase
31
- - No open blockers
35
+ `state.js close-milestone` enforces two guards:
36
+ - `MILESTONE_NOT_READY` any phase not verified
37
+ - `MILESTONE_TOO_SMALL` milestone has < 2 phases
38
+
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
+
41
+ ### 2. Banner + Confirm
32
42
 
33
- If not ready:
34
43
  ```bash
35
- node ~/.claude/bin/qualia-ui.js fail "Milestone not ready — {reason}"
44
+ node ~/.claude/bin/qualia-ui.js banner milestone
45
+ node ~/.claude/bin/qualia-ui.js journey-tree .planning/JOURNEY.md
36
46
  ```
37
- Exit.
38
47
 
39
- ### 2. Banner
48
+ The journey-tree shows the user WHERE they are on the ladder before asking the close question. Read `.planning/JOURNEY.md` to find the next milestone's name + scope. Show:
49
+ - Current milestone name + phases completed + requirements delivered
50
+ - Next milestone name + phase sketch + why-now from JOURNEY.md
51
+
52
+ - header: "Close + open next?"
53
+ - question: "Close {current} and open Milestone {N+1}: {next name}?"
54
+ - options:
55
+ - "Close + open next" — archive this one, regenerate ROADMAP.md for {next name}
56
+ - "Pause" — don't close yet
57
+
58
+ ### 3. Archive Current Milestone
40
59
 
41
60
  ```bash
42
- node ~/.claude/bin/qualia-ui.js banner milestone
61
+ milestone_slug="milestone-{N}-$(echo '{current name}' | tr '[:upper:] ' '[:lower:]-')"
62
+ mkdir -p .planning/archive/$milestone_slug
63
+
64
+ cp .planning/ROADMAP.md .planning/archive/$milestone_slug/ROADMAP.md
65
+ cp .planning/STATE.md .planning/archive/$milestone_slug/STATE.md
66
+ cp .planning/tracking.json .planning/archive/$milestone_slug/tracking.json
67
+ # Move per-phase artifacts if present
68
+ for f in .planning/phase-*-plan.md .planning/phase-*-verification.md .planning/phase-*-context.md .planning/phase-*-research.md .planning/phase-*-gaps-plan.md; do
69
+ [ -f "$f" ] && mv "$f" .planning/archive/$milestone_slug/ 2>/dev/null
70
+ done
43
71
  ```
44
72
 
45
- ### 3. Confirm Closeout
73
+ ### 4. Mark Requirements Complete
46
74
 
47
- Show:
48
- - Milestone name (e.g., "v1 Launch")
49
- - Phases completed
50
- - Requirements delivered
75
+ Edit `.planning/REQUIREMENTS.md`:
76
+ - In the Traceability table, flip this milestone's REQ-IDs from Pending/In Progress → **Complete**
77
+ - Leave the per-milestone section structure intact (preserves history)
51
78
 
52
- - header: "Close milestone?"
53
- - question: "Close {milestone name} and move to the next milestone?"
54
- - options:
55
- - "Close it" — Archive and open next
56
- - "Not yet" — I want to add more first
79
+ ### 5. Close Milestone in State Machine
57
80
 
58
- ### 4. Archive Current Milestone
81
+ Closes current milestone's counters, appends a summary to `tracking.json` milestones[]:
59
82
 
60
83
  ```bash
61
- mkdir -p .planning/archive
62
- cp .planning/ROADMAP.md .planning/archive/{milestone_slug}-ROADMAP.md
63
- cp .planning/STATE.md .planning/archive/{milestone_slug}-STATE.md
64
- cp .planning/tracking.json .planning/archive/{milestone_slug}-tracking.json
65
- cp -r .planning/phases .planning/archive/{milestone_slug}-phases
84
+ node ~/.claude/bin/state.js close-milestone
66
85
  ```
67
86
 
68
- ### 5. Update REQUIREMENTS.md
87
+ If all phases are verified and ≥ 2 phases exist, this succeeds without `--force`. Otherwise add `--force` (rare — usually means the user is closing a preview/demo milestone).
88
+
89
+ ### 6. Read Next Milestone From JOURNEY.md
90
+
91
+ Parse `.planning/JOURNEY.md` to extract the next milestone's:
92
+ - name
93
+ - phase list with goals
94
+ - requirements covered (REQ-IDs)
95
+ - exit criteria
69
96
 
70
- Open `.planning/REQUIREMENTS.md` and:
71
- - Mark every v1 requirement as Complete in the traceability table
72
- - Move the `## v1 Requirements` section content to `## Completed (v1)` at the top (for historical reference)
73
- - Elevate `## v2 Requirements` → `## v1 Requirements` (next milestone's scope)
97
+ If the next milestone is **Handoff** (always the last milestone), use the fixed 4-phase Handoff template (Polish, Content + SEO, Final QA, Handoff) from the journey template.
74
98
 
75
- ### 6. Ask About Next Milestone
99
+ If JOURNEY.md doesn't exist (legacy project pre-v4), fall back to asking the user:
76
100
 
77
101
  - header: "Next milestone"
78
102
  - question: "What's the next milestone called?"
79
- - options (dynamic):
80
- - "v1.5 — {suggested name based on v2 requirements}"
81
- - "v2.0 — {bigger rewrite}"
82
- - "Custom name" — let me type it
83
103
 
84
- ### 7. Create New Roadmap
104
+ Then manually sketch its phases. But ideally every v4 project has a JOURNEY.md from the start.
85
105
 
86
- Spawn the roadmapper to create a new ROADMAP.md for the next milestone:
106
+ ### 7. Regenerate ROADMAP.md for the New Milestone
107
+
108
+ Spawn the roadmapper with the next milestone's JOURNEY.md sketch as input:
87
109
 
88
110
  ```
89
111
  Agent(prompt="
90
112
  Read your role: @~/.claude/agents/roadmapper.md
91
113
 
92
- <task>
93
- Create a new ROADMAP.md for the next milestone.
114
+ <mode>next-milestone</mode>
115
+ <journey_file>.planning/JOURNEY.md</journey_file>
116
+ <next_milestone_num>{N+1}</next_milestone_num>
117
+ <next_milestone_name>{next name from JOURNEY.md}</next_milestone_name>
94
118
 
95
- Milestone name: {milestone name}
96
- Milestone number: {M+1}
119
+ <task>
120
+ Regenerate .planning/ROADMAP.md for Milestone {N+1}. The sketch in JOURNEY.md
121
+ gives you phase names + one-line goals — elevate to full phase-level detail:
122
+ - 2-5 success criteria per phase
123
+ - requirements coverage from REQUIREMENTS.md (section for this milestone)
124
+ - dependency ordering
125
+
126
+ Do NOT re-plan completed milestones. Do NOT create a new JOURNEY.md — the
127
+ existing one stays the source of truth.
128
+
129
+ After writing ROADMAP.md, update STATE.md via:
130
+ node ~/.claude/bin/state.js init --force \\
131
+ --project '{project}' --client '{client}' --type '{type}' \\
132
+ --milestone_name '{next name}' \\
133
+ --phases '<JSON: next milestone phases>' \\
134
+ --total_phases <count>
135
+
136
+ --force is needed because a project already exists.
137
+ </task>
138
+ ", subagent_type="qualia-roadmapper", description="Open milestone {N+1}")
139
+ ```
97
140
 
98
- The new v1 requirements (just promoted from old v2) are in .planning/REQUIREMENTS.md.
99
- The previous milestone's archive is at .planning/archive/.
141
+ ### 8. Commit
100
142
 
101
- Build phases for the new milestone scope. Do NOT plan for already-completed requirements.
102
- ", subagent_type="qualia-roadmapper", description="Create next milestone roadmap")
143
+ ```bash
144
+ git add .planning/
145
+ git commit -m "milestone: close M{N} ({current name}) → open M{N+1} ({next name})"
103
146
  ```
104
147
 
105
- ### 8a. Close Milestone in State Machine
148
+ ### 9. Route (auto-chain aware — the milestone boundary is a human gate in auto mode)
106
149
 
107
- Close the current milestone's tracking data before resetting. This preserves lifetime counters (total tasks, phases, milestones completed) across the reset.
150
+ **Case A: this WAS the Handoff milestone closing project is done.**
108
151
 
109
152
  ```bash
110
- node ~/.claude/bin/state.js close-milestone
153
+ node ~/.claude/bin/qualia-ui.js milestone-complete {N} "Handoff" ""
154
+ node ~/.claude/bin/qualia-ui.js end "PROJECT SHIPPED" "/qualia-report"
111
155
  ```
112
156
 
113
- ### 8b. Reset STATE.md via state.js
157
+ In `--auto` mode, inline-invoke `/qualia-report` and stop. No further chaining — the project is done.
114
158
 
115
- The `init` command resets current-phase fields but preserves `milestone` and `lifetime` data from the close-milestone step above.
159
+ **Case B: a non-final milestone just closed next milestone is open.**
116
160
 
117
161
  ```bash
118
- node ~/.claude/bin/state.js init \
119
- --project "{project name}" \
120
- --client "{client}" \
121
- --type "{type}" \
122
- --phases '{JSON from new roadmap}' \
123
- --total_phases {new N}
162
+ node ~/.claude/bin/qualia-ui.js milestone-complete {N} "{current name}" "{next name}"
124
163
  ```
125
164
 
126
- ### 9. Commit
165
+ **In `--auto` mode**, pause here and ask (this is ONE of the two human gates in auto mode, the other being journey approval at `/qualia-new` time):
166
+
167
+ - header: "Milestone {N} shipped"
168
+ - question: "Continue to Milestone {N+1}: {next name} now?"
169
+ - options:
170
+ - "Continue" — inline-invoke `/qualia-plan 1 --auto` for the new milestone
171
+ - "Pause here" — stop and let the user resume later with `/qualia-plan 1 --auto`
172
+
173
+ If "Continue": the auto-chain resumes. If "Pause": stop, show:
127
174
 
128
175
  ```bash
129
- git add .planning/
130
- git commit -m "feat({milestone_slug}): close milestone, open {next milestone}"
176
+ node ~/.claude/bin/qualia-ui.js end "M{N} CLOSED · M{N+1} READY" "/qualia-plan 1 --auto"
131
177
  ```
132
178
 
133
- ### 10. Route
179
+ **In guided mode**, always stop and show the next step regardless of position:
134
180
 
135
181
  ```bash
136
- node ~/.claude/bin/qualia-ui.js end "MILESTONE {closed} CLOSED" "/qualia-plan 1"
182
+ node ~/.claude/bin/qualia-ui.js end "M{N} CLOSED · M{N+1} OPEN" "/qualia-plan 1"
137
183
  ```
138
184
 
139
185
  ## What Stays, What Changes
140
186
 
141
187
  **Stays:**
142
- - `.planning/PROJECT.md` — the project doesn't change
143
- - `.planning/archive/`historical milestones preserved (incl. tracking.json)
144
- - `tracking.json` lifetime fields cumulative counters survive across milestones
145
- - Git history every commit preserved
188
+ - `.planning/PROJECT.md` — the project identity doesn't change
189
+ - `.planning/JOURNEY.md`the North Star is the SAME file across all milestones; don't regenerate it
190
+ - `.planning/DESIGN.md` — design system persists
191
+ - `.planning/archive/`historical milestones preserved
192
+ - `tracking.json` lifetime fields + milestones[] array — cumulative history
146
193
 
147
194
  **Changes:**
148
- - `.planning/REQUIREMENTS.md` — Completed section grows, v1 scope shifts
149
- - `.planning/ROADMAP.md` — new phases for the new milestone
150
- - `.planning/STATE.md` — reset to Phase 1 of new milestone
195
+ - `.planning/REQUIREMENTS.md` — this milestone's REQ-IDs marked Complete
196
+ - `.planning/ROADMAP.md` — regenerated for the new milestone's phases
197
+ - `.planning/STATE.md` — reset to Phase 1 of the new milestone
151
198
 
152
199
  **Discarded (but archived):**
153
- - `.planning/phases/` the old phase folders move to archive
200
+ - `.planning/phase-*-*.md` files from the closed milestone moved to archive
154
201
 
155
202
  ## Rules
156
203
 
157
- 1. **Don't close early.** All phases must be `verified` with `pass`. No partial milestones.
158
- 2. **Archive, don't delete.** Old phase work stays accessible via `.planning/archive/`.
159
- 3. **New milestone = new phase numbering.** The next phase is Phase 1 of the new milestone, not Phase {N+1} of the old.
160
- 4. **ERP sync aware.** The ERP reads ROADMAP.md after milestone close, push to GitHub so the ERP picks up the new phase structure.
204
+ 1. **Don't close early.** state.js enforces: all phases verified + 2 phases, unless `--force`.
205
+ 2. **JOURNEY.md is the source of truth for next milestone.** Don't ask the user to name it unless JOURNEY.md is missing (legacy project).
206
+ 3. **Archive, don't delete.** Old phase work stays accessible via `.planning/archive/`.
207
+ 4. **New milestone = fresh phase numbering.** First phase of the new milestone is Phase 1, not Phase {N+1}.
208
+ 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.