mindsystem-cc 3.14.0 → 3.16.1

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 (51) 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-code-quality.md +1 -1
  8. package/agents/ms-flutter-reviewer.md +1 -0
  9. package/agents/ms-flutter-simplifier.md +1 -1
  10. package/agents/ms-integration-checker.md +1 -0
  11. package/agents/ms-plan-checker.md +17 -327
  12. package/agents/ms-researcher.md +25 -343
  13. package/agents/ms-roadmapper.md +10 -75
  14. package/agents/ms-verifier.md +33 -309
  15. package/agents/ms-verify-fixer.md +1 -0
  16. package/commands/ms/check-phase.md +24 -55
  17. package/commands/ms/complete-milestone.md +6 -25
  18. package/commands/ms/create-roadmap.md +3 -15
  19. package/commands/ms/design-phase.md +52 -15
  20. package/commands/ms/discuss-phase.md +7 -9
  21. package/commands/ms/doctor.md +224 -0
  22. package/commands/ms/execute-phase.md +22 -12
  23. package/commands/ms/help.md +11 -0
  24. package/commands/ms/new-milestone.md +3 -3
  25. package/commands/ms/plan-phase.md +1 -1
  26. package/commands/ms/research-phase.md +249 -85
  27. package/commands/ms/verify-work.md +1 -0
  28. package/mindsystem/references/plan-risk-assessment.md +1 -2
  29. package/mindsystem/templates/context.md +1 -11
  30. package/mindsystem/templates/discovery.md +2 -3
  31. package/mindsystem/templates/knowledge.md +99 -0
  32. package/mindsystem/templates/requirements.md +3 -61
  33. package/mindsystem/templates/research-comparison-output.md +50 -0
  34. package/mindsystem/templates/research-feasibility-output.md +43 -0
  35. package/mindsystem/templates/research-project-output.md +81 -0
  36. package/mindsystem/templates/research-subagent-prompt.md +164 -48
  37. package/mindsystem/templates/roadmap-milestone.md +67 -0
  38. package/mindsystem/templates/roadmap.md +2 -66
  39. package/mindsystem/workflows/complete-milestone.md +23 -140
  40. package/mindsystem/workflows/define-requirements.md +4 -8
  41. package/mindsystem/workflows/discuss-phase.md +25 -8
  42. package/mindsystem/workflows/execute-phase.md +34 -0
  43. package/mindsystem/workflows/execute-plan.md +8 -0
  44. package/mindsystem/workflows/plan-phase.md +40 -104
  45. package/mindsystem/workflows/verify-work.md +20 -0
  46. package/package.json +1 -1
  47. package/scripts/cleanup-phase-artifacts.sh +68 -0
  48. package/scripts/scan-artifact-subsystems.sh +55 -0
  49. package/scripts/scan-planning-context.py +689 -0
  50. package/mindsystem/templates/decisions.md +0 -145
  51. package/mindsystem/templates/learnings.md +0 -150
@@ -22,16 +22,16 @@ This is the ritual that separates "development" from "shipped."
22
22
 
23
23
  When a milestone completes, this workflow:
24
24
 
25
- 1. Consolidates phase decisions into `.planning/milestones/v[X.Y]-DECISIONS.md`
26
- 2. Cleans up phase artifacts (PLAN, CONTEXT, RESEARCH, DESIGN files deleted)
27
- 3. Extracts full milestone details to `.planning/milestones/v[X.Y]-ROADMAP.md`
28
- 4. Archives requirements to `.planning/milestones/v[X.Y]-REQUIREMENTS.md`
29
- 5. Archives milestone context to `.planning/milestones/v[X.Y]-CONTEXT.md`
30
- 6. Updates ROADMAP.md to replace milestone details with one-line summary
31
- 7. Deletes REQUIREMENTS.md (fresh one created for next milestone)
32
- 8. Extracts learnings into `.planning/LEARNINGS.md` (curated one-line patterns with source refs)
33
- 9. Performs full PROJECT.md evolution review
34
- 10. Routes to `/ms:new-milestone` for next milestone
25
+ 1. Cleans up raw phase artifacts (CONTEXT, DESIGN, RESEARCH, SUMMARY, UAT, VERIFICATION, EXECUTION-ORDER deleted)
26
+ 2. Extracts full milestone details to `.planning/milestones/v[X.Y]-ROADMAP.md`
27
+ 3. Archives requirements to `.planning/milestones/v[X.Y]-REQUIREMENTS.md`
28
+ 4. Archives milestone context to `.planning/milestones/v[X.Y]-CONTEXT.md`
29
+ 5. Updates ROADMAP.md to replace milestone details with one-line summary
30
+ 6. Deletes REQUIREMENTS.md (fresh one created for next milestone)
31
+ 7. Performs full PROJECT.md evolution review
32
+ 8. Routes to `/ms:new-milestone` for next milestone
33
+
34
+ Knowledge files in `.planning/knowledge/` persist across milestones (maintained by phase-level consolidation in execute-phase).
35
35
 
36
36
  **Context Efficiency:**
37
37
 
@@ -102,136 +102,25 @@ cat .planning/config.json 2>/dev/null
102
102
  Proceeding to stats gathering...
103
103
  ```
104
104
 
105
- Proceed directly to consolidate_decisions step.
105
+ Proceed directly to cleanup_artifacts step.
106
106
 
107
107
  </step>
108
108
 
109
- <step name="consolidate_decisions">
110
-
111
- Consolidate phase decisions before archiving.
112
-
113
- **Spawn ms-consolidator agent:**
114
-
115
- ```
116
- Task(
117
- prompt="Consolidate decisions from milestone v[X.Y] [Name].
118
-
119
- Phase range: [PHASE_START]-[PHASE_END]
120
- Phase directories:
121
- - .planning/phases/01-foundation
122
- - .planning/phases/02-auth
123
- - [etc. for all phases in milestone]
124
-
125
- Extract decisions from PLAN, CONTEXT, RESEARCH, DESIGN files.
126
- Create v[X.Y]-DECISIONS.md in .planning/milestones/.
127
- Delete source files (preserve SUMMARY, VERIFICATION, UAT).",
128
- subagent_type="ms-consolidator"
129
- )
130
- ```
131
-
132
- **Wait for completion and verify:**
133
-
134
- ```bash
135
- ls .planning/milestones/v[X.Y]-DECISIONS.md
136
- ```
137
-
138
- **Present consolidation summary:**
139
-
140
- ```
141
- ✓ Decisions consolidated: [N] decisions in [M] categories
142
- ✓ Source files cleaned: PLAN, CONTEXT, RESEARCH, DESIGN deleted
143
- ✓ Preserved: SUMMARY, VERIFICATION, UAT files
144
-
145
- Report: .planning/milestones/v[X.Y]-DECISIONS.md
146
- ```
147
-
148
- Continue to extract_learnings step.
149
-
150
- </step>
151
-
152
- <step name="extract_learnings">
153
-
154
- Extract reusable patterns from milestone artifacts into `.planning/LEARNINGS.md`.
155
-
156
- **Runs in main context** (not subagent) — curation requires judgment.
157
-
158
- **Reference:** `~/.claude/mindsystem/templates/learnings.md`
159
-
160
- **1. Scan source artifacts:**
109
+ <step name="cleanup_artifacts">
161
110
 
162
- All sources are PRESERVED by ms-consolidator (only PLAN, CONTEXT, RESEARCH, DESIGN are deleted).
111
+ Delete remaining raw artifacts from phase directories. Knowledge files are already current from phase-level consolidation in execute-phase no consolidation or learnings extraction needed.
163
112
 
164
113
  ```bash
165
- # Debug resolutions — parse frontmatter for root_cause, resolution, subsystem, prevention
166
- ls .planning/debug/resolved/*.md 2>/dev/null
114
+ ~/.claude/mindsystem/scripts/cleanup-phase-artifacts.sh $PHASE_START $PHASE_END
167
115
  ```
168
116
 
169
- ```bash
170
- # Adhoc summaries — parse frontmatter for learnings array, subsystem
171
- ls .planning/adhoc/*-SUMMARY.md 2>/dev/null
172
- ```
117
+ Knowledge files in `.planning/knowledge/` persist (they ARE the milestone's knowledge output).
173
118
 
174
- ```bash
175
- # Phase summaries in milestone range — read Deviations/Issues sections, parse subsystem
176
- ls .planning/phases/{PHASE_START}*/{PHASE_START}*-SUMMARY.md .planning/phases/{PHASE_END}*/{PHASE_END}*-SUMMARY.md 2>/dev/null
177
- # (expand to all phases in milestone range)
178
- ```
119
+ **Present cleanup summary:**
179
120
 
180
- ```bash
181
- # Completed todos — scan for reusable patterns (lower priority)
182
- ls .planning/todos/done/*.md 2>/dev/null
183
121
  ```
184
-
185
- For each source found, read frontmatter and relevant sections. Extract candidate learnings.
186
-
187
- **2. Curate entries:**
188
-
189
- - Select 4-8 entries max from candidates
190
- - Exclude: decisions (belong in DECISIONS.md), trivial fixes, one-time issues
191
- - Prefer prevention framing: "Always validate X before Y" over "We found a bug in X"
192
- - Deduplicate: if two sources surface the same pattern, keep the more prescriptive version
193
-
194
- **3. Group by subsystem:**
195
-
196
- ```bash
197
- jq -r '.subsystems[]' .planning/config.json 2>/dev/null
198
- ```
199
-
200
- Group entries under subsystem headings from config.json vocabulary.
201
-
202
- **4. Write to LEARNINGS.md:**
203
-
204
- Format per entry:
205
- ```
206
- - **{Brief title}**: {Prescriptive action} → `{source_ref}`
207
- ```
208
-
209
- If `.planning/LEARNINGS.md` does not exist (first milestone):
210
- - Create file with header from template
211
- - Add milestone section
212
-
213
- If `.planning/LEARNINGS.md` exists (subsequent milestone):
214
- - Prepend new milestone section after header (reverse chronological)
215
- - Update "Last updated" footer
216
-
217
- **5. Handle "no learnings" gracefully:**
218
-
219
- If no meaningful patterns found across all sources:
220
- - Do NOT create or modify LEARNINGS.md
221
- - Present informational message:
222
- ```
223
- ℹ No reusable learnings found for v[X.Y]
224
- Sources scanned: [N] debug docs, [N] adhoc summaries, [N] phase summaries, [N] completed todos
225
- Skipping LEARNINGS.md update
226
- ```
227
-
228
- **6. Present summary:**
229
-
230
- ```
231
- ✓ Learnings extracted: [N] entries across [M] subsystems
232
- - [subsystem1]: [count] entries
233
- - [subsystem2]: [count] entries
234
- Written to: .planning/LEARNINGS.md
122
+ Raw artifacts cleaned from phase directories
123
+ Knowledge files persist in .planning/knowledge/
235
124
  ```
236
125
 
237
126
  Continue to gather_stats step.
@@ -757,21 +646,17 @@ Commit milestone completion including archive files and deletions.
757
646
 
758
647
  ```bash
759
648
  # Stage archive files (new)
760
- git add .planning/milestones/v[X.Y]-DECISIONS.md
761
649
  git add .planning/milestones/v[X.Y]-ROADMAP.md
762
650
  git add .planning/milestones/v[X.Y]-REQUIREMENTS.md
763
651
  git add .planning/milestones/v[X.Y]-MILESTONE-AUDIT.md 2>/dev/null || true
764
652
  git add .planning/milestones/v[X.Y]-CONTEXT.md 2>/dev/null || true
765
653
 
766
- # Stage learnings (may not exist if no learnings found)
767
- git add .planning/LEARNINGS.md 2>/dev/null || true
768
-
769
654
  # Stage updated files
770
655
  git add .planning/MILESTONES.md
771
656
  git add .planning/PROJECT.md
772
657
  git add .planning/STATE.md
773
658
 
774
- # Stage deletions
659
+ # Stage deletions (raw artifacts cleaned from phase directories)
775
660
  git add -u .planning/
776
661
 
777
662
  # Commit with descriptive message
@@ -779,13 +664,13 @@ git commit -m "$(cat <<'EOF'
779
664
  chore: complete v[X.Y] milestone
780
665
 
781
666
  Archived:
782
- - milestones/v[X.Y]-DECISIONS.md (consolidated decisions)
783
667
  - milestones/v[X.Y]-ROADMAP.md
784
668
  - milestones/v[X.Y]-REQUIREMENTS.md
785
669
  - milestones/v[X.Y]-MILESTONE-AUDIT.md (if audit was run)
786
670
 
787
671
  Cleaned:
788
- - Phase PLAN, CONTEXT, RESEARCH, DESIGN files (consolidated into DECISIONS.md)
672
+ - Raw phase artifacts (CONTEXT, DESIGN, RESEARCH, SUMMARY, UAT, VERIFICATION, EXECUTION-ORDER)
673
+ - Knowledge files persist in .planning/knowledge/
789
674
 
790
675
  Deleted (fresh for next milestone):
791
676
  - ROADMAP.md
@@ -795,7 +680,6 @@ Updated:
795
680
  - MILESTONES.md (new entry)
796
681
  - PROJECT.md (requirements → Validated)
797
682
  - STATE.md (reset for next milestone)
798
- - LEARNINGS.md (curated patterns, if any found)
799
683
 
800
684
  Tagged: v[X.Y]
801
685
  EOF
@@ -886,9 +770,8 @@ If yes → milestone. If no → keep working.
886
770
 
887
771
  Milestone completion is successful when:
888
772
 
889
- - [ ] Decisions consolidated (milestones/v[X.Y]-DECISIONS.md created)
890
- - [ ] Phase artifacts cleaned (PLAN, CONTEXT, RESEARCH, DESIGN deleted)
891
- - [ ] Learnings extracted to .planning/LEARNINGS.md (or gracefully skipped if none found)
773
+ - [ ] Raw artifacts cleaned from phase directories (CONTEXT, DESIGN, RESEARCH, SUMMARY, UAT, VERIFICATION, EXECUTION-ORDER)
774
+ - [ ] Knowledge files persist in .planning/knowledge/
892
775
  - [ ] MILESTONES.md entry created with stats and accomplishments
893
776
  - [ ] PROJECT.md full evolution review completed
894
777
  - [ ] All shipped requirements moved to Validated in PROJECT.md
@@ -4,8 +4,6 @@ Define concrete, checkable requirements for v1.
4
4
  Two modes:
5
5
  1. **With research** — Transform FEATURES.md into scoped requirements
6
6
  2. **Without research** — Gather requirements through questioning
7
-
8
- This is the bridge between "what's possible/wanted" and "what we're committing to."
9
7
  </purpose>
10
8
 
11
9
  <required_reading>
@@ -318,13 +316,11 @@ Requirements defined:
318
316
  </quality_criteria>
319
317
 
320
318
  <success_criteria>
321
- - [ ] PROJECT.md core value extracted
322
- - [ ] Features gathered (from research OR conversation)
323
- - [ ] All categories presented to user
324
- - [ ] User scoped each category (v1/v2/out of scope)
325
- - [ ] User had opportunity to add requirements
326
319
  - [ ] Core value alignment validated
320
+ - [ ] User had opportunity to add requirements
321
+ - [ ] User scoped each category (v1/v2/out of scope)
322
+ - [ ] All categories presented to user
327
323
  - [ ] REQUIREMENTS.md created with REQ-IDs
328
324
  - [ ] v1, v2, and out of scope clearly separated
329
- - [ ] Requirements committed to git
325
+ - [ ] Features gathered (from research OR conversation)
330
326
  </success_criteria>
@@ -30,11 +30,7 @@ Phase number: $ARGUMENTS (required)
30
30
  Validate phase exists in roadmap:
31
31
 
32
32
  ```bash
33
- if [ -f .planning/ROADMAP.md ]; then
34
- cat .planning/ROADMAP.md | grep "Phase ${PHASE}:"
35
- else
36
- cat .planning/ROADMAP.md | grep "Phase ${PHASE}:"
37
- fi
33
+ grep "Phase ${PHASE}:" .planning/ROADMAP.md
38
34
  ```
39
35
 
40
36
  **If phase not found:**
@@ -55,6 +51,29 @@ Parse phase details from roadmap:
55
51
  - Phase description
56
52
  - Status (should be "Not started" or "In progress")
57
53
 
54
+ Continue to load_prior_knowledge.
55
+ </step>
56
+
57
+ <step name="load_prior_knowledge">
58
+ Determine which subsystem(s) this phase touches from ROADMAP.md phase description + config.json:
59
+
60
+ ```bash
61
+ jq -r '.subsystems[]' .planning/config.json 2>/dev/null
62
+ grep -A20 "Phase ${PHASE}:" .planning/ROADMAP.md
63
+ ```
64
+
65
+ Load matching `knowledge/{subsystem}.md` files:
66
+
67
+ ```bash
68
+ cat .planning/knowledge/{subsystem}.md 2>/dev/null
69
+ ```
70
+
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
+
75
+ **If no knowledge files exist:** Skip silently (normal for first phase).
76
+
58
77
  Continue to check_existing.
59
78
  </step>
60
79
 
@@ -239,10 +258,8 @@ Confirm: "Committed: docs(${PHASE}): capture phase context"
239
258
 
240
259
  <success_criteria>
241
260
 
242
- - Phase validated against roadmap
243
261
  - Vision gathered through collaborative thinking (not interrogation)
244
262
  - User's imagination captured: how it works, what's essential
245
- - CONTEXT.md created in phase directory
246
- - CONTEXT.md committed to git
247
263
  - User knows next steps (typically: research or plan the phase)
264
+ - CONTEXT.md committed to git
248
265
  </success_criteria>
@@ -441,6 +441,38 @@ fi
441
441
  - Discard: `rm {patch_file}`
442
442
  </step>
443
443
 
444
+ <step name="consolidate_knowledge">
445
+ Consolidate phase knowledge into per-subsystem knowledge files.
446
+
447
+ **Spawn ms-consolidator:**
448
+
449
+ ```
450
+ Task(
451
+ prompt="Consolidate knowledge from phase {phase_number}.
452
+ Phase directory: {phase_dir}
453
+ Phase number: {phase_number}
454
+ Read SUMMARY.md files for affected subsystems, then read phase artifacts
455
+ and existing knowledge files. Produce updated knowledge files and delete
456
+ PLAN.md files.",
457
+ subagent_type="ms-consolidator"
458
+ )
459
+ ```
460
+
461
+ **Verify consolidation:**
462
+
463
+ ```bash
464
+ ls .planning/knowledge/*.md 2>/dev/null
465
+ ```
466
+
467
+ Report the consolidation summary returned by ms-consolidator.
468
+
469
+ **Handle failure:** If consolidation fails, ask user:
470
+ - "Continue without consolidation" → proceed to update_roadmap
471
+ - "Stop execution" → exit with partial completion report
472
+
473
+ Knowledge consolidation is not a blocking gate — phase execution succeeded regardless.
474
+ </step>
475
+
444
476
  <step name="update_roadmap">
445
477
  Update ROADMAP.md to reflect phase completion:
446
478
 
@@ -453,6 +485,8 @@ Update ROADMAP.md to reflect phase completion:
453
485
  Commit phase completion (roadmap, state, verification):
454
486
  ```bash
455
487
  git add .planning/ROADMAP.md .planning/STATE.md .planning/phases/{phase_dir}/*-VERIFICATION.md .planning/phases/{phase_dir}/*-SUMMARY.md
488
+ git add .planning/knowledge/*.md
489
+ git add -u .planning/phases/{phase_dir}/*-PLAN.md
456
490
  git add .planning/REQUIREMENTS.md # if updated
457
491
  git commit -m "docs(phase-{X}): complete phase execution"
458
492
  ```
@@ -43,6 +43,14 @@ Parse plan sections:
43
43
  **If `**Type:** tdd`:** Read `~/.claude/mindsystem/references/tdd-execution.md` for RED-GREEN-REFACTOR execution flow.
44
44
  </step>
45
45
 
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.
48
+
49
+ - One clear match → invoke it directly
50
+ - Multiple candidates → use AskUserQuestion to let the user choose
51
+ - No match → proceed without
52
+ </step>
53
+
46
54
  <step name="execute">
47
55
  Record start time: `PLAN_START_TIME=$(date -u +"%Y-%m-%dT%H:%M:%SZ"); PLAN_START_EPOCH=$(date +%s)`
48
56
 
@@ -263,135 +263,74 @@ For niche domains (3D, games, audio, shaders, ML), suggest `/ms:research-phase`
263
263
  </step>
264
264
 
265
265
  <step name="read_project_history">
266
- **Intelligent context assembly from frontmatter dependency graph:**
266
+ **Intelligent context assembly via scanner script + selective reading:**
267
267
 
268
- **1. Scan all summary frontmatter (cheap - first ~25 lines):**
268
+ **1. Determine scanner arguments** from prior steps:
269
+
270
+ - Phase number from identify_phase step
271
+ - Subsystem from `.planning/config.json` if available
272
+ - Phase name from ROADMAP.md phase description
269
273
 
270
274
  ```bash
271
- for f in .planning/phases/*/*-SUMMARY.md; do
272
- # Extract frontmatter only (between first two --- markers)
273
- sed -n '1,/^---$/p; /^---$/q' "$f" | head -30
274
- done
275
+ SUBSYSTEM=$(jq -r '.subsystems[0] // empty' .planning/config.json 2>/dev/null)
276
+ PHASE_NAME=$(grep -A2 "Phase ${PHASE}:" .planning/ROADMAP.md 2>/dev/null | head -1 | sed 's/.*Phase [0-9]*: *//')
275
277
  ```
276
278
 
277
- Parse YAML to extract: phase, subsystem, requires, provides, affects, tags, key-decisions, key-files
278
-
279
- **2. Build dependency graph for current phase:**
280
-
281
- - **Check affects field:** Which prior phases have current phase in their `affects` list? → Direct dependencies
282
- - **Check subsystem:** Which prior phases share same subsystem? → Related work
283
- - **Check requires chains:** If phase X requires phase Y, and we need X, we also need Y → Transitive dependencies
284
- - **Check roadmap:** Any phases marked as dependencies in ROADMAP.md phase description?
285
-
286
- **3. Select relevant summaries:**
287
-
288
- Auto-select phases that match ANY of:
289
- - Current phase name/number appears in prior phase's `affects` field
290
- - Same `subsystem` value
291
- - In `requires` chain (transitive closure)
292
- - Explicitly mentioned in STATE.md decisions as affecting current phase
279
+ **2. Run context scanner:**
293
280
 
294
- Typical selection: 2-4 prior phases (immediately prior + related subsystem work)
295
-
296
- **4. Extract context from frontmatter (WITHOUT opening full summaries yet):**
281
+ ```bash
282
+ uv run ~/.claude/mindsystem/scripts/scan-planning-context.py \
283
+ --phase "${PHASE}" \
284
+ --phase-name "${PHASE_NAME}" \
285
+ ${SUBSYSTEM:+--subsystem "${SUBSYSTEM}"}
286
+ ```
297
287
 
298
- From selected phases' frontmatter, extract:
299
- - **Tech available:** Union of all tech-stack.added lists
300
- - **Patterns established:** Union of all tech-stack.patterns and patterns-established
301
- - **Key files:** Union of all key-files (for @context references)
302
- - **Decisions:** Extract key-decisions from frontmatter
288
+ **3. Parse JSON output.** Check `success` field. If the script fails or returns non-JSON, fall back to manual scanning (read SUMMARY frontmatter with sed as before). The scanner handles missing directories gracefully — check `sources.*.skipped` for skip reasons.
303
289
 
304
- **4b. Present established patterns to user:**
290
+ **4. Present established patterns to user:**
305
291
 
306
- If patterns-established entries were collected, display:
292
+ From `aggregated.patterns_established`, display:
307
293
 
308
294
  ```
309
295
  ### Established Patterns to Maintain
310
296
  - [Pattern: description] (from phase XX)
311
297
  ```
312
298
 
313
- If no patterns collected, skip.
299
+ If empty, skip.
314
300
 
315
- **5. Now read FULL summaries for selected phases:**
301
+ **5. Conditionally read full summaries.**
316
302
 
317
- Only now open and read complete SUMMARY.md files for the selected relevant phases. Extract:
318
- - Detailed "Accomplishments" section
319
- - "Next Phase Readiness" warnings/blockers
320
- - "Issues Encountered" that might affect current phase
321
- - "Deviations from Plan" for patterns
303
+ Read full SUMMARY.md body ONLY for summaries where:
304
+ - `relevance` is HIGH AND `has_readiness_warnings` is true
305
+ - OR frontmatter alone doesn't provide enough context for task breakdown (use judgment)
322
306
 
323
- **6. Search additional knowledge sources (cross-cutting retrieval):**
307
+ Extract from full reads: "Next Phase Readiness" warnings, "Issues Encountered", detailed accomplishments.
324
308
 
325
- Use keywords already extracted: phase name, subsystem (from config.json), tags/tech terms from selected summaries.
309
+ Summaries scored MEDIUM or HIGH without readiness warnings → frontmatter data in JSON is sufficient (tech stack, patterns, key files, decisions already aggregated).
326
310
 
327
- **6a. Resolved debug docs:**
311
+ **6. Present matched learnings:**
328
312
 
329
- ```bash
330
- for f in .planning/debug/resolved/*.md; do
331
- sed -n '1,/^---$/p; /^---$/q' "$f" | head -20
332
- done 2>/dev/null
333
- ```
334
-
335
- Select docs matching: same `subsystem`, overlapping `tags`, or `phase` in dependency chain.
336
- Extract: `root_cause` + `resolution` one-liners from frontmatter.
337
-
338
- **If matched debug docs found, present warning to user:**
313
+ **From `debug_learnings`** — present as warnings:
339
314
 
340
315
  ```
341
316
  ### Previous Debug Sessions in This Area
342
317
  - **{slug}** ({subsystem}): {root_cause} — Fix: {resolution}
343
318
  ```
344
319
 
345
- Awareness onlylearnings still flow to `<learnings>` handoff.
346
- If no matches, skip.
347
-
348
- **6b. Adhoc summaries:**
320
+ **From `adhoc_learnings`**extract entries with non-empty `learnings` arrays for handoff context.
349
321
 
350
- ```bash
351
- for f in .planning/adhoc/*-SUMMARY.md; do
352
- sed -n '1,/^---$/p; /^---$/q' "$f" | head -20
353
- done 2>/dev/null
354
- ```
322
+ If neither source has matches, skip.
355
323
 
356
- Select matching: same `subsystem`, overlapping `tags`, or `related_phase` in dependency chain.
357
- Extract: `learnings` array entries (skip if empty).
324
+ **7. Read knowledge files:**
358
325
 
359
- **6c. Completed todos:**
326
+ For each entry in `knowledge_files` where `matched` is true, read the full file. Knowledge files are prose (no frontmatter) so the LLM must read them to extract decisions, architecture, pitfalls.
360
327
 
361
- ```bash
362
- ls .planning/todos/done/*.md 2>/dev/null
363
- ```
328
+ **8. Assess pending todos:**
364
329
 
365
- If exists, grep body content for phase keywords or subsystem. Extract brief description of resolved items.
366
-
367
- **6d. Milestone decisions:**
368
-
369
- ```bash
370
- ls .planning/milestones/v*-DECISIONS.md 2>/dev/null
371
- ```
372
-
373
- If exists, grep for entries matching current subsystem or phase keywords. Extract matched decision rows.
374
-
375
- **6e. LEARNINGS.md (cross-milestone index):**
376
-
377
- ```bash
378
- cat .planning/LEARNINGS.md 2>/dev/null
379
- ```
380
-
381
- If exists, grep for entries matching phase keywords, subsystem, or tech terms. Extract matched one-liner entries with source references.
382
-
383
- **Collect matched learnings for handoff** — assemble into flat list for `<learnings>` section.
330
+ From `pending_todos` frontmatter in JSON, assess each todo's relevance. Read full body only for todos matching current phase subsystem/tags.
384
331
 
385
332
  **From STATE.md:** Decisions → constrain approach. Pending todos → candidates. Blockers → may need to address.
386
333
 
387
- **From pending todos:**
388
-
389
- ```bash
390
- ls .planning/todos/pending/*.md 2>/dev/null
391
- ```
392
-
393
- Assess each pending todo - relevant to this phase? Natural to address now?
394
-
395
334
  **Answer before proceeding:**
396
335
  - Q1: What decisions from previous phases constrain this phase?
397
336
  - Q2: Are there pending todos that should become tasks?
@@ -400,13 +339,13 @@ Assess each pending todo - relevant to this phase? Natural to address now?
400
339
 
401
340
  **Track for handoff to ms-plan-writer:**
402
341
  - Which summaries were selected (for @context references)
403
- - Tech stack available (from frontmatter)
404
- - Established patterns (from frontmatter)
405
- - Key files to reference (from frontmatter)
406
- - Applicable decisions (from frontmatter + full summary)
342
+ - Tech stack available (from `aggregated.tech_stack_added`)
343
+ - Established patterns (from `aggregated.patterns_established`)
344
+ - Key files to reference (from `aggregated.key_files_created` + `key_files_modified`)
345
+ - Applicable decisions (from `aggregated.key_decisions` + full summary reads)
407
346
  - Todos being addressed (from pending todos)
408
- - Concerns being verified (from "Next Phase Readiness")
409
- - Matched learnings (from debug docs, adhoc summaries, patterns, decisions, LEARNINGS.md)
347
+ - Concerns being verified (from "Next Phase Readiness" in full reads)
348
+ - Matched learnings (from `debug_learnings`, `adhoc_learnings`, patterns, knowledge files)
410
349
  </step>
411
350
 
412
351
  <step name="gather_phase_context">
@@ -563,8 +502,7 @@ Assemble handoff payload:
563
502
  <learning type="debug" source=".planning/debug/resolved/{slug}.md">{root_cause} — fix: {resolution}</learning>
564
503
  <learning type="adhoc" source=".planning/adhoc/{file}.md">{learnings entry}</learning>
565
504
  <learning type="pattern" source=".planning/phases/{path}">{patterns-established entry}</learning>
566
- <learning type="decision" source=".planning/milestones/{file}">{decision}: {rationale}</learning>
567
- <learning type="curated" source="{source_ref from LEARNINGS.md}">{one-liner pattern}</learning>
505
+ <learning type="knowledge" source=".planning/knowledge/{subsystem}.md">{decisions, architecture, pitfalls from knowledge files}</learning>
568
506
  </learnings>
569
507
  ```
570
508
 
@@ -573,7 +511,6 @@ Assemble handoff payload:
573
511
  ```
574
512
  Task(
575
513
  subagent_type: "ms-plan-writer"
576
- model: "sonnet"
577
514
  description: "Write PLAN.md files for phase {PHASE}"
578
515
  prompt: "{assembled handoff payload}"
579
516
  )
@@ -664,7 +601,6 @@ Spawn ms-plan-checker:
664
601
  ```
665
602
  Task(
666
603
  subagent_type: "ms-plan-checker"
667
- model: "sonnet"
668
604
  description: "Verify phase ${PHASE} plans"
669
605
  prompt: """
670
606
  Verify plans for phase ${PHASE}.
@@ -602,6 +602,26 @@ git add ".planning/phases/XX-name/{phase}-UAT.md"
602
602
  git commit -m "test({phase}): complete UAT - {passed} passed, {fixed} fixed, {skipped} assumptions"
603
603
  ```
604
604
 
605
+ **5.5. Update knowledge pitfalls (lightweight):**
606
+
607
+ ```bash
608
+ # Check for significant findings
609
+ grep -c "severity: blocker\|severity: major" "$PHASE_DIR/${PHASE}-UAT.md" 2>/dev/null
610
+ ```
611
+
612
+ If significant issues (blocker/major) were found AND fixed:
613
+ 1. Determine affected subsystem(s) from the UAT.md test descriptions and config.json
614
+ 2. Read relevant `knowledge/{subsystem}.md` files
615
+ 3. Append new pitfall entries to the Pitfalls section (do not rewrite entire file — just append)
616
+ 4. Commit knowledge file updates:
617
+ ```bash
618
+ git add .planning/knowledge/*.md && git commit -m "docs: update pitfalls from UAT findings"
619
+ ```
620
+
621
+ If no significant findings or no fixes: skip silently.
622
+
623
+ This is NOT a full re-consolidation. Read only UAT.md and add specific pitfall entries.
624
+
605
625
  **6. Present summary:**
606
626
  ```
607
627
  ## UAT Complete: Phase {phase}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mindsystem-cc",
3
- "version": "3.14.0",
3
+ "version": "3.16.1",
4
4
  "description": "A meta-prompting, context engineering and spec-driven development system for Claude Code by TÂCHES.",
5
5
  "bin": {
6
6
  "mindsystem-cc": "bin/install.js"