mindsystem-cc 3.14.0 → 3.16.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 (48) hide show
  1. package/README.md +1 -0
  2. package/agents/ms-codebase-researcher.md +105 -0
  3. package/agents/ms-consolidator.md +137 -286
  4. package/agents/ms-debugger.md +1 -0
  5. package/agents/ms-designer.md +1 -0
  6. package/agents/ms-executor.md +2 -1
  7. package/agents/ms-flutter-reviewer.md +1 -0
  8. package/agents/ms-integration-checker.md +1 -0
  9. package/agents/ms-plan-checker.md +17 -327
  10. package/agents/ms-researcher.md +25 -343
  11. package/agents/ms-roadmapper.md +10 -75
  12. package/agents/ms-verifier.md +33 -309
  13. package/agents/ms-verify-fixer.md +1 -0
  14. package/commands/ms/check-phase.md +24 -55
  15. package/commands/ms/complete-milestone.md +6 -25
  16. package/commands/ms/create-roadmap.md +3 -15
  17. package/commands/ms/design-phase.md +34 -0
  18. package/commands/ms/discuss-phase.md +1 -9
  19. package/commands/ms/doctor.md +224 -0
  20. package/commands/ms/execute-phase.md +22 -12
  21. package/commands/ms/help.md +11 -0
  22. package/commands/ms/new-milestone.md +3 -3
  23. package/commands/ms/plan-phase.md +1 -1
  24. package/commands/ms/research-phase.md +249 -85
  25. package/commands/ms/verify-work.md +1 -0
  26. package/mindsystem/templates/context.md +1 -11
  27. package/mindsystem/templates/discovery.md +2 -3
  28. package/mindsystem/templates/knowledge.md +99 -0
  29. package/mindsystem/templates/requirements.md +3 -61
  30. package/mindsystem/templates/research-comparison-output.md +50 -0
  31. package/mindsystem/templates/research-feasibility-output.md +43 -0
  32. package/mindsystem/templates/research-project-output.md +81 -0
  33. package/mindsystem/templates/research-subagent-prompt.md +164 -48
  34. package/mindsystem/templates/roadmap-milestone.md +67 -0
  35. package/mindsystem/templates/roadmap.md +2 -66
  36. package/mindsystem/workflows/complete-milestone.md +23 -140
  37. package/mindsystem/workflows/define-requirements.md +4 -8
  38. package/mindsystem/workflows/discuss-phase.md +25 -8
  39. package/mindsystem/workflows/execute-phase.md +34 -0
  40. package/mindsystem/workflows/execute-plan.md +8 -0
  41. package/mindsystem/workflows/plan-phase.md +40 -102
  42. package/mindsystem/workflows/verify-work.md +20 -0
  43. package/package.json +1 -1
  44. package/scripts/cleanup-phase-artifacts.sh +68 -0
  45. package/scripts/scan-artifact-subsystems.sh +55 -0
  46. package/scripts/scan-planning-context.py +689 -0
  47. package/mindsystem/templates/decisions.md +0 -145
  48. package/mindsystem/templates/learnings.md +0 -150
@@ -112,6 +112,8 @@ If no `## Must-Haves` section found in plans, derive using goal-backward process
112
112
 
113
113
  - List 3-7 observable behaviors from user perspective
114
114
  - Each truth should be testable by a human using the app
115
+ - Good: "User can see existing messages in the chat" (observable, testable)
116
+ - Bad: "Chat component works correctly" (vague, untestable)
115
117
 
116
118
  3. **Derive artifacts:** For each truth, ask "What must EXIST?"
117
119
 
@@ -150,109 +152,26 @@ For each required artifact, verify three levels:
150
152
 
151
153
  ### Level 1: Existence
152
154
 
153
- ```bash
154
- check_exists() {
155
- local path="$1"
156
- if [ -f "$path" ]; then
157
- echo "EXISTS"
158
- elif [ -d "$path" ]; then
159
- echo "EXISTS (directory)"
160
- else
161
- echo "MISSING"
162
- fi
163
- }
164
- ```
165
-
166
- If MISSING → artifact fails, record and continue.
155
+ Check the file or directory exists. If MISSING → artifact fails, record and continue.
167
156
 
168
157
  ### Level 2: Substantive
169
158
 
170
- Check that the file has real implementation, not a stub.
171
-
172
- **Line count check:**
173
-
174
- ```bash
175
- check_length() {
176
- local path="$1"
177
- local min_lines="$2"
178
- local lines=$(wc -l < "$path" 2>/dev/null || echo 0)
179
- [ "$lines" -ge "$min_lines" ] && echo "SUBSTANTIVE ($lines lines)" || echo "THIN ($lines lines)"
180
- }
181
- ```
182
-
183
- Minimum lines by type:
184
-
185
- - Component: 15+ lines
186
- - API route: 10+ lines
187
- - Hook/util: 10+ lines
188
- - Schema model: 5+ lines
189
-
190
- **Stub pattern check:**
191
-
192
- ```bash
193
- check_stubs() {
194
- local path="$1"
195
-
196
- # Universal stub patterns
197
- local stubs=$(grep -c -E "TODO|FIXME|placeholder|not implemented|coming soon" "$path" 2>/dev/null || echo 0)
198
-
199
- # Empty returns
200
- local empty=$(grep -c -E "return null|return undefined|return \{\}|return \[\]" "$path" 2>/dev/null || echo 0)
201
-
202
- # Placeholder content
203
- local placeholder=$(grep -c -E "will be here|placeholder|lorem ipsum" "$path" 2>/dev/null || echo 0)
204
-
205
- local total=$((stubs + empty + placeholder))
206
- [ "$total" -gt 0 ] && echo "STUB_PATTERNS ($total found)" || echo "NO_STUBS"
207
- }
208
- ```
209
-
210
- **Export check (for components/hooks):**
159
+ Verify the file has real implementation, not a stub:
211
160
 
212
- ```bash
213
- check_exports() {
214
- local path="$1"
215
- grep -E "^export (default )?(function|const|class)" "$path" && echo "HAS_EXPORTS" || echo "NO_EXPORTS"
216
- }
217
- ```
218
-
219
- **Combine level 2 results:**
161
+ 1. **Adequate length** for its type — component: 15+ lines, route: 10+, hook/util: 10+, schema: 5+
162
+ 2. **No stub patterns** — grep for: `TODO`, `FIXME`, `placeholder`, `not implemented`, `coming soon`, `return null`, `return undefined`, `return {}`, `return []`, `lorem ipsum`
163
+ 3. **Has exports** — the file exports its primary functionality
220
164
 
221
- - SUBSTANTIVE: Adequate length + no stubs + has exports
222
- - STUB: Too short OR has stub patterns OR no exports
223
- - PARTIAL: Mixed signals (length OK but has some stubs)
165
+ **Status:** SUBSTANTIVE (all pass), STUB (too short OR stub patterns OR no exports), PARTIAL (mixed signals)
224
166
 
225
167
  ### Level 3: Wired
226
168
 
227
- Check that the artifact is connected to the system.
228
-
229
- **Import check (is it used?):**
230
-
231
- ```bash
232
- check_imported() {
233
- local artifact_name="$1"
234
- local search_path="${2:-src/}"
235
- local imports=$(grep -r "import.*$artifact_name" "$search_path" --include="*.ts" --include="*.tsx" 2>/dev/null | wc -l)
236
- [ "$imports" -gt 0 ] && echo "IMPORTED ($imports times)" || echo "NOT_IMPORTED"
237
- }
238
- ```
239
-
240
- **Usage check (is it called?):**
241
-
242
- ```bash
243
- check_used() {
244
- local artifact_name="$1"
245
- local search_path="${2:-src/}"
246
- local uses=$(grep -r "$artifact_name" "$search_path" --include="*.ts" --include="*.tsx" 2>/dev/null | grep -v "import" | wc -l)
247
- [ "$uses" -gt 0 ] && echo "USED ($uses times)" || echo "NOT_USED"
248
- }
249
- ```
169
+ Verify the artifact is connected to the system. Adapt grep patterns to the project's tech stack (file extensions, import syntax, module system):
250
170
 
251
- **Combine level 3 results:**
171
+ 1. **Imported** other files reference/import the artifact
172
+ 2. **Used** — the artifact is called/rendered/instantiated (not just imported)
252
173
 
253
- - WIRED: Imported AND used
254
- - ORPHANED: Exists but not imported/used
255
- - PARTIAL: Imported but not used (or vice versa)
174
+ **Status:** WIRED (imported AND used), ORPHANED (exists but not imported/used), PARTIAL (imported but not used or vice versa)
256
175
 
257
176
  ### Final artifact status
258
177
 
@@ -265,112 +184,21 @@ check_used() {
265
184
 
266
185
  ## Step 5: Verify Key Links (Wiring)
267
186
 
268
- Key links are critical connections. If broken, the goal fails even with all artifacts present.
269
-
270
- ### Pattern: Component → API
187
+ Key links are critical connections. If broken, the goal fails even with all artifacts present. This is where 80% of stubs hide — the pieces exist but aren't connected.
271
188
 
272
- ```bash
273
- verify_component_api_link() {
274
- local component="$1"
275
- local api_path="$2"
276
-
277
- # Check for fetch/axios call to the API
278
- local has_call=$(grep -E "fetch\(['\"].*$api_path|axios\.(get|post).*$api_path" "$component" 2>/dev/null)
279
-
280
- if [ -n "$has_call" ]; then
281
- # Check if response is used
282
- local uses_response=$(grep -A 5 "fetch\|axios" "$component" | grep -E "await|\.then|setData|setState" 2>/dev/null)
283
-
284
- if [ -n "$uses_response" ]; then
285
- echo "WIRED: $component → $api_path (call + response handling)"
286
- else
287
- echo "PARTIAL: $component → $api_path (call exists but response not used)"
288
- fi
289
- else
290
- echo "NOT_WIRED: $component → $api_path (no call found)"
291
- fi
292
- }
293
- ```
294
-
295
- ### Pattern: API → Database
296
-
297
- ```bash
298
- verify_api_db_link() {
299
- local route="$1"
300
- local model="$2"
301
-
302
- # Check for Prisma/DB call
303
- local has_query=$(grep -E "prisma\.$model|db\.$model|$model\.(find|create|update|delete)" "$route" 2>/dev/null)
304
-
305
- if [ -n "$has_query" ]; then
306
- # Check if result is returned
307
- local returns_result=$(grep -E "return.*json.*\w+|res\.json\(\w+" "$route" 2>/dev/null)
308
-
309
- if [ -n "$returns_result" ]; then
310
- echo "WIRED: $route → database ($model)"
311
- else
312
- echo "PARTIAL: $route → database (query exists but result not returned)"
313
- fi
314
- else
315
- echo "NOT_WIRED: $route → database (no query for $model)"
316
- fi
317
- }
318
- ```
189
+ Identify the project's tech stack from file extensions and project structure. For each key link, verify the connection using grep patterns appropriate to the technology.
319
190
 
320
- ### Pattern: Form Handler
191
+ **Common link types to check:**
321
192
 
322
- ```bash
323
- verify_form_handler_link() {
324
- local component="$1"
325
-
326
- # Find onSubmit handler
327
- local has_handler=$(grep -E "onSubmit=\{|handleSubmit" "$component" 2>/dev/null)
328
-
329
- if [ -n "$has_handler" ]; then
330
- # Check if handler has real implementation
331
- local handler_content=$(grep -A 10 "onSubmit.*=" "$component" | grep -E "fetch|axios|mutate|dispatch" 2>/dev/null)
332
-
333
- if [ -n "$handler_content" ]; then
334
- echo "WIRED: form → handler (has API call)"
335
- else
336
- # Check for stub patterns
337
- local is_stub=$(grep -A 5 "onSubmit" "$component" | grep -E "console\.log|preventDefault\(\)$|\{\}" 2>/dev/null)
338
- if [ -n "$is_stub" ]; then
339
- echo "STUB: form → handler (only logs or empty)"
340
- else
341
- echo "PARTIAL: form → handler (exists but unclear implementation)"
342
- fi
343
- fi
344
- else
345
- echo "NOT_WIRED: form → handler (no onSubmit found)"
346
- fi
347
- }
348
- ```
193
+ - **UI → Data source:** Component/widget fetches or subscribes to data. Verify the call exists AND the response is used (not just fired and ignored).
194
+ - **Data layer → Backend/DB:** API route or repository queries the database. Verify the query result is returned/used (not a static placeholder).
195
+ - **User action → Handler:** Form/button has a handler with real implementation. Red flag: handler only logs, only prevents default, or is an empty closure.
196
+ - **State → Display:** State variable or model is declared AND rendered/displayed (not just stored).
349
197
 
350
- ### Pattern: State Render
198
+ **For each link, verify two things:**
351
199
 
352
- ```bash
353
- verify_state_render_link() {
354
- local component="$1"
355
- local state_var="$2"
356
-
357
- # Check if state variable exists
358
- local has_state=$(grep -E "useState.*$state_var|\[$state_var," "$component" 2>/dev/null)
359
-
360
- if [ -n "$has_state" ]; then
361
- # Check if state is used in JSX
362
- local renders_state=$(grep -E "\{.*$state_var.*\}|\{$state_var\." "$component" 2>/dev/null)
363
-
364
- if [ -n "$renders_state" ]; then
365
- echo "WIRED: state → render ($state_var displayed)"
366
- else
367
- echo "NOT_WIRED: state → render ($state_var exists but not displayed)"
368
- fi
369
- else
370
- echo "N/A: state → render (no state var $state_var)"
371
- fi
372
- }
373
- ```
200
+ 1. **Connection exists** — grep confirms the call/import/reference
201
+ 2. **Connection is functional** — the result is consumed, not ignored. A fetch with no await, a query whose result isn't returned, or a handler that only logs are all PARTIAL, not WIRED.
374
202
 
375
203
  ## Step 6: Check Requirements Coverage
376
204
 
@@ -394,36 +222,14 @@ For each requirement:
394
222
 
395
223
  ## Step 7: Scan for Anti-Patterns
396
224
 
397
- Identify files modified in this phase:
225
+ Identify files modified in this phase from PLAN.md `**Files:**` lines or git history — do NOT rely on SUMMARY.md for file lists.
398
226
 
399
227
  ```bash
400
- # Extract files from SUMMARY.md
401
- grep -E "^\- \`" "$PHASE_DIR"/*-SUMMARY.md | sed 's/.*`\([^`]*\)`.*/\1/' | sort -u
228
+ # Extract files from PLAN.md (trustworthy source)
229
+ grep "^\*\*Files:\*\*" "$PHASE_DIR"/*-PLAN.md | sed 's/.*`\([^`]*\)`.*/\1/' | sort -u
402
230
  ```
403
231
 
404
- Run anti-pattern detection:
405
-
406
- ```bash
407
- scan_antipatterns() {
408
- local files="$@"
409
-
410
- for file in $files; do
411
- [ -f "$file" ] || continue
412
-
413
- # TODO/FIXME comments
414
- grep -n -E "TODO|FIXME|XXX|HACK" "$file" 2>/dev/null
415
-
416
- # Placeholder content
417
- grep -n -E "placeholder|coming soon|will be here" "$file" -i 2>/dev/null
418
-
419
- # Empty implementations
420
- grep -n -E "return null|return \{\}|return \[\]|=> \{\}" "$file" 2>/dev/null
421
-
422
- # Console.log only implementations
423
- grep -n -B 2 -A 2 "console\.log" "$file" 2>/dev/null | grep -E "^\s*(const|function|=>)"
424
- done
425
- }
426
- ```
232
+ Scan each file for anti-patterns: `TODO/FIXME/XXX/HACK` comments, placeholder content (`coming soon`, `will be here`), empty implementations (`return null`, `return {}`, `=> {}`), console.log-only handlers.
427
233
 
428
234
  Categorize findings:
429
235
 
@@ -689,95 +495,13 @@ Automated checks passed. Awaiting human verification.
689
495
 
690
496
  </critical_rules>
691
497
 
692
- <stub_detection_patterns>
693
-
694
- ## Universal Stub Patterns
695
-
696
- ```bash
697
- # Comment-based stubs
698
- grep -E "(TODO|FIXME|XXX|HACK|PLACEHOLDER)" "$file"
699
- grep -E "implement|add later|coming soon|will be" "$file" -i
700
-
701
- # Placeholder text in output
702
- grep -E "placeholder|lorem ipsum|coming soon|under construction" "$file" -i
703
-
704
- # Empty or trivial implementations
705
- grep -E "return null|return undefined|return \{\}|return \[\]" "$file"
706
- grep -E "console\.(log|warn|error).*only" "$file"
707
-
708
- # Hardcoded values where dynamic expected
709
- grep -E "id.*=.*['\"].*['\"]" "$file"
710
- ```
711
-
712
- ## React Component Stubs
713
-
714
- ```javascript
715
- // RED FLAGS:
716
- return <div>Component</div>
717
- return <div>Placeholder</div>
718
- return <div>{/* TODO */}</div>
719
- return null
720
- return <></>
721
-
722
- // Empty handlers:
723
- onClick={() => {}}
724
- onChange={() => console.log('clicked')}
725
- onSubmit={(e) => e.preventDefault()} // Only prevents default
726
- ```
727
-
728
- ## API Route Stubs
729
-
730
- ```typescript
731
- // RED FLAGS:
732
- export async function POST() {
733
- return Response.json({ message: "Not implemented" });
734
- }
735
-
736
- export async function GET() {
737
- return Response.json([]); // Empty array with no DB query
738
- }
739
-
740
- // Console log only:
741
- export async function POST(req) {
742
- console.log(await req.json());
743
- return Response.json({ ok: true });
744
- }
745
- ```
746
-
747
- ## Wiring Red Flags
748
-
749
- ```typescript
750
- // Fetch exists but response ignored:
751
- fetch('/api/messages') // No await, no .then, no assignment
752
-
753
- // Query exists but result not returned:
754
- await prisma.message.findMany()
755
- return Response.json({ ok: true }) // Returns static, not query result
756
-
757
- // Handler only prevents default:
758
- onSubmit={(e) => e.preventDefault()}
759
-
760
- // State exists but not rendered:
761
- const [messages, setMessages] = useState([])
762
- return <div>No messages</div> // Always shows "no messages"
763
- ```
764
-
765
- </stub_detection_patterns>
766
-
767
498
  <success_criteria>
768
499
 
769
- - [ ] Previous VERIFICATION.md checked (Step 0)
770
- - [ ] If re-verification: must-haves loaded from previous, focus on failed items
771
- - [ ] If initial: must-haves established (from ## Must-Haves section or derived from phase goal)
772
- - [ ] All truths verified with status and evidence
773
- - [ ] All artifacts checked at all three levels (exists, substantive, wired)
774
- - [ ] All key links verified
775
- - [ ] Requirements coverage assessed (if applicable)
776
- - [ ] Anti-patterns scanned and categorized
777
- - [ ] Human verification items identified
778
- - [ ] Overall status determined
779
- - [ ] Gaps structured in YAML frontmatter (if gaps_found)
780
- - [ ] Re-verification metadata included (if previous existed)
781
- - [ ] VERIFICATION.md created with complete report
782
- - [ ] Results returned to orchestrator (NOT committed)
500
+ - [ ] Gaps structured in YAML frontmatter (if gaps_found) — planner depends on this
501
+ - [ ] Key links verified not just artifact existence; this is where stubs hide
502
+ - [ ] Artifacts checked at all three levels (exists substantive wired)
503
+ - [ ] SUMMARY.md claims verified against actual code, not trusted
504
+ - [ ] Human verification items identified for what can't be checked programmatically
505
+ - [ ] Re-verification: focus on previously-failed items, regression-check passed items
506
+ - [ ] Results returned to orchestrator — NOT committed
783
507
  </success_criteria>
@@ -1,6 +1,7 @@
1
1
  ---
2
2
  name: ms-verify-fixer
3
3
  description: Investigates and fixes single UAT issues. Spawned by verify-work when lightweight investigation fails.
4
+ model: sonnet
4
5
  tools: Read, Write, Edit, Bash, Grep, Glob
5
6
  color: orange
6
7
  ---
@@ -10,11 +10,11 @@ allowed-tools:
10
10
  - Task
11
11
  ---
12
12
 
13
- <purpose>
13
+ <objective>
14
14
  On-demand plan verification. Use when a plan seems large or complex and you want a structured review before executing.
15
15
 
16
16
  This spawns ms-plan-checker to analyze your PLAN.md files against the phase goal.
17
- </purpose>
17
+ </objective>
18
18
 
19
19
  <what_it_checks>
20
20
  1. **Requirement Coverage** — Does every phase requirement have tasks addressing it?
@@ -48,23 +48,6 @@ ls "$PHASE_DIR"/*-PLAN.md 2>/dev/null
48
48
  If no PLAN.md files found, remind user to run `/ms:plan-phase` first.
49
49
  </step>
50
50
 
51
- <step name="load_context">
52
- Read the phase goal from ROADMAP.md:
53
-
54
- ```bash
55
- grep -A 15 "Phase ${PHASE}:" .planning/ROADMAP.md | head -20
56
- ```
57
-
58
- Count plans and tasks:
59
-
60
- ```bash
61
- for plan in "$PHASE_DIR"/*-PLAN.md; do
62
- echo "=== $(basename $plan) ==="
63
- grep -c "^### " "$plan" 2>/dev/null || echo "0 changes"
64
- done
65
- ```
66
- </step>
67
-
68
51
  <step name="spawn_checker">
69
52
  Spawn the plan checker agent:
70
53
 
@@ -93,57 +76,37 @@ Present the checker's findings clearly.
93
76
  **Format for VERIFICATION PASSED:**
94
77
 
95
78
  ```
96
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
97
- PLAN VERIFICATION: PASSED
98
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
99
-
100
- Phase: [name]
101
- Plans: [count]
102
- Tasks: [total count]
103
-
104
- All checks passed:
105
- ✓ Requirement coverage complete
106
- ✓ All tasks have required fields
107
- ✓ Dependency graph valid
108
- ✓ Key links planned
109
- ✓ Scope within budget
110
- ✓ Verification criteria derived
111
- ✓ Context compliance verified (if CONTEXT.md exists)
112
-
113
- Ready to execute: /ms:execute-phase $ARGUMENTS
79
+ ## Plan Verification: PASSED
80
+
81
+ Phase: [name] | Plans: [count] | Tasks: [total count]
82
+
83
+ All checks passed.
84
+
85
+ Ready to execute: `/ms:execute-phase $ARGUMENTS`
114
86
  ```
115
87
 
116
88
  **Format for ISSUES FOUND:**
117
89
 
118
90
  ```
119
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
120
- PLAN VERIFICATION: ISSUES FOUND
121
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
122
-
123
- Phase: [name]
124
- Plans: [count]
125
- Issues: [X blockers, Y warnings]
91
+ ## Plan Verification: ISSUES FOUND
126
92
 
127
- BLOCKERS (must fix):
93
+ Phase: [name] | Plans: [count] | Issues: [X blockers, Y warnings]
128
94
 
129
- 1. [dimension] [description]
130
- Plan: [which plan]
131
- Fix: [specific fix hint]
95
+ ### Blockers (must fix)
132
96
 
133
- 2. [dimension] [description]
134
- Plan: [which plan]
135
- Fix: [specific fix hint]
97
+ 1. **[dimension]** [description]
98
+ Plan: [which plan] | Fix: [specific fix hint]
136
99
 
137
- WARNINGS (should fix):
100
+ ### Warnings (should fix)
138
101
 
139
- 1. [dimension] [description]
102
+ 1. **[dimension]** [description]
140
103
  Fix: [hint]
141
104
 
142
105
  ---
143
106
 
144
107
  Options:
145
- - Fix the issues and run /ms:check-phase $ARGUMENTS again
146
- - Proceed anyway: /ms:execute-phase $ARGUMENTS (not recommended if blockers exist)
108
+ - Fix the issues and run `/ms:check-phase $ARGUMENTS` again
109
+ - Proceed anyway: `/ms:execute-phase $ARGUMENTS` (not recommended if blockers exist)
147
110
  ```
148
111
  </step>
149
112
 
@@ -163,3 +126,9 @@ Options:
163
126
  /ms:execute-phase 5 # Execute
164
127
  ```
165
128
  </examples>
129
+
130
+ <success_criteria>
131
+ - Blockers and warnings presented distinctly — blockers have plan name and fix hint
132
+ - Output includes actionable next command (`/ms:execute-phase` or `/ms:check-phase` rerun)
133
+ - Checker agent spawned with correct phase directory path
134
+ </success_criteria>
@@ -68,31 +68,14 @@ Output: Milestone archived (roadmap + requirements), PROJECT.md evolved, git tag
68
68
  - Present milestone scope and stats
69
69
  - Wait for confirmation
70
70
 
71
- 1.5. **Consolidate decisions:**
71
+ 1.5. **Clean up raw artifacts:**
72
72
 
73
- Spawn ms-consolidator to extract decisions from phase artifacts:
73
+ Delete remaining raw artifacts from phase directories. Knowledge files are already current from phase-level consolidation in execute-phase.
74
74
 
75
- ```
76
- Task(
77
- prompt="Consolidate decisions from milestone v{{version}}.
78
- Phase range: [PHASE_START]-[PHASE_END]
79
- Create v{{version}}-DECISIONS.md.
80
- Delete source files (PLAN, CONTEXT, RESEARCH, DESIGN).",
81
- subagent_type="ms-consolidator"
82
- )
83
- ```
84
-
85
- Wait for completion. Verify DECISIONS.md created:
86
75
  ```bash
87
- ls .planning/milestones/v{{version}}-DECISIONS.md
76
+ ~/.claude/mindsystem/scripts/cleanup-phase-artifacts.sh $PHASE_START $PHASE_END
88
77
  ```
89
78
 
90
- 1.7. **Extract learnings:**
91
-
92
- Scan debug resolutions, adhoc summaries, phase summaries, and completed todos.
93
- Curate 4-8 reusable patterns into `.planning/LEARNINGS.md` (or skip gracefully if none found).
94
- See workflow `extract_learnings` step for full process.
95
-
96
79
  2. **Gather stats:**
97
80
 
98
81
  - Count phases, plans, tasks
@@ -128,7 +111,7 @@ Output: Milestone archived (roadmap + requirements), PROJECT.md evolved, git tag
128
111
 
129
112
  7. **Commit and tag:**
130
113
 
131
- - Stage: MILESTONES.md, PROJECT.md, ROADMAP.md, STATE.md, LEARNINGS.md, archive files
114
+ - Stage: MILESTONES.md, PROJECT.md, ROADMAP.md, STATE.md, archive files
132
115
  - Commit: `chore: archive v{{version}} milestone`
133
116
  - Tag: `git tag -a v{{version}} -m "[milestone summary]"`
134
117
  - Ask about pushing tag
@@ -144,9 +127,7 @@ Output: Milestone archived (roadmap + requirements), PROJECT.md evolved, git tag
144
127
 
145
128
  <success_criteria>
146
129
 
147
- - Decisions consolidated to `.planning/milestones/v{{version}}-DECISIONS.md`
148
- - Phase artifacts cleaned (PLAN, CONTEXT, RESEARCH, DESIGN deleted)
149
- - Learnings extracted to `.planning/LEARNINGS.md` (or gracefully skipped if none found)
130
+ - Raw artifacts cleaned from phase directories (CONTEXT, DESIGN, RESEARCH, SUMMARY, UAT, VERIFICATION, EXECUTION-ORDER)
150
131
  - Milestone archived to `.planning/milestones/v{{version}}-ROADMAP.md`
151
132
  - Requirements archived to `.planning/milestones/v{{version}}-REQUIREMENTS.md`
152
133
  - `.planning/REQUIREMENTS.md` deleted (fresh for next milestone)
@@ -162,7 +143,7 @@ Output: Milestone archived (roadmap + requirements), PROJECT.md evolved, git tag
162
143
  - **Load workflow first:** Read complete-milestone.md before executing
163
144
  - **Verify completion:** All phases must have SUMMARY.md files
164
145
  - **User confirmation:** Wait for approval at verification gates
165
- - **Archive before deleting:** Always create archive files before updating/deleting originals
146
+ - **Archive before deleting:** Always create archive files (ROADMAP, REQUIREMENTS) before updating/deleting originals
166
147
  - **One-line summary:** Collapsed milestone in ROADMAP.md should be single line with link
167
148
  - **Context efficiency:** Archive keeps ROADMAP.md and REQUIREMENTS.md constant size per milestone
168
149
  - **Fresh requirements:** Next milestone starts with `/ms:create-roadmap`, not reusing old file
@@ -13,25 +13,15 @@ allowed-tools:
13
13
  <objective>
14
14
  Define project requirements and create roadmap with phase breakdown.
15
15
 
16
- Derives REQUIREMENTS.md from MILESTONE-CONTEXT.md (or through lightweight questioning for first milestones), then maps requirements to phases.
17
-
18
16
  Run after `/ms:new-milestone` or `/ms:new-project` + optional `/ms:research-project`.
19
-
20
- **How it works:** Spawns ms-roadmapper agent which derives requirements AND creates roadmap in one pass, then presents combined results for approval.
21
17
  </objective>
22
18
 
23
19
  <execution_context>
24
- @~/.claude/mindsystem/references/principles.md
25
- @~/.claude/mindsystem/workflows/define-requirements.md
26
- @~/.claude/mindsystem/templates/requirements.md
27
- @~/.claude/mindsystem/templates/roadmap.md
28
20
  @~/.claude/mindsystem/templates/state.md
29
- @~/.claude/mindsystem/references/goal-backward.md
30
21
  </execution_context>
31
22
 
32
23
  <context>
33
24
  @.planning/PROJECT.md
34
- @.planning/config.json
35
25
  @.planning/MILESTONE-CONTEXT.md (if exists)
36
26
  @.planning/research/FEATURES.md (if exists)
37
27
  @.planning/research/SUMMARY.md (if exists)
@@ -342,13 +332,11 @@ Update `.planning/STATE.md` Last Command field:
342
332
  </process>
343
333
 
344
334
  <success_criteria>
345
- - [ ] PROJECT.md validated
346
- - [ ] Context gathered (from MILESTONE-CONTEXT.md, research, or questioning)
347
- - [ ] ms-roadmapper spawned with context
348
- - [ ] REQUIREMENTS.md created with REQ-IDs and scope classification
349
335
  - [ ] All v1 requirements mapped to phases (no orphans)
350
336
  - [ ] Success criteria derived for each phase (2-5 observable behaviors)
351
- - [ ] Requirements and roadmap presented to user for approval
352
337
  - [ ] User feedback incorporated (if any)
338
+ - [ ] Requirements and roadmap presented to user for approval
339
+ - [ ] ms-roadmapper spawned with full planning context
340
+ - [ ] REQUIREMENTS.md created with REQ-IDs and scope classification
353
341
  - [ ] REQUIREMENTS.md, ROADMAP.md, STATE.md committed after approval
354
342
  </success_criteria>
@@ -107,6 +107,23 @@ If exists, extract:
107
107
  - What Must Be Nailed (essentials)
108
108
  - Specific Ideas (references to products)
109
109
 
110
+ **3b2. Optional context — prior knowledge:**
111
+
112
+ Match subsystem(s) to this phase by comparing ROADMAP phase description against subsystem names in config.json. Load matching knowledge files:
113
+
114
+ ```bash
115
+ jq -r '.subsystems[]' .planning/config.json 2>/dev/null
116
+ cat .planning/knowledge/{matched_subsystem}.md 2>/dev/null
117
+ ```
118
+
119
+ If knowledge files exist, extract:
120
+ - Architecture patterns (tech constraints the design must respect)
121
+ - Prior design patterns (visual consistency)
122
+ - Key decisions (constraints)
123
+ - Pitfalls (design must avoid known traps)
124
+
125
+ Pass the extracted knowledge to ms-designer in the design prompt (see step 5 `<prior_knowledge>` block).
126
+
110
127
  **3c. Optional context — project UI skill:**
111
128
 
112
129
  Scan the skills list in the most recent system-reminder for a skill whose description mentions UI patterns, components, design system, or implementation styling (e.g., "Flutter/Dart patterns", "React component library", "UI implementation patterns").
@@ -238,6 +255,23 @@ Vision inferred from phase requirements and PROJECT.md context.
238
255
  Reference products: [From Q&A if asked, or "None specified"]
239
256
  </user_vision>
240
257
 
258
+ <prior_knowledge>
259
+ [If knowledge files exist:]
260
+
261
+ Architecture constraints:
262
+ [From knowledge Architecture sections]
263
+
264
+ Prior design patterns:
265
+ [From knowledge Design sections]
266
+
267
+ Pitfalls to avoid:
268
+ [From knowledge Pitfalls sections]
269
+
270
+ [If no knowledge files exist:]
271
+
272
+ No prior knowledge files. First phase or no prior execution.
273
+ </prior_knowledge>
274
+
241
275
  <existing_aesthetic>
242
276
  [If project UI skill exists:]
243
277