mindsystem-cc 4.2.1 → 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.
package/README.md CHANGED
@@ -187,11 +187,13 @@ You approve the plan structure and can adjust granularity.
187
187
 
188
188
  Runs without intervention. Each plan runs in a fresh subagent with the full context window available. Goal-backward verification checks that the phase achieved its intended outcome, not just that tasks got marked complete.
189
189
 
190
+ For web projects, browser verification launches a real browser against your dev server, derives a checklist from execution summaries, and verifies each route visually and programmatically. Clear mismatches get fixed inline; issues beyond visual fixes are reported with screenshot evidence for verify-work.
191
+
190
192
  Configurable code review produces separate commits for review changes. Patch files are generated for manual inspection.
191
193
 
192
194
  After execution, knowledge consolidation updates subsystem-scoped knowledge files. Future phases touching the same subsystems start with accumulated context: decisions made, patterns established, pitfalls encountered.
193
195
 
194
- **Creates:** `SUMMARY.md`, `VERIFICATION.md`, `.patch` files, knowledge file updates.
196
+ **Creates:** `SUMMARY.md`, `VERIFICATION.md`, `.patch` files, screenshots, knowledge file updates.
195
197
 
196
198
  ### 9. Verify work
197
199
 
@@ -251,6 +253,10 @@ Orchestration metadata (wave grouping, dependencies) lives in `EXECUTION-ORDER.m
251
253
 
252
254
  Unnecessary instructions aren't wasted space — they interfere with the ones that matter. Each instruction passes a reliability test: does removing this degrade output in the actual runtime context? Every command, workflow, and agent definition gets audited to cut that interference. Audited agents show 35-39% context reduction with no behavioral regression.
253
255
 
256
+ ### Browser verification
257
+
258
+ During execute-phase, web projects get automatic visual QA via [agent-browser](https://github.com/anthropics/agent-browser). A checklist is derived from execution summaries, then each route is verified with screenshots and programmatic diagnostics (console logs, JS errors, network failures). Clear mismatches get fixed inline; anything deeper is reported with screenshot evidence for verify-work. Enabled by default — disable per-project via `/ms:config`.
259
+
254
260
  ### Built-in code review
255
261
 
256
262
  Configurable per tier: adhoc, phase, or milestone. Runs after execution and produces separate commits for inspection. Ships with structural analysis (`ms-code-reviewer`) and clarity-focused simplification (`ms-code-simplifier`), but you can point any tier at your own custom reviewer agent via `.planning/config.json`.
@@ -296,6 +302,11 @@ Requirements you want but haven't shipped yet are tracked in `PROJECT.md` with o
296
302
  - [uv](https://docs.astral.sh/uv/) — Python package runner used by CLI scripts (`curl -LsSf https://astral.sh/uv/install.sh | sh`)
297
303
  - Python 3.10+ (used by uv for scripts)
298
304
 
305
+ **Optional (for web projects):**
306
+
307
+ - [agent-browser](https://github.com/anthropics/agent-browser) — enables browser verification during execute-phase (`npm install -g agent-browser`)
308
+ - `cwebp` — optimizes verification screenshots to WebP (`brew install webp`)
309
+
299
310
  ---
300
311
 
301
312
  ## Quick start
@@ -452,6 +463,13 @@ Mindsystem stores project config in `.planning/config.json`. Run `/ms:config` to
452
463
  // "auto" (default) | "ask" | "off"
453
464
  "open_mockups": "auto",
454
465
 
466
+ // Browser verification during execute-phase (web projects only).
467
+ // Launches a real browser, derives checklist from summaries,
468
+ // screenshots + console/network diagnostics.
469
+ "browser_verification": {
470
+ "enabled": true // default: true for web projects
471
+ },
472
+
455
473
  // External task tracker integration (Linear only for now).
456
474
  // null → disabled (default)
457
475
  "task_tracker": {
@@ -34,13 +34,22 @@ Open the app URL headless. If redirected to login, report auth failure and exit
34
34
  <step name="environment_preflight">
35
35
  Navigate to the app's main route. Screenshot `00-preflight.png`.
36
36
 
37
+ Read diagnostics:
38
+ ```bash
39
+ agent-browser console
40
+ agent-browser errors
41
+ agent-browser network requests
42
+ ```
43
+
37
44
  Evaluate:
38
- - Does the app load?
39
- - Visible backend errors? Console errors? Blank page?
45
+ - Does the app load visually?
46
+ - Console errors or uncaught exceptions?
47
+ - Failed network requests (4xx/5xx)?
48
+ - Blank page?
40
49
 
41
- **If systemic issue** (app won't load, white screen, critical error):
50
+ **If systemic issue** (app won't load, white screen, critical error, cascade of failed requests):
42
51
  - Screenshot the failure
43
- - Return `environment_blocked` report to orchestrator with screenshot evidence
52
+ - Return `environment_blocked` report to orchestrator with screenshot and diagnostic output
44
53
  - Stop — no point testing individual items
45
54
 
46
55
  **If app loads with minor warnings:**
@@ -59,16 +68,23 @@ mkdir -p {screenshots_dir}
59
68
  For each checklist item:
60
69
 
61
70
  ```
71
+ agent-browser errors --clear ← isolate errors per item
72
+
62
73
  Navigate to route → Screenshot → Evaluate
63
74
 
64
75
  Match expected?
65
76
  YES → PASSED, next item
66
- NO → Environment issue? (API error, 404, empty data, console network errors)
77
+ NO → Read diagnostics:
78
+ agent-browser errors
79
+ agent-browser console
80
+ agent-browser network requests
81
+
82
+ Environment issue? (uncaught exception, failed API request, 4xx/5xx, empty data)
67
83
  YES → ENVIRONMENT_BLOCKED for this item
68
84
  Same error on 2+ consecutive items? → stop, return report
69
85
  Otherwise → next item
70
- NO → Investigate in project source files
71
- → Hit a stop signal? (see Investigation boundaries + Fix discipline) → ISSUE with screenshot evidence, next item
86
+ NO → Investigate in project source files (diagnostics narrow the search)
87
+ → Hit a stop signal? (see Investigation boundaries + Fix discipline) → ISSUE with screenshot and diagnostic evidence, next item
72
88
  → Root cause found → Fix attempt → re-screenshot
73
89
  Fix worked? → FIXED (commit), next item
74
90
  Fix failed? → Different root-cause theory available?
@@ -77,9 +93,9 @@ NO → Environment issue? (API error, 404, empty data, console network errors)
77
93
  ```
78
94
 
79
95
  **Per-item screenshots:**
80
- - `{NN}-{item-slug}.png` — initial state
81
- - `{NN}-{item-slug}-result.png` — after interaction (if applicable)
82
- - `{NN}-{item-slug}-fixed.png` — after fix (if applicable)
96
+ - `{NN}-{item-slug}.webp` — initial state (`.png` if cwebp unavailable)
97
+ - `{NN}-{item-slug}-result.webp` — after interaction (if applicable)
98
+ - `{NN}-{item-slug}-fixed.webp` — after fix (if applicable)
83
99
 
84
100
  **Interactions:** If the checklist item includes an interaction (click, type, submit), perform it and screenshot the result.
85
101
  </step>
@@ -105,10 +121,10 @@ Close the browser. Return a structured report to the orchestrator:
105
121
  - {what was wrong} → {what was fixed} | Commit: {hash}
106
122
 
107
123
  ### Issues Found
108
- - {description} | Screenshot: {filename} | Evidence: {what the screenshot shows}
124
+ - {description} | Screenshot: {filename} | Evidence: {what the screenshot shows} | Diagnostics: {console errors, failed network requests, or "none"}
109
125
 
110
126
  ### Environment Blockers
111
- - {description} | Screenshot: {filename}
127
+ - {description} | Screenshot: {filename} | Diagnostics: {error messages, failed requests}
112
128
  ```
113
129
  </step>
114
130
 
@@ -120,11 +136,15 @@ Close the browser. Return a structured report to the orchestrator:
120
136
  - Save all screenshots to `{screenshots_dir}` — never to temp or working directory
121
137
  - Re-snapshot after every DOM change (element refs go stale)
122
138
  - Wait for networkidle before evaluating
139
+ - Convert screenshots to WebP after capture:
140
+ 1. Check once during preflight: `which cwebp`
141
+ 2. If available, after each screenshot: `cwebp -q 80 {file}.png -o {file}.webp && rm {file}.png`
142
+ 3. If unavailable: keep PNGs as-is
123
143
 
124
144
  ## Investigation boundaries
125
145
  - Only read project source files — never node_modules, dist, build output, or generated directories
126
146
  - Never read framework/library source to understand why something doesn't work internally
127
- - Check network responses and console errors before investigating code — if the data source is the problem, it's ENVIRONMENT_BLOCKED
147
+ - Read `agent-browser errors`, `agent-browser console`, and `agent-browser network requests` before investigating source code — if diagnostics show a failed API call or server error, it's ENVIRONMENT_BLOCKED, not a code fix
128
148
  - If 2+ consecutive items show the same failure pattern, identify the shared root cause rather than investigating each individually
129
149
 
130
150
  ## Fix discipline
@@ -19,7 +19,7 @@ You are a Mindsystem knowledge compounder spawned by the compound workflow to up
19
19
  ## Required Context (provided by compound workflow)
20
20
 
21
21
  - **Input mode:** `git`, `file`, or `description`
22
- - **Change reference:** Git ref/range (git mode), file path (file mode), or description + exploration summary (description mode)
22
+ - **Change reference:** Git ref/range (git mode), file path (file mode), or description/conversation summary (description mode)
23
23
  - **Affected subsystems:** List confirmed by user in main context
24
24
  - **Subsystem vocabulary:** From config.json (for alignment validation)
25
25
 
@@ -47,7 +47,7 @@ Retrieve the raw changes based on input mode:
47
47
 
48
48
  - **Git mode:** `git show <ref>` for single commit, `git diff <range>` for ranges. Include `--stat` for file overview.
49
49
  - **File mode:** Read the file content. Run `git log --oneline -5 -- <path>` for recent history context.
50
- - **Description mode:** Use the provided exploration summary as change context. No additional reads needed.
50
+ - **Description mode:** Use the provided summary (from exploration or conversation context) as change context. No additional reads needed.
51
51
 
52
52
  ## Step 2: Read Existing Knowledge Files
53
53
 
@@ -483,7 +483,8 @@ Orchestrator provides:
483
483
 
484
484
  ```bash
485
485
  # For phase research, check for CONTEXT.md from discuss-phase
486
- PHASE_DIR=$(ls -d .planning/phases/${PHASE}-* 2>/dev/null | head -1)
486
+ ms-tools find-phase "${PHASE}"
487
+ # Extract PHASE_DIR from the `dir` field of the JSON output
487
488
  if [ -n "$PHASE_DIR" ]; then
488
489
  cat "${PHASE_DIR}"/*-CONTEXT.md 2>/dev/null
489
490
  fi
@@ -534,6 +534,19 @@ Verify 100% requirement mapping:
534
534
 
535
535
  If gaps found, include in draft for user decision.
536
536
 
537
+ ## Step 6b: Evaluate Subsystem Coverage
538
+
539
+ Compare phase domains against config.json `subsystems` array. Phases may introduce domains not in the current subsystem vocabulary.
540
+
541
+ 1. Parse `subsystems` from config.json (provided in planning context)
542
+ 2. For each phase, identify its primary domain (e.g., "Payment Processing" maps to `payments`)
543
+ 3. Match against existing subsystems — exact or close synonym counts as covered
544
+ 4. Collect unmatched domains as proposed additions
545
+
546
+ Include proposals in the return under `### Subsystem Proposals`. Do not modify config.json — the orchestrator handles confirmation and update.
547
+
548
+ If all phase domains map to existing subsystems, omit the section.
549
+
537
550
  ## Step 7: Write Files Immediately
538
551
 
539
552
  **Write files first, then return.** This ensures artifacts persist even if context is lost.
@@ -613,6 +626,16 @@ When files are written and returning to orchestrator:
613
626
 
614
627
  {For phases with Likely recommendations, include topics/focus}
615
628
 
629
+ {If new subsystems proposed:}
630
+
631
+ ### Subsystem Proposals
632
+
633
+ New domains detected that don't match existing subsystems:
634
+
635
+ | Proposed | Source Phase | Rationale |
636
+ |----------|-------------|-----------|
637
+ | {name} | Phase {N}: {phase-name} | {why this needs its own subsystem} |
638
+
616
639
  ### Files Ready for Review
617
640
 
618
641
  User can review actual files:
@@ -644,6 +667,16 @@ After incorporating user feedback and updating files:
644
667
  - .planning/ROADMAP.md
645
668
  - .planning/STATE.md (if needed)
646
669
 
670
+ {If new subsystems proposed:}
671
+
672
+ ### Subsystem Proposals
673
+
674
+ New domains detected that don't match existing subsystems:
675
+
676
+ | Proposed | Source Phase | Rationale |
677
+ |----------|-------------|-----------|
678
+ | {name} | Phase {N}: {phase-name} | {why this needs its own subsystem} |
679
+
647
680
  ### Updated Summary
648
681
 
649
682
  | Phase | Goal | Requirements |
@@ -19,7 +19,7 @@ Input modes:
19
19
  - **Git reference:** SHA, range (`HEAD~3..HEAD`), or any git ref
20
20
  - **File path:** Path to a changed file
21
21
  - **Description:** Free-text description of changes
22
- - **No args:** Infer from current conversation context
22
+ - **No args:** Reflect on current conversation context + git data
23
23
  </objective>
24
24
 
25
25
  <execution_context>
@@ -34,7 +34,7 @@ Validate active project: check `.planning/config.json` exists.
34
34
  </step>
35
35
 
36
36
  <step name="resolve_change_context">
37
- Gather lightweight change context. Git mode: diff stats. File mode: recent git log. Description mode: spawn Explore agents to find relevant changes.
37
+ Gather lightweight change context. Git mode: diff stats. File mode: recent git log. No-args mode: reflect on conversation context + git diff/log; if context is thin, ask user for intent. Description mode: spawn Explore agents to find relevant changes.
38
38
  </step>
39
39
 
40
40
  <step name="determine_subsystems">
@@ -50,7 +50,7 @@ Spawn ms-compounder with input mode, change reference, confirmed subsystems, and
50
50
  </step>
51
51
 
52
52
  <step name="finalize">
53
- Update config.json if new subsystems confirmed. Commit knowledge file changes. Set last command.
53
+ Update config.json if new subsystems confirmed. Commit knowledge file changes. Set last command. Report results.
54
54
  </step>
55
55
 
56
56
  </process>
@@ -136,8 +136,9 @@ Task(
136
136
  5. Map every v1 requirement to exactly one phase
137
137
  6. Derive 2-5 success criteria per phase (observable user behaviors)
138
138
  7. Validate 100% coverage
139
- 8. Write files immediately (REQUIREMENTS.md, ROADMAP.md, STATE.md)
140
- 9. Return ROADMAP CREATED with combined requirements + roadmap summary
139
+ 8. Evaluate subsystem coverage — compare phase domains against config.json subsystems, propose additions for unmatched domains
140
+ 9. Write files immediately (REQUIREMENTS.md, ROADMAP.md, STATE.md)
141
+ 10. Return ROADMAP CREATED with combined requirements + roadmap summary
141
142
 
142
143
  Write files first, then return. This ensures artifacts persist even if context is lost.
143
144
  </instructions>
@@ -200,6 +201,18 @@ Pre-work: Research [Likely/Unlikely] | Discuss [Likely/Unlikely] | Design [Likel
200
201
 
201
202
  [... continue for all phases ...]
202
203
 
204
+ {If roadmapper returned Subsystem Proposals:}
205
+
206
+ ### New Subsystems
207
+
208
+ The roadmap introduces domains not covered by current subsystems:
209
+
210
+ | Proposed | Source Phase | Rationale |
211
+ |----------|-------------|-----------|
212
+ | {name} | Phase {N} | {reason} |
213
+
214
+ These will be added to config.json upon approval.
215
+
203
216
  ---
204
217
  ```
205
218
  </step>
@@ -275,7 +288,11 @@ Return ROADMAP REVISED with changes made.
275
288
  **Update state and commit:**
276
289
 
277
290
  ```bash
291
+ # For each subsystem proposal the user approved (skip any rejected during revision):
292
+ ms-tools config-set subsystems --append "{subsystem-name}"
293
+
278
294
  git add .planning/REQUIREMENTS.md .planning/ROADMAP.md .planning/STATE.md
295
+ git diff --quiet .planning/config.json 2>/dev/null || git add .planning/config.json
279
296
  git commit -m "$(cat <<'EOF'
280
297
  docs: define requirements and create roadmap
281
298
 
@@ -30,9 +30,14 @@ Create design specifications for a phase. Spawns ms-designer agent with phase co
30
30
  <context>
31
31
  Phase number: $ARGUMENTS (required)
32
32
 
33
+ Resolve phase directory:
34
+ ```bash
35
+ ms-tools find-phase "$ARGUMENTS"
36
+ ```
37
+
33
38
  Check for existing design:
34
39
  ```bash
35
- ls .planning/phases/${PHASE}-*/*DESIGN.md 2>/dev/null
40
+ ls ${PHASE_DIR}/*DESIGN.md 2>/dev/null
36
41
  ```
37
42
  </context>
38
43
 
@@ -52,8 +57,7 @@ ms-tools find-phase "$ARGUMENTS"
52
57
  ## 2. Check Existing Design
53
58
 
54
59
  ```bash
55
- # Check for existing DESIGN.md
56
- PHASE_DIR=$(ls -d .planning/phases/${PHASE}-* 2>/dev/null | head -1)
60
+ # PHASE_DIR already resolved from find-phase in <context>
57
61
  ls "${PHASE_DIR}"/*-DESIGN.md 2>/dev/null
58
62
  ```
59
63
 
@@ -119,7 +123,7 @@ Extract from ROADMAP.md:
119
123
  **4b. Optional context - CONTEXT.md (from discuss-phase):**
120
124
 
121
125
  ```bash
122
- cat .planning/phases/${PHASE}-*/${PHASE}-CONTEXT.md 2>/dev/null
126
+ cat ${PHASE_DIR}/*-CONTEXT.md 2>/dev/null
123
127
  ```
124
128
 
125
129
  If exists, extract:
@@ -377,7 +381,7 @@ Task(
377
381
 
378
382
  ```bash
379
383
  ms-tools set-last-command "ms:design-phase $ARGUMENTS"
380
- git add .planning/phases/${PHASE}-*/*-DESIGN.md .planning/STATE.md
384
+ git add ${PHASE_DIR}/*-DESIGN.md .planning/STATE.md
381
385
  git commit -m "docs: create design for phase ${PHASE}"
382
386
  ```
383
387
 
@@ -387,12 +391,12 @@ Display summary from agent response:
387
391
  - Screens designed
388
392
  - Key design decisions
389
393
 
390
- Then present pre-work status: Read `~/.claude/mindsystem/references/prework-status.md` and show what's done vs still needed for this phase.
391
-
392
394
  Also offer:
393
395
  - **Refine design** — Discuss changes conversationally
394
396
  - **View full design** — Display DESIGN.md
395
397
 
398
+ Read `~/.claude/mindsystem/references/prework-status.md` and present what's done vs still needed for this phase.
399
+
396
400
  **`## DESIGN NEEDS CLARIFICATION`:**
397
401
 
398
402
  Present the question to user. Get response. Spawn continuation with the clarification.
@@ -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
 
@@ -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), 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"
@@ -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
 
@@ -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
@@ -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
 
@@ -6,6 +6,7 @@ Complete verify-and-fix session: by session end, everything verified, issues fix
6
6
 
7
7
  <execution_context>
8
8
  <!-- mock-patterns.md loaded on demand for transient_state mocks (see generate_mocks step) -->
9
+ <!-- knowledge files loaded on first fix attempt (see investigate_issue step) -->
9
10
  </execution_context>
10
11
 
11
12
  <process>
@@ -74,7 +75,8 @@ Provide a phase number to start testing (e.g., /ms:verify-work 4)
74
75
  **Find SUMMARY.md files for the phase:**
75
76
 
76
77
  ```bash
77
- PHASE_DIR=$(ls -d .planning/phases/${PHASE_ARG}* 2>/dev/null | head -1)
78
+ ms-tools find-phase "${PHASE_ARG}"
79
+ # Extract PHASE_DIR from the `dir` field of the JSON output
78
80
  ls "$PHASE_DIR"/*-SUMMARY.md 2>/dev/null
79
81
  ```
80
82
 
@@ -341,6 +343,19 @@ Progress auto-recalculates on every `uat-update` call. No manual progress recalc
341
343
  <step name="investigate_issue">
342
344
  **Investigate reported issue:**
343
345
 
346
+ **0. Load knowledge (first issue only):**
347
+
348
+ If this is the first issue requiring investigation in this session, load knowledge files now. On subsequent issues, knowledge is already in context — skip to step 1.
349
+
350
+ ```bash
351
+ ms-tools config-get subsystems
352
+ grep "^subsystem:" "$PHASE_DIR"/*-SUMMARY.md 2>/dev/null
353
+ ```
354
+
355
+ Match SUMMARY.md subsystem values against config subsystems. Read matching `.planning/knowledge/{subsystem}.md` files (1-3 most relevant).
356
+
357
+ This knowledge informs investigation (where to look, known pitfalls) and any subsequent fixes.
358
+
344
359
  **1. Lightweight investigation (2-3 tool calls):**
345
360
 
346
361
  ```
@@ -440,6 +455,10 @@ You are a Mindsystem verify-fixer. Investigate this issue, find the root cause,
440
455
 
441
456
  {lightweight_investigation_results}
442
457
 
458
+ ## Knowledge Context
459
+
460
+ {loaded_knowledge_content or "No knowledge files loaded for this session."}
461
+
443
462
  ## Your task
444
463
 
445
464
  1. Investigate to find root cause
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mindsystem-cc",
3
- "version": "4.2.1",
3
+ "version": "4.3.0",
4
4
  "description": "The engineer's meta-prompting system for Claude Code.",
5
5
  "bin": {
6
6
  "mindsystem-cc": "bin/install.js"
@@ -1198,6 +1198,7 @@ def cmd_doctor_scan(args: argparse.Namespace) -> None:
1198
1198
 
1199
1199
  # ---- CHECK 11: Browser Verification ----
1200
1200
  print("=== Browser Verification ===")
1201
+ is_web, web_signal = False, "not checked"
1201
1202
  bv_enabled = True
1202
1203
  bv_config = config.get("browser_verification", {})
1203
1204
  if isinstance(bv_config, dict):
@@ -1233,6 +1234,28 @@ def cmd_doctor_scan(args: argparse.Namespace) -> None:
1233
1234
  record("PASS", "Browser Verification")
1234
1235
  print()
1235
1236
 
1237
+ # ---- CHECK 12: Screenshot Optimization ----
1238
+ print("=== Screenshot Optimization ===")
1239
+ if not bv_enabled:
1240
+ print("Status: SKIP")
1241
+ print("Browser verification disabled")
1242
+ record("SKIP", "Screenshot Optimization")
1243
+ elif not is_web:
1244
+ print("Status: SKIP")
1245
+ print(f"Not a web project ({web_signal})")
1246
+ record("SKIP", "Screenshot Optimization")
1247
+ else:
1248
+ if shutil.which("cwebp"):
1249
+ print("Status: PASS")
1250
+ print("cwebp available — screenshots will be converted to WebP")
1251
+ record("PASS", "Screenshot Optimization")
1252
+ else:
1253
+ print("Status: WARN")
1254
+ print("cwebp not found — browser screenshots will remain as PNG (larger files)")
1255
+ print("Install: brew install webp | apt install webp | choco install webp")
1256
+ record("WARN", "Screenshot Optimization")
1257
+ print()
1258
+
1236
1259
  # ---- SUMMARY ----
1237
1260
  total = pass_count + warn_count + fail_count + skip_count
1238
1261
  print("=== Summary ===")
@@ -3126,7 +3149,7 @@ def _load_uat(args_phase: str) -> tuple[Path, "UATFile"]:
3126
3149
  if phase_dir is None:
3127
3150
  print(f"Error: Phase directory not found for {phase}", file=sys.stderr)
3128
3151
  sys.exit(1)
3129
- uat_path = phase_dir / f"{phase_dir.name}-UAT.md"
3152
+ uat_path = phase_dir / f"{phase}-UAT.md"
3130
3153
  if not uat_path.is_file():
3131
3154
  print(f"Error: UAT file not found: {uat_path}", file=sys.stderr)
3132
3155
  sys.exit(1)
@@ -3166,7 +3189,7 @@ def cmd_uat_init(args: argparse.Namespace) -> None:
3166
3189
  phase_name = phase_dir.name
3167
3190
  uat = UATFile.from_init_json(data, phase_name)
3168
3191
 
3169
- out_path = phase_dir / f"{phase_name}-UAT.md"
3192
+ out_path = phase_dir / f"{phase}-UAT.md"
3170
3193
  out_path.write_text(uat.serialize(), encoding="utf-8")
3171
3194
 
3172
3195
  n_tests = len(uat.tests)
@@ -3196,7 +3219,7 @@ def cmd_uat_update(args: argparse.Namespace) -> None:
3196
3219
  print(f"Error: Phase directory not found for {phase}", file=sys.stderr)
3197
3220
  sys.exit(1)
3198
3221
 
3199
- uat_path = phase_dir / f"{phase_dir.name}-UAT.md"
3222
+ uat_path = phase_dir / f"{phase}-UAT.md"
3200
3223
  if not uat_path.is_file():
3201
3224
  print(f"Error: UAT file not found: {uat_path}", file=sys.stderr)
3202
3225
  sys.exit(1)
@@ -3264,7 +3287,7 @@ def cmd_uat_status(args: argparse.Namespace) -> None:
3264
3287
  print(f"Error: Phase directory not found for {phase}", file=sys.stderr)
3265
3288
  sys.exit(1)
3266
3289
 
3267
- uat_path = phase_dir / f"{phase_dir.name}-UAT.md"
3290
+ uat_path = phase_dir / f"{phase}-UAT.md"
3268
3291
  if not uat_path.is_file():
3269
3292
  print(f"Error: UAT file not found: {uat_path}", file=sys.stderr)
3270
3293
  sys.exit(1)