mindsystem-cc 4.1.1 → 4.2.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.
@@ -0,0 +1,102 @@
1
+ ---
2
+ name: ms-browser-verifier
3
+ description: Automated functional verification via browser. Tests observable truths, fixes issues inline, reports patterns for knowledge compounding.
4
+ model: sonnet
5
+ tools: Read, Write, Edit, Bash, Grep, Glob
6
+ skills:
7
+ - agent-browser
8
+ color: green
9
+ ---
10
+
11
+ <role>
12
+ You are a Mindsystem browser verifier. You test observable truths from VERIFICATION.md by interacting with the app in a real browser. When you find issues, you fix them inline and re-verify.
13
+
14
+ **Critical mindset:** Test what users see, not what code claims. A passing structural check means files exist — you verify they actually work in the browser.
15
+ </role>
16
+
17
+ <process>
18
+
19
+ <step name="start_dev_server">
20
+ Check if dev server is already running by probing common ports (5173, 3000, 8080, 4200, 3001).
21
+
22
+ If not running:
23
+ 1. Read `package.json` scripts for dev command (`dev`, `start`, `serve`)
24
+ 2. Start via `npm run {script}` or `yarn {script}` based on lock file presence
25
+ 3. Retry port probe with backoff (1s, 2s, 4s) until ready or timeout (30s)
26
+ </step>
27
+
28
+ <step name="check_auth_state">
29
+ Auth is handled by the orchestrator before spawning this agent. If the orchestrator provides a storage state file path, load it when launching the browser to restore the authenticated session.
30
+
31
+ Open the app URL headless. If redirected to login, report auth failure and exit — do not attempt to automate auth.
32
+ </step>
33
+
34
+ <step name="extract_testable_truths">
35
+ Read VERIFICATION.md from the phase directory. Extract observable truths and filter for browser-testable ones.
36
+
37
+ Read plans and summaries to understand pages, routes, and components involved.
38
+
39
+ **Browser-testable:** UI renders, navigation works, form submission succeeds, data displays correctly, interactions produce expected state changes.
40
+
41
+ **Not browser-testable:** API internals, database state, background job execution, server-side logging.
42
+ </step>
43
+
44
+ <step name="verify_each_truth">
45
+ Create the screenshots directory:
46
+
47
+ ```bash
48
+ mkdir -p {screenshots_dir}
49
+ ```
50
+
51
+ For each testable truth:
52
+ 1. Navigate to the relevant page/route
53
+ 2. Take a screenshot, save to `{screenshots_dir}/{truth-slug}.png`
54
+ 3. Interact as needed (click, type, submit)
55
+ 4. Wait for `networkidle` before verifying expected state
56
+ 5. Verify expected state (element exists, text matches, route changed)
57
+ 6. Take a post-verification screenshot: `{screenshots_dir}/{truth-slug}-result.png`
58
+
59
+ **Critical:** Re-snapshot after every DOM change. Element references go stale after navigation or dynamic updates.
60
+ </step>
61
+
62
+ <step name="fix_issues">
63
+ If an issue is found:
64
+ 1. Investigate: read source files for the component/page
65
+ 2. Fix: use Edit/Write to correct the issue
66
+ 3. Wait for hot reload (probe dev server)
67
+ 4. Re-verify in browser
68
+ 5. If fixed: commit with `fix({phase}-browser): {description}`
69
+ 6. If fix fails after one retry: flag as unresolved, continue to next truth
70
+ </step>
71
+
72
+ <step name="close_and_report">
73
+ Close the browser when all truths are verified.
74
+
75
+ Return a structured report to the orchestrator:
76
+
77
+ ```
78
+ ## Browser Verification Report
79
+
80
+ **Tested:** {count} | **Passed:** {count} | **Fixed:** {count} | **Unresolved:** {count}
81
+
82
+ ### Fixes Applied
83
+ - {what was wrong} → {what was fixed} | Files: {changed files}
84
+
85
+ ### Unresolved Issues
86
+ - {description} | Attempted: {what was tried}
87
+
88
+ ### Patterns for Knowledge
89
+ - {recurring pattern observed across multiple truths}
90
+ ```
91
+ </step>
92
+
93
+ </process>
94
+
95
+ <rules>
96
+ - Save all screenshots to `{screenshots_dir}` — never to temp or working directory
97
+ - Re-snapshot after every DOM change (refs go stale)
98
+ - Wait for networkidle before verifying
99
+ - Do not attempt to automate auth (orchestrator handles it)
100
+ - One retry per fix, then flag and move on
101
+ - Commit each fix atomically with `fix({phase}-browser):` prefix
102
+ </rules>
@@ -15,6 +15,8 @@ You are spawned by:
15
15
  - `/ms:research-milestone` orchestrator (milestone-scoped research before roadmap)
16
16
 
17
17
  Your job: Answer research questions with verified, actionable findings. Produce structured output files that inform quality planning.
18
+
19
+ **Tool selection:** Match tool to question type. Library API docs → `ms-lookup docs`. Deep synthesis → `ms-lookup deep` (3-4 calls max). Discovery/trends → WebSearch. Follow the orchestrator's `<focus>` rules.
18
20
  </role>
19
21
 
20
22
  <upstream_input>
package/bin/install.js CHANGED
@@ -25,9 +25,8 @@ ${cyan} ███╗ ███╗██╗███╗ ██╗███
25
25
  ╚═╝ ╚═╝╚═╝╚═╝ ╚═══╝╚═════╝ ╚══════╝ ╚═╝ ╚══════╝ ╚═╝ ╚══════╝╚═╝ ╚═╝${reset}
26
26
 
27
27
  Mindsystem ${dim}v${pkg.version}${reset}
28
- A meta-prompting, context engineering and spec-driven
29
- development system for Claude Code by Roland Tolnay.
30
- Based on GSD by TÂCHES.
28
+ The engineer's meta-prompting system for Claude Code.
29
+ Amplify your workflow. Compound your knowledge.
31
30
  `;
32
31
 
33
32
  // Parse args
@@ -202,7 +202,7 @@ Skip code review step (proceed to next steps).
202
202
  ```bash
203
203
  # Find first commit in milestone (first phase commit)
204
204
  FIRST_PHASE=$(ls -d .planning/phases/*/ | sort -V | head -1 | xargs basename | cut -d- -f1)
205
- FIRST_COMMIT=$(git log --oneline --grep="(${FIRST_PHASE}-" --format="%H" | tail -1)
205
+ FIRST_COMMIT=$(ms-tools find-phase-commits ${FIRST_PHASE} | tail -1)
206
206
 
207
207
  # Get all implementation files changed since first commit
208
208
  CHANGED_FILES=$(git diff --name-only ${FIRST_COMMIT}^..HEAD | grep -E '\.(dart|ts|tsx|js|jsx|swift|kt|py|go|rs)$')
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: ms:config
3
- description: Configure Mindsystem preferences — code reviewers, mockups, gitignore, git remote, task tracker
3
+ description: Configure Mindsystem preferences — code reviewers, mockups, browser verification, gitignore, git remote, task tracker
4
4
  allowed-tools:
5
5
  - Read
6
6
  - Write
@@ -12,7 +12,7 @@ allowed-tools:
12
12
 
13
13
  Configure Mindsystem preferences for the current project.
14
14
 
15
- Manages code reviewer agents, mockup preferences, .gitignore patterns for `.planning/` artifacts, git remote setup, and task tracker integration. Run anytime to reconfigure — idempotent.
15
+ Manages code reviewer agents, mockup preferences, browser verification, .gitignore patterns for `.planning/` artifacts, git remote setup, and task tracker integration. Run anytime to reconfigure — idempotent.
16
16
 
17
17
  </objective>
18
18
 
@@ -33,6 +33,36 @@ Manages code reviewer agents, mockup preferences, .gitignore patterns for `.plan
33
33
  git remote -v 2>/dev/null || echo "NO_REMOTE"
34
34
  ```
35
35
 
36
+ **Determine mode** from `code_review` values in config.json:
37
+
38
+ - **Setup mode** — all `code_review` values are null (or no config file): first-time configuration.
39
+ - **Edit mode** — any `code_review` value is non-null: reconfiguration.
40
+
41
+ </step>
42
+
43
+ <step name="route">
44
+
45
+ **Setup mode:** Proceed through all setting steps sequentially (git_remote → code_reviewers → gitignore_patterns → mockup_preferences → browser_verification → task_tracker). Then go to `validation_summary`.
46
+
47
+ **Edit mode:** Display all current settings with values from config.json, git remote, and .gitignore:
48
+
49
+ ```
50
+ ## Current Settings
51
+
52
+ 1. **Git remote** — {remote URL or "none configured"}
53
+ 2. **Code reviewers** — adhoc: {value or "not set"}, phase: {value or "not set"}, milestone: {value or "not set"}
54
+ 3. **Gitignore** — {current .planning/ patterns or "no .planning/ patterns"}
55
+ 4. **Mockups** — open: {auto / ask / off}
56
+ 5. **Browser verification** — {enabled / disabled}
57
+ 6. **Task tracker** — {type + cli path, or "none"}
58
+ ```
59
+
60
+ Ask: "Which settings would you like to change? Enter the numbers (e.g. 1, 3, 5), 'all' to reconfigure everything, or 'done' if everything looks good."
61
+
62
+ - **"done"** → skip to `validation_summary` (no changes)
63
+ - **"all"** → proceed through all setting steps sequentially
64
+ - **Specific numbers** → proceed through only the corresponding setting steps, skip the rest
65
+
36
66
  </step>
37
67
 
38
68
  <step name="git_remote">
@@ -100,12 +130,14 @@ Use AskUserQuestion (multiSelect):
100
130
  - options:
101
131
  - "Phase patch files (`.planning/phases/**/*.patch`)" — Large binary diffs, regeneratable
102
132
  - "Design mockups (`.planning/phases/**/*.html`)" — Generated HTML mockups from design-phase
133
+ - "Browser screenshots (`.planning/phases/**/screenshots/`)" — Browser verification screenshots
103
134
 
104
135
  Apply selected patterns to `.gitignore`. Create the file if needed:
105
136
 
106
137
  ```bash
107
- echo '.planning/phases/**/*.patch' >> .gitignore # if selected
108
- echo '.planning/phases/**/*.html' >> .gitignore # if selected
138
+ echo '.planning/phases/**/*.patch' >> .gitignore # if selected
139
+ echo '.planning/phases/**/*.html' >> .gitignore # if selected
140
+ echo '.planning/phases/**/screenshots/' >> .gitignore # if selected
109
141
  ```
110
142
 
111
143
  If no selections: skip gitignore changes.
@@ -142,6 +174,34 @@ ms-tools config-set open_mockups "$VALUE"
142
174
 
143
175
  </step>
144
176
 
177
+ <step name="browser_verification">
178
+
179
+ Read current value:
180
+
181
+ ```bash
182
+ CURRENT=$(ms-tools config-get browser_verification.enabled --default "true")
183
+ echo "Current browser_verification.enabled: $CURRENT"
184
+ ```
185
+
186
+ Use AskUserQuestion:
187
+ - header: "Browser verification"
188
+ - question: "Enable automated browser verification during execute-phase? (Tests your web UI after code changes)"
189
+ - options:
190
+ - "Enabled (Recommended)" — Automatically test web UI after phase execution
191
+ - "Disabled" — Skip browser verification
192
+
193
+ Map selection:
194
+ - "Enabled" → `true`
195
+ - "Disabled" → `false`
196
+
197
+ Update config.json:
198
+
199
+ ```bash
200
+ ms-tools config-set browser_verification --json '{"enabled": true}' # or false
201
+ ```
202
+
203
+ </step>
204
+
145
205
  <step name="task_tracker">
146
206
 
147
207
  Read current value:
@@ -193,6 +253,7 @@ Configuration updated:
193
253
 
194
254
  - Code reviewers: [adhoc / phase / milestone values]
195
255
  - Mockup open: [auto / ask / off]
256
+ - Browser verification: [enabled / disabled]
196
257
  - Gitignore: [patterns added, or "no changes"]
197
258
  - Git remote: [remote URL, or "none configured"]
198
259
  - Task tracker: [type + cli path, or "none"]
@@ -217,28 +278,17 @@ EOF
217
278
 
218
279
  </step>
219
280
 
220
- <step name="done">
221
-
222
- Present next steps using the "Next Up" format:
223
-
224
- - **If PROJECT.md exists:** recommend `/ms:new-milestone` — Discover what to build next, create requirements and roadmap
225
- - **If no PROJECT.md:** recommend `/ms:new-project` — Initialize project with business context and vision
226
-
227
- Also list: `/ms:doctor` — Verify subsystems and artifact health
228
-
229
- </step>
230
-
231
281
  </process>
232
282
 
233
283
  <success_criteria>
234
284
 
285
+ - [ ] Setup mode triggered when all code_review values null; edit mode otherwise
286
+ - [ ] Edit mode displays numbered settings with current values
287
+ - [ ] Only user-selected settings modified in edit mode
235
288
  - [ ] Changes committed (if any)
236
- - [ ] User routed to next step
237
289
  - [ ] Gitignore patterns applied (if selected)
238
290
  - [ ] Git remote offered (if missing)
239
291
  - [ ] Validation summary displayed
240
- - [ ] Config.json code_review values set (or preserved if skipped)
241
- - [ ] Config.json open_mockups value set (or preserved if skipped)
242
- - [ ] Config.json task_tracker value set (or preserved if skipped)
292
+ - [ ] Terminates after commit/summary no Next Up routing
243
293
 
244
294
  </success_criteria>
@@ -292,6 +292,19 @@ EOF
292
292
  ```
293
293
  </step>
294
294
 
295
+ <step name="create_phase_dirs">
296
+ Create phase directories from the roadmap:
297
+
298
+ ```bash
299
+ ms-tools create-phase-dirs
300
+ ```
301
+
302
+ ```bash
303
+ git add .planning/phases/
304
+ git commit -m "chore: create phase directories from roadmap"
305
+ ```
306
+ </step>
307
+
295
308
  <step name="done">
296
309
  ```
297
310
  Requirements and roadmap created:
@@ -13,7 +13,7 @@ allowed-tools:
13
13
  ---
14
14
 
15
15
  <objective>
16
- Run health checks on project configuration. Detect and fix structural drift across 10 categories: subsystem vocabulary, milestone directory structure, milestone naming convention, phase archival, knowledge files, phase summaries, PLAN cleanup, CLI wrappers and environment diagnostics, research API keys, and Mindsystem version.
16
+ Run health checks on project configuration. Detect and fix structural drift across 12 categories: subsystem vocabulary, milestone directory structure, milestone naming convention, phase archival, knowledge files, phase summaries, PLAN cleanup, CLI wrappers and environment diagnostics, research API keys, phase directory naming, browser verification prerequisites, and Mindsystem version.
17
17
 
18
18
  Idempotent.
19
19
  </objective>
@@ -119,6 +119,8 @@ Display results as a markdown table:
119
119
  | PLAN cleanup | FAIL | 9 leftover PLAN.md files |
120
120
  | CLI wrappers | FAIL | Not resolvable; bin dir not in PATH |
121
121
  | Research API Keys | WARN | PERPLEXITY_API_KEY not set |
122
+ | Phase directory naming | FAIL | 1 non-canonical directory |
123
+ | Browser Verification | WARN | Web project, missing agent-browser CLI |
122
124
  | Mindsystem version | WARN | v3.21.0 → v3.22.1 available |
123
125
  ```
124
126
 
@@ -141,7 +143,7 @@ If "Skip" → go to `report`.
141
143
 
142
144
  If "Review each" → use AskUserQuestion for each failed check with its details and options: "Fix" / "Skip". Only run fixes for accepted checks.
143
145
 
144
- Apply fixes in dependency order: fix_subsystems → fix_milestone_dirs → fix_milestone_naming → fix_phase_archival → fix_plan_cleanup → fix_knowledge. Skip any fix whose check passed or was skipped by user.
146
+ Apply fixes in dependency order: fix_subsystems → fix_milestone_dirs → fix_milestone_naming → fix_phase_archival → fix_plan_cleanup → fix_phase_dirs → fix_knowledge. Skip any fix whose check passed or was skipped by user.
145
147
 
146
148
  Phase summaries are resolved by fix_phase_archival. CLI wrapper failures have specific fixes: bin dir not in PATH → restart Claude Code session; missing wrappers or bin dir → re-run `npx mindsystem-cc`; uv not found → `curl -LsSf https://astral.sh/uv/install.sh | sh`. WARN checks (Research API Keys, missing uv) are informational — no automated fix, only displayed in the report.
147
149
  </step>
@@ -179,6 +181,8 @@ Final summary table:
179
181
  | PLAN cleanup | PASS | ... |
180
182
  | CLI wrappers | PASS | ... |
181
183
  | Research API Keys | PASS | ... |
184
+ | Phase directory naming | PASS | ... |
185
+ | Browser Verification | PASS | ... |
182
186
  | Mindsystem version | PASS | ... |
183
187
 
184
188
  All checks passed.
@@ -195,6 +199,6 @@ Include counts: checks total, passed, warned, fixed during this run.
195
199
  - [ ] Re-scan verifies all checks pass after fixes
196
200
  - [ ] Each fix group committed atomically
197
201
  - [ ] Fixes applied in dependency order: subsystems → dirs → milestone naming → archival → cleanup → knowledge
198
- - [ ] All 10 categories reported with PASS/FAIL/WARN/SKIP
202
+ - [ ] All 12 categories reported with PASS/FAIL/WARN/SKIP
199
203
  - [ ] Clean project reports all PASS with no fix prompts
200
204
  </success_criteria>
@@ -77,29 +77,35 @@ ms-tools find-phase "$ARGUMENTS"
77
77
  - `passed` → continue to step 7
78
78
  - `gaps_found` → present gaps, route via gap-closure-routing.md triage
79
79
 
80
- 7. **Code review (optional)**
80
+ 7. **Browser verification (web projects)**
81
+ - Run `ms-tools browser-check` for prerequisites
82
+ - If ready: handle auth, spawn `ms-browser-verifier` for functional testing
83
+ - Verifier tests observable truths in browser, fixes issues inline
84
+ - If skipped: not a web project or browser verification disabled
85
+
86
+ 8. **Code review (optional)**
81
87
  - Read `code_review.phase` from config.json (default: `ms-code-simplifier`)
82
- - If `"skip"`: proceed to step 8
88
+ - If `"skip"`: proceed to step 9
83
89
  - Spawn code review agent with phase file scope
84
90
  - If changes made: commit as `refactor({phase}): code review improvements`
85
91
 
86
- 8. **Generate phase patch**
92
+ 9. **Generate phase patch**
87
93
  - Run: `ms-tools generate-phase-patch ${PHASE_NUMBER}`
88
94
  - Outputs to `.planning/phases/{phase_dir}/{phase}-changes.patch`
89
95
  - Verify: patch file exists OR skip message logged
90
96
  - Note: Patch captures all changes including simplifications
91
97
 
92
- 9. **Consolidate knowledge**
93
- - Spawn `ms-consolidator` with phase directory and number
94
- - Consolidator reads phase artifacts and existing knowledge files
95
- - Produces updated `.planning/knowledge/{subsystem}.md` files
96
- - Deletes PLAN.md files (execution instructions consumed)
97
- - Verify: knowledge files written to `.planning/knowledge/`
98
+ 10. **Consolidate knowledge**
99
+ - Spawn `ms-consolidator` with phase directory and number
100
+ - Consolidator reads phase artifacts and existing knowledge files
101
+ - Produces updated `.planning/knowledge/{subsystem}.md` files
102
+ - Deletes PLAN.md files (execution instructions consumed)
103
+ - Verify: knowledge files written to `.planning/knowledge/`
98
104
 
99
- 10. **Update roadmap and state**
105
+ 11. **Update roadmap and state**
100
106
  - Update ROADMAP.md, STATE.md
101
107
 
102
- 11. **Update requirements**
108
+ 12. **Update requirements**
103
109
  Mark phase requirements as Complete:
104
110
  - Read ROADMAP.md, find this phase's `Requirements:` line (e.g., "AUTH-01, AUTH-02")
105
111
  - Read REQUIREMENTS.md traceability table
@@ -107,7 +113,7 @@ ms-tools find-phase "$ARGUMENTS"
107
113
  - Write updated REQUIREMENTS.md
108
114
  - Skip if: REQUIREMENTS.md doesn't exist, or phase has no Requirements line
109
115
 
110
- 12. **Commit phase completion**
116
+ 13. **Commit phase completion**
111
117
  Bundle all phase metadata updates in one commit:
112
118
  - Stage: `git add .planning/ROADMAP.md .planning/STATE.md`
113
119
  - Stage knowledge files: `git add .planning/knowledge/*.md`
@@ -115,10 +121,10 @@ ms-tools find-phase "$ARGUMENTS"
115
121
  - Stage REQUIREMENTS.md if updated: `git add .planning/REQUIREMENTS.md`
116
122
  - Commit: `docs({phase}): complete {phase-name} phase`
117
123
 
118
- 13. **Offer next steps**
124
+ 14. **Offer next steps**
119
125
  - Route to next action (see `<offer_next>`)
120
126
 
121
- 14. **Update last command:** `ms-tools set-last-command "ms:execute-phase $ARGUMENTS"`
127
+ 15. **Update last command:** `ms-tools set-last-command "ms:execute-phase $ARGUMENTS"`
122
128
  </process>
123
129
 
124
130
  <offer_next>
@@ -247,6 +253,7 @@ After all plans in phase complete:
247
253
  - [ ] All incomplete plans in phase executed
248
254
  - [ ] Code review completed (or skipped if config says "skip")
249
255
  - [ ] Phase goal verified (Must-Haves checked against codebase)
256
+ - [ ] Browser verification completed or skipped (non-web/disabled)
250
257
  - [ ] VERIFICATION.md created in phase directory
251
258
  - [ ] Patch file generated OR explicitly skipped with message
252
259
  - [ ] Knowledge files written to .planning/knowledge/ (consolidation complete)
@@ -123,12 +123,12 @@ Phase Research — External Documentation focus.
123
123
 
124
124
  <focus>
125
125
  Library documentation, APIs, version-specific behavior, verified code examples.
126
- Use the ms-lookup CLI for library docs and deep research:
127
- ms-lookup docs <library> '<query>'
128
- ms-lookup deep '<query>'
129
- Use WebSearch for ecosystem discovery.
130
- Focus on finding authoritative, current documentation for the libraries and tools
131
- needed to implement this phase.
126
+ Focus on finding authoritative, current documentation for the libraries and tools needed to implement this phase.
127
+
128
+ Tool selection rules:
129
+ - Library API docs, syntax, configuration → `ms-lookup docs <library> '<query>'`
130
+ - Complex architecture/approach synthesis `ms-lookup deep '<query>'` (limit: 3-4 calls)
131
+ - Library discovery, trends, ecosystem survey → WebSearch
132
132
  </focus>
133
133
 
134
134
  <existing_tech>
@@ -225,10 +225,12 @@ Phase Research — Best Practices & Community Consensus focus.
225
225
 
226
226
  <focus>
227
227
  Community consensus, common pitfalls, proven approaches, state of the art.
228
- Use the ms-lookup CLI for deep research on high-value questions:
229
- ms-lookup deep '<query>'
230
- Use WebSearch for community articles, blog posts, Stack Overflow patterns.
231
228
  Focus on what practitioners recommend and what mistakes to avoid.
229
+
230
+ Tool selection rules:
231
+ - Complex best-practices synthesis, architecture decisions → `ms-lookup deep '<query>'` (limit: 3-4 calls)
232
+ - Community opinions, blog posts, trends, library discovery → WebSearch
233
+ - Library-specific API verification (when confirming a recommendation) → `ms-lookup docs <library> '<query>'`
232
234
  </focus>
233
235
 
234
236
  <existing_tech>
@@ -0,0 +1,76 @@
1
+ <browser_verification>
2
+
3
+ # Browser Verification Reference
4
+
5
+ Lazily loaded by execute-phase when `ms-tools browser-check` returns READY (exit 0).
6
+
7
+ ## Auth Flow
8
+
9
+ Handle browser authentication before spawning the verifier agent.
10
+
11
+ **Step 1: Check for existing auth state**
12
+
13
+ ```bash
14
+ AUTH_STATE=".agent-browser-state.json"
15
+ [ -f "$AUTH_STATE" ] && echo "HAS_STATE" || echo "NO_STATE"
16
+ ```
17
+
18
+ **Step 2: Detect dev server URL**
19
+
20
+ Probe common ports to find the running dev server:
21
+
22
+ ```bash
23
+ for PORT in 5173 3000 8080 4200 3001; do
24
+ curl -s -o /dev/null -w "%{http_code}" "http://localhost:$PORT" 2>/dev/null | grep -q "200\|301\|302" && echo "http://localhost:$PORT" && break
25
+ done
26
+ ```
27
+
28
+ Store the result as `{dev_url}`.
29
+
30
+ **Step 3: Validate or establish auth**
31
+
32
+ If `HAS_STATE`:
33
+ 1. Open app headless at `{dev_url}`
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
36
+
37
+ If `NO_STATE` or auth expired:
38
+ 1. Close headless browser
39
+ 2. Open `{dev_url}` in **headed** mode (visible browser)
40
+ 3. Use AskUserQuestion:
41
+ - header: "Browser authentication"
42
+ - question: "Please log in to the app in the browser window. Select 'Done' when you've logged in."
43
+ - options: ["Done — I'm logged in", "Skip browser verification"]
44
+ 4. If user logged in: save browser state to `.agent-browser-state.json`, close headed browser, ensure gitignored:
45
+ ```bash
46
+ grep -q "\.agent-browser-state\.json" .gitignore 2>/dev/null || echo '.agent-browser-state.json' >> .gitignore
47
+ ```
48
+ 5. If user skips: proceed to code_review, skip browser verification
49
+
50
+ ## Spawn
51
+
52
+ Spawn the browser verifier agent after auth is established:
53
+
54
+ ```
55
+ Task(
56
+ prompt="Run browser verification for phase {phase_number}.
57
+
58
+ Phase directory: {phase_dir}
59
+ Phase goal: {phase_goal}
60
+ VERIFICATION.md: {verification_path}
61
+ Dev URL: {dev_url}
62
+ Auth state: .agent-browser-state.json
63
+ Screenshots directory: {phase_dir}/screenshots
64
+
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.",
68
+ subagent_type="ms-browser-verifier"
69
+ )
70
+ ```
71
+
72
+ **After verifier returns:**
73
+
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.
75
+
76
+ </browser_verification>
@@ -5,5 +5,8 @@
5
5
  "phase": null,
6
6
  "milestone": null
7
7
  },
8
- "open_mockups": "auto"
8
+ "open_mockups": "auto",
9
+ "browser_verification": {
10
+ "enabled": true
11
+ }
9
12
  }
@@ -32,12 +32,12 @@ Phase Research — External Documentation focus.
32
32
 
33
33
  <focus>
34
34
  Library documentation, APIs, version-specific behavior, verified code examples.
35
- Use the ms-lookup CLI for library docs and deep research:
36
- ms-lookup docs <library> '<query>'
37
- ms-lookup deep '<query>'
38
- Use WebSearch for ecosystem discovery.
39
- Focus on finding authoritative, current documentation for the libraries and tools
40
- needed to implement this phase.
35
+ Focus on finding authoritative, current documentation for the libraries and tools needed to implement this phase.
36
+
37
+ Tool selection rules:
38
+ - Library API docs, syntax, configuration → `ms-lookup docs <library> '<query>'`
39
+ - Complex architecture/approach synthesis `ms-lookup deep '<query>'` (limit: 3-4 calls)
40
+ - Library discovery, trends, ecosystem survey → WebSearch
41
41
  </focus>
42
42
 
43
43
  <existing_tech>
@@ -128,10 +128,12 @@ Phase Research — Best Practices & Community Consensus focus.
128
128
 
129
129
  <focus>
130
130
  Community consensus, common pitfalls, proven approaches, state of the art.
131
- Use the ms-lookup CLI for deep research on high-value questions:
132
- ms-lookup deep '<query>'
133
- Use WebSearch for community articles, blog posts, Stack Overflow patterns.
134
131
  Focus on what practitioners recommend and what mistakes to avoid.
132
+
133
+ Tool selection rules:
134
+ - Complex best-practices synthesis, architecture decisions → `ms-lookup deep '<query>'` (limit: 3-4 calls)
135
+ - Community opinions, blog posts, trends, library discovery → WebSearch
136
+ - Library-specific API verification (when confirming a recommendation) → `ms-lookup docs <library> '<query>'`
135
137
  </focus>
136
138
 
137
139
  <existing_tech>
@@ -38,7 +38,7 @@ When a milestone completes, this workflow:
38
38
 
39
39
  **PHASE-SUMMARIES** consolidates all `*-SUMMARY.md` files from phase directories, organized by phase and plan, before artifacts are deleted.
40
40
 
41
- **phases/** contains the phase directories themselves (with remaining files like `.patch`, `mockups/`) moved from `.planning/phases/`.
41
+ **phases/** contains the phase directories themselves (with remaining files like `.patch`, `mockups/`, `screenshots/`) moved from `.planning/phases/`.
42
42
 
43
43
  **REQUIREMENTS archive** contains:
44
44
  - All v1 requirements marked complete with outcomes
@@ -80,7 +80,7 @@ For each flat file like `milestones/v0.1-ROADMAP.md`:
80
80
  3. `git mv` the file, stripping the version prefix from the filename:
81
81
  `git mv .planning/milestones/v0.1-ROADMAP.md .planning/milestones/v0.1/ROADMAP.md`
82
82
 
83
- **Note:** New milestones use slug-based directories (e.g., `milestones/mvp/`, `milestones/push-notifications/`). Old v-prefixed directories from previous format are valid and handled.
83
+ New milestones use slug-based directories (e.g., `milestones/mvp/`, `milestones/push-notifications/`). Old v-prefixed directories from previous format are valid and handled.
84
84
 
85
85
  Commit:
86
86
 
@@ -106,7 +106,7 @@ EOF
106
106
  2. **Resolve slugs** — For each versioned dir, match to MILESTONES.md name mapping:
107
107
  - Standard dirs: version matches directly (v0.1 → "MVP" → slug "mvp")
108
108
  - Nested dirs: match sub-directory name to the milestone name in MILESTONES.md (v2.0.0/quests → "Quests Feature" → slug "quests-feature")
109
- - Derive short slugs from names (Claude proposes, user confirms)
109
+ - Derive slugs from names: lowercase, hyphenated (e.g., "Demo Release" → "demo-release"). Claude proposes, user confirms
110
110
 
111
111
  3. **Present mapping** to user with AskUserQuestion:
112
112
 
@@ -236,6 +236,35 @@ EOF
236
236
  ```
237
237
  </step>
238
238
 
239
+ <step name="fix_phase_dirs">
240
+ **Only if Phase Directory Naming failed or warned.**
241
+
242
+ 1. Create any missing phase directories:
243
+
244
+ ```bash
245
+ ms-tools create-phase-dirs
246
+ ```
247
+
248
+ 2. For non-canonical directories (reported as FAIL), rename using `git mv`:
249
+
250
+ Parse each non-canonical suggestion from the doctor check output (format: `{old} → git mv .planning/phases/{old} .planning/phases/{canonical}`) and execute the `git mv`.
251
+
252
+ Commit:
253
+
254
+ ```bash
255
+ git add .planning/phases/
256
+ ```
257
+
258
+ ```bash
259
+ git commit -m "$(cat <<'EOF'
260
+ chore(doctor): fix phase directory naming
261
+
262
+ Created missing and renamed non-canonical phase directories.
263
+ EOF
264
+ )"
265
+ ```
266
+ </step>
267
+
239
268
  <step name="fix_knowledge">
240
269
  **Only if Knowledge Files failed.**
241
270
 
@@ -253,7 +282,7 @@ If `SUMMARIES > 0`: **artifact mode**. If `SUMMARIES == 0`: **source code mode**
253
282
 
254
283
  ### 2. Spawn subagent
255
284
 
256
- Spawn a `general-purpose` subagent (Task tool) with the following structured prompt. Inject detected mode, subsystem list from config.json, and environment flags into the prompt.
285
+ Spawn a `general-purpose` subagent (Task tool) with the following structured prompt. Inject detected mode, subsystem list from config.json, and detection results (SUMMARIES, HAS_CODEBASE_DOCS, HAS_PROJECT) into the prompt.
257
286
 
258
287
  ---
259
288