mindsystem-cc 3.19.0 → 3.21.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 (83) hide show
  1. package/README.md +5 -6
  2. package/agents/ms-designer.md +5 -2
  3. package/agents/ms-mockup-designer.md +1 -1
  4. package/agents/ms-plan-writer.md +8 -1
  5. package/agents/ms-product-researcher.md +69 -0
  6. package/agents/ms-research-synthesizer.md +1 -1
  7. package/agents/ms-researcher.md +8 -8
  8. package/agents/ms-roadmapper.md +9 -13
  9. package/bin/install.js +68 -5
  10. package/commands/ms/add-phase.md +30 -18
  11. package/commands/ms/adhoc.md +1 -1
  12. package/commands/ms/audit-milestone.md +12 -12
  13. package/commands/ms/complete-milestone.md +25 -22
  14. package/commands/ms/config.md +202 -0
  15. package/commands/ms/design-phase.md +34 -29
  16. package/commands/ms/discuss-phase.md +26 -22
  17. package/commands/ms/doctor.md +22 -202
  18. package/commands/ms/execute-phase.md +18 -7
  19. package/commands/ms/help.md +46 -39
  20. package/commands/ms/insert-phase.md +29 -17
  21. package/commands/ms/new-milestone.md +42 -19
  22. package/commands/ms/new-project.md +88 -103
  23. package/commands/ms/plan-milestone-gaps.md +4 -5
  24. package/commands/ms/plan-phase.md +5 -3
  25. package/commands/ms/progress.md +2 -4
  26. package/commands/ms/research-phase.md +7 -12
  27. package/commands/ms/research-project.md +12 -12
  28. package/mindsystem/references/continuation-format.md +3 -3
  29. package/mindsystem/references/plan-format.md +11 -1
  30. package/mindsystem/references/principles.md +1 -1
  31. package/mindsystem/references/questioning.md +50 -8
  32. package/mindsystem/references/routing/audit-result-routing.md +12 -11
  33. package/mindsystem/references/routing/between-milestones-routing.md +2 -2
  34. package/mindsystem/references/routing/milestone-complete-routing.md +1 -1
  35. package/mindsystem/references/routing/next-phase-routing.md +4 -2
  36. package/mindsystem/templates/context.md +7 -6
  37. package/mindsystem/templates/milestone-archive.md +5 -5
  38. package/mindsystem/templates/milestone-context.md +1 -1
  39. package/mindsystem/templates/milestone.md +9 -9
  40. package/mindsystem/templates/project.md +70 -64
  41. package/mindsystem/templates/research-subagent-prompt.md +3 -3
  42. package/mindsystem/templates/roadmap-milestone.md +14 -14
  43. package/mindsystem/templates/roadmap.md +9 -7
  44. package/mindsystem/workflows/adhoc.md +1 -1
  45. package/mindsystem/workflows/complete-milestone.md +66 -107
  46. package/mindsystem/workflows/discuss-phase.md +137 -65
  47. package/mindsystem/workflows/doctor-fixes.md +273 -0
  48. package/mindsystem/workflows/execute-phase.md +7 -3
  49. package/mindsystem/workflows/execute-plan.md +6 -5
  50. package/mindsystem/workflows/map-codebase.md +2 -2
  51. package/mindsystem/workflows/mockup-generation.md +1 -1
  52. package/mindsystem/workflows/plan-phase.md +28 -3
  53. package/mindsystem/workflows/transition.md +20 -25
  54. package/mindsystem/workflows/verify-work.md +1 -1
  55. package/package.json +1 -1
  56. package/scripts/__pycache__/ms-tools.cpython-314.pyc +0 -0
  57. package/scripts/__pycache__/test_ms_tools.cpython-314-pytest-9.0.2.pyc +0 -0
  58. package/scripts/fixtures/scan-context/.planning/ROADMAP.md +16 -0
  59. package/scripts/fixtures/scan-context/.planning/adhoc/20260220-fix-token-SUMMARY.md +12 -0
  60. package/scripts/fixtures/scan-context/.planning/config.json +3 -0
  61. package/scripts/fixtures/scan-context/.planning/debug/resolved/token-bug.md +11 -0
  62. package/scripts/fixtures/scan-context/.planning/knowledge/auth.md +11 -0
  63. package/scripts/fixtures/scan-context/.planning/phases/02-infra/02-1-SUMMARY.md +20 -0
  64. package/scripts/fixtures/scan-context/.planning/phases/04-setup/04-1-SUMMARY.md +21 -0
  65. package/scripts/fixtures/scan-context/.planning/phases/05-auth/05-1-SUMMARY.md +28 -0
  66. package/scripts/fixtures/scan-context/.planning/todos/done/setup-db.md +10 -0
  67. package/scripts/fixtures/scan-context/.planning/todos/pending/add-logout.md +10 -0
  68. package/scripts/fixtures/scan-context/expected-output.json +257 -0
  69. package/scripts/ms-tools.py +2139 -0
  70. package/scripts/test_ms_tools.py +836 -0
  71. package/commands/ms/list-phase-assumptions.md +0 -56
  72. package/mindsystem/workflows/list-phase-assumptions.md +0 -178
  73. package/scripts/__pycache__/compare_mockups.cpython-314.pyc +0 -0
  74. package/scripts/archive-milestone-files.sh +0 -68
  75. package/scripts/archive-milestone-phases.sh +0 -138
  76. package/scripts/doctor-scan.sh +0 -379
  77. package/scripts/gather-milestone-stats.sh +0 -179
  78. package/scripts/generate-adhoc-patch.sh +0 -79
  79. package/scripts/generate-phase-patch.sh +0 -169
  80. package/scripts/scan-artifact-subsystems.sh +0 -55
  81. package/scripts/scan-planning-context.py +0 -839
  82. package/scripts/update-state.sh +0 -59
  83. package/scripts/validate-execution-order.sh +0 -104
@@ -1,29 +1,25 @@
1
1
  <purpose>
2
- Gather phase context through collaborative thinking before planning. Help the user articulate their vision for how this phase should work, look, and feel.
2
+ Gather phase context through product-informed collaborative thinking before planning. Act as a collaborative product owner loading milestone-level artifacts, surfacing assumptions, optionally researching competitors, and grounding every question in product analysis.
3
3
 
4
- You are a thinking partner, not an interviewer. The user is the visionary — you are the builder. Your job is to understand their vision, not interrogate them about technical details you can figure out yourself.
4
+ You are a thinking partner, not an interviewer. The user is the visionary — you are the builder with product sense. Your job is to understand their vision, ground it in industry context, and help them make informed decisions.
5
5
  </purpose>
6
6
 
7
7
  <philosophy>
8
- **User = founder/visionary. Claude = builder.**
8
+ The user knows vision, priorities, and preferences. They don't know codebase patterns, technical risks, or implementation constraints — you figure those out.
9
9
 
10
- The user doesn't know (and shouldn't need to know):
11
- - Codebase patterns (you read the code)
12
- - Technical risks (you identify during research)
13
- - Implementation constraints (you figure those out)
14
- - Success metrics (you infer from the work)
15
-
16
- The user DOES know:
17
- - How they imagine it working
18
- - What it should look/feel like
19
- - What's essential vs nice-to-have
20
- - Any specific things they have in mind
10
+ **Product-thinking lens (analytical tool, not checklist):**
11
+ - Ground analysis in target audience (Who It's For from PROJECT.md)
12
+ - Focus on what moves the needle (Core Value)
13
+ - Think in systems, not features — how does this phase connect to the whole?
14
+ - Validate against industry patterns, don't blindly follow them
21
15
 
22
- Ask about vision. Figure out implementation yourself.
16
+ Ask about vision. Apply product thinking. Figure out implementation yourself.
23
17
  </philosophy>
24
18
 
25
19
  <process>
26
20
 
21
+ <!-- STAGE 1: LOAD + ASSESS -->
22
+
27
23
  <step name="validate_phase" priority="first">
28
24
  Phase number: $ARGUMENTS (required)
29
25
 
@@ -51,30 +47,33 @@ Parse phase details from roadmap:
51
47
  - Phase description
52
48
  - Status (should be "Not started" or "In progress")
53
49
 
54
- Continue to load_prior_knowledge.
50
+ Continue to load_context.
55
51
  </step>
56
52
 
57
- <step name="load_prior_knowledge">
58
- Determine which subsystem(s) this phase touches from ROADMAP.md phase description + config.json:
53
+ <step name="load_context">
54
+ Load milestone artifacts and prior knowledge. Handle gracefully when any file is missing.
59
55
 
60
56
  ```bash
57
+ cat .planning/PROJECT.md 2>/dev/null
58
+ cat .planning/MILESTONE-CONTEXT.md 2>/dev/null
59
+ cat .planning/REQUIREMENTS.md 2>/dev/null
61
60
  jq -r '.subsystems[]' .planning/config.json 2>/dev/null
62
61
  grep -A20 "Phase ${PHASE}:" .planning/ROADMAP.md
63
62
  ```
64
63
 
65
- Load matching `knowledge/{subsystem}.md` files:
64
+ Extract from PROJECT.md: **Who It's For**, **Core Value**, **How It's Different**
65
+
66
+ Extract from REQUIREMENTS.md: Requirements mapped to this phase (match phase number/name against requirement tags)
67
+
68
+ Load matching `knowledge/{subsystem}.md` files for subsystems this phase touches:
66
69
 
67
70
  ```bash
68
71
  cat .planning/knowledge/{subsystem}.md 2>/dev/null
69
72
  ```
70
73
 
71
- Handle gracefully when `.planning/knowledge/` doesn't exist (first milestone, no phases executed yet).
72
-
73
- **If knowledge exists:** Present a brief "What we know so far" summary to the user before questioning — prior decisions, architectural patterns, and pitfalls relevant to this phase. This grounds the discussion without interrogating.
74
+ **If knowledge exists:** Present a brief "What we know so far" summary — prior decisions, patterns, and pitfalls relevant to this phase.
74
75
 
75
76
  **If no knowledge files exist:** Skip silently (normal for first phase).
76
-
77
- Continue to check_existing.
78
77
  </step>
79
78
 
80
79
  <step name="check_existing">
@@ -98,75 +97,142 @@ What's next?
98
97
 
99
98
  Wait for user response.
100
99
 
101
- If "Update context": Load existing CONTEXT.md, continue to questioning
100
+ If "Update context": Load existing CONTEXT.md, continue to assess_and_research
102
101
  If "View existing": Read and display CONTEXT.md, then offer update/skip
103
102
  If "Skip": Exit workflow
104
103
 
105
104
  **If doesn't exist:**
106
- Continue to questioning.
105
+ Continue to assess_and_research.
107
106
  </step>
108
107
 
109
- <step name="questioning">
110
- **CRITICAL: ALL questions use AskUserQuestion. Never ask inline text questions.**
108
+ <!-- STAGE 2: BRIEFING + CONDITIONAL RESEARCH -->
109
+
110
+ <step name="assess_and_research">
111
+ Parse the requirements mapped to this phase from REQUIREMENTS.md and the phase description from ROADMAP.md.
112
+
113
+ **Assess whether product research would add value:**
111
114
 
112
- Present initial context from roadmap, then immediately use AskUserQuestion:
115
+ Research is valuable when the phase involves user-facing product decisions where competitor context, UX patterns, or audience expectations would inform better choices. Examples: UI layouts, user flows, feature scope, interaction patterns.
116
+
117
+ Research is NOT valuable for: backend infrastructure, data migrations, build tooling, refactoring, developer-facing work with no UX decisions.
118
+
119
+ **If research would add value:**
120
+
121
+ Use AskUserQuestion:
122
+ - header: "Research"
123
+ - question: "This phase involves product decisions where competitor and UX research could help. Want me to research how others handle this before we discuss?"
124
+ - options:
125
+ - "Research first" — Investigate competitors and UX patterns (~30s)
126
+ - "Skip research" — Discuss based on what we know
127
+
128
+ **If user selects "Research first":**
129
+
130
+ Spawn ms-product-researcher subagent via Task tool:
113
131
 
114
132
  ```
115
- Phase ${PHASE}: ${PHASE_NAME}
133
+ <product_context>
134
+ [Who It's For, Core Value, How It's Different from PROJECT.md]
135
+ </product_context>
136
+
137
+ <phase_requirements>
138
+ [Phase goal, description, mapped requirements from ROADMAP.md/REQUIREMENTS.md]
139
+ </phase_requirements>
116
140
 
117
- From the roadmap: ${PHASE_DESCRIPTION}
141
+ <research_focus>
142
+ [Specific product questions relevant to this phase — what would help the user decide?]
143
+ </research_focus>
118
144
  ```
119
145
 
120
- **1. Open:**
146
+ Store research findings for use in present_briefing and questioning steps.
121
147
 
122
- Use AskUserQuestion:
123
- - header: "Vision"
124
- - question: "How do you imagine this working?"
125
- - options: 2-3 interpretations based on the phase description + "Let me describe it"
148
+ **If user selects "Skip research" or research not valuable:**
149
+ Continue without research findings.
150
+ </step>
151
+
152
+ <step name="present_briefing">
153
+ Present a consolidated briefing that weaves together all loaded context.
154
+
155
+ ```
156
+ ## Phase ${PHASE}: ${PHASE_NAME}
126
157
 
127
- **2. Follow the thread:**
158
+ ### What This Phase Delivers
159
+ [Requirements mapped to this phase from REQUIREMENTS.md, or phase goal from ROADMAP.md if no requirements mapping]
128
160
 
129
- Based on their response, use AskUserQuestion:
130
- - header: "[Topic they mentioned]"
131
- - question: "You mentioned [X] — what would that look like?"
132
- - options: 2-3 interpretations + "Something else"
161
+ ### My Assumptions
162
+ - **Approach:** How Claude would tackle this
163
+ - **Scope:** What's included vs excluded
164
+ - **Risks/Dependencies:** Where Claude expects complexity or unknowns
133
165
 
134
- **3. Sharpen the core:**
166
+ [If research findings available:]
167
+ ### Industry Context
168
+ [Key findings from product research — competitor patterns, UX conventions, audience expectations. Dense, prescriptive summary.]
169
+ ```
135
170
 
136
- Use AskUserQuestion with multiSelect: true:
137
- - header: "Essential"
138
- - question: "What's most important to nail in this phase? Select all that apply."
139
- - options: Key aspects they've mentioned
171
+ Then use AskUserQuestion:
172
+ - header: "Assumptions"
173
+ - question: "Are these assumptions on track? Anything I'm getting wrong or missing?"
174
+ - options:
175
+ - "Looks right" — Assumptions are accurate, let's continue
176
+ - "Some corrections" — I have specific corrections
177
+ - "Way off" — Let me reframe this
140
178
 
141
- **4. Capture specifics (optional):**
179
+ **If "Some corrections" or "Way off":** Receive corrections, acknowledge, update understanding. Then continue to questioning.
180
+ **If "Looks right":** Continue to questioning.
181
+ </step>
142
182
 
143
- If they seem to have specific ideas, use AskUserQuestion:
144
- - header: "Specifics"
145
- - question: "Any particular look/feel/behavior in mind?"
146
- - options: Contextual options based on what they've said + "No specifics" + "Let me describe"
183
+ <!-- STAGE 3: INFORMED DISCUSSION -->
147
184
 
148
- CRITICAL — What NOT to ask:
185
+ <step name="questioning">
186
+ **ALL questions use AskUserQuestion. Never ask inline text questions.**
187
+
188
+ What NOT to ask — the user doesn't know and shouldn't be asked about:
149
189
  - Technical risks (you figure those out)
150
190
  - Codebase patterns (you read the code)
151
191
  - Success metrics (too corporate)
152
192
  - Constraints they didn't mention (don't interrogate)
153
193
  - What's out of scope (implicit from roadmap)
154
194
 
155
- **5. Decision gate:**
195
+ **Scope guardrail:** Phase boundary from ROADMAP.md is FIXED. Discussion clarifies HOW to implement, not WHETHER to add more. If user suggests new capabilities: "That sounds like its own phase. I'll note it in Deferred Ideas."
196
+
197
+ **Product lens:** Before each question, show brief analysis — audience needs, competitor patterns (from research if available), tradeoffs and recommendation. This grounds the user's decision.
198
+
199
+ **1. Open:**
200
+
201
+ Present brief product analysis, then use AskUserQuestion:
202
+ - header: "Vision"
203
+ - question: "How do you imagine this working?"
204
+ - options: 2-3 interpretations based on phase description, requirements, and industry context + "Let me describe it"
205
+
206
+ **2. Follow the thread (2-4 rounds typical):**
207
+
208
+ Follow the user's thread. Each round: apply product lens to the topic they raised, then AskUserQuestion with 2-3 interpretations + escape hatch. Use multiSelect for priority/essential questions. Stop when vision is clear — don't over-question.
209
+
210
+ **3. Decision gate:**
211
+
212
+ Present a coverage summary before offering to finalize:
213
+
214
+ ```
215
+ ### Coverage Summary
216
+ **Discussed:** [Topics covered during this conversation]
217
+ **From artifacts:** [Context loaded from PROJECT.md, REQUIREMENTS.md, research]
218
+ **Open areas:** [Anything from the requirements/roadmap not yet discussed — or "None" if comprehensive]
219
+ ```
156
220
 
157
221
  Use AskUserQuestion:
158
222
  - header: "Ready?"
159
223
  - question: "Ready to capture this context, or explore more?"
160
224
  - options (ALL THREE REQUIRED):
161
- - "Create CONTEXT.md" - I've shared my vision
162
- - "Ask more questions" - Help me think through this more
163
- - "Let me add context" - I have more to share
225
+ - "Create CONTEXT.md" I've shared my vision
226
+ - "Ask more questions" Help me think through this more
227
+ - "Let me add context" I have more to share
164
228
 
165
229
  If "Ask more questions" → return to step 2 with new probes.
166
230
  If "Let me add context" → receive input → return to step 2.
167
231
  Loop until "Create CONTEXT.md" selected.
168
232
  </step>
169
233
 
234
+ <!-- STAGE 4: OUTPUT -->
235
+
170
236
  <step name="write_context">
171
237
  Create CONTEXT.md capturing the user's vision and decisions.
172
238
 
@@ -188,15 +254,10 @@ Populate template sections:
188
254
  - `<notes>`: Any other context gathered
189
255
 
190
256
  **Decision context (for downstream agents):**
191
- - `<decisions>`: Concrete choices made during discussion (locked)
257
+ - `<decisions>`: Concrete choices made during discussion (locked). Include inline reasoning grounded in vision, audience, competitor patterns, or tradeoff analysis: `- [Decision] — [Why: reasoning]`
192
258
  - `### Claude's Discretion`: Areas where user said "you decide" or didn't express preference
193
259
  - `<deferred>`: Ideas mentioned but explicitly out of scope
194
260
 
195
- **Scope guardrail:**
196
- - Phase boundary from ROADMAP.md is FIXED
197
- - Discussion clarifies HOW to implement, not WHETHER to add more
198
- - If user suggests new capabilities: "That sounds like its own phase. I'll note it in Deferred Ideas."
199
-
200
261
  Do NOT populate with your own technical analysis. That comes during research/planning.
201
262
 
202
263
  Write file.
@@ -254,12 +315,23 @@ EOF
254
315
  Confirm: "Committed: docs(${PHASE}): capture phase context"
255
316
  </step>
256
317
 
318
+ <step name="show_prework_status">
319
+ Read `~/.claude/mindsystem/references/prework-status.md` and present what's done vs still needed for this phase.
320
+ </step>
321
+
322
+ <step name="update_state">
323
+ Update `.planning/STATE.md` Last Command field:
324
+
325
+ Format: `Last Command: ms:discuss-phase ${PHASE} | YYYY-MM-DD HH:MM`
326
+ </step>
327
+
257
328
  </process>
258
329
 
259
330
  <success_criteria>
260
331
 
261
- - Vision gathered through collaborative thinking (not interrogation)
262
- - User's imagination captured: how it works, what's essential
332
+ - Assumptions surfaced and validated with user before deep questioning
333
+ - Product research offered for user-facing phases (skipped silently for infra/backend)
334
+ - Vision gathered through product-informed collaborative thinking (not interrogation)
335
+ - CONTEXT.md captures: vision, essentials, and decisions with inline reasoning
263
336
  - User knows next steps (typically: research or plan the phase)
264
- - CONTEXT.md committed to git
265
337
  </success_criteria>
@@ -0,0 +1,273 @@
1
+ <purpose>
2
+ Apply fixes for doctor health check failures. Each step targets one check category,
3
+ runs only if that check failed, and commits atomically.
4
+ </purpose>
5
+
6
+ <process>
7
+
8
+ <step name="fix_subsystems">
9
+ **Only if Subsystem Vocabulary failed.**
10
+
11
+ If subsystems array is empty (State A):
12
+
13
+ 1. Scan all artifacts for existing values:
14
+
15
+ ```bash
16
+ ms-tools scan-artifact-subsystems --values-only
17
+ ```
18
+
19
+ 2. Read `.planning/PROJECT.md` and `.planning/ROADMAP.md`.
20
+
21
+ 3. Derive 5-12 canonical subsystem identifiers from:
22
+ - Unique values found in artifacts
23
+ - Project domain from PROJECT.md
24
+ - Phase structure from ROADMAP.md
25
+
26
+ Rules:
27
+ - Lowercase, single-word or hyphenated (e.g., "auth", "real-time", "ui")
28
+ - Merge synonyms into one canonical value (pick shortest/most common)
29
+ - Cover all existing usage plus obvious gaps
30
+ - Include infrastructure-level subsystems if relevant (api, database, infra, testing)
31
+
32
+ 4. Present the proposed list with merge mappings (e.g., "authentication" -> "auth").
33
+
34
+ 5. Use AskUserQuestion:
35
+ - header: "Subsystems"
36
+ - question: "These subsystems were derived from your project. Look good?"
37
+ - options:
38
+ - "Looks good" — accept and apply
39
+ - "Add/remove some" — iterate on the list
40
+ - "Start over" — re-derive from scratch
41
+
42
+ 6. After confirmation: update `config.json` (subsystems as first field), standardize existing artifact `subsystem:` fields using Edit tool.
43
+
44
+ If subsystems exist but artifacts have mismatches (State B):
45
+
46
+ 1. Classify each artifact as OK/MISMATCH/MISSING.
47
+ 2. For MISMATCH: propose closest canonical value.
48
+ 3. For MISSING: propose based on artifact content/path.
49
+ 4. Apply fixes using Edit tool.
50
+
51
+ Commit:
52
+
53
+ ```bash
54
+ git add .planning/config.json
55
+ git add .planning/phases/*/*-SUMMARY.md 2>/dev/null
56
+ git add .planning/adhoc/*-SUMMARY.md 2>/dev/null
57
+ git add .planning/debug/*.md 2>/dev/null
58
+ git add .planning/debug/resolved/*.md 2>/dev/null
59
+ git add .planning/todos/pending/*.md 2>/dev/null
60
+ git add .planning/todos/done/*.md 2>/dev/null
61
+ ```
62
+
63
+ ```bash
64
+ git commit -m "$(cat <<'EOF'
65
+ chore(doctor): fix subsystem vocabulary
66
+
67
+ Standardized subsystem configuration and artifact values.
68
+ EOF
69
+ )"
70
+ ```
71
+ </step>
72
+
73
+ <step name="fix_milestone_dirs">
74
+ **Only if Milestone Directory Structure failed.**
75
+
76
+ For each flat file like `milestones/v0.1-ROADMAP.md`:
77
+
78
+ 1. Extract version prefix (e.g., `v0.1`).
79
+ 2. Create directory if it doesn't exist: `mkdir -p .planning/milestones/v0.1`
80
+ 3. `git mv` the file, stripping the version prefix from the filename:
81
+ `git mv .planning/milestones/v0.1-ROADMAP.md .planning/milestones/v0.1/ROADMAP.md`
82
+
83
+ **Note:** New milestones use slug-based directories (e.g., `milestones/mvp/`, `milestones/push-notifications/`). Old v-prefixed directories from previous format are valid and handled.
84
+
85
+ Commit:
86
+
87
+ ```bash
88
+ git add .planning/milestones/
89
+ ```
90
+
91
+ ```bash
92
+ git commit -m "$(cat <<'EOF'
93
+ chore(doctor): restructure milestone directories
94
+
95
+ Moved flat milestone files into versioned directories.
96
+ EOF
97
+ )"
98
+ ```
99
+ </step>
100
+
101
+ <step name="fix_milestone_naming">
102
+ **Only if Milestone Naming Convention failed.**
103
+
104
+ 1. **Build mapping** — run `ms-tools scan-milestone-naming`, parse JSON output.
105
+
106
+ 2. **Resolve slugs** — For each versioned dir, match to MILESTONES.md name mapping:
107
+ - Standard dirs: version matches directly (v0.1 → "MVP" → slug "mvp")
108
+ - Nested dirs: match sub-directory name to the milestone name in MILESTONES.md (v2.0.0/quests → "Quests Feature" → slug "quests-feature")
109
+ - Derive short slugs from names (Claude proposes, user confirms)
110
+
111
+ 3. **Present mapping** to user with AskUserQuestion:
112
+
113
+ ```
114
+ | Current Directory | Milestone Name | Proposed Slug |
115
+ |-------------------------|----------------------|------------------|
116
+ | v0.1/ | MVP | mvp |
117
+ | v0.2/ | Infrastructure | infrastructure |
118
+ | (active) | Demo Release | demo-release |
119
+ ```
120
+
121
+ Options: "Looks good" / "Edit slugs" / "Skip"
122
+
123
+ 4. **Rename directories:**
124
+ - Standard: `git mv .planning/milestones/v0.1 .planning/milestones/mvp`
125
+ - Nested: `git mv .planning/milestones/v2.0.0/quests .planning/milestones/quests-feature` for each sub-dir, then `rmdir .planning/milestones/v2.0.0` to remove empty parent
126
+
127
+ 5. **Update archived milestone files** (inside each renamed dir):
128
+ - `PHASE-SUMMARIES.md`: `# Phase Summaries: v0.1` → `# Phase Summaries: MVP`
129
+ - `ROADMAP.md`: `# Milestone v0.1: Name` → `# Milestone: Name`
130
+ - `REQUIREMENTS.md`: `# Requirements Archive: v0.1 Name` → `# Requirements Archive: Name`
131
+ - `MILESTONE-AUDIT.md`: YAML `milestone: v0.1` → `milestone: mvp` (use slug)
132
+ - `CONTEXT.md`: `# Milestone Context: v0.1 Name` → `# Milestone Context: Name`
133
+
134
+ 6. **Update MILESTONES.md:**
135
+ - Strip version prefix from headers: `## v0.1 MVP (Shipped:...)` → `## MVP (Shipped:...)`
136
+ - Preserve all other content (git ranges, stats, accomplishments)
137
+
138
+ 7. **Update active .planning files:**
139
+ - `PROJECT.md`: Replace `— v0.1` with `— MVP` in validated requirements, strip version from `## Current Milestone:` header, update `Shipped v0.2 with...` → `Shipped Infrastructure with...`
140
+ - `STATE.md`: Replace version refs with names (`v0.3 Demo Release` → `Demo Release`)
141
+ - `ROADMAP.md`: Strip version from `**Milestone:** v0.3 Demo Release` → `**Milestone:** Demo Release`
142
+ - `MILESTONE-CONTEXT.md`: Strip version from header
143
+ - `REQUIREMENTS.md`: Strip version from `**Milestone:**` line. For deferred sections (`### v0.4 — On-Device Hardening`), use AskUserQuestion to confirm replacement names or keep description-only format (`### On-Device Hardening (deferred)`)
144
+
145
+ 8. **Rules:**
146
+ - Do NOT modify git range references (`**Git range:** feat(01-01) → ...`)
147
+ - Do NOT modify git commit messages quoted in MILESTONES.md
148
+ - Preserve shipped dates, stats, phase ranges
149
+ - Use Edit tool for targeted replacements (not bulk find-replace)
150
+
151
+ 9. **Commit:**
152
+
153
+ ```bash
154
+ git add .planning/
155
+ ```
156
+
157
+ ```bash
158
+ git commit -m "$(cat <<'EOF'
159
+ chore(doctor): migrate milestone naming from versions to slugs
160
+
161
+ Renamed milestone directories from version-based (v0.1/, v2.0.0/) to
162
+ name-based slugs (mvp/, quests-feature/). Updated all planning file references.
163
+ EOF
164
+ )"
165
+ ```
166
+ </step>
167
+
168
+ <step name="fix_phase_archival">
169
+ **Only if Phase Archival failed.**
170
+
171
+ Parse MILESTONES.md for completed milestones and their phase ranges (`**Phases completed:** X-Y`).
172
+
173
+ For each completed milestone with orphaned phases in `.planning/phases/`:
174
+
175
+ 1. Determine the version and phase range from MILESTONES.md.
176
+ 2. Ensure the milestone directory exists: `mkdir -p .planning/milestones/{slug}`
177
+ 3. Run the archive script:
178
+
179
+ ```bash
180
+ ms-tools archive-milestone-phases <start> <end> <slug>
181
+ ```
182
+
183
+ This simultaneously:
184
+ - Consolidates PHASE-SUMMARIES.md (fixes Phase Summaries check)
185
+ - Deletes raw artifacts (CONTEXT, DESIGN, RESEARCH, SUMMARY, UAT, VERIFICATION)
186
+ - Moves phase directories to milestone archive
187
+
188
+ **If MILESTONES.md doesn't have parseable phase ranges:** Use AskUserQuestion to ask the user for the phase range for each milestone.
189
+
190
+ After archive completes, clean up leftover PLAN files in archived phases (fixes PLAN Cleanup check):
191
+
192
+ ```bash
193
+ find .planning/milestones/*/phases/ -name "*-PLAN.md" -delete 2>/dev/null
194
+ ```
195
+
196
+ Commit:
197
+
198
+ ```bash
199
+ git add .planning/phases/ .planning/milestones/
200
+ ```
201
+
202
+ ```bash
203
+ git commit -m "$(cat <<'EOF'
204
+ chore(doctor): archive completed milestone phases
205
+
206
+ Consolidated summaries, deleted raw artifacts, moved phase directories.
207
+ EOF
208
+ )"
209
+ ```
210
+ </step>
211
+
212
+ <step name="fix_plan_cleanup">
213
+ **Only if PLAN Cleanup failed AND fix_phase_archival did not already handle it.**
214
+
215
+ Delete leftover PLAN files in completed phase directories:
216
+
217
+ ```bash
218
+ find .planning/milestones/*/phases/ -name "*-PLAN.md" -delete 2>/dev/null
219
+ ```
220
+
221
+ For any leftover PLANs in `phases/` belonging to completed milestones (identified by the scan), delete those too.
222
+
223
+ Commit:
224
+
225
+ ```bash
226
+ git add .planning/
227
+ ```
228
+
229
+ ```bash
230
+ git commit -m "$(cat <<'EOF'
231
+ chore(doctor): clean up leftover PLAN files
232
+
233
+ Removed PLAN files from completed phase directories.
234
+ EOF
235
+ )"
236
+ ```
237
+ </step>
238
+
239
+ <step name="fix_knowledge">
240
+ **Only if Knowledge Files failed.**
241
+
242
+ Spawn a `general-purpose` subagent (Task tool) to generate knowledge files retroactively. Provide the subagent with:
243
+
244
+ - Subsystem vocabulary from config.json
245
+ - Instructions to read all PHASE-SUMMARIES.md from `milestones/*/PHASE-SUMMARIES.md` AND any remaining SUMMARY files in `phases/`
246
+ - The knowledge template at `~/.claude/mindsystem/templates/knowledge.md`
247
+ - Instructions to read any existing knowledge files and merge (rewrite semantics — current state, not append)
248
+ - Instructions to create `.planning/knowledge/` directory if missing
249
+ - Instructions to write `.planning/knowledge/{subsystem}.md` for each missing subsystem
250
+
251
+ After subagent completes, verify files exist:
252
+
253
+ ```bash
254
+ ls .planning/knowledge/*.md
255
+ ```
256
+
257
+ Commit:
258
+
259
+ ```bash
260
+ git add .planning/knowledge/
261
+ ```
262
+
263
+ ```bash
264
+ git commit -m "$(cat <<'EOF'
265
+ chore(doctor): generate knowledge files
266
+
267
+ Created per-subsystem knowledge files from phase summaries.
268
+ EOF
269
+ )"
270
+ ```
271
+ </step>
272
+
273
+ </process>
@@ -81,7 +81,7 @@ Skip completed plans. If all complete, report "Phase already executed" and exit.
81
81
  Run validation before launching executors:
82
82
 
83
83
  ```bash
84
- ~/.claude/mindsystem/scripts/validate-execution-order.sh "$PHASE_DIR"
84
+ ms-tools validate-execution-order "$PHASE_DIR"
85
85
  ```
86
86
 
87
87
  If validation fails (exit 1), stop execution and report the mismatch to user.
@@ -201,7 +201,7 @@ Execute each wave in sequence. Autonomous plans within a wave run in parallel.
201
201
 
202
202
  After reporting wave completion, update STATE.md with progress:
203
203
  ```bash
204
- ~/.claude/mindsystem/scripts/update-state.sh {completed_count} {total_count}
204
+ ms-tools update-state {completed_count} {total_count}
205
205
  ```
206
206
 
207
207
  5. **Handle failures:**
@@ -412,7 +412,7 @@ Generate a patch file with all implementation changes from this phase.
412
412
 
413
413
  **Run the patch generation script:**
414
414
  ```bash
415
- ~/.claude/mindsystem/scripts/generate-phase-patch.sh ${PHASE_NUMBER}
415
+ ms-tools generate-phase-patch ${PHASE_NUMBER}
416
416
  ```
417
417
 
418
418
  The script will:
@@ -527,6 +527,10 @@ git commit -m "docs: update codebase map after phase {X}"
527
527
  <step name="offer_next">
528
528
  Present next steps based on milestone status.
529
529
 
530
+ **First, surface user actions:**
531
+
532
+ Read `## User Actions Required` from all `*-SUMMARY.md` files in the phase directory. If any non-empty actions exist, present as `## ⚠ Action Required` block before route-specific content. Skip if all "None".
533
+
530
534
  **If more phases remain:**
531
535
 
532
536
  Read `~/.claude/mindsystem/references/routing/next-phase-routing.md` and follow its instructions to present "Next Up" with pre-work context for the next phase.
@@ -28,7 +28,7 @@ cat .planning/STATE.md 2>/dev/null
28
28
  <step name="load_plan">
29
29
  Read the plan file provided in your prompt context.
30
30
 
31
- Parse inline metadata from header: `**Subsystem:**` and `**Type:**` values.
31
+ Parse inline metadata from header: `**Subsystem:**`, `**Type:**`, and `**Skills:**` values.
32
32
 
33
33
  Parse plan sections:
34
34
  - Context (files to read, @-references)
@@ -44,11 +44,9 @@ Parse plan sections:
44
44
  </step>
45
45
 
46
46
  <step name="load_skills">
47
- Scan the skill list in your system message for skills matching the plan's technology or domain. Invoke each match via the Skill tool before proceeding skills contain project-specific conventions and patterns that change what you produce during implementation.
47
+ **If `**Skills:**` is present in plan metadata:** Invoke each listed skill via the Skill tool before proceeding. These were confirmed by the user during planning load them without further confirmation.
48
48
 
49
- - One clear match invoke it directly
50
- - Multiple candidates → use AskUserQuestion to let the user choose
51
- - No match → proceed without
49
+ **If `**Skills:**` is absent:** Proceed without loading skills. Skill discovery happens during `/ms:plan-phase` absence means no skills were relevant.
52
50
  </step>
53
51
 
54
52
  <step name="execute">
@@ -300,6 +298,9 @@ completed: YYYY-MM-DD
300
298
  ## Issues Encountered
301
299
  [Problems during planned work, or "None"]
302
300
 
301
+ ## User Actions Required
302
+ [Commands the user must run: migrations, package installs, env vars, server restarts. Or "None — no manual steps needed."]
303
+
303
304
  ## Next Step
304
305
  [Ready for next plan, or "Phase complete, ready for transition"]
305
306
  ```
@@ -100,8 +100,8 @@ After writing STACK.md, update config.json code_review fields with the appropria
100
100
  1. Read STACK.md to detect primary framework
101
101
  2. Map framework to code review agent names:
102
102
  - Flutter/Dart:
103
- - adhoc: "ms-flutter-simplifier"
104
- - phase: "ms-flutter-simplifier"
103
+ - adhoc: "ms-flutter-code-quality"
104
+ - phase: "ms-flutter-code-quality"
105
105
  - milestone: "ms-flutter-reviewer"
106
106
  - All others (React, Next.js, Node, Swift, Kotlin, etc.):
107
107
  - adhoc: "ms-code-simplifier"
@@ -106,7 +106,7 @@ Task(prompt=assembled_context, subagent_type="ms-mockup-designer", description="
106
106
  After all 3 agents return, run the comparison script to create the comparison page. Do NOT generate comparison HTML manually — use the script:
107
107
 
108
108
  ```bash
109
- uv run ~/.claude/mindsystem/scripts/compare_mockups.py "${PHASE_DIR}/mockups"
109
+ ms-compare-mockups "${PHASE_DIR}/mockups"
110
110
  open "${PHASE_DIR}/mockups/comparison.html"
111
111
  ```
112
112