mindsystem-cc 4.2.0 → 4.3.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 (37) hide show
  1. package/README.md +19 -1
  2. package/agents/ms-browser-verifier.md +95 -40
  3. package/agents/ms-compounder.md +2 -2
  4. package/agents/ms-researcher.md +2 -1
  5. package/agents/ms-roadmapper.md +33 -0
  6. package/commands/ms/add-todo.md +4 -4
  7. package/commands/ms/adhoc.md +2 -1
  8. package/commands/ms/audit-milestone.md +3 -2
  9. package/commands/ms/complete-milestone.md +2 -3
  10. package/commands/ms/compound.md +3 -3
  11. package/commands/ms/config.md +3 -4
  12. package/commands/ms/create-roadmap.md +25 -14
  13. package/commands/ms/design-phase.md +13 -14
  14. package/commands/ms/execute-phase.md +31 -10
  15. package/commands/ms/help.md +1 -0
  16. package/commands/ms/map-codebase.md +1 -2
  17. package/commands/ms/new-milestone.md +3 -7
  18. package/commands/ms/new-project.md +6 -9
  19. package/commands/ms/progress.md +8 -62
  20. package/commands/ms/remove-phase.md +2 -9
  21. package/commands/ms/research-milestone.md +3 -8
  22. package/commands/ms/research-phase.md +17 -17
  23. package/commands/ms/verify-work.md +8 -2
  24. package/mindsystem/references/browser-verification.md +76 -9
  25. package/mindsystem/references/prework-status.md +2 -1
  26. package/mindsystem/references/routing/next-phase-routing.md +6 -5
  27. package/mindsystem/workflows/adhoc.md +14 -15
  28. package/mindsystem/workflows/compound.md +28 -17
  29. package/mindsystem/workflows/define-requirements.md +2 -1
  30. package/mindsystem/workflows/discuss-phase.md +11 -32
  31. package/mindsystem/workflows/execute-phase.md +57 -13
  32. package/mindsystem/workflows/execute-plan.md +3 -1
  33. package/mindsystem/workflows/map-codebase.md +4 -1
  34. package/mindsystem/workflows/mockup-generation.md +3 -2
  35. package/mindsystem/workflows/verify-work.md +21 -2
  36. package/package.json +1 -1
  37. package/scripts/ms-tools.py +27 -4
@@ -136,6 +136,7 @@ Define requirements and create roadmap with phases.
136
136
  - Creates `.planning/ROADMAP.md` (phase breakdown)
137
137
  - Creates `.planning/STATE.md` (project memory)
138
138
  - Creates `.planning/phases/` directories
139
+ - Evaluates subsystem coverage — proposes new subsystems if phases introduce unmatched domains
139
140
 
140
141
  Usage: `/ms:create-roadmap`
141
142
 
@@ -58,9 +58,8 @@ Check for .planning/STATE.md - loads context if project already initialized
58
58
  - Agent 4: concerns focus → writes CONCERNS.md
59
59
  4. Wait for agents to complete, collect confirmations (NOT document contents)
60
60
  5. Verify all 7 documents exist with line counts
61
- 6. Commit codebase map
61
+ 6. Update last command and commit codebase map (together with STATE.md)
62
62
  7. Offer next steps (adapts: /ms:new-project if no PROJECT.md, /ms:doctor if PROJECT.md exists)
63
- 8. **Update last command:** `ms-tools set-last-command "ms:map-codebase $ARGUMENTS"`
64
63
  </process>
65
64
 
66
65
  <success_criteria>
@@ -254,14 +254,12 @@ Milestone name: $ARGUMENTS (optional — will emerge during discovery if not pro
254
254
 
255
255
  Keep Accumulated Context (decisions, blockers) from previous milestone.
256
256
 
257
- 17. **Git commit:**
257
+ 17. **Update state and commit:**
258
258
 
259
259
  ```bash
260
+ ms-tools set-last-command "ms:new-milestone $ARGUMENTS"
260
261
  git add .planning/PROJECT.md .planning/STATE.md .planning/MILESTONE-CONTEXT.md
261
- git commit -m "$(cat <<'EOF'
262
- docs: start milestone [Name]
263
- EOF
264
- )"
262
+ git commit -m "docs: start milestone [Name]"
265
263
  ```
266
264
 
267
265
  18. **Calculate next phase number:**
@@ -302,8 +300,6 @@ Milestone name: $ARGUMENTS (optional — will emerge during discovery if not pro
302
300
  ---
303
301
  ```
304
302
 
305
- 20. **Update last command:** `ms-tools set-last-command "ms:new-milestone $ARGUMENTS"`
306
-
307
303
  </process>
308
304
 
309
305
  <success_criteria>
@@ -195,9 +195,11 @@ These values are used throughout the system for consistent categorization of sum
195
195
 
196
196
  <step name="commit">
197
197
 
198
- **First run:**
198
+ **First run — update state and commit:**
199
199
  ```bash
200
+ ms-tools set-last-command "ms:new-project"
200
201
  git add .planning/PROJECT.md .planning/config.json
202
+ [ -f .planning/STATE.md ] && git add .planning/STATE.md
201
203
  git commit -m "$(cat <<'EOF'
202
204
  docs: initialize [project-name]
203
205
 
@@ -208,9 +210,10 @@ EOF
208
210
  )"
209
211
  ```
210
212
 
211
- **Update mode:**
213
+ **Update mode — update state and commit:**
212
214
  ```bash
213
- git add .planning/PROJECT.md .planning/config.json
215
+ ms-tools set-last-command "ms:new-project"
216
+ git add .planning/PROJECT.md .planning/config.json .planning/STATE.md
214
217
  git commit -m "$(cat <<'EOF'
215
218
  docs: update [project-name] project context
216
219
 
@@ -268,12 +271,6 @@ Project updated:
268
271
 
269
272
  </step>
270
273
 
271
- <step name="update_last_command">
272
- ```bash
273
- ms-tools set-last-command "ms:new-project"
274
- ```
275
- </step>
276
-
277
274
  </process>
278
275
 
279
276
  <output>
@@ -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>
@@ -259,14 +259,13 @@ Update any internal references to reflect new numbering.
259
259
  </step>
260
260
 
261
261
  <step name="commit">
262
- Stage and commit the removal:
262
+ **Update state and commit:**
263
263
 
264
264
  ```bash
265
+ ms-tools set-last-command "ms:remove-phase $ARGUMENTS"
265
266
  git add .planning/
266
267
  git commit -m "chore: remove phase {target} ({original-phase-name})"
267
268
  ```
268
-
269
- The commit message preserves the historical record of what was removed.
270
269
  </step>
271
270
 
272
271
  <step name="completion">
@@ -297,12 +296,6 @@ Would you like to:
297
296
  ```
298
297
  </step>
299
298
 
300
- <step name="update_last_command">
301
- ```bash
302
- ms-tools set-last-command "ms:remove-phase $ARGUMENTS"
303
- ```
304
- </step>
305
-
306
299
  </process>
307
300
 
308
301
  <anti_patterns>
@@ -285,10 +285,11 @@ Write Executive Summary (2-3 paragraphs) synthesizing all findings.
285
285
 
286
286
  Merge overlapping findings. Resolve conflicts by preferring higher-confidence sources.
287
287
 
288
- ## 7. Present Results and Commit
288
+ ## 7. Update state and commit:
289
289
 
290
290
  ```bash
291
- git add .planning/MILESTONE-RESEARCH.md
291
+ ms-tools set-last-command "ms:research-milestone"
292
+ git add .planning/MILESTONE-RESEARCH.md .planning/STATE.md
292
293
  git commit -m "$(cat <<'EOF'
293
294
  docs: complete milestone research
294
295
 
@@ -320,12 +321,6 @@ Key findings:
320
321
  ---
321
322
  ```
322
323
 
323
- ## 8. Update Last Command
324
-
325
- ```bash
326
- ms-tools set-last-command "ms:research-milestone"
327
- ```
328
-
329
324
  </process>
330
325
 
331
326
  <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
@@ -300,35 +300,35 @@ After all 3 agents return, read their structured outputs. Map findings to RESEAR
300
300
 
301
301
  Write RESEARCH.md to `.planning/phases/{phase}-{slug}/{phase}-RESEARCH.md` using the standard template structure (semantic XML tags: `<research_summary>`, `<standard_stack>`, `<architecture_patterns>`, `<dont_hand_roll>`, `<common_pitfalls>`, `<code_examples>`, `<sota_updates>`, `<open_questions>`, `<sources>`, `<metadata>`).
302
302
 
303
- ## 7. Commit and Present
303
+ ## 7. Update state and commit:
304
304
 
305
305
  ```bash
306
- git add .planning/phases/${PHASE}-*/*-RESEARCH.md
306
+ ms-tools set-last-command "ms:research-phase $ARGUMENTS"
307
+ git add ${PHASE_DIR}/*-RESEARCH.md .planning/STATE.md
307
308
  git commit -m "docs: complete research for phase ${PHASE}"
308
309
  ```
309
310
 
310
- 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.
311
312
 
312
313
  **Post-synthesis routing:**
313
314
 
314
315
  Scan the synthesized RESEARCH.md for LOW confidence sections and significant open questions.
315
316
 
316
- If all sections HIGH/MEDIUM confidence with no major gaps, use AskUserQuestion:
317
- 1. Proceed to planning
318
- 2. Dig deeper into specific area
319
- 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
320
324
 
321
325
  If any section has LOW confidence or significant open questions, flag the weak areas explicitly, then use AskUserQuestion:
322
326
  1. Dig deeper into [specific LOW area] — re-run targeted agent
323
327
  2. Try different research mode (e.g., ecosystem -> implementation)
324
- 3. Proceed to planning with caveats noted
328
+ 3. Proceed with caveats noted
325
329
  4. Review full research
326
330
 
327
- ## 8. Update Last Command
328
-
329
- ```bash
330
- ms-tools set-last-command "ms:research-phase $ARGUMENTS"
331
- ```
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
332
 
333
333
  </process>
334
334
 
@@ -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
@@ -32,7 +32,7 @@ Store the result as `{dev_url}`.
32
32
  If `HAS_STATE`:
33
33
  1. Open app headless at `{dev_url}`
34
34
  2. Check current URL — if redirected to a login/auth path, auth has expired
35
- 3. If still on app pages: auth valid, proceed to Spawn
35
+ 3. If still on app pages: auth valid, proceed to Derive Browser Checklist
36
36
 
37
37
  If `NO_STATE` or auth expired:
38
38
  1. Close headless browser
@@ -47,30 +47,97 @@ If `NO_STATE` or auth expired:
47
47
  ```
48
48
  5. If user skips: proceed to code_review, skip browser verification
49
49
 
50
+ ## Derive Browser Checklist
51
+
52
+ Transform SUMMARY.md accomplishments into a structured checklist for the browser verifier.
53
+
54
+ **Step 1: Read summaries**
55
+
56
+ Read all `*-SUMMARY.md` files from the phase directory.
57
+
58
+ **Step 2: Extract per-summary**
59
+
60
+ For each SUMMARY, extract:
61
+ - **Accomplishments** section
62
+ - **mock_hints** frontmatter (if present) — specifically `external_data` entries
63
+ - **key-files** frontmatter (if present) — for route inference
64
+
65
+ **Step 3: Derive checklist items**
66
+
67
+ For each user-observable accomplishment, derive:
68
+ - `name`: brief description of what to verify
69
+ - `route`: URL path (infer from key-files paths, routing config, or component names)
70
+ - `expected`: what should be visible on screen (be specific — "table with columns X, Y, Z", not "data displays")
71
+ - `interaction`: optional action + expected result (e.g., "click Add button → modal opens with form fields A, B, C")
72
+ - `needs_backend_data`: true/false (from mock_hints `external_data` entries)
73
+
74
+ **Step 4: Filter**
75
+
76
+ Include: UI renders, navigation, forms, data display, visual states, user interactions.
77
+ Exclude: refactors, type changes, API internals, test files, build config, non-visual changes.
78
+
79
+ **Step 5: Group and format**
80
+
81
+ Group items by route for efficient navigation. Format as a numbered list:
82
+
83
+ ```
84
+ 1. **{name}**
85
+ Route: {route}
86
+ Expected: {expected}
87
+ Interaction: {interaction or "none"}
88
+ Needs backend data: {yes/no}
89
+
90
+ 2. **{name}**
91
+ ...
92
+ ```
93
+
50
94
  ## Spawn
51
95
 
52
- Spawn the browser verifier agent after auth is established:
96
+ Spawn the browser verifier agent after auth is established and checklist is derived:
53
97
 
54
98
  ```
55
99
  Task(
56
100
  prompt="Run browser verification for phase {phase_number}.
57
101
 
58
102
  Phase directory: {phase_dir}
59
- Phase goal: {phase_goal}
60
- VERIFICATION.md: {verification_path}
61
103
  Dev URL: {dev_url}
62
104
  Auth state: .agent-browser-state.json
63
105
  Screenshots directory: {phase_dir}/screenshots
64
106
 
65
- Read VERIFICATION.md for observable truths. Test browser-testable ones.
66
- Save all screenshots to {phase_dir}/screenshots/.
67
- Fix issues inline. Return structured report.",
107
+ ## Browser Checklist
108
+
109
+ {derived_checklist}
110
+
111
+ ## Backend Context
112
+
113
+ {summary of which items need real backend data — from mock_hints external_data entries.
114
+ Items needing backend data may show empty states or errors — mark as ENVIRONMENT_BLOCKED, not ISSUE.}
115
+
116
+ Verify each checklist item. Save all screenshots to {phase_dir}/screenshots/.
117
+ Fix trivial issues inline. Return structured report.",
68
118
  subagent_type="ms-browser-verifier"
69
119
  )
70
120
  ```
71
121
 
72
- **After verifier returns:**
122
+ ## Post-Verifier Handling
123
+
124
+ Route based on the report's **Status** field:
125
+
126
+ **`environment_blocked`:**
127
+ Surface the blocker description and screenshot evidence to the user. Use AskUserQuestion:
128
+ - header: "Browser verification blocked"
129
+ - question: "The browser verifier hit an environment issue: {blocker description}. How to proceed?"
130
+ - options: ["Re-run after fixing environment", "Skip browser verification"]
131
+
132
+ **`has_fixes`:**
133
+ Report: "Browser verification: {N} fixes applied, {M} issues found"
134
+ Include the Fixes Applied section in the consolidator prompt (step `consolidate_knowledge`) so browser-discovered patterns are captured in knowledge files.
135
+
136
+ **`has_issues`:**
137
+ Report: "Browser verification: {N} issues found (see screenshots in {phase_dir}/screenshots/)"
138
+ Note issues for verify-work — these are candidates for manual UAT.
73
139
 
74
- If fixes were made, include the report summary in the consolidator prompt (step `consolidate_knowledge`) so browser-discovered patterns are captured in knowledge files.
140
+ **`all_passed`:**
141
+ Report: "Browser verification: all {N} items passed"
75
142
 
76
143
  </browser_verification>
@@ -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), execute-phase (next 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"
@@ -132,7 +132,12 @@ Present a summary to the user:
132
132
  - Key files affected
133
133
  - Must-Haves checklist
134
134
 
135
- Allow the user to approve, request edits, or abort. If edits requested, apply them directly to the plan file.
135
+ **AskUserQuestion** with options:
136
+ - Approve and execute
137
+ - Request edits (let me describe)
138
+ - Abort
139
+
140
+ If edits requested, apply them directly to the plan file, then re-present and ask again. If aborted, clean up `${exec_dir}` and stop.
136
141
  </step>
137
142
 
138
143
  <step name="spawn_executor">
@@ -202,8 +207,14 @@ The consolidator reads `adhoc-01-SUMMARY.md`, extracts knowledge (key-decisions,
202
207
 
203
208
  **Finalize todo (when detected):** Follow the **Finalization**, **Commit Message Suffix**, and **Report Additions** sections from the loaded todo reference.
204
209
 
205
- **Commit knowledge updates:**
210
+ **Update STATE.md** "Recent Adhoc Work" section:
211
+ - Find or create "### Recent Adhoc Work" under "## Accumulated Context"
212
+ - Add entry at top: `- [YYYY-MM-DD]: [description] ({exec_dir}/adhoc-01-SUMMARY.md)`
213
+ - Keep last 5 entries (remove older ones from list)
214
+
215
+ **Update state and commit:**
206
216
  ```bash
217
+ ms-tools set-last-command "ms:adhoc ${slug}"
207
218
  git add .planning/knowledge/*.md "${exec_dir}/adhoc-01-SUMMARY.md" .planning/STATE.md
208
219
  # Only include patch if it was generated
209
220
  [ -f "${exec_dir}/adhoc-01-changes.patch" ] && git add "${exec_dir}/adhoc-01-changes.patch"
@@ -215,16 +226,6 @@ EOF
215
226
  )"
216
227
  ```
217
228
 
218
- **Update STATE.md** "Recent Adhoc Work" section:
219
- - Find or create "### Recent Adhoc Work" under "## Accumulated Context"
220
- - Add entry at top: `- [YYYY-MM-DD]: [description] ({exec_dir}/adhoc-01-SUMMARY.md)`
221
- - Keep last 5 entries (remove older ones from list)
222
-
223
- **Set last command:**
224
- ```bash
225
- ms-tools set-last-command "ms:adhoc $ARGUMENTS"
226
- ```
227
-
228
229
  **Report completion:**
229
230
  ```
230
231
  Adhoc work complete: [description]
@@ -242,9 +243,7 @@ Artifacts:
242
243
  ```
243
244
  ---
244
245
 
245
- Continue with current work or check project status:
246
- - `/ms:progress` — see project status
247
- - `/ms:execute-phase` — continue phase execution
246
+ Check `/ms:progress` to see project status and next steps.
248
247
  ```
249
248
  </step>
250
249
 
@@ -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,26 +109,19 @@ 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"
98
116
  ```
99
117
 
100
- **Commit changes:**
118
+ **Update state and commit:**
101
119
  ```bash
102
- git add .planning/knowledge/*.md
120
+ ms-tools set-last-command "ms:compound $ARGUMENTS"
121
+ git add .planning/knowledge/*.md .planning/STATE.md
103
122
  # Only add config.json if modified
104
123
  git add .planning/config.json 2>/dev/null
105
- git commit -m "$(cat <<'EOF'
106
- docs: compound knowledge from <description>
107
- EOF
108
- )"
109
- ```
110
-
111
- **Set last command:**
112
- ```bash
113
- ms-tools set-last-command "ms:compound $ARGUMENTS"
124
+ git commit -m "docs: compound knowledge from <description>"
114
125
  ```
115
126
 
116
127
  **Report:** Subsystems updated, entries added/changed/removed, new subsystems created (if any).
@@ -258,7 +258,8 @@ If "adjust": Return to scope_categories or identify_gaps as appropriate.
258
258
  </step>
259
259
 
260
260
  <step name="git_commit">
261
- Commit requirements:
261
+
262
+ **Update state and commit:**
262
263
 
263
264
  ```bash
264
265
  git add .planning/REQUIREMENTS.md