mindsystem-cc 3.13.1 → 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 (54) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +1 -0
  3. package/agents/ms-codebase-researcher.md +105 -0
  4. package/agents/ms-consolidator.md +137 -286
  5. package/agents/ms-debugger.md +1 -0
  6. package/agents/ms-designer.md +1 -0
  7. package/agents/ms-executor.md +2 -1
  8. package/agents/ms-flutter-reviewer.md +1 -0
  9. package/agents/ms-integration-checker.md +1 -0
  10. package/agents/ms-plan-checker.md +17 -327
  11. package/agents/ms-researcher.md +25 -343
  12. package/agents/ms-roadmapper.md +10 -75
  13. package/agents/ms-verifier.md +33 -309
  14. package/agents/ms-verify-fixer.md +1 -0
  15. package/commands/ms/check-phase.md +24 -55
  16. package/commands/ms/complete-milestone.md +6 -25
  17. package/commands/ms/create-roadmap.md +3 -15
  18. package/commands/ms/design-phase.md +40 -2
  19. package/commands/ms/discuss-phase.md +1 -9
  20. package/commands/ms/doctor.md +224 -0
  21. package/commands/ms/execute-phase.md +22 -12
  22. package/commands/ms/help.md +11 -0
  23. package/commands/ms/new-milestone.md +3 -3
  24. package/commands/ms/plan-phase.md +1 -1
  25. package/commands/ms/research-phase.md +249 -85
  26. package/commands/ms/verify-work.md +7 -13
  27. package/mindsystem/templates/UAT.md +0 -274
  28. package/mindsystem/templates/context.md +1 -11
  29. package/mindsystem/templates/discovery.md +2 -3
  30. package/mindsystem/templates/knowledge.md +99 -0
  31. package/mindsystem/templates/requirements.md +3 -61
  32. package/mindsystem/templates/research-comparison-output.md +50 -0
  33. package/mindsystem/templates/research-feasibility-output.md +43 -0
  34. package/mindsystem/templates/research-project-output.md +81 -0
  35. package/mindsystem/templates/research-subagent-prompt.md +164 -48
  36. package/mindsystem/templates/roadmap-milestone.md +67 -0
  37. package/mindsystem/templates/roadmap.md +2 -66
  38. package/mindsystem/workflows/complete-milestone.md +23 -140
  39. package/mindsystem/workflows/define-requirements.md +4 -8
  40. package/mindsystem/workflows/discuss-phase.md +25 -8
  41. package/mindsystem/workflows/execute-phase.md +34 -0
  42. package/mindsystem/workflows/execute-plan.md +8 -0
  43. package/mindsystem/workflows/mockup-generation.md +1 -1
  44. package/mindsystem/workflows/plan-phase.md +40 -102
  45. package/mindsystem/workflows/verify-work.md +40 -234
  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/skills/flutter-code-quality/SKILL.md +1 -1
  51. package/skills/flutter-code-simplification/SKILL.md +1 -1
  52. package/skills/flutter-senior-review/SKILL.md +1 -1
  53. package/mindsystem/templates/decisions.md +0 -145
  54. package/mindsystem/templates/learnings.md +0 -150
@@ -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
 
@@ -87,7 +87,7 @@ Task(prompt=assembled_context, subagent_type="ms-mockup-designer", description="
87
87
  </step>
88
88
 
89
89
  <step name="present_mockups">
90
- After all 3 agents return, generate comparison page and open it:
90
+ After all 3 agents return, run the comparison script to create the comparison page. Do NOT generate comparison HTML manually — use the script:
91
91
 
92
92
  ```bash
93
93
  uv run ~/.claude/mindsystem/scripts/compare_mockups.py "${PHASE_DIR}/mockups"
@@ -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