mindsystem-cc 3.18.1 → 3.19.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.
- package/agents/ms-plan-writer.md +50 -52
- package/commands/ms/check-phase.md +1 -1
- package/commands/ms/doctor.md +208 -80
- package/commands/ms/execute-phase.md +8 -8
- package/commands/ms/help.md +5 -5
- package/commands/ms/plan-phase.md +2 -1
- package/commands/ms/release-notes.md +32 -49
- package/mindsystem/references/prework-status.md +1 -1
- package/mindsystem/references/principles.md +2 -2
- package/mindsystem/references/scope-estimation.md +12 -13
- package/mindsystem/templates/phase-prompt.md +5 -6
- package/mindsystem/templates/roadmap.md +1 -1
- package/mindsystem/templates/verification-report.md +1 -1
- package/mindsystem/workflows/execute-phase.md +70 -70
- package/mindsystem/workflows/mockup-generation.md +24 -8
- package/mindsystem/workflows/plan-phase.md +54 -17
- package/mindsystem/workflows/verify-phase.md +1 -1
- package/package.json +1 -1
- package/scripts/doctor-scan.sh +379 -0
package/agents/ms-plan-writer.md
CHANGED
|
@@ -11,10 +11,11 @@ You are a Mindsystem plan writer. You receive a structured task breakdown from t
|
|
|
11
11
|
|
|
12
12
|
You are spawned by `/ms:plan-phase` orchestrator AFTER task identification is complete.
|
|
13
13
|
|
|
14
|
-
Your job: Transform task lists into
|
|
14
|
+
Your job: Transform task lists into PLAN.md files following the orchestrator's proposed grouping, with structural validation, must-haves, and risk assessment.
|
|
15
15
|
|
|
16
16
|
**What you receive:**
|
|
17
17
|
- Task list with needs/creates/tdd_candidate flags
|
|
18
|
+
- Proposed grouping from orchestrator (plan boundaries, wave assignments, budget estimates)
|
|
18
19
|
- Phase context (number, name, goal, directory, requirements)
|
|
19
20
|
- Project references (paths to STATE, ROADMAP, CONTEXT, prior summaries)
|
|
20
21
|
- Relevant learnings from past work (debug resolutions, adhoc insights, established patterns, prior decisions, curated cross-milestone learnings)
|
|
@@ -77,6 +78,17 @@ The orchestrator provides structured XML:
|
|
|
77
78
|
</prior_summaries>
|
|
78
79
|
</project_refs>
|
|
79
80
|
|
|
81
|
+
<proposed_grouping>
|
|
82
|
+
<plan id="01" title="Auth foundation" budget="30%" wave="1">
|
|
83
|
+
<tasks>1, 2, 3</tasks>
|
|
84
|
+
<rationale>Core models and config — no external dependencies</rationale>
|
|
85
|
+
</plan>
|
|
86
|
+
<plan id="02" title="Auth endpoints + UI" budget="40%" wave="2">
|
|
87
|
+
<tasks>4, 5, 6</tasks>
|
|
88
|
+
<rationale>Depends on models from Plan 01</rationale>
|
|
89
|
+
</plan>
|
|
90
|
+
</proposed_grouping>
|
|
91
|
+
|
|
80
92
|
<learnings>
|
|
81
93
|
<learning type="debug" source=".planning/debug/resolved/n-plus-one-queries.md">Missing eager loading on association chains — fix: Added includes() for all relationship traversals</learning>
|
|
82
94
|
<learning type="pattern" source=".planning/phases/02-foundation/02-01-SUMMARY.md">All API endpoints use Zod validation on input</learning>
|
|
@@ -150,46 +162,30 @@ Verify:
|
|
|
150
162
|
Wave assignments are written to EXECUTION-ORDER.md, not to individual plans.
|
|
151
163
|
</step>
|
|
152
164
|
|
|
153
|
-
<step name="
|
|
154
|
-
**
|
|
165
|
+
<step name="validate_and_apply_grouping">
|
|
166
|
+
**Apply the orchestrator's proposed grouping after structural validation.**
|
|
155
167
|
|
|
156
|
-
|
|
168
|
+
The orchestrator proposed plan boundaries collaboratively with the user. Start from these boundaries — do NOT re-derive grouping from budget math.
|
|
157
169
|
|
|
158
|
-
**
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
Sort tasks by feature affinity (vertical slice)
|
|
162
|
-
current_plan = new plan
|
|
163
|
-
current_budget = 0
|
|
164
|
-
|
|
165
|
-
For each task:
|
|
166
|
-
If task.tdd_candidate:
|
|
167
|
-
Create dedicated plan for this task (TDD plans always standalone)
|
|
168
|
-
Continue
|
|
169
|
-
|
|
170
|
-
task_cost = marginal_cost(task.weight)
|
|
171
|
-
If current_budget + task_cost > 45% AND current_plan not empty:
|
|
172
|
-
Finalize current_plan
|
|
173
|
-
current_plan = new plan
|
|
174
|
-
current_budget = 0
|
|
175
|
-
|
|
176
|
-
If no file conflicts with current_plan:
|
|
177
|
-
Add task to current_plan
|
|
178
|
-
current_budget += task_cost
|
|
179
|
-
Else:
|
|
180
|
-
Finalize current_plan
|
|
181
|
-
current_plan = new plan with this task
|
|
182
|
-
current_budget = task_cost
|
|
183
|
-
```
|
|
170
|
+
**If `<proposed_grouping>` is absent:** Stop and report the missing grouping to the orchestrator. Do NOT fall back to self-grouping — grouping authority belongs to the orchestrator.
|
|
171
|
+
|
|
172
|
+
**1. Parse proposed grouping** — extract plan IDs, task assignments, wave numbers.
|
|
184
173
|
|
|
185
|
-
**
|
|
174
|
+
**2. Validate structurally** against the dependency graph built in the previous step:
|
|
175
|
+
- **File conflicts:** Two tasks in the same parallel wave that modify the same file
|
|
176
|
+
- **Circular dependencies:** Plan A needs Plan B and Plan B needs Plan A
|
|
177
|
+
- **Missing dependency chains:** A task needs an artifact from another plan but isn't sequenced after it
|
|
178
|
+
- **TDD isolation:** Tasks marked `tdd_candidate` must be in dedicated plans
|
|
186
179
|
|
|
187
|
-
**
|
|
180
|
+
**3. Apply grouping:**
|
|
181
|
+
- If validation passes → use proposed boundaries as-is
|
|
182
|
+
- If structural issue found → adjust minimally to resolve (move conflicting task, add wave dependency). Record the deviation and reason in grouping rationale.
|
|
188
183
|
|
|
189
|
-
**
|
|
184
|
+
**4. Classify task weights** (L/M/H) for the grouping rationale table. Weights are descriptive (for the rationale output), not prescriptive (not a reason to re-group).
|
|
190
185
|
|
|
191
|
-
**
|
|
192
|
-
|
|
186
|
+
**5. Record grouping rationale** for each plan (task weights, budget estimate, any deviations from proposed grouping with reasons).
|
|
187
|
+
|
|
188
|
+
**Do NOT override proposed grouping because weight math exceeds 45%.** The orchestrator already considered context budget. Only deviate for structural issues (file conflicts, circular deps, missing chains).
|
|
193
189
|
</step>
|
|
194
190
|
|
|
195
191
|
<step name="derive_must_haves">
|
|
@@ -213,17 +209,14 @@ The verifier derives artifacts and key_links from the plan's ## Changes section.
|
|
|
213
209
|
</step>
|
|
214
210
|
|
|
215
211
|
<step name="estimate_scope">
|
|
216
|
-
**Verify each plan
|
|
212
|
+
**Verify each plan's scope is reasonable.**
|
|
217
213
|
|
|
218
214
|
Per plan:
|
|
219
|
-
- Sum weights
|
|
220
|
-
-
|
|
221
|
-
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
- Budget > 45%: Split by feature affinity
|
|
225
|
-
- 10+ files: Split by subsystem
|
|
226
|
-
- Under 10%: Merge with related same-wave plan
|
|
215
|
+
- Sum weights for grouping rationale table
|
|
216
|
+
- Count files modified
|
|
217
|
+
- Flag plans modifying 10+ files in grouping rationale
|
|
218
|
+
|
|
219
|
+
This step is informational. Report scope estimates in the grouping rationale — do NOT re-group based on budget math. The orchestrator already made grouping decisions with user input.
|
|
227
220
|
</step>
|
|
228
221
|
|
|
229
222
|
<step name="write_plan_files">
|
|
@@ -419,10 +412,15 @@ Return structured markdown to orchestrator:
|
|
|
419
412
|
|
|
420
413
|
### Grouping Rationale
|
|
421
414
|
|
|
422
|
-
| Plan | Tasks | Est.
|
|
423
|
-
|
|
424
|
-
| 01 | 4 (L+L+L+M) | ~25% |
|
|
425
|
-
| 02 | 3 (M+M+M) | ~30% |
|
|
415
|
+
| Plan | Tasks | Est. Weight | Notes |
|
|
416
|
+
|------|-------|-------------|-------|
|
|
417
|
+
| 01 | 4 (L+L+L+M) | ~25% | Per orchestrator proposal |
|
|
418
|
+
| 02 | 3 (M+M+M) | ~30% | Per orchestrator proposal |
|
|
419
|
+
|
|
420
|
+
{If any deviations from proposed grouping:}
|
|
421
|
+
|
|
422
|
+
### Grouping Deviations
|
|
423
|
+
- **Plan 03 split from Plan 02:** File conflict — both tasks modify `src/config.ts`
|
|
426
424
|
|
|
427
425
|
### Risk Assessment
|
|
428
426
|
|
|
@@ -440,7 +438,7 @@ Return structured markdown to orchestrator:
|
|
|
440
438
|
- ...
|
|
441
439
|
```
|
|
442
440
|
|
|
443
|
-
**Include Grouping Rationale**
|
|
441
|
+
**Include Grouping Rationale** when any deviation from proposed grouping occurred. Omit when proposed grouping was applied as-is.
|
|
444
442
|
|
|
445
443
|
The orchestrator parses this to present risk via AskUserQuestion and offer next steps.
|
|
446
444
|
</output_format>
|
|
@@ -458,8 +456,8 @@ Plan 02 does not depend on Plan 01 just because 01 comes first. Check actual nee
|
|
|
458
456
|
Bad: Plan 01 = all models, Plan 02 = all APIs
|
|
459
457
|
Good: Plan 01 = User (model + API), Plan 02 = Product (model + API)
|
|
460
458
|
|
|
461
|
-
**DO NOT
|
|
462
|
-
|
|
459
|
+
**DO NOT override proposed grouping for budget reasons.**
|
|
460
|
+
The orchestrator's grouping reflects collaborative decisions with the user. Deviate only for structural issues (file conflicts, circular deps). Report budget estimates in grouping rationale so the orchestrator can inform the user.
|
|
463
461
|
|
|
464
462
|
**DO NOT write implementation-focused truths.**
|
|
465
463
|
Bad: "bcrypt library installed"
|
|
@@ -477,7 +475,7 @@ Plan writing complete when:
|
|
|
477
475
|
- [ ] References loaded (phase-prompt, plan-format, scope-estimation, + tdd if needed)
|
|
478
476
|
- [ ] Dependency graph built from needs/creates
|
|
479
477
|
- [ ] Waves assigned (all roots wave 1, dependents correct)
|
|
480
|
-
- [ ]
|
|
478
|
+
- [ ] Proposed grouping validated structurally and applied (deviations only for file conflicts/circular deps)
|
|
481
479
|
- [ ] Must-haves derived as markdown checklists
|
|
482
480
|
- [ ] PLAN.md files written with pure markdown format
|
|
483
481
|
- [ ] EXECUTION-ORDER.md generated with wave groups
|
|
@@ -21,7 +21,7 @@ This spawns ms-plan-checker to analyze your PLAN.md files against the phase goal
|
|
|
21
21
|
2. **Task Completeness** — Does every change have Files, implementation details, and verification?
|
|
22
22
|
3. **Dependency Correctness** — Are plan dependencies valid and acyclic?
|
|
23
23
|
4. **Key Links Planned** — Are artifacts wired together, not just created in isolation?
|
|
24
|
-
5. **Scope Sanity** —
|
|
24
|
+
5. **Scope Sanity** — Are plans reasonably sized for context budget (target 25-45%)?
|
|
25
25
|
6. **Verification Derivation** — Are Must-Haves user-observable, not implementation-focused?
|
|
26
26
|
7. **Context Compliance** — Do plans honor decisions from CONTEXT.md?
|
|
27
27
|
</what_it_checks>
|
package/commands/ms/doctor.md
CHANGED
|
@@ -8,19 +8,19 @@ allowed-tools:
|
|
|
8
8
|
- Bash
|
|
9
9
|
- Glob
|
|
10
10
|
- Grep
|
|
11
|
+
- Task
|
|
11
12
|
- AskUserQuestion
|
|
12
13
|
---
|
|
13
14
|
|
|
14
15
|
<objective>
|
|
15
|
-
Run health checks on project configuration. Detect and fix
|
|
16
|
-
|
|
17
|
-
V1 check: subsystem vocabulary setup and validation. Ensures `.planning/config.json` has a canonical `subsystems` array and all artifacts use values from it.
|
|
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.
|
|
18
17
|
|
|
19
18
|
Idempotent — safe to run repeatedly.
|
|
20
19
|
</objective>
|
|
21
20
|
|
|
22
21
|
<context>
|
|
23
22
|
@.planning/config.json
|
|
23
|
+
@.planning/MILESTONES.md
|
|
24
24
|
</context>
|
|
25
25
|
|
|
26
26
|
<process>
|
|
@@ -64,55 +64,98 @@ Write to `.planning/config.json`. Log: "Created config.json with empty subsystem
|
|
|
64
64
|
Proceed to next step.
|
|
65
65
|
</step>
|
|
66
66
|
|
|
67
|
-
<step name="
|
|
67
|
+
<step name="run_scan">
|
|
68
|
+
Run the diagnostic scan:
|
|
69
|
+
|
|
68
70
|
```bash
|
|
69
|
-
|
|
71
|
+
~/.claude/mindsystem/scripts/doctor-scan.sh
|
|
70
72
|
```
|
|
71
73
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
+
Capture the full output. Parse each check's Status (PASS/FAIL/SKIP) and detail lines.
|
|
75
|
+
</step>
|
|
76
|
+
|
|
77
|
+
<step name="present_results">
|
|
78
|
+
Display results as a markdown table:
|
|
79
|
+
|
|
80
|
+
```
|
|
81
|
+
## Doctor Report
|
|
82
|
+
|
|
83
|
+
| Check | Result | Details |
|
|
84
|
+
|--------------------------|--------|----------------------------------|
|
|
85
|
+
| Subsystem vocabulary | PASS | 9 subsystems, all artifacts OK |
|
|
86
|
+
| Milestone directories | FAIL | 2 flat files need restructuring |
|
|
87
|
+
| Phase archival | FAIL | 8 orphaned phase directories |
|
|
88
|
+
| Knowledge files | FAIL | Directory missing |
|
|
89
|
+
| Phase summaries | FAIL | 2 milestones missing summaries |
|
|
90
|
+
| PLAN cleanup | FAIL | 9 leftover PLAN.md files |
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
Populate Result and Details from scan output. Use concise detail summaries.
|
|
94
|
+
|
|
95
|
+
If all PASS → go to `report`.
|
|
96
|
+
If any FAIL → go to `confirm_action`.
|
|
74
97
|
</step>
|
|
75
98
|
|
|
76
|
-
<step name="
|
|
77
|
-
|
|
99
|
+
<step name="confirm_action">
|
|
100
|
+
Use AskUserQuestion:
|
|
101
|
+
- header: "Fix issues"
|
|
102
|
+
- question: "How would you like to handle the failed checks?"
|
|
103
|
+
- options:
|
|
104
|
+
- "Fix all" — apply all fixes in dependency order
|
|
105
|
+
- "Review each" — present each failed check individually for decision
|
|
106
|
+
- "Skip" — leave as-is, report only
|
|
107
|
+
|
|
108
|
+
If "Skip" → go to `report`.
|
|
109
|
+
|
|
110
|
+
If "Review each" → use AskUserQuestion for each failed check with its details and options: "Fix" / "Skip". Only run fixes for accepted checks.
|
|
111
|
+
|
|
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:
|
|
78
121
|
|
|
79
122
|
```bash
|
|
80
123
|
~/.claude/mindsystem/scripts/scan-artifact-subsystems.sh --values-only
|
|
81
124
|
```
|
|
82
125
|
|
|
83
|
-
|
|
84
|
-
</step>
|
|
126
|
+
2. Read `.planning/PROJECT.md` and `.planning/ROADMAP.md`.
|
|
85
127
|
|
|
86
|
-
|
|
87
|
-
|
|
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
|
|
88
132
|
|
|
89
|
-
|
|
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)
|
|
90
138
|
|
|
91
|
-
|
|
92
|
-
2. Project domain from PROJECT.md
|
|
93
|
-
3. Phase structure from ROADMAP.md
|
|
139
|
+
4. Present the proposed list with merge mappings (e.g., "authentication" -> "auth").
|
|
94
140
|
|
|
95
|
-
|
|
96
|
-
-
|
|
97
|
-
-
|
|
98
|
-
-
|
|
99
|
-
-
|
|
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
|
|
100
148
|
|
|
101
|
-
|
|
149
|
+
6. After confirmation: update `config.json` (subsystems as first field), standardize existing artifact `subsystem:` fields using Edit tool.
|
|
102
150
|
|
|
103
|
-
|
|
104
|
-
- header: "Subsystems"
|
|
105
|
-
- question: "These subsystems were derived from your project. Look good?"
|
|
106
|
-
- options:
|
|
107
|
-
- "Looks good" — accept and apply
|
|
108
|
-
- "Add/remove some" — iterate on the list
|
|
109
|
-
- "Start over" — re-derive from scratch
|
|
151
|
+
If subsystems exist but artifacts have mismatches (State B):
|
|
110
152
|
|
|
111
|
-
|
|
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.
|
|
112
157
|
|
|
113
|
-
|
|
114
|
-
2. If existing artifacts had free-form values, standardize each `subsystem:` field to the canonical value using the Edit tool (only modify the `subsystem:` line, never body content)
|
|
115
|
-
3. Commit all changes:
|
|
158
|
+
Commit:
|
|
116
159
|
|
|
117
160
|
```bash
|
|
118
161
|
git add .planning/config.json
|
|
@@ -126,99 +169,184 @@ git add .planning/todos/done/*.md 2>/dev/null
|
|
|
126
169
|
|
|
127
170
|
```bash
|
|
128
171
|
git commit -m "$(cat <<'EOF'
|
|
129
|
-
chore:
|
|
172
|
+
chore(doctor): fix subsystem vocabulary
|
|
130
173
|
|
|
131
|
-
|
|
174
|
+
Standardized subsystem configuration and artifact values.
|
|
132
175
|
EOF
|
|
133
176
|
)"
|
|
134
177
|
```
|
|
135
178
|
</step>
|
|
136
179
|
|
|
137
|
-
<step name="
|
|
138
|
-
**
|
|
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
|
|
225
|
+
|
|
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):
|
|
139
229
|
|
|
140
230
|
```bash
|
|
141
|
-
|
|
231
|
+
find .planning/milestones/*/phases/ -name "*-PLAN.md" -delete 2>/dev/null
|
|
142
232
|
```
|
|
143
233
|
|
|
144
|
-
|
|
234
|
+
Commit:
|
|
145
235
|
|
|
146
236
|
```bash
|
|
147
|
-
|
|
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
|
+
)"
|
|
148
247
|
```
|
|
248
|
+
</step>
|
|
149
249
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
- **MISMATCH** — value exists but not in canonical list
|
|
153
|
-
- **MISSING** — no `subsystem:` field found
|
|
250
|
+
<step name="fix_plan_cleanup">
|
|
251
|
+
**Only if PLAN Cleanup failed AND fix_phase_archival did not already handle it.**
|
|
154
252
|
|
|
155
|
-
|
|
253
|
+
Delete leftover PLAN files in completed phase directories:
|
|
156
254
|
|
|
255
|
+
```bash
|
|
256
|
+
find .planning/milestones/*/phases/ -name "*-PLAN.md" -delete 2>/dev/null
|
|
157
257
|
```
|
|
158
|
-
## Subsystem Vocabulary
|
|
159
258
|
|
|
160
|
-
|
|
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/
|
|
161
265
|
```
|
|
162
266
|
|
|
163
|
-
|
|
267
|
+
```bash
|
|
268
|
+
git commit -m "$(cat <<'EOF'
|
|
269
|
+
chore(doctor): clean up leftover PLAN files
|
|
164
270
|
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
- "Review each" — present each issue individually for decision
|
|
171
|
-
- "Skip" — leave as-is
|
|
271
|
+
Removed PLAN files from completed phase directories.
|
|
272
|
+
EOF
|
|
273
|
+
)"
|
|
274
|
+
```
|
|
275
|
+
</step>
|
|
172
276
|
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
- MISSING: propose based on artifact content/path context
|
|
277
|
+
<step name="fix_knowledge">
|
|
278
|
+
**Only if Knowledge Files failed.**
|
|
176
279
|
|
|
177
|
-
|
|
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:
|
|
178
290
|
|
|
179
291
|
```bash
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
292
|
+
ls .planning/knowledge/*.md
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
Commit:
|
|
296
|
+
|
|
297
|
+
```bash
|
|
298
|
+
git add .planning/knowledge/
|
|
186
299
|
```
|
|
187
300
|
|
|
188
301
|
```bash
|
|
189
302
|
git commit -m "$(cat <<'EOF'
|
|
190
|
-
chore:
|
|
303
|
+
chore(doctor): generate knowledge files
|
|
191
304
|
|
|
192
|
-
|
|
305
|
+
Created per-subsystem knowledge files from phase summaries.
|
|
193
306
|
EOF
|
|
194
307
|
)"
|
|
195
308
|
```
|
|
196
309
|
</step>
|
|
197
310
|
|
|
311
|
+
<step name="verify">
|
|
312
|
+
Re-run the diagnostic scan:
|
|
313
|
+
|
|
314
|
+
```bash
|
|
315
|
+
~/.claude/mindsystem/scripts/doctor-scan.sh
|
|
316
|
+
```
|
|
317
|
+
|
|
318
|
+
All checks should now PASS. If any still fail, report which checks remain and why.
|
|
319
|
+
</step>
|
|
320
|
+
|
|
198
321
|
<step name="report">
|
|
199
|
-
Final summary:
|
|
322
|
+
Final summary table:
|
|
200
323
|
|
|
201
324
|
```
|
|
202
325
|
## Doctor Report
|
|
203
326
|
|
|
204
|
-
| Check
|
|
205
|
-
|
|
206
|
-
| Subsystem vocabulary
|
|
327
|
+
| Check | Result | Details |
|
|
328
|
+
|--------------------------|--------|----------------------------------|
|
|
329
|
+
| Subsystem vocabulary | PASS | ... |
|
|
330
|
+
| Milestone directories | PASS | ... |
|
|
331
|
+
| Phase archival | PASS | ... |
|
|
332
|
+
| Knowledge files | PASS | ... |
|
|
333
|
+
| Phase summaries | PASS | ... |
|
|
334
|
+
| PLAN cleanup | PASS | ... |
|
|
207
335
|
|
|
208
336
|
All checks passed.
|
|
209
337
|
```
|
|
210
338
|
|
|
211
|
-
|
|
212
|
-
- **INIT**: subsystems were initialized during this run
|
|
213
|
-
- Include artifact count (how many scanned) and subsystem count
|
|
339
|
+
Include counts: checks total, passed, fixed during this run.
|
|
214
340
|
</step>
|
|
215
341
|
|
|
216
342
|
</process>
|
|
217
343
|
|
|
218
344
|
<success_criteria>
|
|
219
|
-
- [ ]
|
|
220
|
-
- [ ]
|
|
221
|
-
- [ ]
|
|
222
|
-
- [ ]
|
|
223
|
-
- [ ]
|
|
345
|
+
- [ ] Each fix group committed atomically
|
|
346
|
+
- [ ] Re-scan verifies all checks pass after fixes
|
|
347
|
+
- [ ] User confirms fix strategy before changes (Fix all / Review each / Skip)
|
|
348
|
+
- [ ] Fixes applied in dependency order: subsystems → dirs → archival → cleanup → knowledge
|
|
349
|
+
- [ ] Results displayed as markdown table before any action
|
|
350
|
+
- [ ] All 6 categories reported with PASS/FAIL/SKIP
|
|
351
|
+
- [ ] Clean project reports all PASS with no fix prompts
|
|
224
352
|
</success_criteria>
|
|
@@ -69,21 +69,21 @@ PHASE=$(printf "%02d" "$PHASE_ARG" 2>/dev/null || echo "$PHASE_ARG")
|
|
|
69
69
|
- Collect summaries from all plans
|
|
70
70
|
- Report phase completion status
|
|
71
71
|
|
|
72
|
-
6. **
|
|
73
|
-
- Read `code_review.phase` from config.json (default: `ms-code-simplifier`)
|
|
74
|
-
- If `"skip"`: proceed to step 7
|
|
75
|
-
- Spawn code review agent with phase file scope
|
|
76
|
-
- If changes made: commit as `refactor({phase}): code review improvements`
|
|
77
|
-
|
|
78
|
-
7. **Verify phase goal**
|
|
72
|
+
6. **Verify phase goal**
|
|
79
73
|
- Spawn `ms-verifier` subagent with phase directory and goal
|
|
80
74
|
- Verifier checks Must-Haves against actual codebase (not SUMMARY claims)
|
|
81
75
|
- Creates VERIFICATION.md with detailed report
|
|
82
76
|
- Route by status:
|
|
83
|
-
- `passed` → continue to step
|
|
77
|
+
- `passed` → continue to step 7
|
|
84
78
|
- `human_needed` → present items, get approval or feedback
|
|
85
79
|
- `gaps_found` → present gaps, offer `/ms:plan-phase {X} --gaps`
|
|
86
80
|
|
|
81
|
+
7. **Code review (optional)**
|
|
82
|
+
- Read `code_review.phase` from config.json (default: `ms-code-simplifier`)
|
|
83
|
+
- If `"skip"`: proceed to step 8
|
|
84
|
+
- Spawn code review agent with phase file scope
|
|
85
|
+
- If changes made: commit as `refactor({phase}): code review improvements`
|
|
86
|
+
|
|
87
87
|
8. **Generate phase patch**
|
|
88
88
|
- Run: `~/.claude/mindsystem/scripts/generate-phase-patch.sh ${PHASE_NUMBER}`
|
|
89
89
|
- Outputs to `.planning/phases/{phase_dir}/{phase}-changes.patch`
|
package/commands/ms/help.md
CHANGED
|
@@ -377,12 +377,12 @@ Usage: `/ms:adhoc Fix auth token not refreshing on 401`
|
|
|
377
377
|
### Utility Commands
|
|
378
378
|
|
|
379
379
|
**`/ms:doctor`**
|
|
380
|
-
Health check and fix project configuration.
|
|
380
|
+
Health check and fix project configuration — subsystems, milestone structure, knowledge files.
|
|
381
381
|
|
|
382
|
-
- Use when:
|
|
383
|
-
-
|
|
384
|
-
-
|
|
385
|
-
-
|
|
382
|
+
- Use when: project has structural drift, missing config, or periodic health check
|
|
383
|
+
- Runs 6 checks: subsystem vocabulary, milestone directories, phase archival, knowledge files, phase summaries, PLAN cleanup
|
|
384
|
+
- Presents results table, then offers to fix all issues in dependency order
|
|
385
|
+
- Each fix group gets its own atomic commit
|
|
386
386
|
- Idempotent — safe to run repeatedly
|
|
387
387
|
|
|
388
388
|
Usage: `/ms:doctor`
|
|
@@ -90,7 +90,8 @@ Check for `.planning/codebase/` and load relevant documents based on phase type.
|
|
|
90
90
|
- Perform mandatory discovery (Level 0-3 as appropriate)
|
|
91
91
|
- Scan project history via context scanner script (prior decisions, issues, debug resolutions, adhoc learnings, cross-milestone patterns)
|
|
92
92
|
- Break phase into tasks
|
|
93
|
-
-
|
|
93
|
+
- Propose plan grouping (plan boundaries, wave structure, budget estimates) for user review
|
|
94
|
+
- Hand off tasks + proposed grouping to plan-writer subagent
|
|
94
95
|
- Create PLAN.md file(s) with executable structure
|
|
95
96
|
|
|
96
97
|
**Gap closure mode (--gaps flag):**
|