mindsystem-cc 3.20.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 (79) hide show
  1. package/README.md +5 -6
  2. package/agents/ms-mockup-designer.md +1 -1
  3. package/agents/ms-product-researcher.md +69 -0
  4. package/agents/ms-research-synthesizer.md +1 -1
  5. package/agents/ms-researcher.md +8 -8
  6. package/agents/ms-roadmapper.md +9 -13
  7. package/bin/install.js +68 -5
  8. package/commands/ms/add-phase.md +4 -4
  9. package/commands/ms/adhoc.md +1 -1
  10. package/commands/ms/audit-milestone.md +12 -12
  11. package/commands/ms/complete-milestone.md +25 -22
  12. package/commands/ms/config.md +202 -0
  13. package/commands/ms/design-phase.md +3 -8
  14. package/commands/ms/discuss-phase.md +26 -22
  15. package/commands/ms/doctor.md +22 -202
  16. package/commands/ms/execute-phase.md +18 -7
  17. package/commands/ms/help.md +46 -39
  18. package/commands/ms/insert-phase.md +3 -3
  19. package/commands/ms/new-milestone.md +40 -16
  20. package/commands/ms/new-project.md +53 -42
  21. package/commands/ms/plan-milestone-gaps.md +4 -5
  22. package/commands/ms/plan-phase.md +2 -2
  23. package/commands/ms/progress.md +2 -4
  24. package/commands/ms/research-phase.md +7 -12
  25. package/commands/ms/research-project.md +12 -12
  26. package/mindsystem/references/continuation-format.md +3 -3
  27. package/mindsystem/references/principles.md +1 -1
  28. package/mindsystem/references/routing/audit-result-routing.md +12 -11
  29. package/mindsystem/references/routing/between-milestones-routing.md +2 -2
  30. package/mindsystem/references/routing/milestone-complete-routing.md +1 -1
  31. package/mindsystem/references/routing/next-phase-routing.md +4 -2
  32. package/mindsystem/templates/context.md +7 -6
  33. package/mindsystem/templates/milestone-archive.md +5 -5
  34. package/mindsystem/templates/milestone-context.md +1 -1
  35. package/mindsystem/templates/milestone.md +9 -9
  36. package/mindsystem/templates/project.md +2 -2
  37. package/mindsystem/templates/research-subagent-prompt.md +3 -3
  38. package/mindsystem/templates/roadmap-milestone.md +14 -14
  39. package/mindsystem/templates/roadmap.md +9 -7
  40. package/mindsystem/workflows/adhoc.md +1 -1
  41. package/mindsystem/workflows/complete-milestone.md +40 -75
  42. package/mindsystem/workflows/discuss-phase.md +137 -65
  43. package/mindsystem/workflows/doctor-fixes.md +273 -0
  44. package/mindsystem/workflows/execute-phase.md +7 -3
  45. package/mindsystem/workflows/execute-plan.md +3 -0
  46. package/mindsystem/workflows/map-codebase.md +2 -2
  47. package/mindsystem/workflows/mockup-generation.md +1 -1
  48. package/mindsystem/workflows/plan-phase.md +1 -1
  49. package/mindsystem/workflows/transition.md +2 -2
  50. package/mindsystem/workflows/verify-work.md +1 -1
  51. package/package.json +1 -1
  52. package/scripts/__pycache__/ms-tools.cpython-314.pyc +0 -0
  53. package/scripts/__pycache__/test_ms_tools.cpython-314-pytest-9.0.2.pyc +0 -0
  54. package/scripts/fixtures/scan-context/.planning/ROADMAP.md +16 -0
  55. package/scripts/fixtures/scan-context/.planning/adhoc/20260220-fix-token-SUMMARY.md +12 -0
  56. package/scripts/fixtures/scan-context/.planning/config.json +3 -0
  57. package/scripts/fixtures/scan-context/.planning/debug/resolved/token-bug.md +11 -0
  58. package/scripts/fixtures/scan-context/.planning/knowledge/auth.md +11 -0
  59. package/scripts/fixtures/scan-context/.planning/phases/02-infra/02-1-SUMMARY.md +20 -0
  60. package/scripts/fixtures/scan-context/.planning/phases/04-setup/04-1-SUMMARY.md +21 -0
  61. package/scripts/fixtures/scan-context/.planning/phases/05-auth/05-1-SUMMARY.md +28 -0
  62. package/scripts/fixtures/scan-context/.planning/todos/done/setup-db.md +10 -0
  63. package/scripts/fixtures/scan-context/.planning/todos/pending/add-logout.md +10 -0
  64. package/scripts/fixtures/scan-context/expected-output.json +257 -0
  65. package/scripts/ms-tools.py +2139 -0
  66. package/scripts/test_ms_tools.py +836 -0
  67. package/commands/ms/list-phase-assumptions.md +0 -56
  68. package/mindsystem/workflows/list-phase-assumptions.md +0 -178
  69. package/scripts/__pycache__/compare_mockups.cpython-314.pyc +0 -0
  70. package/scripts/archive-milestone-files.sh +0 -68
  71. package/scripts/archive-milestone-phases.sh +0 -138
  72. package/scripts/doctor-scan.sh +0 -402
  73. package/scripts/gather-milestone-stats.sh +0 -179
  74. package/scripts/generate-adhoc-patch.sh +0 -79
  75. package/scripts/generate-phase-patch.sh +0 -169
  76. package/scripts/scan-artifact-subsystems.sh +0 -55
  77. package/scripts/scan-planning-context.py +0 -839
  78. package/scripts/update-state.sh +0 -59
  79. package/scripts/validate-execution-order.sh +0 -104
@@ -0,0 +1,202 @@
1
+ ---
2
+ name: ms:config
3
+ description: Configure Mindsystem preferences — code reviewers, gitignore, git remote
4
+ allowed-tools:
5
+ - Read
6
+ - Write
7
+ - Bash
8
+ - AskUserQuestion
9
+ ---
10
+
11
+ <objective>
12
+
13
+ Configure Mindsystem preferences for the current project.
14
+
15
+ Manages code reviewer agents, .gitignore patterns for `.planning/` artifacts, and git remote setup. Run anytime to reconfigure — idempotent.
16
+
17
+ </objective>
18
+
19
+ <process>
20
+
21
+ <step name="load_context">
22
+
23
+ **Load current state:**
24
+
25
+ ```bash
26
+ # Check for existing config
27
+ [ -f .planning/config.json ] && cat .planning/config.json || echo "NO_CONFIG"
28
+
29
+ # Check for PROJECT.md (tech stack detection)
30
+ [ -f .planning/PROJECT.md ] && echo "HAS_PROJECT" || echo "NO_PROJECT"
31
+
32
+ # Check for STACK.md (precise tech detection)
33
+ [ -f .planning/codebase/STACK.md ] && echo "HAS_STACK" || echo "NO_STACK"
34
+
35
+ # Check git remote
36
+ git remote -v 2>/dev/null || echo "NO_REMOTE"
37
+ ```
38
+
39
+ **Run this before proceeding.**
40
+
41
+ </step>
42
+
43
+ <step name="git_remote">
44
+
45
+ **Skip if remote already configured.**
46
+
47
+ If no remote exists:
48
+
49
+ Explain: "Your project has a local git repo but no remote. Want to create one on GitHub?"
50
+
51
+ Use AskUserQuestion:
52
+ - header: "Git remote"
53
+ - question: "Create a GitHub repository for this project?"
54
+ - options:
55
+ - "Create with gh CLI" — Run `gh repo create` to set up remote and push
56
+ - "Skip for now" — Continue without remote
57
+
58
+ If "Create with gh CLI":
59
+ - Derive repo name from directory name
60
+ - Show the command: `gh repo create [name] --source=. --push`
61
+ - Confirm with user before executing
62
+ - Execute via Bash tool
63
+
64
+ </step>
65
+
66
+ <step name="code_reviewers">
67
+
68
+ Show current code_review values from config.json (if loaded).
69
+
70
+ **If PROJECT.md or STACK.md exists:** Detect tech stack and suggest appropriate reviewers:
71
+
72
+ - **Flutter/Dart:** adhoc=`ms-flutter-code-quality`, phase=`ms-flutter-code-quality`, milestone=`ms-flutter-reviewer`
73
+ - **All others:** adhoc=`ms-code-simplifier`, phase=`ms-code-simplifier`, milestone=null
74
+
75
+ **If no PROJECT.md or STACK.md:** Warn: "No PROJECT.md found — can't suggest reviewers based on tech stack. Run `/ms:new-project` first, or pick manually."
76
+
77
+ Use AskUserQuestion:
78
+ - header: "Code review"
79
+ - question: "Which code reviewer configuration do you want?"
80
+ - options:
81
+ - "[Suggested based on stack]" — e.g., "Flutter reviewers (ms-flutter-code-quality)" (Recommended)
82
+ - "Skip code review" — Disable review for all tiers
83
+ - "Custom" — I'll specify reviewers manually
84
+
85
+ If "Custom": ask for each tier (adhoc, phase, milestone) individually.
86
+
87
+ If "Skip code review": set all three values to `"skip"`.
88
+
89
+ Update config.json with selected values.
90
+
91
+ </step>
92
+
93
+ <step name="gitignore_patterns">
94
+
95
+ Check if `.gitignore` exists and current `.planning/` ignore patterns:
96
+
97
+ ```bash
98
+ [ -f .gitignore ] && grep -n "planning" .gitignore || echo "NO_PLANNING_PATTERNS"
99
+ ```
100
+
101
+ Explain: "We recommend committing `.planning/` to git — it's your project's memory (decisions, requirements, knowledge files). But some artifacts are large or environment-specific."
102
+
103
+ Use AskUserQuestion (multiSelect):
104
+ - header: "Gitignore"
105
+ - question: "Which `.planning/` artifacts should be git-ignored?"
106
+ - options:
107
+ - "Phase patch files (`.planning/phases/**/*.patch`)" — Large binary diffs, regeneratable
108
+ - "Design mockups (`.planning/phases/**/*.html`)" — Generated HTML mockups from design-phase
109
+
110
+ Apply selected patterns to `.gitignore`. Create the file if needed.
111
+
112
+ If no selections: skip gitignore changes.
113
+
114
+ </step>
115
+
116
+ <step name="validation_summary">
117
+
118
+ Show final config state:
119
+
120
+ ```
121
+ Configuration updated:
122
+
123
+ - Code reviewers: [adhoc / phase / milestone values]
124
+ - Gitignore: [patterns added, or "no changes"]
125
+ - Git remote: [remote URL, or "none configured"]
126
+ ```
127
+
128
+ Check subsystems in config.json. If empty or missing, note:
129
+ "Subsystems are derived during `/ms:new-project`. Run `/ms:doctor` to update or verify them."
130
+
131
+ </step>
132
+
133
+ <step name="commit">
134
+
135
+ **Skip if no changes made.**
136
+
137
+ ```bash
138
+ git add .planning/config.json .gitignore
139
+ git commit -m "$(cat <<'EOF'
140
+ chore: configure mindsystem preferences
141
+ EOF
142
+ )"
143
+ ```
144
+
145
+ </step>
146
+
147
+ <step name="done">
148
+
149
+ Present next steps:
150
+
151
+ **If PROJECT.md exists:**
152
+
153
+ ```
154
+ ---
155
+
156
+ ## ▶ Next Up
157
+
158
+ `/ms:new-milestone` — Discover what to build next, create requirements and roadmap
159
+
160
+ <sub>`/clear` first → fresh context window</sub>
161
+
162
+ ---
163
+
164
+ **Also available:**
165
+ - `/ms:doctor` — Verify subsystems and artifact health
166
+
167
+ ---
168
+ ```
169
+
170
+ **If no PROJECT.md:**
171
+
172
+ ```
173
+ ---
174
+
175
+ ## ▶ Next Up
176
+
177
+ `/ms:new-project` — Initialize project with business context and vision
178
+
179
+ <sub>`/clear` first → fresh context window</sub>
180
+
181
+ ---
182
+
183
+ **Also available:**
184
+ - `/ms:doctor` — Verify subsystems and artifact health
185
+
186
+ ---
187
+ ```
188
+
189
+ </step>
190
+
191
+ </process>
192
+
193
+ <success_criteria>
194
+
195
+ - [ ] Changes committed (if any)
196
+ - [ ] User routed to next step
197
+ - [ ] Gitignore patterns applied (if selected)
198
+ - [ ] Git remote offered (if missing)
199
+ - [ ] Validation summary displayed
200
+ - [ ] Config.json code_review values set (or preserved if skipped)
201
+
202
+ </success_criteria>
@@ -41,17 +41,12 @@ ls .planning/phases/${PHASE}-*/*DESIGN.md 2>/dev/null
41
41
  ## 1. Parse and Validate Phase
42
42
 
43
43
  ```bash
44
- # Extract and normalize phase number from arguments
45
- PHASE_ARG="$ARGUMENTS"
46
- PHASE=$(printf "%02d" "$PHASE_ARG" 2>/dev/null || echo "$PHASE_ARG")
47
-
48
- # Validate phase exists in roadmap
49
- grep -A5 "Phase ${PHASE}:" .planning/ROADMAP.md 2>/dev/null
44
+ ms-tools find-phase "$ARGUMENTS"
50
45
  ```
51
46
 
52
- **If not found:** Error and exit with message: "Phase ${PHASE} not found in ROADMAP.md"
47
+ **If not found (dir is null):** Error and exit with message: "Phase not found in ROADMAP.md"
53
48
 
54
- **If found:** Extract phase number, name, description. Store for later use.
49
+ **If found:** Extract phase number, name, description from the returned JSON and ROADMAP.md.
55
50
 
56
51
  ## 2. Check Existing Design
57
52
 
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: ms:discuss-phase
3
- description: Gather phase context through adaptive questioning before planning
3
+ description: Gather phase context through product-informed collaborative thinking before planning
4
4
  argument-hint: "[phase]"
5
5
  allowed-tools:
6
6
  - Read
@@ -8,14 +8,15 @@ allowed-tools:
8
8
  - Bash
9
9
  - Glob
10
10
  - AskUserQuestion
11
+ - Task
11
12
  ---
12
13
 
13
14
  <objective>
14
- Help the user articulate their vision for a phase through collaborative thinking.
15
+ Act as a collaborative product owner loading milestone-level artifacts, surfacing assumptions, optionally researching competitors, and grounding every question in product analysis.
15
16
 
16
- Purpose: Understand HOW the user imagines this phase working what it looks like, what's essential. You're a thinking partner helping them crystallize their vision, not an interviewer gathering technical requirements.
17
+ Purpose: Understand HOW the user imagines this phase working, informed by target audience, competitive landscape, and industry patterns. You're a thinking partner with product sense helping them crystallize their vision.
17
18
 
18
- Output: {phase}-CONTEXT.md capturing the user's vision for the phase
19
+ Output: {phase}-CONTEXT.md capturing the user's vision with reasoning-backed decisions
19
20
  </objective>
20
21
 
21
22
  <execution_context>
@@ -25,10 +26,9 @@ Output: {phase}-CONTEXT.md capturing the user's vision for the phase
25
26
  <context>
26
27
  Phase number: $ARGUMENTS (required)
27
28
 
28
- **Normalize phase number:**
29
+ **Resolve phase:**
29
30
  ```bash
30
- PHASE_ARG="$ARGUMENTS"
31
- PHASE=$(printf "%02d" "$PHASE_ARG" 2>/dev/null || echo "$PHASE_ARG")
31
+ ms-tools find-phase "$ARGUMENTS"
32
32
  ```
33
33
 
34
34
  **Load project state first:**
@@ -36,31 +36,35 @@ PHASE=$(printf "%02d" "$PHASE_ARG" 2>/dev/null || echo "$PHASE_ARG")
36
36
 
37
37
  **Load roadmap:**
38
38
  @.planning/ROADMAP.md
39
+
40
+ **Load project context:**
41
+ @.planning/PROJECT.md
39
42
  </context>
40
43
 
41
44
  <process>
42
45
  1. Validate phase number argument (error if missing or invalid)
43
46
  2. Check if phase exists in roadmap
44
- 3. Check if CONTEXT.md already exists (offer to update if yes)
45
- 3.5. **Load prior knowledge** — determine relevant subsystem(s) by matching ROADMAP.md phase description against subsystem names in config.json. Load matching `.planning/knowledge/{subsystem}.md` files. If knowledge exists, present brief "What we know so far" summary before questioning.
46
- 4. Follow discuss-phase.md workflow with **ALL questions using AskUserQuestion**:
47
- - Present phase from roadmap
48
- - Use AskUserQuestion: "How do you imagine this working?" with interpretation options
49
- - Use AskUserQuestion to follow their thread probe what excites them
50
- - Use AskUserQuestion to sharpen the core what's essential for THIS phase
51
- - Use AskUserQuestion for decision gate (ready / ask more / let me add context)
52
- - Create CONTEXT.md capturing their vision
53
- 5. Present pre-work status: Read `~/.claude/mindsystem/references/prework-status.md` and show what's done vs still needed for this phase
54
- 6. Update `.planning/STATE.md` Last Command field:
55
- - Format: `Last Command: ms:discuss-phase $ARGUMENTS | YYYY-MM-DD HH:MM`
47
+ 3. **Load milestone artifacts** — extract Who It's For, Core Value, How It's Different from PROJECT.md. Parse requirements mapped to this phase from REQUIREMENTS.md. Graceful if any artifact missing.
48
+ 4. **Load prior knowledge** — determine relevant subsystem(s) by matching ROADMAP.md phase description against subsystem names in config.json. Load matching `.planning/knowledge/{subsystem}.md` files. If knowledge exists, present brief "What we know so far" summary.
49
+ 5. Check if CONTEXT.md already exists (offer to update if yes)
50
+ 6. **Assess and research** — evaluate if phase involves user-facing product decisions. If yes, offer product research via AskUserQuestion → spawn ms-product-researcher if accepted. Skip silently for backend/infra phases.
51
+ 7. **Present briefing** weave together: requirements for this phase, Claude's assumptions (approach, scope, risks with confidence levels), and research findings if available. Ask user to validate/correct assumptions.
52
+ 8. **Informed discussion** follow discuss-phase.md workflow. ALL questions use AskUserQuestion.
53
+ 9. Create CONTEXT.md capturing their vision with reasoning-backed decisions
54
+ 10. Present pre-work status: Read `~/.claude/mindsystem/references/prework-status.md` and show what's done vs still needed for this phase
55
+ 11. Update `.planning/STATE.md` Last Command field:
56
+ - Format: `Last Command: ms:discuss-phase $ARGUMENTS | YYYY-MM-DD HH:MM`
56
57
 
57
58
  **CRITICAL: ALL questions use AskUserQuestion. Never ask inline text questions.**
58
59
  </process>
59
60
 
60
61
  <success_criteria>
61
62
 
62
- - Phase validated against roadmap
63
- - Vision gathered through collaborative thinking (not interrogation)
64
- - CONTEXT.md captures: how it works, what's essential
63
+ - Phase validated and milestone artifacts loaded (graceful if missing)
64
+ - Assumptions surfaced and validated before deep questioning
65
+ - Product research offered for user-facing phases
66
+ - Vision gathered through product-informed collaborative thinking (not interrogation)
67
+ - CONTEXT.md captures: how it works, what's essential, decisions with inline reasoning
68
+ - CONTEXT.md committed and STATE.md Last Command updated
65
69
  - User knows next steps (research or plan the phase)
66
70
  </success_criteria>
@@ -13,11 +13,15 @@ allowed-tools:
13
13
  ---
14
14
 
15
15
  <objective>
16
- Run comprehensive health checks on project configuration. Detect and fix structural drift across 6 categories: subsystem vocabulary, milestone directory structure, phase archival, knowledge files, phase summaries, and PLAN cleanup.
16
+ Run health checks on project configuration. Detect and fix structural drift across 8 categories: subsystem vocabulary, milestone directory structure, milestone naming convention, phase archival, knowledge files, phase summaries, PLAN cleanup, and CLI wrappers.
17
17
 
18
- Idempotent — safe to run repeatedly.
18
+ Idempotent.
19
19
  </objective>
20
20
 
21
+ <execution_context>
22
+ @~/.claude/mindsystem/workflows/doctor-fixes.md
23
+ </execution_context>
24
+
21
25
  <context>
22
26
  @.planning/config.json
23
27
  @.planning/MILESTONES.md
@@ -68,7 +72,7 @@ Proceed to next step.
68
72
  Run the diagnostic scan:
69
73
 
70
74
  ```bash
71
- ~/.claude/mindsystem/scripts/doctor-scan.sh
75
+ ms-tools doctor-scan
72
76
  ```
73
77
 
74
78
  Capture the full output. Parse each check's Status (PASS/FAIL/SKIP) and detail lines.
@@ -84,10 +88,12 @@ Display results as a markdown table:
84
88
  |--------------------------|--------|----------------------------------|
85
89
  | Subsystem vocabulary | PASS | 9 subsystems, all artifacts OK |
86
90
  | Milestone directories | FAIL | 2 flat files need restructuring |
91
+ | Milestone naming | FAIL | 2 version-prefixed dirs need migration |
87
92
  | Phase archival | FAIL | 8 orphaned phase directories |
88
93
  | Knowledge files | FAIL | Directory missing |
89
94
  | Phase summaries | FAIL | 2 milestones missing summaries |
90
95
  | PLAN cleanup | FAIL | 9 leftover PLAN.md files |
96
+ | CLI wrappers | FAIL | ms-tools not on PATH |
91
97
  ```
92
98
 
93
99
  Populate Result and Details from scan output. Use concise detail summaries.
@@ -109,210 +115,22 @@ If "Skip" → go to `report`.
109
115
 
110
116
  If "Review each" → use AskUserQuestion for each failed check with its details and options: "Fix" / "Skip". Only run fixes for accepted checks.
111
117
 
112
- Apply fixes in dependency order: fix_subsystems → fix_milestone_dirs → fix_phase_archival → fix_plan_cleanup → fix_knowledge. Skip any fix whose check passed or was skipped by user.
113
- </step>
114
-
115
- <step name="fix_subsystems">
116
- **Only if Subsystem Vocabulary failed.**
117
-
118
- If subsystems array is empty (State A):
119
-
120
- 1. Scan all artifacts for existing values:
121
-
122
- ```bash
123
- ~/.claude/mindsystem/scripts/scan-artifact-subsystems.sh --values-only
124
- ```
125
-
126
- 2. Read `.planning/PROJECT.md` and `.planning/ROADMAP.md`.
127
-
128
- 3. Derive 5-12 canonical subsystem identifiers from:
129
- - Unique values found in artifacts
130
- - Project domain from PROJECT.md
131
- - Phase structure from ROADMAP.md
132
-
133
- Rules:
134
- - Lowercase, single-word or hyphenated (e.g., "auth", "real-time", "ui")
135
- - Merge synonyms into one canonical value (pick shortest/most common)
136
- - Cover all existing usage plus obvious gaps
137
- - Include infrastructure-level subsystems if relevant (api, database, infra, testing)
138
-
139
- 4. Present the proposed list with merge mappings (e.g., "authentication" -> "auth").
140
-
141
- 5. Use AskUserQuestion:
142
- - header: "Subsystems"
143
- - question: "These subsystems were derived from your project. Look good?"
144
- - options:
145
- - "Looks good" — accept and apply
146
- - "Add/remove some" — iterate on the list
147
- - "Start over" — re-derive from scratch
148
-
149
- 6. After confirmation: update `config.json` (subsystems as first field), standardize existing artifact `subsystem:` fields using Edit tool.
150
-
151
- If subsystems exist but artifacts have mismatches (State B):
152
-
153
- 1. Classify each artifact as OK/MISMATCH/MISSING.
154
- 2. For MISMATCH: propose closest canonical value.
155
- 3. For MISSING: propose based on artifact content/path.
156
- 4. Apply fixes using Edit tool.
157
-
158
- Commit:
159
-
160
- ```bash
161
- git add .planning/config.json
162
- git add .planning/phases/*/*-SUMMARY.md 2>/dev/null
163
- git add .planning/adhoc/*-SUMMARY.md 2>/dev/null
164
- git add .planning/debug/*.md 2>/dev/null
165
- git add .planning/debug/resolved/*.md 2>/dev/null
166
- git add .planning/todos/pending/*.md 2>/dev/null
167
- git add .planning/todos/done/*.md 2>/dev/null
168
- ```
169
-
170
- ```bash
171
- git commit -m "$(cat <<'EOF'
172
- chore(doctor): fix subsystem vocabulary
173
-
174
- Standardized subsystem configuration and artifact values.
175
- EOF
176
- )"
177
- ```
178
- </step>
179
-
180
- <step name="fix_milestone_dirs">
181
- **Only if Milestone Directory Structure failed.**
182
-
183
- For each flat file like `milestones/v0.1-ROADMAP.md`:
184
-
185
- 1. Extract version prefix (e.g., `v0.1`).
186
- 2. Create versioned directory if it doesn't exist: `mkdir -p .planning/milestones/v0.1`
187
- 3. `git mv` the file, stripping the version prefix from the filename:
188
- `git mv .planning/milestones/v0.1-ROADMAP.md .planning/milestones/v0.1/ROADMAP.md`
189
-
190
- Commit:
191
-
192
- ```bash
193
- git add .planning/milestones/
194
- ```
195
-
196
- ```bash
197
- git commit -m "$(cat <<'EOF'
198
- chore(doctor): restructure milestone directories
199
-
200
- Moved flat milestone files into versioned directories.
201
- EOF
202
- )"
203
- ```
204
- </step>
205
-
206
- <step name="fix_phase_archival">
207
- **Only if Phase Archival failed.**
208
-
209
- Parse MILESTONES.md for completed milestones and their phase ranges (`**Phases completed:** X-Y`).
210
-
211
- For each completed milestone with orphaned phases in `.planning/phases/`:
212
-
213
- 1. Determine the version and phase range from MILESTONES.md.
214
- 2. Ensure the milestone directory exists: `mkdir -p .planning/milestones/{version}`
215
- 3. Run the archive script:
216
-
217
- ```bash
218
- ~/.claude/mindsystem/scripts/archive-milestone-phases.sh <start> <end> <version>
219
- ```
220
-
221
- This simultaneously:
222
- - Consolidates PHASE-SUMMARIES.md (fixes Phase Summaries check)
223
- - Deletes raw artifacts (CONTEXT, DESIGN, RESEARCH, SUMMARY, UAT, VERIFICATION)
224
- - Moves phase directories to milestone archive
118
+ Apply fixes in dependency order: fix_subsystems → fix_milestone_dirs → fix_milestone_naming → fix_phase_archival → fix_plan_cleanup → fix_knowledge. Skip any fix whose check passed or was skipped by user.
225
119
 
226
- **If MILESTONES.md doesn't have parseable phase ranges:** Use AskUserQuestion to ask the user for the phase range for each milestone.
227
-
228
- After archive completes, clean up leftover PLAN files in archived phases (fixes PLAN Cleanup check):
229
-
230
- ```bash
231
- find .planning/milestones/*/phases/ -name "*-PLAN.md" -delete 2>/dev/null
232
- ```
233
-
234
- Commit:
235
-
236
- ```bash
237
- git add .planning/phases/ .planning/milestones/
238
- ```
239
-
240
- ```bash
241
- git commit -m "$(cat <<'EOF'
242
- chore(doctor): archive completed milestone phases
243
-
244
- Consolidated summaries, deleted raw artifacts, moved phase directories.
245
- EOF
246
- )"
247
- ```
120
+ Phase summaries are resolved by fix_phase_archival. CLI wrappers require manual PATH configuration (no automated fix).
248
121
  </step>
249
122
 
250
- <step name="fix_plan_cleanup">
251
- **Only if PLAN Cleanup failed AND fix_phase_archival did not already handle it.**
252
-
253
- Delete leftover PLAN files in completed phase directories:
254
-
255
- ```bash
256
- find .planning/milestones/*/phases/ -name "*-PLAN.md" -delete 2>/dev/null
257
- ```
258
-
259
- For any leftover PLANs in `phases/` belonging to completed milestones (identified by the scan), delete those too.
260
-
261
- Commit:
262
-
263
- ```bash
264
- git add .planning/
265
- ```
266
-
267
- ```bash
268
- git commit -m "$(cat <<'EOF'
269
- chore(doctor): clean up leftover PLAN files
270
-
271
- Removed PLAN files from completed phase directories.
272
- EOF
273
- )"
274
- ```
275
- </step>
276
-
277
- <step name="fix_knowledge">
278
- **Only if Knowledge Files failed.**
279
-
280
- Spawn a `general-purpose` subagent (Task tool) to generate knowledge files retroactively. Provide the subagent with:
281
-
282
- - Subsystem vocabulary from config.json
283
- - Instructions to read all PHASE-SUMMARIES.md from `milestones/*/PHASE-SUMMARIES.md` AND any remaining SUMMARY files in `phases/`
284
- - The knowledge template at `~/.claude/mindsystem/templates/knowledge.md`
285
- - Instructions to read any existing knowledge files and merge (rewrite semantics — current state, not append)
286
- - Instructions to create `.planning/knowledge/` directory if missing
287
- - Instructions to write `.planning/knowledge/{subsystem}.md` for each missing subsystem
288
-
289
- After subagent completes, verify files exist:
290
-
291
- ```bash
292
- ls .planning/knowledge/*.md
293
- ```
294
-
295
- Commit:
296
-
297
- ```bash
298
- git add .planning/knowledge/
299
- ```
300
-
301
- ```bash
302
- git commit -m "$(cat <<'EOF'
303
- chore(doctor): generate knowledge files
304
-
305
- Created per-subsystem knowledge files from phase summaries.
306
- EOF
307
- )"
308
- ```
123
+ <step name="apply_fixes">
124
+ Execute fix steps from doctor-fixes workflow in dependency order. For "Fix all": run all
125
+ applicable steps. For "Review each": run only user-accepted steps. Skip any step whose
126
+ check passed.
309
127
  </step>
310
128
 
311
129
  <step name="verify">
312
130
  Re-run the diagnostic scan:
313
131
 
314
132
  ```bash
315
- ~/.claude/mindsystem/scripts/doctor-scan.sh
133
+ ms-tools doctor-scan
316
134
  ```
317
135
 
318
136
  All checks should now PASS. If any still fail, report which checks remain and why.
@@ -328,10 +146,12 @@ Final summary table:
328
146
  |--------------------------|--------|----------------------------------|
329
147
  | Subsystem vocabulary | PASS | ... |
330
148
  | Milestone directories | PASS | ... |
149
+ | Milestone naming | PASS | ... |
331
150
  | Phase archival | PASS | ... |
332
151
  | Knowledge files | PASS | ... |
333
152
  | Phase summaries | PASS | ... |
334
153
  | PLAN cleanup | PASS | ... |
154
+ | CLI wrappers | PASS | ... |
335
155
 
336
156
  All checks passed.
337
157
  ```
@@ -342,11 +162,11 @@ Include counts: checks total, passed, fixed during this run.
342
162
  </process>
343
163
 
344
164
  <success_criteria>
345
- - [ ] Each fix group committed atomically
346
- - [ ] Re-scan verifies all checks pass after fixes
347
165
  - [ ] User confirms fix strategy before changes (Fix all / Review each / Skip)
348
- - [ ] Fixes applied in dependency order: subsystems → dirs → archival → cleanup → knowledge
349
166
  - [ ] Results displayed as markdown table before any action
350
- - [ ] All 6 categories reported with PASS/FAIL/SKIP
167
+ - [ ] Re-scan verifies all checks pass after fixes
168
+ - [ ] Each fix group committed atomically
169
+ - [ ] Fixes applied in dependency order: subsystems → dirs → milestone naming → archival → cleanup → knowledge
170
+ - [ ] All 8 categories reported with PASS/FAIL/SKIP
351
171
  - [ ] Clean project reports all PASS with no fix prompts
352
172
  </success_criteria>
@@ -30,10 +30,9 @@ Context budget: ~15% orchestrator, 100% fresh per subagent.
30
30
  <context>
31
31
  Phase: $ARGUMENTS
32
32
 
33
- **Normalize phase number:**
33
+ **Resolve phase:**
34
34
  ```bash
35
- PHASE_ARG="$ARGUMENTS"
36
- PHASE=$(printf "%02d" "$PHASE_ARG" 2>/dev/null || echo "$PHASE_ARG")
35
+ ms-tools find-phase "$ARGUMENTS"
37
36
  ```
38
37
 
39
38
  @.planning/ROADMAP.md
@@ -53,7 +52,7 @@ PHASE=$(printf "%02d" "$PHASE_ARG" 2>/dev/null || echo "$PHASE_ARG")
53
52
  - Build list of incomplete plans
54
53
 
55
54
  3. **Validate and read execution order**
56
- - Run `validate-execution-order.sh` on phase directory
55
+ - Run `ms-tools validate-execution-order` on phase directory
57
56
  - Parse EXECUTION-ORDER.md wave structure
58
57
  - Report wave structure to user
59
58
 
@@ -62,7 +61,7 @@ PHASE=$(printf "%02d" "$PHASE_ARG" 2>/dev/null || echo "$PHASE_ARG")
62
61
  - Spawn `ms-executor` for each plan in wave (parallel Task calls)
63
62
  - Wait for completion (Task blocks)
64
63
  - Verify SUMMARYs created
65
- - Run `update-state.sh` to update plan progress
64
+ - Run `ms-tools update-state` to update plan progress
66
65
  - Proceed to next wave
67
66
 
68
67
  5. **Aggregate results**
@@ -85,7 +84,7 @@ PHASE=$(printf "%02d" "$PHASE_ARG" 2>/dev/null || echo "$PHASE_ARG")
85
84
  - If changes made: commit as `refactor({phase}): code review improvements`
86
85
 
87
86
  8. **Generate phase patch**
88
- - Run: `~/.claude/mindsystem/scripts/generate-phase-patch.sh ${PHASE_NUMBER}`
87
+ - Run: `ms-tools generate-phase-patch ${PHASE_NUMBER}`
89
88
  - Outputs to `.planning/phases/{phase_dir}/{phase}-changes.patch`
90
89
  - Verify: patch file exists OR skip message logged
91
90
  - Note: Patch captures all changes including simplifications
@@ -127,7 +126,19 @@ PHASE=$(printf "%02d" "$PHASE_ARG" 2>/dev/null || echo "$PHASE_ARG")
127
126
  <offer_next>
128
127
  **MANDATORY: Present copy/paste-ready next command.**
129
128
 
130
- After verification completes, route based on status:
129
+ After verification completes:
130
+
131
+ **First, surface user actions from all SUMMARYs:**
132
+
133
+ Extract `## User Actions Required` sections from all `*-SUMMARY.md` files in the phase directory. If any contain actions (not "None"), present before route-specific content:
134
+
135
+ ```
136
+ ## ⚠ Action Required
137
+
138
+ {Consolidated list from all SUMMARYs — deduplicate if overlapping}
139
+ ```
140
+
141
+ Then route based on status:
131
142
 
132
143
  | Status | Route |
133
144
  |--------|-------|