mindsystem-cc 4.2.1 → 4.3.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 (33) hide show
  1. package/README.md +30 -12
  2. package/agents/ms-browser-verifier.md +33 -13
  3. package/agents/ms-compounder.md +16 -15
  4. package/agents/ms-consolidator.md +14 -13
  5. package/agents/ms-researcher.md +2 -1
  6. package/agents/ms-roadmapper.md +33 -0
  7. package/commands/ms/add-phase.md +0 -4
  8. package/commands/ms/compound.md +3 -3
  9. package/commands/ms/create-roadmap.md +19 -2
  10. package/commands/ms/design-phase.md +11 -7
  11. package/commands/ms/execute-phase.md +20 -13
  12. package/commands/ms/help.md +1 -0
  13. package/commands/ms/insert-phase.md +0 -4
  14. package/commands/ms/progress.md +8 -62
  15. package/commands/ms/research-phase.md +16 -11
  16. package/commands/ms/verify-work.md +8 -2
  17. package/mindsystem/references/prework-status.md +2 -1
  18. package/mindsystem/references/routing/next-phase-routing.md +6 -5
  19. package/mindsystem/templates/knowledge.md +1 -1
  20. package/mindsystem/templates/milestone-archive.md +0 -14
  21. package/mindsystem/templates/roadmap-milestone.md +5 -16
  22. package/mindsystem/templates/roadmap.md +6 -32
  23. package/mindsystem/workflows/complete-milestone.md +0 -1
  24. package/mindsystem/workflows/compound.md +24 -6
  25. package/mindsystem/workflows/discuss-phase.md +7 -22
  26. package/mindsystem/workflows/doctor-fixes.md +1 -1
  27. package/mindsystem/workflows/execute-phase.md +13 -15
  28. package/mindsystem/workflows/execute-plan.md +3 -1
  29. package/mindsystem/workflows/mockup-generation.md +3 -2
  30. package/mindsystem/workflows/transition.md +6 -8
  31. package/mindsystem/workflows/verify-work.md +31 -15
  32. package/package.json +1 -1
  33. package/scripts/ms-tools.py +27 -4
@@ -11,8 +11,6 @@ allowed-tools:
11
11
 
12
12
  <objective>
13
13
  Check project progress, summarize recent work and what's ahead, then intelligently route to the next action - either executing an existing plan or creating the next one.
14
-
15
- Provides situational awareness before continuing work.
16
14
  </objective>
17
15
 
18
16
 
@@ -77,7 +75,7 @@ Compare versions. Store result for the report step. If npm fails or versions mat
77
75
  - Read `.planning/STATE.md` for living memory (position, decisions, issues)
78
76
  - Read `.planning/ROADMAP.md` for phase structure and objectives
79
77
  - Read `.planning/PROJECT.md` for current state (What This Is, Core Value, Requirements)
80
- </step>
78
+ </step>
81
79
 
82
80
  <step name="recent">
83
81
  **Gather recent work context:**
@@ -85,7 +83,7 @@ Compare versions. Store result for the report step. If npm fails or versions mat
85
83
  - Find the 2-3 most recent SUMMARY.md files
86
84
  - Extract from each: what was accomplished, key decisions, any issues logged
87
85
  - This shows "what we've been working on"
88
- </step>
86
+ </step>
89
87
 
90
88
  <step name="position">
91
89
  **Parse current position:**
@@ -97,7 +95,7 @@ Compare versions. Store result for the report step. If npm fails or versions mat
97
95
  - Check for DESIGN.md: For UI-heavy phases, check if `{phase}-DESIGN.md` exists in phase directory
98
96
  - Count pending todos: `ls .planning/todos/*.md 2>/dev/null | wc -l`
99
97
  - Check for active debug sessions: `ls .planning/debug/*.md 2>/dev/null | grep -v resolved | wc -l`
100
- </step>
98
+ </step>
101
99
 
102
100
  <step name="report">
103
101
  **Present rich status report:**
@@ -205,48 +203,7 @@ Read its `<objective>` section.
205
203
 
206
204
  **Route B: Phase needs planning**
207
205
 
208
- Check if `{phase}-CONTEXT.md` exists in phase directory.
209
-
210
- **If CONTEXT.md exists:**
211
-
212
- ```
213
- ---
214
-
215
- ## ▶ Next Up
216
-
217
- **Phase {N}: {Name}** — {Goal from ROADMAP.md}
218
- <sub>✓ Context gathered, ready to plan</sub>
219
-
220
- `/ms:plan-phase {phase-number}`
221
-
222
- <sub>`/clear` first → fresh context window</sub>
223
-
224
- ---
225
- ```
226
-
227
- **If CONTEXT.md does NOT exist:**
228
-
229
- ```
230
- ---
231
-
232
- ## ▶ Next Up
233
-
234
- **Phase {N}: {Name}** — {Goal from ROADMAP.md}
235
-
236
- `/ms:plan-phase {phase}`
237
-
238
- <sub>`/clear` first → fresh context window</sub>
239
-
240
- ---
241
-
242
- **Also available:**
243
- - `/ms:discuss-phase {phase}` — gather context first
244
- - `/ms:design-phase {phase}` — create UI/UX specifications
245
- - `/ms:research-phase {phase}` — investigate unknowns
246
- - `/ms:discuss-phase {phase}` — gather context and validate assumptions
247
-
248
- ---
249
- ```
206
+ Read `~/.claude/mindsystem/references/routing/next-phase-routing.md` and follow its instructions for the **current** phase (not next phase) to present "Next Up" with pre-work context from ROADMAP.md flags.
250
207
 
251
208
  ---
252
209
 
@@ -299,22 +256,11 @@ A milestone was completed and archived. Read `~/.claude/mindsystem/references/ro
299
256
 
300
257
  </step>
301
258
 
302
- <step name="edge_cases">
303
- **Handle edge cases:**
304
-
305
- - Phase complete but next phase not planned → offer `/ms:plan-phase [next]`
306
- - All work complete → offer milestone completion
307
- - Blockers present → highlight before offering to continue
308
- </step>
309
-
310
259
  </process>
311
260
 
312
261
  <success_criteria>
313
262
 
314
- - [ ] Rich context provided (recent work, decisions, issues)
315
- - [ ] Current position clear with visual progress
316
- - [ ] What's next clearly explained
317
- - [ ] Smart routing: /ms:execute-phase if plan exists, /ms:plan-phase if not
318
- - [ ] User confirms before any action
319
- - [ ] Seamless handoff to appropriate mindsystem command
320
- </success_criteria>
263
+ - [ ] Report includes recent work, decisions, blockers, and pending counts
264
+ - [ ] Smart routing: /ms:execute-phase if plan exists, ROADMAP pre-work flags consulted if not
265
+ - [ ] Presents copy-paste command — never auto-executes the routed action
266
+ </success_criteria>
@@ -40,7 +40,7 @@ Use `find-phase` output from context. **If phase not found (dir is null):** Erro
40
40
  ## 2. Check Existing Research
41
41
 
42
42
  ```bash
43
- ls .planning/phases/${PHASE}-*/RESEARCH.md 2>/dev/null
43
+ ls ${PHASE_DIR}/*RESEARCH.md 2>/dev/null
44
44
  ```
45
45
 
46
46
  **If exists:** Offer: 1) Update research, 2) View existing, 3) Skip. Wait for response.
@@ -61,9 +61,9 @@ grep -A20 "Phase ${PHASE}:" .planning/ROADMAP.md
61
61
  # Requirements
62
62
  cat .planning/REQUIREMENTS.md 2>/dev/null
63
63
 
64
- # Phase-specific context and design
65
- cat .planning/phases/${PHASE}-*/${PHASE}-CONTEXT.md 2>/dev/null
66
- cat .planning/phases/${PHASE}-*/${PHASE}-DESIGN.md 2>/dev/null
64
+ # Phase-specific context and design (PHASE_DIR from find-phase in <context>)
65
+ cat ${PHASE_DIR}/*-CONTEXT.md 2>/dev/null
66
+ cat ${PHASE_DIR}/*-DESIGN.md 2>/dev/null
67
67
 
68
68
  # Locked decisions
69
69
  grep -A30 "### Decisions Made" .planning/STATE.md 2>/dev/null
@@ -304,27 +304,32 @@ Write RESEARCH.md to `.planning/phases/{phase}-{slug}/{phase}-RESEARCH.md` using
304
304
 
305
305
  ```bash
306
306
  ms-tools set-last-command "ms:research-phase $ARGUMENTS"
307
- git add .planning/phases/${PHASE}-*/*-RESEARCH.md .planning/STATE.md
307
+ git add ${PHASE_DIR}/*-RESEARCH.md .planning/STATE.md
308
308
  git commit -m "docs: complete research for phase ${PHASE}"
309
309
  ```
310
310
 
311
- Display research summary. Read `~/.claude/mindsystem/references/prework-status.md` to show what's done vs still needed for this phase.
311
+ Display research summary.
312
312
 
313
313
  **Post-synthesis routing:**
314
314
 
315
315
  Scan the synthesized RESEARCH.md for LOW confidence sections and significant open questions.
316
316
 
317
- If all sections HIGH/MEDIUM confidence with no major gaps, use AskUserQuestion:
318
- 1. Proceed to planning
319
- 2. Dig deeper into specific area
320
- 3. Review full research
317
+ If all sections HIGH/MEDIUM confidence with no major gaps:
318
+
319
+ Read `~/.claude/mindsystem/references/prework-status.md` and present what's done vs still needed for this phase.
320
+
321
+ Also offer:
322
+ - **Dig deeper** — into specific area
323
+ - **Review full research** — display RESEARCH.md
321
324
 
322
325
  If any section has LOW confidence or significant open questions, flag the weak areas explicitly, then use AskUserQuestion:
323
326
  1. Dig deeper into [specific LOW area] — re-run targeted agent
324
327
  2. Try different research mode (e.g., ecosystem -> implementation)
325
- 3. Proceed to planning with caveats noted
328
+ 3. Proceed with caveats noted
326
329
  4. Review full research
327
330
 
331
+ When user selects "Proceed with caveats noted", read `~/.claude/mindsystem/references/prework-status.md` and present what's done vs still needed for this phase.
332
+
328
333
  </process>
329
334
 
330
335
  <checkpoint_handling>
@@ -31,6 +31,11 @@ Phase: $ARGUMENTS (optional)
31
31
  - If provided: Test specific phase (e.g., "4")
32
32
  - If not provided: Check for active sessions or prompt for phase
33
33
 
34
+ Resolve phase directory:
35
+ ```bash
36
+ ms-tools find-phase "$ARGUMENTS"
37
+ ```
38
+
34
39
  @.planning/STATE.md
35
40
  @.planning/ROADMAP.md
36
41
  @.planning/PROJECT.md
@@ -49,9 +54,10 @@ Phase: $ARGUMENTS (optional)
49
54
  - Present tests via AskUserQuestion (Pass / Can't test / Skip / Other)
50
55
  - Process results — UAT.md updates happen via `ms-tools uat-update` (auto-recalculates progress)
51
56
  - **For each issue found:**
52
- - Lightweight investigation (2-3 tool calls)
57
+ - On first issue: load knowledge files (match phase subsystem against `.planning/knowledge/*.md`)
58
+ - Lightweight investigation (2-3 tool calls, informed by knowledge)
53
59
  - If simple: Fix inline, commit (amend previous fix commit on retry when HEAD matches fix_commit), ask for re-test
54
- - If complex: Spawn ms-verify-fixer subagent
60
+ - If complex: Spawn ms-verify-fixer subagent (with knowledge context in prompt)
55
61
  - 2 retries on failed re-test, then offer options
56
62
  8. **On batch transition:**
57
63
  - If new mock_type: Revert old mocks (`git checkout -- <mocked_files>`), apply new ones
@@ -22,7 +22,8 @@ Extract:
22
22
  Check what context files already exist:
23
23
 
24
24
  ```bash
25
- PHASE_DIR=$(ls -d .planning/phases/${PHASE}-* 2>/dev/null | head -1)
25
+ ms-tools find-phase "${PHASE}"
26
+ # Extract PHASE_DIR from the `dir` field of the JSON output
26
27
  [ -f "$PHASE_DIR"/*-CONTEXT.md ] && echo "CONTEXT_EXISTS"
27
28
  [ -f "$PHASE_DIR"/*-DESIGN.md ] && echo "DESIGN_EXISTS"
28
29
  [ -f "$PHASE_DIR"/*-RESEARCH.md ] && echo "RESEARCH_EXISTS"
@@ -1,17 +1,17 @@
1
1
  # Next Phase Routing
2
2
 
3
- Reference for presenting "Next Up" guidance when moving to the next phase. Used by execute-phase and verify-work.
3
+ Reference for presenting "Next Up" guidance for a phase. Used by progress (current phase) and verify-work (next phase).
4
4
 
5
5
  ## Purpose
6
6
 
7
- Help user decide between Discuss/Research/Design/Plan for the NEXT phase without referencing external files.
7
+ Help user decide between Discuss/Research/Design/Plan for a target phase using ROADMAP.md pre-work flags.
8
8
 
9
9
  ## Information to Extract
10
10
 
11
- From ROADMAP.md, get the next phase details:
11
+ From ROADMAP.md, get the target phase details:
12
12
 
13
13
  ```bash
14
- grep -A 25 "### Phase ${NEXT_PHASE}:" .planning/ROADMAP.md
14
+ grep -A 25 "### Phase ${TARGET_PHASE}:" .planning/ROADMAP.md
15
15
  ```
16
16
 
17
17
  Extract:
@@ -26,7 +26,8 @@ Extract:
26
26
  Check for existing context files:
27
27
 
28
28
  ```bash
29
- PHASE_DIR=$(ls -d .planning/phases/${NEXT_PHASE}-* 2>/dev/null | head -1)
29
+ ms-tools find-phase "${TARGET_PHASE}"
30
+ # Extract PHASE_DIR from the `dir` field of the JSON output
30
31
  [ -f "$PHASE_DIR"/*-CONTEXT.md ] && echo "CONTEXT_EXISTS"
31
32
  [ -f "$PHASE_DIR"/*-DESIGN.md ] && echo "DESIGN_EXISTS"
32
33
  [ -f "$PHASE_DIR"/*-RESEARCH.md ] && echo "RESEARCH_EXISTS"
@@ -66,7 +66,7 @@ Template for `.planning/knowledge/{subsystem}.md` — per-subsystem knowledge fi
66
66
  - **Architecture and Design use prose bullets.** Describe how things work, not tables.
67
67
  - **Pitfalls use bold titles** for scannability.
68
68
  - **Key Files is a flat list.** No nesting, no grouping.
69
- - **Rewrite semantics, not append.** Each consolidation produces the current state. Superseded decisions get updated. Outdated patterns get removed. The file is always current.
69
+ - **Edit to reflect current state.** Each update produces the current state through targeted edits — update superseded decisions, remove outdated patterns, append new entries. Use `Edit` for existing files, `Write` only for new files. Never replace an entire knowledge file via `Write`.
70
70
 
71
71
  ## Cross-Reference Pattern
72
72
 
@@ -10,8 +10,6 @@ This template is used by the complete-milestone workflow to create archive files
10
10
 
11
11
  **Status:** ✅ SHIPPED {{DATE}}
12
12
  **Phases:** {{PHASE_START}}-{{PHASE_END}}
13
- **Total Plans:** {{TOTAL_PLANS}}
14
-
15
13
  ## Overview
16
14
 
17
15
  {{MILESTONE_DESCRIPTION}}
@@ -26,13 +24,6 @@ This template is used by the complete-milestone workflow to create archive files
26
24
 
27
25
  **Goal**: {{PHASE_GOAL}}
28
26
  **Depends on**: {{DEPENDS_ON}}
29
- **Plans**: {{PLAN_COUNT}} plans
30
-
31
- Plans:
32
-
33
- - [x] {{PHASE}}-01: {{PLAN_DESCRIPTION}}
34
- - [x] {{PHASE}}-02: {{PLAN_DESCRIPTION}}
35
- [... all plans ...]
36
27
 
37
28
  **Details:**
38
29
  {{PHASE_DETAILS_FROM_ROADMAP}}
@@ -43,11 +34,6 @@ Plans:
43
34
 
44
35
  **Goal**: Fix authentication bypass vulnerability
45
36
  **Depends on**: Phase 2
46
- **Plans**: 1 plan
47
-
48
- Plans:
49
-
50
- - [x] 02.1-01: Patch auth vulnerability
51
37
 
52
38
  **Details:**
53
39
  {{PHASE_DETAILS_FROM_ROADMAP}}
@@ -18,12 +18,6 @@ Template for reorganizing `ROADMAP.md` after first milestone ships. Collapse com
18
18
 
19
19
  ### Phase 1: [Name]
20
20
  **Goal**: [What this phase delivers]
21
- **Plans**: 3 plans
22
-
23
- Plans:
24
- - [x] 01-01: [Brief description]
25
- - [x] 01-02: [Brief description]
26
- - [x] 01-03: [Brief description]
27
21
 
28
22
  [... remaining phases ...]
29
23
 
@@ -36,11 +30,6 @@ Plans:
36
30
  #### Phase 5: [Name]
37
31
  **Goal**: [What this phase delivers]
38
32
  **Depends on**: Phase 4
39
- **Plans**: 2 plans
40
-
41
- Plans:
42
- - [ ] 05-01: [Brief description]
43
- - [ ] 05-02: [Brief description]
44
33
 
45
34
  [... remaining phases ...]
46
35
 
@@ -52,11 +41,11 @@ Plans:
52
41
 
53
42
  ## Progress
54
43
 
55
- | Phase | Milestone | Plans Complete | Status | Completed |
56
- |-------|-----------|----------------|--------|-----------|
57
- | 1. Foundation | MVP | 3/3 | Complete | YYYY-MM-DD |
58
- | 2. Features | MVP | 2/2 | Complete | YYYY-MM-DD |
59
- | 5. Security | Security & Polish | 0/2 | Not started | - |
44
+ | Phase | Milestone | Status | Completed |
45
+ |-------|-----------|--------|-----------|
46
+ | 1. Foundation | MVP | Complete | YYYY-MM-DD |
47
+ | 2. Features | MVP | Complete | YYYY-MM-DD |
48
+ | 5. Security | Security & Polish | Not started | - |
60
49
  ```
61
50
 
62
51
  **Notes:**
@@ -52,12 +52,6 @@ Decimal phases appear between their surrounding integers in numeric order.
52
52
  **Discuss**: Unlikely (mechanical setup, zero design decisions)
53
53
  **Design**: Unlikely (backend only)
54
54
  **Research**: Unlikely (established patterns)
55
- **Plans**: [Number of plans, e.g., "3 plans" or "TBD"]
56
-
57
- Plans:
58
- - [ ] 01-01: [Brief description of first plan]
59
- - [ ] 01-02: [Brief description of second plan]
60
- - [ ] 01-03: [Brief description of third plan]
61
55
 
62
56
  ### Phase 2: [Name]
63
57
  **Goal**: [What this phase delivers]
@@ -72,21 +66,12 @@ Plans:
72
66
  **Design focus**: [What to design]
73
67
  **Research**: Likely (new integration)
74
68
  **Research topics**: [What needs investigating]
75
- **Plans**: [Number of plans]
76
-
77
- Plans:
78
- - [ ] 02-01: [Brief description]
79
- - [ ] 02-02: [Brief description]
80
69
 
81
70
  ### Phase 2.1: Critical Fix (INSERTED)
82
71
  **Goal**: [Urgent work inserted between phases]
83
72
  **Depends on**: Phase 2
84
73
  **Success Criteria** (what must be TRUE):
85
74
  1. [What the fix achieves]
86
- **Plans**: 1 plan
87
-
88
- Plans:
89
- - [ ] 02.1-01: [Description]
90
75
 
91
76
  ### Phase 3: [Name]
92
77
  **Goal**: [What this phase delivers]
@@ -101,11 +86,6 @@ Plans:
101
86
  **Design**: Unlikely (API only)
102
87
  **Research**: Likely (external API)
103
88
  **Research topics**: [What needs investigating]
104
- **Plans**: [Number of plans]
105
-
106
- Plans:
107
- - [ ] 03-01: [Brief description]
108
- - [ ] 03-02: [Brief description]
109
89
 
110
90
  ### Phase 4: [Name]
111
91
  **Goal**: [What this phase delivers]
@@ -118,22 +98,18 @@ Plans:
118
98
  **Discuss topics**: [Priority rules, batch vs individual, error recovery]
119
99
  **Design**: Unlikely (backend only)
120
100
  **Research**: Unlikely (internal patterns)
121
- **Plans**: [Number of plans]
122
-
123
- Plans:
124
- - [ ] 04-01: [Brief description]
125
101
 
126
102
  ## Progress
127
103
 
128
104
  **Execution Order:**
129
105
  Phases execute in numeric order: 2 → 2.1 → 2.2 → 3 → 3.1 → 4
130
106
 
131
- | Phase | Plans Complete | Status | Completed |
132
- |-------|----------------|--------|-----------|
133
- | 1. [Name] | 0/3 | Not started | - |
134
- | 2. [Name] | 0/2 | Not started | - |
135
- | 3. [Name] | 0/2 | Not started | - |
136
- | 4. [Name] | 0/1 | Not started | - |
107
+ | Phase | Status | Completed |
108
+ |-------|--------|-----------|
109
+ | 1. [Name] | Not started | - |
110
+ | 2. [Name] | Not started | - |
111
+ | 3. [Name] | Not started | - |
112
+ | 4. [Name] | Not started | - |
137
113
  ```
138
114
 
139
115
  <guidelines>
@@ -145,11 +121,9 @@ Phases execute in numeric order: 2 → 2.1 → 2.2 → 3 → 3.1 → 4
145
121
  **Initial planning:**
146
122
  - Phase count derived from actual work (not a target number)
147
123
  - Each phase delivers something coherent
148
- - Phases can have 1+ plans (split by orchestrator judgment — multiple subsystems, context budget, vertical slices)
149
124
  - Plans use naming: {phase}-{plan}-PLAN.md (e.g., 01-02-PLAN.md)
150
125
  - No time estimates (this isn't enterprise PM)
151
126
  - Progress table updated by execute workflow
152
- - Plan count can be "TBD" initially, refined during planning
153
127
 
154
128
  **Success criteria:**
155
129
  - 2-5 observable behaviors per phase (from user's perspective)
@@ -345,7 +345,6 @@ Extract completed milestone details and create archive file.
345
345
  - {{DATE}} — Today's date
346
346
  - {{PHASE_START}} — First phase number in milestone
347
347
  - {{PHASE_END}} — Last phase number in milestone
348
- - {{TOTAL_PLANS}} — Count of all plans in milestone
349
348
  - {{MILESTONE_DESCRIPTION}} — From ROADMAP.md overview
350
349
  - {{PHASES_SECTION}} — Full phase details extracted
351
350
  - {{DECISIONS_FROM_PROJECT}} — Key decisions from PROJECT.md
@@ -19,7 +19,7 @@ fi
19
19
  ```
20
20
 
21
21
  **Mode detection:**
22
- - If `$ARGUMENTS` empty: **description mode** — deduce from conversation context. Summarize what was discussed/changed in the current session.
22
+ - If `$ARGUMENTS` empty: **conversation mode** — reflect on current conversation to build change summary. No Explore agents needed.
23
23
  - If matches git SHA pattern (7-40 hex chars), contains `..`, or starts with `HEAD`: **git mode**
24
24
  - If matches existing file path (`test -e "$ARGUMENTS"`): **file mode**
25
25
  - Otherwise: **description mode** — treat `$ARGUMENTS` as free-text description
@@ -42,7 +42,25 @@ git log --oneline -5 -- <path>
42
42
  ```
43
43
  Capture file path for passing to compounder.
44
44
 
45
- **Description mode (including no-args):**
45
+ **Conversation mode (no args):**
46
+ Build change summary from conversation context and git data.
47
+
48
+ 1. **Reflect on conversation:** Summarize what was discussed, changed, and decided
49
+ in the current session. Include rationale and key decisions.
50
+ 2. **Supplement with git data:**
51
+ ```bash
52
+ git diff --stat # uncommitted changes
53
+ git log --stat -5 # recent commits with file lists
54
+ ```
55
+ 3. **Thin-context guard:** If conversation reflection produces little substance
56
+ (e.g., fresh context, unrelated discussion), use AskUserQuestion:
57
+ - "Describe what changed" — enter free-text, then proceed as description mode (spawn Explore agents)
58
+ - "Compound recent commits" — use git log output as change context
59
+ - "Cancel" — abort
60
+ 4. **Combine into change summary:** Merge conversation insights with git file paths
61
+ into a concise summary covering: what changed, why, which files, key decisions.
62
+
63
+ **Description mode (free-text argument provided):**
46
64
  Spawn 1 Explore agent to find relevant code changes. If changes span multiple unrelated areas, spawn a second agent for the additional area. They return:
47
65
  - Which files changed or are relevant
48
66
  - Which subsystems are likely affected
@@ -60,7 +78,7 @@ ms-tools config-get subsystems
60
78
 
61
79
  **Git/file mode:** Match file paths from diff stats against subsystem names via keyword matching.
62
80
 
63
- **Description mode:** Use Explore agent findings for subsystem matching.
81
+ **Description/conversation mode:** Use Explore agent findings or conversation summary for subsystem matching.
64
82
 
65
83
  **Detect potential new subsystems:** Changes in file areas that don't match any existing subsystem.
66
84
 
@@ -82,8 +100,8 @@ AskUserQuestion: "Compound knowledge for these subsystems?" with options:
82
100
 
83
101
  <step name="spawn_compounder">
84
102
  Spawn ms-compounder via Task tool with:
85
- - Input mode (`git`, `file`, or `description`)
86
- - Change reference (git ref/range, file path, or description + exploration findings)
103
+ - Input mode (`git`, `file`, or `description` — conversation mode passes as `description`)
104
+ - Change reference (git ref/range, file path, description + exploration findings, or conversation summary)
87
105
  - Confirmed affected subsystems list
88
106
  - Config.json subsystem vocabulary
89
107
 
@@ -91,7 +109,7 @@ Agent reads changes, reads affected knowledge files, writes updates, returns rep
91
109
  </step>
92
110
 
93
111
  <step name="finalize">
94
- **Update config.json** (if new subsystems were confirmed in step 4):
112
+ **Update config.json** (if new subsystems were confirmed in confirm_with_user step):
95
113
  ```bash
96
114
  # Add new subsystem to config.json
97
115
  ms-tools config-set subsystems --append "new-subsystem"
@@ -80,8 +80,9 @@ cat .planning/knowledge/{subsystem}.md 2>/dev/null
80
80
  Check if CONTEXT.md already exists for this phase:
81
81
 
82
82
  ```bash
83
- ls .planning/phases/${PHASE}-*/CONTEXT.md 2>/dev/null
84
- ls .planning/phases/${PHASE}-*/${PHASE}-CONTEXT.md 2>/dev/null
83
+ ms-tools find-phase "${PHASE}"
84
+ # Extract PHASE_DIR from the `dir` field, PHASE from `phase` field (normalized, e.g. "02")
85
+ ls ${PHASE_DIR}/*CONTEXT.md 2>/dev/null
85
86
  ```
86
87
 
87
88
  **If exists:**
@@ -242,10 +243,10 @@ Create CONTEXT.md capturing the user's vision and decisions.
242
243
 
243
244
  Use template from ~/.claude/mindsystem/templates/context.md
244
245
 
245
- **File location:** `.planning/phases/${PHASE}-${SLUG}/${PHASE}-CONTEXT.md`
246
+ **File location:** `${PHASE_DIR}/${PHASE}-CONTEXT.md`
246
247
 
247
248
  **If phase directory doesn't exist yet:**
248
- Create it: `.planning/phases/${PHASE}-${SLUG}/`
249
+ Create it using normalized `${PHASE}` from find-phase output: `.planning/phases/${PHASE}-${SLUG}/`
249
250
 
250
251
  Use roadmap phase name for slug (lowercase, hyphens).
251
252
 
@@ -271,7 +272,7 @@ Write file.
271
272
  Present CONTEXT.md summary:
272
273
 
273
274
  ```
274
- Created: .planning/phases/${PHASE}-${SLUG}/${PHASE}-CONTEXT.md
275
+ Created: ${PHASE_DIR}/${PHASE}-CONTEXT.md
275
276
 
276
277
  ## Vision
277
278
  [How they imagine it working]
@@ -279,22 +280,6 @@ Created: .planning/phases/${PHASE}-${SLUG}/${PHASE}-CONTEXT.md
279
280
  ## Essential
280
281
  [What must be nailed]
281
282
 
282
- ---
283
-
284
- ## ▶ Next Up
285
-
286
- **Phase ${PHASE}: [Name]** — [Goal from ROADMAP.md]
287
-
288
- `/ms:plan-phase ${PHASE}`
289
-
290
- <sub>`/clear` first → fresh context window</sub>
291
-
292
- ---
293
-
294
- **Also available:**
295
- - `/ms:research-phase ${PHASE}` — investigate unknowns
296
- - Review/edit CONTEXT.md before continuing
297
-
298
283
  ---
299
284
  ```
300
285
 
@@ -306,7 +291,7 @@ Created: .planning/phases/${PHASE}-${SLUG}/${PHASE}-CONTEXT.md
306
291
 
307
292
  ```bash
308
293
  ms-tools set-last-command "ms:discuss-phase ${PHASE}"
309
- git add .planning/phases/${PHASE}-${SLUG}/${PHASE}-CONTEXT.md .planning/STATE.md
294
+ git add ${PHASE_DIR}/${PHASE}-CONTEXT.md .planning/STATE.md
310
295
  git commit -m "$(cat <<'EOF'
311
296
  docs(${PHASE}): capture phase context
312
297
 
@@ -315,7 +315,7 @@ Spawn a `general-purpose` subagent (Task tool) with the following structured pro
315
315
  > - Preserve rationale when visible in code comments or config. Do not fabricate reasons.
316
316
  > - Do not fabricate specific numbers (limits, thresholds, counts) — read from source or omit.
317
317
  > - Omit empty sections. No Design section if subsystem has no UI.
318
- > - Rewrite semanticsif existing knowledge files exist, merge by producing current state.
318
+ > - Edit to reflect current state use `Edit` for existing knowledge files (targeted changes), `Write` only for new files.
319
319
  > - Cross-reference between subsystems where relevant: "(see api subsystem)".
320
320
  > - Decisions table: 5-10 words per cell. Source column: `"existing"` for source code mode, artifact reference for artifact mode.
321
321
  > - Key files must reference actual paths verified to exist.
@@ -39,11 +39,9 @@ Options:
39
39
  Confirm phase exists and has plans:
40
40
 
41
41
  ```bash
42
- PHASE_DIR=$(ls -d .planning/phases/${PHASE_ARG}* 2>/dev/null | head -1)
43
- if [ -z "$PHASE_DIR" ]; then
44
- echo "ERROR: No phase directory matching '${PHASE_ARG}'"
45
- exit 1
46
- fi
42
+ ms-tools find-phase "${PHASE_ARG}"
43
+ # Extract PHASE_DIR from the `dir` field of the JSON output
44
+ # If dir is null, error: "No phase directory matching '${PHASE_ARG}'"
47
45
 
48
46
  PLAN_COUNT=$(ls -1 "$PHASE_DIR"/*-PLAN.md 2>/dev/null | wc -l | tr -d ' ')
49
47
  if [ "$PLAN_COUNT" -eq 0 ]; then
@@ -541,24 +539,24 @@ All {Y} plans finished. Phase goal verified.
541
539
 
542
540
  **Then present "Also available" based on milestone status:**
543
541
 
544
- **If more phases remain:**
542
+ **If more phases remain AND skip context applies:**
545
543
 
546
- Read `~/.claude/mindsystem/references/routing/next-phase-routing.md` to determine the most appropriate command for the next phase (discuss/design/research/plan based on pre-work flags). Present concisely under "Also available":
544
+ Determine the next phase's primary suggestion inline do NOT read next-phase-routing.md:
545
+ - From ROADMAP.md (already in context), get Phase {Z+1} pre-work flags
546
+ - Check: CONTEXT.md exists? DESIGN.md? RESEARCH.md? in next phase dir
547
+ - Priority: discuss (if Likely + no CONTEXT.md) > design (if Likely + no DESIGN.md) > research (if Likely + no RESEARCH.md) > plan-phase
548
+ - Present ONE "Also available" entry:
547
549
 
548
550
  ```markdown
549
551
  ---
550
-
551
- **Phase {Z+1}: {Name}** — {Goal}
552
- {If pre-work flagged: brief note about recommendations}
553
-
554
552
  **Also available:**
555
- - `/ms:{suggested} {Z+1}` — {reason from routing}
556
- - `/ms:plan-phase {Z+1}` — skip pre-work, plan directly
557
-
553
+ - `/ms:{suggested} {Z+1}` — skip verify, start Phase {Z+1}: {Name}
558
554
  ---
559
555
  ```
560
556
 
561
- Include the pre-work recommendations table from the routing reference if any pre-work is flagged as "Likely".
557
+ **If more phases remain but skip context does NOT apply:** No "Also available" — verify-work is the sole suggestion.
558
+
559
+ Do NOT present pre-work recommendation tables or multiple cross-phase alternatives. Cross-phase routing belongs to verify-work and progress.
562
560
 
563
561
  **If milestone complete:**
564
562
 
@@ -260,7 +260,9 @@ completed: YYYY-MM-DD
260
260
  ---
261
261
  ```
262
262
 
263
- **Subsystem:** Use inline `**Subsystem:**` metadata from plan header if present. Otherwise select from `ms-tools config-get subsystems`. If novel, append to config.json and log in decisions.
263
+ **Subsystem:** Use inline `**Subsystem:**` metadata from plan header if present. Otherwise select the best match from `ms-tools config-get subsystems`.
264
+
265
+ **Novel subsystem (safety net):** If the plan's work genuinely doesn't fit any existing subsystem, append: `ms-tools config-set subsystems --append "{name}"`. Use in SUMMARY frontmatter and log the addition in Decisions Made. This is a fallback — `create-roadmap` handles most subsystem additions proactively.
264
266
 
265
267
  **Mock hints:** Reflect on what you built. If UI with transient states (loading, animations, async transitions) or external data dependencies, populate accordingly. If purely backend or no async UI, write `mock_hints: none # reason`. Always populate.
266
268
 
@@ -79,8 +79,9 @@ Extract the HTML scaffold from the `<template>` block.
79
79
 
80
80
  <step name="spawn_agents">
81
81
  ```bash
82
- PHASE_DIR=$(ls -d .planning/phases/${PHASE}-* 2>/dev/null | head -1)
83
- # Assumes single match. If empty, phase directory is missing — stop and report.
82
+ ms-tools find-phase "${PHASE}"
83
+ # Extract PHASE_DIR from the `dir` field of the JSON output
84
+ # If dir is null, phase directory is missing — stop and report.
84
85
  mkdir -p "${PHASE_DIR}/mockups"
85
86
  ```
86
87