mindsystem-cc 3.0.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 (139) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +501 -0
  3. package/agents/ms-codebase-mapper.md +739 -0
  4. package/agents/ms-debugger.md +1184 -0
  5. package/agents/ms-designer.md +414 -0
  6. package/agents/ms-executor.md +760 -0
  7. package/agents/ms-integration-checker.md +423 -0
  8. package/agents/ms-milestone-auditor.md +448 -0
  9. package/agents/ms-mock-generator.md +182 -0
  10. package/agents/ms-plan-checker.md +746 -0
  11. package/agents/ms-research-synthesizer.md +248 -0
  12. package/agents/ms-researcher.md +962 -0
  13. package/agents/ms-roadmapper.md +606 -0
  14. package/agents/ms-verifier.md +779 -0
  15. package/agents/ms-verify-fixer.md +124 -0
  16. package/bin/install.js +296 -0
  17. package/commands/ms/add-phase.md +207 -0
  18. package/commands/ms/add-todo.md +182 -0
  19. package/commands/ms/audit-milestone.md +318 -0
  20. package/commands/ms/check-phase.md +162 -0
  21. package/commands/ms/check-todos.md +217 -0
  22. package/commands/ms/complete-milestone.md +137 -0
  23. package/commands/ms/create-roadmap.md +273 -0
  24. package/commands/ms/debug.md +149 -0
  25. package/commands/ms/define-requirements.md +121 -0
  26. package/commands/ms/design-phase.md +341 -0
  27. package/commands/ms/discuss-milestone.md +48 -0
  28. package/commands/ms/discuss-phase.md +60 -0
  29. package/commands/ms/do-work.md +90 -0
  30. package/commands/ms/execute-phase.md +289 -0
  31. package/commands/ms/help.md +623 -0
  32. package/commands/ms/insert-phase.md +227 -0
  33. package/commands/ms/list-phase-assumptions.md +50 -0
  34. package/commands/ms/map-codebase.md +71 -0
  35. package/commands/ms/new-milestone.md +193 -0
  36. package/commands/ms/new-project.md +338 -0
  37. package/commands/ms/pause-work.md +123 -0
  38. package/commands/ms/plan-milestone-gaps.md +285 -0
  39. package/commands/ms/plan-phase.md +105 -0
  40. package/commands/ms/progress.md +370 -0
  41. package/commands/ms/remove-phase.md +338 -0
  42. package/commands/ms/research-phase.md +175 -0
  43. package/commands/ms/research-project.md +339 -0
  44. package/commands/ms/resume-work.md +40 -0
  45. package/commands/ms/review-design.md +484 -0
  46. package/commands/ms/simplify-flutter.md +193 -0
  47. package/commands/ms/update.md +159 -0
  48. package/commands/ms/verify-work.md +92 -0
  49. package/commands/ms/whats-new.md +124 -0
  50. package/mindsystem/references/checkpoints.md +788 -0
  51. package/mindsystem/references/continuation-format.md +255 -0
  52. package/mindsystem/references/debugging/debugging-mindset.md +11 -0
  53. package/mindsystem/references/debugging/hypothesis-testing.md +11 -0
  54. package/mindsystem/references/debugging/investigation-techniques.md +11 -0
  55. package/mindsystem/references/debugging/verification-patterns.md +11 -0
  56. package/mindsystem/references/debugging/when-to-research.md +11 -0
  57. package/mindsystem/references/git-integration.md +254 -0
  58. package/mindsystem/references/goal-backward.md +286 -0
  59. package/mindsystem/references/mock-patterns.md +294 -0
  60. package/mindsystem/references/plan-format.md +473 -0
  61. package/mindsystem/references/principles.md +73 -0
  62. package/mindsystem/references/questioning.md +140 -0
  63. package/mindsystem/references/research-pitfalls.md +233 -0
  64. package/mindsystem/references/scope-estimation.md +256 -0
  65. package/mindsystem/references/tdd.md +263 -0
  66. package/mindsystem/references/verification-patterns.md +595 -0
  67. package/mindsystem/templates/DEBUG.md +159 -0
  68. package/mindsystem/templates/UAT.md +403 -0
  69. package/mindsystem/templates/adhoc-summary.md +153 -0
  70. package/mindsystem/templates/codebase/architecture.md +255 -0
  71. package/mindsystem/templates/codebase/concerns.md +310 -0
  72. package/mindsystem/templates/codebase/conventions.md +307 -0
  73. package/mindsystem/templates/codebase/integrations.md +280 -0
  74. package/mindsystem/templates/codebase/stack.md +186 -0
  75. package/mindsystem/templates/codebase/structure.md +285 -0
  76. package/mindsystem/templates/codebase/testing.md +480 -0
  77. package/mindsystem/templates/config.json +26 -0
  78. package/mindsystem/templates/context.md +140 -0
  79. package/mindsystem/templates/continue-here.md +78 -0
  80. package/mindsystem/templates/debug-subagent-prompt.md +91 -0
  81. package/mindsystem/templates/design-iteration.md +208 -0
  82. package/mindsystem/templates/design.md +417 -0
  83. package/mindsystem/templates/discovery.md +146 -0
  84. package/mindsystem/templates/milestone-archive.md +123 -0
  85. package/mindsystem/templates/milestone-context.md +93 -0
  86. package/mindsystem/templates/milestone.md +115 -0
  87. package/mindsystem/templates/phase-prompt.md +574 -0
  88. package/mindsystem/templates/project.md +184 -0
  89. package/mindsystem/templates/requirements.md +231 -0
  90. package/mindsystem/templates/research-project/ARCHITECTURE.md +204 -0
  91. package/mindsystem/templates/research-project/FEATURES.md +147 -0
  92. package/mindsystem/templates/research-project/PITFALLS.md +200 -0
  93. package/mindsystem/templates/research-project/STACK.md +120 -0
  94. package/mindsystem/templates/research-project/SUMMARY.md +170 -0
  95. package/mindsystem/templates/research-subagent-prompt.md +92 -0
  96. package/mindsystem/templates/research.md +529 -0
  97. package/mindsystem/templates/roadmap.md +214 -0
  98. package/mindsystem/templates/state.md +224 -0
  99. package/mindsystem/templates/summary.md +269 -0
  100. package/mindsystem/templates/user-setup.md +323 -0
  101. package/mindsystem/templates/verification-report.md +322 -0
  102. package/mindsystem/workflows/complete-milestone.md +759 -0
  103. package/mindsystem/workflows/create-milestone.md +203 -0
  104. package/mindsystem/workflows/debug.md +14 -0
  105. package/mindsystem/workflows/define-requirements.md +330 -0
  106. package/mindsystem/workflows/diagnose-issues.md +241 -0
  107. package/mindsystem/workflows/discovery-phase.md +293 -0
  108. package/mindsystem/workflows/discuss-milestone.md +310 -0
  109. package/mindsystem/workflows/discuss-phase.md +237 -0
  110. package/mindsystem/workflows/do-work.md +359 -0
  111. package/mindsystem/workflows/execute-phase.md +644 -0
  112. package/mindsystem/workflows/execute-plan.md +1828 -0
  113. package/mindsystem/workflows/generate-mocks.md +187 -0
  114. package/mindsystem/workflows/list-phase-assumptions.md +178 -0
  115. package/mindsystem/workflows/map-codebase.md +289 -0
  116. package/mindsystem/workflows/plan-phase.md +876 -0
  117. package/mindsystem/workflows/research-phase.md +17 -0
  118. package/mindsystem/workflows/research-project.md +23 -0
  119. package/mindsystem/workflows/resume-project.md +311 -0
  120. package/mindsystem/workflows/transition.md +564 -0
  121. package/mindsystem/workflows/verify-phase.md +629 -0
  122. package/mindsystem/workflows/verify-work.md +823 -0
  123. package/package.json +32 -0
  124. package/scripts/generate-phase-patch.sh +169 -0
  125. package/scripts/ms-lookup/README.md +112 -0
  126. package/scripts/ms-lookup/ms_lookup/__init__.py +3 -0
  127. package/scripts/ms-lookup/ms_lookup/__main__.py +6 -0
  128. package/scripts/ms-lookup/ms_lookup/backends/__init__.py +6 -0
  129. package/scripts/ms-lookup/ms_lookup/backends/context7.py +219 -0
  130. package/scripts/ms-lookup/ms_lookup/backends/perplexity.py +145 -0
  131. package/scripts/ms-lookup/ms_lookup/cache.py +48 -0
  132. package/scripts/ms-lookup/ms_lookup/cli.py +219 -0
  133. package/scripts/ms-lookup/ms_lookup/config.py +23 -0
  134. package/scripts/ms-lookup/ms_lookup/errors.py +24 -0
  135. package/scripts/ms-lookup/ms_lookup/output.py +49 -0
  136. package/scripts/ms-lookup/ms_lookup/tokens.py +56 -0
  137. package/scripts/ms-lookup/pyproject.toml +17 -0
  138. package/scripts/ms-lookup/uv.lock +207 -0
  139. package/scripts/ms-lookup-wrapper.sh +21 -0
@@ -0,0 +1,629 @@
1
+ <purpose>
2
+ Verify phase goal achievement through goal-backward analysis. Check that the codebase actually delivers what the phase promised, not just that tasks were completed.
3
+
4
+ This workflow is executed by a verification subagent spawned from execute-phase.md.
5
+ </purpose>
6
+
7
+ <core_principle>
8
+ **Task completion ≠ Goal achievement**
9
+
10
+ A task "create chat component" can be marked complete when the component is a placeholder. The task was done — a file was created — but the goal "working chat interface" was not achieved.
11
+
12
+ Goal-backward verification starts from the outcome and works backwards:
13
+ 1. What must be TRUE for the goal to be achieved?
14
+ 2. What must EXIST for those truths to hold?
15
+ 3. What must be WIRED for those artifacts to function?
16
+
17
+ Then verify each level against the actual codebase.
18
+ </core_principle>
19
+
20
+ <required_reading>
21
+ **Load these references:**
22
+ - ~/.claude/mindsystem/references/goal-backward.md (derivation process)
23
+ - ~/.claude/mindsystem/references/verification-patterns.md (detection patterns)
24
+ - ~/.claude/mindsystem/templates/verification-report.md (output format)
25
+ </required_reading>
26
+
27
+ <process>
28
+
29
+ <step name="load_context" priority="first">
30
+ **Gather all verification context:**
31
+
32
+ ```bash
33
+ # Phase directory
34
+ PHASE_DIR=$(ls -d .planning/phases/${PHASE_ARG}* 2>/dev/null | head -1)
35
+
36
+ # Phase goal from ROADMAP
37
+ grep -A 5 "Phase ${PHASE_NUM}" .planning/ROADMAP.md
38
+
39
+ # Requirements mapped to this phase
40
+ grep -E "^| ${PHASE_NUM}" .planning/REQUIREMENTS.md 2>/dev/null
41
+
42
+ # All SUMMARY files (claims to verify)
43
+ ls "$PHASE_DIR"/*-SUMMARY.md 2>/dev/null
44
+
45
+ # All PLAN files (for must_haves in frontmatter)
46
+ ls "$PHASE_DIR"/*-PLAN.md 2>/dev/null
47
+ ```
48
+
49
+ **Extract phase goal:** Parse ROADMAP.md for this phase's goal/description. This is the outcome to verify, not the tasks.
50
+
51
+ **Extract requirements:** If REQUIREMENTS.md exists, find requirements mapped to this phase. These become additional verification targets.
52
+ </step>
53
+
54
+ <step name="establish_must_haves">
55
+ **Determine what must be verified.**
56
+
57
+ **Option A: Must-haves in PLAN frontmatter**
58
+
59
+ Check if any PLAN.md has `must_haves` in frontmatter:
60
+
61
+ ```bash
62
+ grep -l "must_haves:" "$PHASE_DIR"/*-PLAN.md 2>/dev/null
63
+ ```
64
+
65
+ If found, extract and use:
66
+ ```yaml
67
+ must_haves:
68
+ truths:
69
+ - "User can see existing messages"
70
+ - "User can send a message"
71
+ artifacts:
72
+ - path: "src/components/Chat.tsx"
73
+ provides: "Message list rendering"
74
+ key_links:
75
+ - from: "Chat.tsx"
76
+ to: "api/chat"
77
+ via: "fetch in useEffect"
78
+ ```
79
+
80
+ **Option B: Derive from phase goal**
81
+
82
+ If no must_haves in frontmatter, derive using goal-backward process:
83
+
84
+ 1. **State the goal:** Take phase goal from ROADMAP.md
85
+
86
+ 2. **Derive truths:** Ask "What must be TRUE for this goal to be achieved?"
87
+ - List 3-7 observable behaviors from user perspective
88
+ - Each truth should be testable by a human using the app
89
+
90
+ 3. **Derive artifacts:** For each truth, ask "What must EXIST?"
91
+ - Map truths to concrete files (components, routes, schemas)
92
+ - Be specific: `src/components/Chat.tsx`, not "chat component"
93
+
94
+ 4. **Derive key links:** For each artifact, ask "What must be CONNECTED?"
95
+ - Identify critical wiring (component calls API, API queries DB)
96
+ - These are where stubs hide
97
+
98
+ 5. **Document derived must-haves** before proceeding to verification.
99
+
100
+ See ~/.claude/mindsystem/references/goal-backward.md for detailed derivation guidance.
101
+ </step>
102
+
103
+ <step name="verify_truths">
104
+ **For each observable truth, determine if codebase enables it.**
105
+
106
+ A truth is achievable if the supporting artifacts exist, are substantive, and are wired correctly.
107
+
108
+ **Verification status:**
109
+ - ✓ VERIFIED: All supporting artifacts pass all checks
110
+ - ✗ FAILED: One or more supporting artifacts missing, stub, or unwired
111
+ - ? UNCERTAIN: Can't verify programmatically (needs human)
112
+
113
+ **For each truth:**
114
+
115
+ 1. Identify supporting artifacts (which files make this truth possible?)
116
+ 2. Check artifact status (see verify_artifacts step)
117
+ 3. Check wiring status (see verify_wiring step)
118
+ 4. Determine truth status based on supporting infrastructure
119
+
120
+ **Example:**
121
+
122
+ Truth: "User can see existing messages"
123
+
124
+ Supporting artifacts:
125
+ - Chat.tsx (renders messages)
126
+ - /api/chat GET (provides messages)
127
+ - Message model (defines schema)
128
+
129
+ If Chat.tsx is a stub → Truth FAILED
130
+ If /api/chat GET returns hardcoded [] → Truth FAILED
131
+ If Chat.tsx exists, is substantive, calls API, renders response → Truth VERIFIED
132
+ </step>
133
+
134
+ <step name="verify_artifacts">
135
+ **For each required artifact, verify three levels:**
136
+
137
+ ### Level 1: Existence
138
+
139
+ ```bash
140
+ check_exists() {
141
+ local path="$1"
142
+ if [ -f "$path" ]; then
143
+ echo "EXISTS"
144
+ elif [ -d "$path" ]; then
145
+ echo "EXISTS (directory)"
146
+ else
147
+ echo "MISSING"
148
+ fi
149
+ }
150
+ ```
151
+
152
+ If MISSING → artifact fails, record and continue to next artifact.
153
+
154
+ ### Level 2: Substantive
155
+
156
+ Check that the file has real implementation, not a stub.
157
+
158
+ **Line count check:**
159
+ ```bash
160
+ check_length() {
161
+ local path="$1"
162
+ local min_lines="$2"
163
+ local lines=$(wc -l < "$path" 2>/dev/null || echo 0)
164
+ [ "$lines" -ge "$min_lines" ] && echo "SUBSTANTIVE ($lines lines)" || echo "THIN ($lines lines)"
165
+ }
166
+ ```
167
+
168
+ Minimum lines by type:
169
+ - Component: 15+ lines
170
+ - API route: 10+ lines
171
+ - Hook/util: 10+ lines
172
+ - Schema model: 5+ lines
173
+
174
+ **Stub pattern check:**
175
+ ```bash
176
+ check_stubs() {
177
+ local path="$1"
178
+
179
+ # Universal stub patterns
180
+ local stubs=$(grep -c -E "TODO|FIXME|placeholder|not implemented|coming soon" "$path" 2>/dev/null || echo 0)
181
+
182
+ # Empty returns
183
+ local empty=$(grep -c -E "return null|return undefined|return \{\}|return \[\]" "$path" 2>/dev/null || echo 0)
184
+
185
+ # Placeholder content
186
+ local placeholder=$(grep -c -E "will be here|placeholder|lorem ipsum" "$path" 2>/dev/null || echo 0)
187
+
188
+ local total=$((stubs + empty + placeholder))
189
+ [ "$total" -gt 0 ] && echo "STUB_PATTERNS ($total found)" || echo "NO_STUBS"
190
+ }
191
+ ```
192
+
193
+ **Export check (for components/hooks):**
194
+ ```bash
195
+ check_exports() {
196
+ local path="$1"
197
+ grep -E "^export (default )?(function|const|class)" "$path" && echo "HAS_EXPORTS" || echo "NO_EXPORTS"
198
+ }
199
+ ```
200
+
201
+ **Combine level 2 results:**
202
+ - SUBSTANTIVE: Adequate length + no stubs + has exports
203
+ - STUB: Too short OR has stub patterns OR no exports
204
+ - PARTIAL: Mixed signals (length OK but has some stubs)
205
+
206
+ ### Level 3: Wired
207
+
208
+ Check that the artifact is connected to the system.
209
+
210
+ **Import check (is it used?):**
211
+ ```bash
212
+ check_imported() {
213
+ local artifact_name="$1"
214
+ local search_path="${2:-src/}"
215
+
216
+ # Find imports of this artifact
217
+ local imports=$(grep -r "import.*$artifact_name" "$search_path" --include="*.ts" --include="*.tsx" 2>/dev/null | wc -l)
218
+
219
+ [ "$imports" -gt 0 ] && echo "IMPORTED ($imports times)" || echo "NOT_IMPORTED"
220
+ }
221
+ ```
222
+
223
+ **Usage check (is it called?):**
224
+ ```bash
225
+ check_used() {
226
+ local artifact_name="$1"
227
+ local search_path="${2:-src/}"
228
+
229
+ # Find usages (function calls, component renders, etc.)
230
+ local uses=$(grep -r "$artifact_name" "$search_path" --include="*.ts" --include="*.tsx" 2>/dev/null | grep -v "import" | wc -l)
231
+
232
+ [ "$uses" -gt 0 ] && echo "USED ($uses times)" || echo "NOT_USED"
233
+ }
234
+ ```
235
+
236
+ **Combine level 3 results:**
237
+ - WIRED: Imported AND used
238
+ - ORPHANED: Exists but not imported/used
239
+ - PARTIAL: Imported but not used (or vice versa)
240
+
241
+ ### Final artifact status
242
+
243
+ | Exists | Substantive | Wired | Status |
244
+ |--------|-------------|-------|--------|
245
+ | ✓ | ✓ | ✓ | ✓ VERIFIED |
246
+ | ✓ | ✓ | ✗ | ⚠️ ORPHANED |
247
+ | ✓ | ✗ | - | ✗ STUB |
248
+ | ✗ | - | - | ✗ MISSING |
249
+
250
+ Record status and evidence for each artifact.
251
+ </step>
252
+
253
+ <step name="verify_wiring">
254
+ **Verify key links between artifacts.**
255
+
256
+ Key links are critical connections. If broken, the goal fails even with all artifacts present.
257
+
258
+ ### Pattern: Component → API
259
+
260
+ Check if component actually calls the API:
261
+
262
+ ```bash
263
+ verify_component_api_link() {
264
+ local component="$1"
265
+ local api_path="$2"
266
+
267
+ # Check for fetch/axios call to the API
268
+ local has_call=$(grep -E "fetch\(['\"].*$api_path|axios\.(get|post).*$api_path" "$component" 2>/dev/null)
269
+
270
+ if [ -n "$has_call" ]; then
271
+ # Check if response is used
272
+ local uses_response=$(grep -A 5 "fetch\|axios" "$component" | grep -E "await|\.then|setData|setState" 2>/dev/null)
273
+
274
+ if [ -n "$uses_response" ]; then
275
+ echo "WIRED: $component → $api_path (call + response handling)"
276
+ else
277
+ echo "PARTIAL: $component → $api_path (call exists but response not used)"
278
+ fi
279
+ else
280
+ echo "NOT_WIRED: $component → $api_path (no call found)"
281
+ fi
282
+ }
283
+ ```
284
+
285
+ ### Pattern: API → Database
286
+
287
+ Check if API route queries database:
288
+
289
+ ```bash
290
+ verify_api_db_link() {
291
+ local route="$1"
292
+ local model="$2"
293
+
294
+ # Check for Prisma/DB call
295
+ local has_query=$(grep -E "prisma\.$model|db\.$model|$model\.(find|create|update|delete)" "$route" 2>/dev/null)
296
+
297
+ if [ -n "$has_query" ]; then
298
+ # Check if result is returned
299
+ local returns_result=$(grep -E "return.*json.*\w+|res\.json\(\w+" "$route" 2>/dev/null)
300
+
301
+ if [ -n "$returns_result" ]; then
302
+ echo "WIRED: $route → database ($model)"
303
+ else
304
+ echo "PARTIAL: $route → database (query exists but result not returned)"
305
+ fi
306
+ else
307
+ echo "NOT_WIRED: $route → database (no query for $model)"
308
+ fi
309
+ }
310
+ ```
311
+
312
+ ### Pattern: Form → Handler
313
+
314
+ Check if form submission does something:
315
+
316
+ ```bash
317
+ verify_form_handler_link() {
318
+ local component="$1"
319
+
320
+ # Find onSubmit handler
321
+ local has_handler=$(grep -E "onSubmit=\{|handleSubmit" "$component" 2>/dev/null)
322
+
323
+ if [ -n "$has_handler" ]; then
324
+ # Check if handler has real implementation
325
+ local handler_content=$(grep -A 10 "onSubmit.*=" "$component" | grep -E "fetch|axios|mutate|dispatch" 2>/dev/null)
326
+
327
+ if [ -n "$handler_content" ]; then
328
+ echo "WIRED: form → handler (has API call)"
329
+ else
330
+ # Check for stub patterns
331
+ local is_stub=$(grep -A 5 "onSubmit" "$component" | grep -E "console\.log|preventDefault\(\)$|\{\}" 2>/dev/null)
332
+ if [ -n "$is_stub" ]; then
333
+ echo "STUB: form → handler (only logs or empty)"
334
+ else
335
+ echo "PARTIAL: form → handler (exists but unclear implementation)"
336
+ fi
337
+ fi
338
+ else
339
+ echo "NOT_WIRED: form → handler (no onSubmit found)"
340
+ fi
341
+ }
342
+ ```
343
+
344
+ ### Pattern: State → Render
345
+
346
+ Check if state is actually rendered:
347
+
348
+ ```bash
349
+ verify_state_render_link() {
350
+ local component="$1"
351
+ local state_var="$2"
352
+
353
+ # Check if state variable exists
354
+ local has_state=$(grep -E "useState.*$state_var|\[$state_var," "$component" 2>/dev/null)
355
+
356
+ if [ -n "$has_state" ]; then
357
+ # Check if state is used in JSX
358
+ local renders_state=$(grep -E "\{.*$state_var.*\}|\{$state_var\." "$component" 2>/dev/null)
359
+
360
+ if [ -n "$renders_state" ]; then
361
+ echo "WIRED: state → render ($state_var displayed)"
362
+ else
363
+ echo "NOT_WIRED: state → render ($state_var exists but not displayed)"
364
+ fi
365
+ else
366
+ echo "N/A: state → render (no state var $state_var)"
367
+ fi
368
+ }
369
+ ```
370
+
371
+ ### Aggregate key link results
372
+
373
+ For each key link in must_haves:
374
+ - Run appropriate verification function
375
+ - Record status and evidence
376
+ - WIRED / PARTIAL / STUB / NOT_WIRED
377
+ </step>
378
+
379
+ <step name="verify_requirements">
380
+ **Check requirements coverage if REQUIREMENTS.md exists.**
381
+
382
+ ```bash
383
+ # Find requirements mapped to this phase
384
+ grep -E "Phase ${PHASE_NUM}" .planning/REQUIREMENTS.md 2>/dev/null
385
+ ```
386
+
387
+ For each requirement:
388
+ 1. Parse requirement description
389
+ 2. Identify which truths/artifacts support it
390
+ 3. Determine status based on supporting infrastructure
391
+
392
+ **Requirement status:**
393
+ - ✓ SATISFIED: All supporting truths verified
394
+ - ✗ BLOCKED: One or more supporting truths failed
395
+ - ? NEEDS HUMAN: Can't verify requirement programmatically
396
+ </step>
397
+
398
+ <step name="scan_antipatterns">
399
+ **Scan for anti-patterns across phase files.**
400
+
401
+ Identify files modified in this phase:
402
+ ```bash
403
+ # Extract files from SUMMARY.md
404
+ grep -E "^\- \`" "$PHASE_DIR"/*-SUMMARY.md | sed 's/.*`\([^`]*\)`.*/\1/' | sort -u
405
+ ```
406
+
407
+ Run anti-pattern detection:
408
+ ```bash
409
+ scan_antipatterns() {
410
+ local files="$@"
411
+
412
+ echo "## Anti-Patterns Found"
413
+ echo ""
414
+
415
+ for file in $files; do
416
+ [ -f "$file" ] || continue
417
+
418
+ # TODO/FIXME comments
419
+ grep -n -E "TODO|FIXME|XXX|HACK" "$file" 2>/dev/null | while read line; do
420
+ echo "| $file | $(echo $line | cut -d: -f1) | TODO/FIXME | ⚠️ Warning |"
421
+ done
422
+
423
+ # Placeholder content
424
+ grep -n -E "placeholder|coming soon|will be here" "$file" -i 2>/dev/null | while read line; do
425
+ echo "| $file | $(echo $line | cut -d: -f1) | Placeholder | 🛑 Blocker |"
426
+ done
427
+
428
+ # Empty implementations
429
+ grep -n -E "return null|return \{\}|return \[\]|=> \{\}" "$file" 2>/dev/null | while read line; do
430
+ echo "| $file | $(echo $line | cut -d: -f1) | Empty return | ⚠️ Warning |"
431
+ done
432
+
433
+ # Console.log only implementations
434
+ grep -n -B 2 -A 2 "console\.log" "$file" 2>/dev/null | grep -E "^\s*(const|function|=>)" | while read line; do
435
+ echo "| $file | - | Log-only function | ⚠️ Warning |"
436
+ done
437
+ done
438
+ }
439
+ ```
440
+
441
+ Categorize findings:
442
+ - 🛑 Blocker: Prevents goal achievement (placeholder renders, empty handlers)
443
+ - ⚠️ Warning: Indicates incomplete (TODO comments, console.log)
444
+ - ℹ️ Info: Notable but not problematic
445
+ </step>
446
+
447
+ <step name="identify_human_verification">
448
+ **Flag items that need human verification.**
449
+
450
+ Some things can't be verified programmatically:
451
+
452
+ **Always needs human:**
453
+ - Visual appearance (does it look right?)
454
+ - User flow completion (can you do the full task?)
455
+ - Real-time behavior (WebSocket, SSE updates)
456
+ - External service integration (payments, email)
457
+ - Performance feel (does it feel fast?)
458
+ - Error message clarity
459
+
460
+ **Needs human if uncertain:**
461
+ - Complex wiring that grep can't trace
462
+ - Dynamic behavior depending on state
463
+ - Edge cases and error states
464
+
465
+ **Format for human verification:**
466
+ ```markdown
467
+ ## Human Verification Required
468
+
469
+ ### 1. {Test Name}
470
+ **Test:** {What to do}
471
+ **Expected:** {What should happen}
472
+ **Why human:** {Why can't verify programmatically}
473
+ ```
474
+ </step>
475
+
476
+ <step name="determine_status">
477
+ **Calculate overall verification status.**
478
+
479
+ **Status: passed**
480
+ - All truths VERIFIED
481
+ - All artifacts pass level 1-3
482
+ - All key links WIRED
483
+ - No blocker anti-patterns
484
+ - (Human verification items are OK — will be prompted)
485
+
486
+ **Status: gaps_found**
487
+ - One or more truths FAILED
488
+ - OR one or more artifacts MISSING/STUB
489
+ - OR one or more key links NOT_WIRED
490
+ - OR blocker anti-patterns found
491
+
492
+ **Status: human_needed**
493
+ - All automated checks pass
494
+ - BUT items flagged for human verification
495
+ - Can't determine goal achievement without human
496
+
497
+ **Calculate score:**
498
+ ```
499
+ score = (verified_truths / total_truths)
500
+ ```
501
+ </step>
502
+
503
+ <step name="generate_fix_plans">
504
+ **If gaps_found, recommend fix plans.**
505
+
506
+ Group related gaps into fix plans:
507
+
508
+ 1. **Identify gap clusters:**
509
+ - API stub + component not wired → "Wire frontend to backend"
510
+ - Multiple artifacts missing → "Complete core implementation"
511
+ - Wiring issues only → "Connect existing components"
512
+
513
+ 2. **Generate plan recommendations:**
514
+
515
+ ```markdown
516
+ ### {phase}-{next}-PLAN.md: {Fix Name}
517
+
518
+ **Objective:** {What this fixes}
519
+
520
+ **Tasks:**
521
+ 1. {Task to fix gap 1}
522
+ - Files: {files to modify}
523
+ - Action: {specific fix}
524
+ - Verify: {how to confirm fix}
525
+
526
+ 2. {Task to fix gap 2}
527
+ - Files: {files to modify}
528
+ - Action: {specific fix}
529
+ - Verify: {how to confirm fix}
530
+
531
+ 3. Re-verify phase goal
532
+ - Run verification again
533
+ - Confirm all must-haves pass
534
+
535
+ **Estimated scope:** {Small / Medium}
536
+ ```
537
+
538
+ 3. **Keep plans focused:**
539
+ - 2-3 tasks per plan
540
+ - Single concern per plan
541
+ - Include verification task
542
+
543
+ 4. **Order by dependency:**
544
+ - Fix missing artifacts before wiring
545
+ - Fix stubs before integration
546
+ - Verify after all fixes
547
+ </step>
548
+
549
+ <step name="create_report">
550
+ **Generate VERIFICATION.md using template.**
551
+
552
+ ```bash
553
+ REPORT_PATH="$PHASE_DIR/${PHASE_NUM}-VERIFICATION.md"
554
+ ```
555
+
556
+ Fill template sections:
557
+ 1. **Frontmatter:** phase, verified timestamp, status, score
558
+ 2. **Goal Achievement:** Truth verification table
559
+ 3. **Required Artifacts:** Artifact verification table
560
+ 4. **Key Link Verification:** Wiring verification table
561
+ 5. **Requirements Coverage:** If REQUIREMENTS.md exists
562
+ 6. **Anti-Patterns Found:** Scan results table
563
+ 7. **Human Verification Required:** Items needing human
564
+ 8. **Gaps Summary:** Critical and non-critical gaps
565
+ 9. **Recommended Fix Plans:** If gaps_found
566
+ 10. **Verification Metadata:** Approach, timing, counts
567
+
568
+ See ~/.claude/mindsystem/templates/verification-report.md for complete template.
569
+ </step>
570
+
571
+ <step name="return_to_orchestrator">
572
+ **Return results to execute-phase orchestrator.**
573
+
574
+ **Return format:**
575
+
576
+ ```markdown
577
+ ## Verification Complete
578
+
579
+ **Status:** {passed | gaps_found | human_needed}
580
+ **Score:** {N}/{M} must-haves verified
581
+ **Report:** .planning/phases/{phase_dir}/{phase}-VERIFICATION.md
582
+
583
+ {If passed:}
584
+ All must-haves verified. Phase goal achieved. Ready to proceed.
585
+
586
+ {If gaps_found:}
587
+ ### Gaps Found
588
+
589
+ {N} critical gaps blocking goal achievement:
590
+ 1. {Gap 1 summary}
591
+ 2. {Gap 2 summary}
592
+
593
+ ### Recommended Fixes
594
+
595
+ {N} fix plans recommended:
596
+ 1. {phase}-{next}-PLAN.md: {name}
597
+ 2. {phase}-{next+1}-PLAN.md: {name}
598
+
599
+ {If human_needed:}
600
+ ### Human Verification Required
601
+
602
+ {N} items need human testing:
603
+ 1. {Item 1}
604
+ 2. {Item 2}
605
+
606
+ Automated checks passed. Awaiting human verification.
607
+ ```
608
+
609
+ The orchestrator will:
610
+ - If `passed`: Continue to update_roadmap
611
+ - If `gaps_found`: Create and execute fix plans, then re-verify
612
+ - If `human_needed`: Present items to user, collect responses
613
+ </step>
614
+
615
+ </process>
616
+
617
+ <success_criteria>
618
+ - [ ] Must-haves established (from frontmatter or derived)
619
+ - [ ] All truths verified with status and evidence
620
+ - [ ] All artifacts checked at all three levels
621
+ - [ ] All key links verified
622
+ - [ ] Requirements coverage assessed (if applicable)
623
+ - [ ] Anti-patterns scanned and categorized
624
+ - [ ] Human verification items identified
625
+ - [ ] Overall status determined
626
+ - [ ] Fix plans generated (if gaps_found)
627
+ - [ ] VERIFICATION.md created with complete report
628
+ - [ ] Results returned to orchestrator
629
+ </success_criteria>