qualia-framework 3.4.0 → 4.0.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 (42) hide show
  1. package/README.md +96 -51
  2. package/agents/builder.md +25 -14
  3. package/agents/plan-checker.md +29 -16
  4. package/agents/planner.md +33 -24
  5. package/agents/research-synthesizer.md +25 -12
  6. package/agents/roadmapper.md +89 -84
  7. package/agents/verifier.md +11 -2
  8. package/bin/cli.js +13 -2
  9. package/bin/install.js +28 -5
  10. package/bin/qualia-ui.js +267 -1
  11. package/bin/state.js +377 -52
  12. package/bin/statusline.js +40 -20
  13. package/docs/erp-contract.md +23 -2
  14. package/guide.md +84 -21
  15. package/hooks/auto-update.js +54 -70
  16. package/hooks/branch-guard.js +64 -6
  17. package/hooks/migration-guard.js +85 -10
  18. package/hooks/pre-compact.js +28 -4
  19. package/hooks/pre-deploy-gate.js +46 -6
  20. package/hooks/pre-push.js +94 -27
  21. package/hooks/session-start.js +6 -0
  22. package/package.json +1 -1
  23. package/skills/qualia/SKILL.md +3 -1
  24. package/skills/qualia-build/SKILL.md +40 -5
  25. package/skills/qualia-handoff/SKILL.md +87 -12
  26. package/skills/qualia-idk/SKILL.md +155 -3
  27. package/skills/qualia-map/SKILL.md +4 -4
  28. package/skills/qualia-milestone/SKILL.md +122 -79
  29. package/skills/qualia-new/SKILL.md +151 -230
  30. package/skills/qualia-optimize/SKILL.md +4 -4
  31. package/skills/qualia-plan/SKILL.md +14 -9
  32. package/skills/qualia-quick/SKILL.md +1 -1
  33. package/skills/qualia-report/SKILL.md +12 -0
  34. package/skills/qualia-verify/SKILL.md +59 -5
  35. package/templates/help.html +98 -31
  36. package/templates/journey.md +113 -0
  37. package/templates/plan.md +56 -11
  38. package/templates/requirements.md +82 -22
  39. package/templates/roadmap.md +41 -14
  40. package/templates/tracking.json +12 -1
  41. package/tests/runner.js +560 -0
  42. package/tests/state.test.sh +40 -0
@@ -1,8 +1,160 @@
1
1
  ---
2
2
  name: qualia-idk
3
- description: "Alias for /qualia. The smart router handles all 'idk', 'what now', 'I'm stuck' situations."
3
+ description: "Diagnostic intelligence for 'I don't know what's going on.' Runs two isolated scans (.planning/ vs codebase), cross-references against the user's confusion, then explains the situation in plain language with a concrete recommended next step. Use whenever the user says 'I don't know', 'something feels off', 'not sure what to do', 'am I doing this right', 'what's happening', 'help me understand'."
4
4
  ---
5
5
 
6
- # /qualia-idk
6
+ # /qualia-idk — "I Don't Know What's Going On"
7
7
 
8
- This is an alias for `/qualia`. Run `/qualia` it now handles all situation classification and routing.
8
+ Not a router. A **diagnostician**. Use when the user isn't stuck on a command they're stuck on *understanding*.
9
+
10
+ ## How This Differs from `/qualia`
11
+
12
+ | `/qualia` | `/qualia-idk` |
13
+ |---|---|
14
+ | Mechanical: reads state.js, returns `/qualia-X` | Interpretive: reads the project + the code + the confusion |
15
+ | "What command do I run next?" | "What is actually going on here?" |
16
+ | Always returns a skill name | Returns an explanation + a recommendation |
17
+ | Cheap, instant | Spawns 2 isolated agents, ~30s |
18
+
19
+ Run `/qualia` first when the user knows what they're trying to do. Run `/qualia-idk` when the user's confusion is about the *situation itself*.
20
+
21
+ ## Process
22
+
23
+ ### Step 0. Banner
24
+
25
+ ```bash
26
+ node ~/.claude/bin/qualia-ui.js banner router
27
+ node ~/.claude/bin/qualia-ui.js spawn "diagnostic" "Reading planning and codebase in isolation..."
28
+ ```
29
+
30
+ Say: **"Let me take a proper look."**
31
+
32
+ ### Step 1. Gather the User's Confusion
33
+
34
+ Look at the conversation context (if any). Note:
35
+ - What did the user just say or ask?
36
+ - Any recent errors, failed commands, surprising output?
37
+ - Any mismatch between what they expected and what happened?
38
+
39
+ If there's nothing in conversation context yet, ask:
40
+ - header: "What's unclear?"
41
+ - question: "Where are you stuck? (one sentence is fine)"
42
+ - Free text.
43
+
44
+ Store this as `<user_confusion>`.
45
+
46
+ ### Step 2. Spawn Two Isolated Scans (Parallel)
47
+
48
+ Two fresh subagents. Each sees ONLY its respective scope — no cross-contamination.
49
+
50
+ ```
51
+ Agent(prompt="
52
+ You are a read-only diagnostic scanner for the .planning/ folder only.
53
+
54
+ Read ALL of the following if present:
55
+ - .planning/PROJECT.md
56
+ - .planning/JOURNEY.md
57
+ - .planning/REQUIREMENTS.md
58
+ - .planning/ROADMAP.md
59
+ - .planning/STATE.md
60
+ - .planning/tracking.json
61
+ - .planning/phase-*-plan.md (latest 1-2)
62
+ - .planning/phase-*-verification.md (latest 1-2)
63
+ - .planning/DESIGN.md (skim)
64
+ - .continue-here.md (if present)
65
+
66
+ DO NOT read any source code — no src/, app/, components/, lib/, etc.
67
+ DO NOT run any build tools.
68
+
69
+ Produce a 'Plan View' report answering:
70
+ 1. What is this project? (one sentence from PROJECT.md)
71
+ 2. Where does the plan say we ARE? (current milestone + phase + status)
72
+ 3. What does the plan say should be TRUE right now? (current phase's acceptance criteria / success criteria)
73
+ 4. What does the plan say is UNFINISHED? (upcoming phases or unresolved gaps from latest verification)
74
+ 5. Any plan-level inconsistencies? (e.g. tracking.json says phase 3 but STATE.md says phase 2, JOURNEY.md missing, roadmap out of sync)
75
+
76
+ Keep it under 250 words. Be specific. No filler.
77
+ ", subagent_type="Explore", description="Plan-view scan")
78
+
79
+ Agent(prompt="
80
+ You are a read-only diagnostic scanner for the source code only.
81
+
82
+ DO NOT read anything in .planning/ — skip it entirely.
83
+
84
+ Scan the repo:
85
+ - Package/framework detection (package.json, requirements.txt, etc.)
86
+ - Entry points (app/, src/, pages/, index.*)
87
+ - Key files referenced in recent commits (git log --oneline -5, then inspect)
88
+ - Run quick static checks if applicable: 'npx tsc --noEmit' output, lint errors, test status
89
+ - Look for stubs: grep for TODO, FIXME, 'not implemented', empty catch blocks, unused exports
90
+
91
+ Produce a 'Code View' report answering:
92
+ 1. What does the code look like it's BUILDING? (inferred from structure + imports, not from docs)
93
+ 2. What ACTUALLY WORKS right now? (compile status, recent commit messages, any obvious smoke signals)
94
+ 3. What's STUBBED or INCOMPLETE? (concrete file:line citations)
95
+ 4. What's RUNNING locally or deployed? (if there's a dev server log, vercel link, supabase project — flag it)
96
+ 5. Any code-level inconsistencies? (imports that don't resolve, routes referenced but not defined, schema mismatches)
97
+
98
+ Keep it under 250 words. Cite specific files/lines. No filler.
99
+ ", subagent_type="Explore", description="Code-view scan")
100
+ ```
101
+
102
+ Wait for both. Don't proceed to synthesis until you have both reports.
103
+
104
+ ### Step 3. Synthesize
105
+
106
+ With both reports + the user's confusion in hand, cross-reference:
107
+
108
+ **Produce a structured diagnosis** (use this exact shape):
109
+
110
+ ```
111
+ ## What I see
112
+
113
+ **The plan says:** {1-2 sentences — current milestone/phase/status, what should be true}
114
+
115
+ **The code says:** {1-2 sentences — what actually exists, what works, what's stubbed}
116
+
117
+ **The mismatch (if any):** {1-2 sentences — where plan and code disagree. If no mismatch, say "plan and code are consistent".}
118
+
119
+ ## What I think is happening
120
+
121
+ {3-5 sentences, plain language. Tie the user's confusion to what you found. Avoid jargon. If the user said "the login is broken", don't say "the auth middleware has a type inference issue" — say "you're seeing the login fail because the signin function isn't actually imported into the login page, even though the plan says it should be. Someone wrote the helper but forgot to wire it up."}
122
+
123
+ ## What to do next
124
+
125
+ 1. **{concrete action}** — {one sentence why}
126
+ 2. **{concrete action}** — {one sentence why}
127
+ 3. **{optional third}** — {one sentence why}
128
+
129
+ If one of these maps to an existing Qualia command, use it:
130
+ - `/qualia-plan {N} --gaps` if the mismatch is "plan says X but code has stubs"
131
+ - `/qualia-verify {N}` if the mismatch is "code says built but no verification exists"
132
+ - `/qualia-debug` if a specific error is the block
133
+ - `/qualia-map` if the plan and code have drifted far apart
134
+ - `/qualia-pause` if the user is overwhelmed and should step away
135
+ ```
136
+
137
+ ### Step 4. Close
138
+
139
+ ```bash
140
+ node ~/.claude/bin/qualia-ui.js divider
141
+ node ~/.claude/bin/qualia-ui.js end "DIAGNOSED" "{top-recommended action if it's a command, else leave blank}"
142
+ ```
143
+
144
+ ## Rules
145
+
146
+ 1. **Two isolated scans, always.** Plan view never peeks at code, code view never peeks at planning. This is what keeps the diagnosis honest — each agent sees one side of the story, and the synthesis catches the delta.
147
+ 2. **Plain language over jargon.** If you can't explain it to a non-dev, rewrite it.
148
+ 3. **No fake certainty.** If the scans come back thin (e.g., brand new repo), say "I don't have enough signal yet — here's what I'd do to gather more."
149
+ 4. **Never invent facts.** If the code-view scan didn't find something, don't say it exists. Cite files.
150
+ 5. **One recommendation primary, two backups.** Decision fatigue is the problem — give the user a lead option.
151
+ 6. **Don't re-run if state.js already knows.** If the user's confusion is purely "what's my next command", `/qualia` already handles that — gently suggest it instead of spawning agents.
152
+
153
+ ## When NOT to Use
154
+
155
+ - User knows what they're doing and just wants the next command → `/qualia`
156
+ - User has a specific error message → `/qualia-debug`
157
+ - User wants to review code quality → `/qualia-review`
158
+ - User wants to pause and come back → `/qualia-pause`
159
+
160
+ `/qualia-idk` is specifically for **"I'm not sure what I'm even looking at"** situations. Route to sharper tools when the question is sharper.
@@ -47,28 +47,28 @@ Map 4 dimensions in parallel for speed. Each writes one file in `.planning/codeb
47
47
 
48
48
  ```
49
49
  Agent 1: Architecture scanner
50
- Task(prompt="
50
+ Agent(prompt="
51
51
  Scan the current codebase and produce .planning/codebase/architecture.md.
52
52
  Identify: entry points, folder structure, module boundaries, data flow.
53
53
  Focus on WHAT the codebase does, not HOW to fix it.
54
54
  ", subagent_type="general-purpose", description="Architecture scan")
55
55
 
56
56
  Agent 2: Stack detector
57
- Task(prompt="
57
+ Agent(prompt="
58
58
  Detect the tech stack. Read package.json, requirements.txt, Gemfile, etc.
59
59
  Produce .planning/codebase/stack.md listing: runtime, framework, key libraries,
60
60
  database, hosting, CI. Include version numbers.
61
61
  ", subagent_type="general-purpose", description="Stack detection")
62
62
 
63
63
  Agent 3: Conventions analyzer
64
- Task(prompt="
64
+ Agent(prompt="
65
65
  Analyze code style and conventions. Sample 10-15 files across the codebase.
66
66
  Produce .planning/codebase/conventions.md listing: naming, component patterns,
67
67
  file organization, import style, test style, commit message format.
68
68
  ", subagent_type="general-purpose", description="Conventions analysis")
69
69
 
70
70
  Agent 4: Concerns scanner
71
- Task(prompt="
71
+ Agent(prompt="
72
72
  Scan for code quality concerns — NOT to fix, just to document.
73
73
  Look for: TODO/FIXME, deprecated APIs, outdated dependencies, missing tests,
74
74
  security smells (hardcoded secrets, no input validation).
@@ -1,160 +1,203 @@
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
4
  ---
5
5
 
6
6
  # /qualia-milestone — Milestone Closeout
7
7
 
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.
8
+ 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
9
 
10
10
  ## When to Use
11
11
 
12
- - After `/qualia-verify N` passes on the LAST phase of a milestone
13
- - Before starting a v1.5 / v2.0 cycle
12
+ - After `/qualia-verify N` passes on the LAST phase of the current milestone
14
13
  - NOT for individual phase completions — use `/qualia-verify N` for that
14
+ - NOT for starting a brand-new project — use `/qualia-new` for that
15
15
 
16
16
  ## Usage
17
17
 
18
- `/qualia-milestone` — close the current milestone, open the next
18
+ `/qualia-milestone` — close the current milestone, open the next from JOURNEY.md
19
+ `/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
20
 
20
21
  ## Process
21
22
 
22
23
  ### 1. Validate Readiness
23
24
 
24
25
  ```bash
25
- node ~/.claude/bin/state.js check 2>/dev/null
26
+ node ~/.claude/bin/state.js check
26
27
  ```
27
28
 
28
- Check:
29
- - All phases in STATE.md are `status: verified`
30
- - `verification: pass` for every phase
31
- - No open blockers
29
+ `state.js close-milestone` enforces two guards:
30
+ - `MILESTONE_NOT_READY` any phase not verified
31
+ - `MILESTONE_TOO_SMALL` milestone has < 2 phases
32
+
33
+ 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).
34
+
35
+ ### 2. Banner + Confirm
32
36
 
33
- If not ready:
34
37
  ```bash
35
- node ~/.claude/bin/qualia-ui.js fail "Milestone not ready — {reason}"
38
+ node ~/.claude/bin/qualia-ui.js banner milestone
39
+ node ~/.claude/bin/qualia-ui.js journey-tree .planning/JOURNEY.md
36
40
  ```
37
- Exit.
38
41
 
39
- ### 2. Banner
42
+ 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:
43
+ - Current milestone name + phases completed + requirements delivered
44
+ - Next milestone name + phase sketch + why-now from JOURNEY.md
45
+
46
+ - header: "Close + open next?"
47
+ - question: "Close {current} and open Milestone {N+1}: {next name}?"
48
+ - options:
49
+ - "Close + open next" — archive this one, regenerate ROADMAP.md for {next name}
50
+ - "Pause" — don't close yet
51
+
52
+ ### 3. Archive Current Milestone
40
53
 
41
54
  ```bash
42
- node ~/.claude/bin/qualia-ui.js banner milestone
55
+ milestone_slug="milestone-{N}-$(echo '{current name}' | tr '[:upper:] ' '[:lower:]-')"
56
+ mkdir -p .planning/archive/$milestone_slug
57
+
58
+ cp .planning/ROADMAP.md .planning/archive/$milestone_slug/ROADMAP.md
59
+ cp .planning/STATE.md .planning/archive/$milestone_slug/STATE.md
60
+ cp .planning/tracking.json .planning/archive/$milestone_slug/tracking.json
61
+ # Move per-phase artifacts if present
62
+ 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
63
+ [ -f "$f" ] && mv "$f" .planning/archive/$milestone_slug/ 2>/dev/null
64
+ done
43
65
  ```
44
66
 
45
- ### 3. Confirm Closeout
67
+ ### 4. Mark Requirements Complete
46
68
 
47
- Show:
48
- - Milestone name (e.g., "v1 Launch")
49
- - Phases completed
50
- - Requirements delivered
69
+ Edit `.planning/REQUIREMENTS.md`:
70
+ - In the Traceability table, flip this milestone's REQ-IDs from Pending/In Progress → **Complete**
71
+ - Leave the per-milestone section structure intact (preserves history)
51
72
 
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
73
+ ### 5. Close Milestone in State Machine
57
74
 
58
- ### 4. Archive Current Milestone
75
+ Closes current milestone's counters, appends a summary to `tracking.json` milestones[]:
59
76
 
60
77
  ```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
78
+ node ~/.claude/bin/state.js close-milestone
66
79
  ```
67
80
 
68
- ### 5. Update REQUIREMENTS.md
81
+ 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).
82
+
83
+ ### 6. Read Next Milestone From JOURNEY.md
84
+
85
+ Parse `.planning/JOURNEY.md` to extract the next milestone's:
86
+ - name
87
+ - phase list with goals
88
+ - requirements covered (REQ-IDs)
89
+ - exit criteria
69
90
 
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)
91
+ 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
92
 
75
- ### 6. Ask About Next Milestone
93
+ If JOURNEY.md doesn't exist (legacy project pre-v4), fall back to asking the user:
76
94
 
77
95
  - header: "Next milestone"
78
96
  - 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
97
 
84
- ### 7. Create New Roadmap
98
+ Then manually sketch its phases. But ideally every v4 project has a JOURNEY.md from the start.
85
99
 
86
- Spawn the roadmapper to create a new ROADMAP.md for the next milestone:
100
+ ### 7. Regenerate ROADMAP.md for the New Milestone
101
+
102
+ Spawn the roadmapper with the next milestone's JOURNEY.md sketch as input:
87
103
 
88
104
  ```
89
105
  Agent(prompt="
90
106
  Read your role: @~/.claude/agents/roadmapper.md
91
107
 
92
- <task>
93
- Create a new ROADMAP.md for the next milestone.
108
+ <mode>next-milestone</mode>
109
+ <journey_file>.planning/JOURNEY.md</journey_file>
110
+ <next_milestone_num>{N+1}</next_milestone_num>
111
+ <next_milestone_name>{next name from JOURNEY.md}</next_milestone_name>
94
112
 
95
- Milestone name: {milestone name}
96
- Milestone number: {M+1}
113
+ <task>
114
+ Regenerate .planning/ROADMAP.md for Milestone {N+1}. The sketch in JOURNEY.md
115
+ gives you phase names + one-line goals — elevate to full phase-level detail:
116
+ - 2-5 success criteria per phase
117
+ - requirements coverage from REQUIREMENTS.md (section for this milestone)
118
+ - dependency ordering
119
+
120
+ Do NOT re-plan completed milestones. Do NOT create a new JOURNEY.md — the
121
+ existing one stays the source of truth.
122
+
123
+ After writing ROADMAP.md, update STATE.md via:
124
+ node ~/.claude/bin/state.js init --force \\
125
+ --project '{project}' --client '{client}' --type '{type}' \\
126
+ --milestone_name '{next name}' \\
127
+ --phases '<JSON: next milestone phases>' \\
128
+ --total_phases <count>
129
+
130
+ --force is needed because a project already exists.
131
+ </task>
132
+ ", subagent_type="qualia-roadmapper", description="Open milestone {N+1}")
133
+ ```
97
134
 
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/.
135
+ ### 8. Commit
100
136
 
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")
137
+ ```bash
138
+ git add .planning/
139
+ git commit -m "milestone: close M{N} ({current name}) → open M{N+1} ({next name})"
103
140
  ```
104
141
 
105
- ### 8a. Close Milestone in State Machine
142
+ ### 9. Route (auto-chain aware — the milestone boundary is a human gate in auto mode)
106
143
 
107
- Close the current milestone's tracking data before resetting. This preserves lifetime counters (total tasks, phases, milestones completed) across the reset.
144
+ **Case A: this WAS the Handoff milestone closing project is done.**
108
145
 
109
146
  ```bash
110
- node ~/.claude/bin/state.js close-milestone
147
+ node ~/.claude/bin/qualia-ui.js milestone-complete {N} "Handoff" ""
148
+ node ~/.claude/bin/qualia-ui.js end "PROJECT SHIPPED" "/qualia-report"
111
149
  ```
112
150
 
113
- ### 8b. Reset STATE.md via state.js
151
+ In `--auto` mode, inline-invoke `/qualia-report` and stop. No further chaining — the project is done.
114
152
 
115
- The `init` command resets current-phase fields but preserves `milestone` and `lifetime` data from the close-milestone step above.
153
+ **Case B: a non-final milestone just closed next milestone is open.**
116
154
 
117
155
  ```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}
156
+ node ~/.claude/bin/qualia-ui.js milestone-complete {N} "{current name}" "{next name}"
124
157
  ```
125
158
 
126
- ### 9. Commit
159
+ **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):
160
+
161
+ - header: "Milestone {N} shipped"
162
+ - question: "Continue to Milestone {N+1}: {next name} now?"
163
+ - options:
164
+ - "Continue" — inline-invoke `/qualia-plan 1 --auto` for the new milestone
165
+ - "Pause here" — stop and let the user resume later with `/qualia-plan 1 --auto`
166
+
167
+ If "Continue": the auto-chain resumes. If "Pause": stop, show:
127
168
 
128
169
  ```bash
129
- git add .planning/
130
- git commit -m "feat({milestone_slug}): close milestone, open {next milestone}"
170
+ node ~/.claude/bin/qualia-ui.js end "M{N} CLOSED · M{N+1} READY" "/qualia-plan 1 --auto"
131
171
  ```
132
172
 
133
- ### 10. Route
173
+ **In guided mode**, always stop and show the next step regardless of position:
134
174
 
135
175
  ```bash
136
- node ~/.claude/bin/qualia-ui.js end "MILESTONE {closed} CLOSED" "/qualia-plan 1"
176
+ node ~/.claude/bin/qualia-ui.js end "M{N} CLOSED · M{N+1} OPEN" "/qualia-plan 1"
137
177
  ```
138
178
 
139
179
  ## What Stays, What Changes
140
180
 
141
181
  **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
182
+ - `.planning/PROJECT.md` — the project identity doesn't change
183
+ - `.planning/JOURNEY.md`the North Star is the SAME file across all milestones; don't regenerate it
184
+ - `.planning/DESIGN.md` — design system persists
185
+ - `.planning/archive/`historical milestones preserved
186
+ - `tracking.json` lifetime fields + milestones[] array — cumulative history
146
187
 
147
188
  **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
189
+ - `.planning/REQUIREMENTS.md` — this milestone's REQ-IDs marked Complete
190
+ - `.planning/ROADMAP.md` — regenerated for the new milestone's phases
191
+ - `.planning/STATE.md` — reset to Phase 1 of the new milestone
151
192
 
152
193
  **Discarded (but archived):**
153
- - `.planning/phases/` the old phase folders move to archive
194
+ - `.planning/phase-*-*.md` files from the closed milestone moved to archive
154
195
 
155
196
  ## Rules
156
197
 
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.
198
+ 1. **Don't close early.** state.js enforces: all phases verified + 2 phases, unless `--force`.
199
+ 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).
200
+ 3. **Archive, don't delete.** Old phase work stays accessible via `.planning/archive/`.
201
+ 4. **New milestone = fresh phase numbering.** First phase of the new milestone is Phase 1, not Phase {N+1}.
202
+ 5. **ERP sync aware.** tracking.json milestones[] gets a summary entry on close — the ERP reads this to render the tree.
203
+ 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.