@massu/core 0.1.2 → 0.4.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 (84) hide show
  1. package/commands/_shared-preamble.md +76 -0
  2. package/commands/massu-audit-deps.md +211 -0
  3. package/commands/massu-changelog.md +174 -0
  4. package/commands/massu-cleanup.md +315 -0
  5. package/commands/massu-commit.md +481 -0
  6. package/commands/massu-create-plan.md +752 -0
  7. package/commands/massu-dead-code.md +131 -0
  8. package/commands/massu-debug.md +484 -0
  9. package/commands/massu-deploy.md +91 -0
  10. package/commands/massu-deps.md +374 -0
  11. package/commands/massu-doc-gen.md +279 -0
  12. package/commands/massu-docs.md +364 -0
  13. package/commands/massu-estimate.md +313 -0
  14. package/commands/massu-golden-path.md +973 -0
  15. package/commands/massu-guide.md +167 -0
  16. package/commands/massu-hotfix.md +480 -0
  17. package/commands/massu-loop-playwright.md +837 -0
  18. package/commands/massu-loop.md +775 -0
  19. package/commands/massu-new-feature.md +511 -0
  20. package/commands/massu-parity.md +214 -0
  21. package/commands/massu-plan.md +456 -0
  22. package/commands/massu-push-light.md +207 -0
  23. package/commands/massu-push.md +434 -0
  24. package/commands/massu-refactor.md +410 -0
  25. package/commands/massu-release.md +363 -0
  26. package/commands/massu-review.md +238 -0
  27. package/commands/massu-simplify.md +281 -0
  28. package/commands/massu-status.md +278 -0
  29. package/commands/massu-tdd.md +201 -0
  30. package/commands/massu-test.md +516 -0
  31. package/commands/massu-verify-playwright.md +281 -0
  32. package/commands/massu-verify.md +667 -0
  33. package/dist/cli.js +12522 -0
  34. package/dist/hooks/cost-tracker.js +80 -5
  35. package/dist/hooks/post-edit-context.js +72 -6
  36. package/dist/hooks/post-tool-use.js +234 -57
  37. package/dist/hooks/pre-compact.js +144 -5
  38. package/dist/hooks/pre-delete-check.js +141 -11
  39. package/dist/hooks/quality-event.js +80 -5
  40. package/dist/hooks/security-gate.js +29 -0
  41. package/dist/hooks/session-end.js +83 -8
  42. package/dist/hooks/session-start.js +153 -7
  43. package/dist/hooks/user-prompt.js +166 -5
  44. package/package.json +6 -5
  45. package/src/backfill-sessions.ts +5 -4
  46. package/src/cli.ts +6 -0
  47. package/src/commands/doctor.ts +193 -6
  48. package/src/commands/init.ts +235 -6
  49. package/src/commands/install-commands.ts +137 -0
  50. package/src/config.ts +68 -2
  51. package/src/db.ts +115 -2
  52. package/src/docs-tools.ts +8 -6
  53. package/src/hooks/post-edit-context.ts +1 -1
  54. package/src/hooks/post-tool-use.ts +130 -0
  55. package/src/hooks/pre-compact.ts +23 -1
  56. package/src/hooks/pre-delete-check.ts +92 -4
  57. package/src/hooks/security-gate.ts +32 -0
  58. package/src/hooks/session-start.ts +97 -4
  59. package/src/hooks/user-prompt.ts +46 -1
  60. package/src/import-resolver.ts +2 -1
  61. package/src/knowledge-db.ts +169 -0
  62. package/src/knowledge-indexer.ts +704 -0
  63. package/src/knowledge-tools.ts +1413 -0
  64. package/src/license.ts +482 -0
  65. package/src/memory-db.ts +14 -1
  66. package/src/observation-extractor.ts +11 -4
  67. package/src/page-deps.ts +3 -2
  68. package/src/python/coupling-detector.ts +124 -0
  69. package/src/python/domain-enforcer.ts +83 -0
  70. package/src/python/impact-analyzer.ts +95 -0
  71. package/src/python/import-parser.ts +244 -0
  72. package/src/python/import-resolver.ts +135 -0
  73. package/src/python/migration-indexer.ts +115 -0
  74. package/src/python/migration-parser.ts +332 -0
  75. package/src/python/model-indexer.ts +70 -0
  76. package/src/python/model-parser.ts +279 -0
  77. package/src/python/route-indexer.ts +58 -0
  78. package/src/python/route-parser.ts +317 -0
  79. package/src/python-tools.ts +629 -0
  80. package/src/sentinel-db.ts +2 -1
  81. package/src/server.ts +29 -6
  82. package/src/session-archiver.ts +4 -5
  83. package/src/tools.ts +283 -31
  84. package/README.md +0 -40
@@ -0,0 +1,667 @@
1
+ ---
2
+ name: massu-verify
3
+ description: Run all VR-* verification checks for current work with mandatory proof output
4
+ allowed-tools: Bash(*), Read(*), Grep(*), Glob(*)
5
+ ---
6
+ name: massu-verify
7
+
8
+ > **Shared rules apply.** Read `.claude/commands/_shared-preamble.md` before proceeding. CR-9, CR-35 enforced.
9
+
10
+ # Massu Verify: Comprehensive Verification Protocol
11
+
12
+ ## Objective
13
+
14
+ Run ALL applicable VR-* verification checks and produce proof output. This command validates current work against CLAUDE.md patterns and produces verifiable evidence.
15
+
16
+ ---
17
+
18
+ ## NON-NEGOTIABLE RULES
19
+
20
+ - **Proof > Claims** - Show command output, not summaries
21
+ - **ALL checks run** - Do not skip any applicable verification
22
+ - **Zero tolerance** - Any failure blocks "complete" status
23
+ - **No assumptions** - Check actual state, don't guess
24
+ - **Plan Coverage** - Verify ALL plan items, not just code quality
25
+ - **VR-CONFIG mandatory** - For config-driven features, verify config values match code expectations
26
+ - **VR-TEST mandatory (CR-7)** - ALL tests MUST pass, tests are NEVER optional
27
+ - **FIX ALL ISSUES ENCOUNTERED (CR-9)** - If ANY issue is discovered during verification - whether from current changes OR pre-existing - fix it immediately. "Not in scope" and "pre-existing" are NEVER valid reasons to skip a fix. When fixing a bug, search entire codebase for same pattern and fix ALL instances.
28
+
29
+ ---
30
+
31
+ ## CR-7: TEST REQUIREMENT (MANDATORY)
32
+
33
+ **ALL tests MUST pass before verification can be marked complete. Tests are NEVER optional.**
34
+
35
+ ```bash
36
+ npm test
37
+ # Expected: Exit 0, ALL tests pass
38
+ ```
39
+
40
+ | Test State | Action | Verification Complete? |
41
+ |------------|--------|------------------------|
42
+ | All tests pass | Proceed | YES |
43
+ | Any test fails | Fix ALL failures | NO |
44
+ | Tests not run | Run tests first | NO |
45
+ | "Tests not applicable" | INVALID - tests are ALWAYS applicable | NO |
46
+
47
+ **Why This Is Mandatory (CR-7):**
48
+ - "Tests are optional" escape hatch led to false "complete" claims
49
+ - Tests catch regressions other checks miss
50
+ - Production-grade means ALL tests pass
51
+
52
+ ---
53
+
54
+ ## ZERO-GAP AUDIT LOOP
55
+
56
+ **This command does NOT complete until a SINGLE COMPLETE AUDIT finds ZERO issues.**
57
+
58
+ ### The Rule
59
+
60
+ ```
61
+ AUDIT LOOP:
62
+ 1. Run ALL verification checks
63
+ 2. Count total gaps/issues found
64
+ 3. IF gaps > 0:
65
+ - Fix ALL gaps
66
+ - Re-run ENTIRE audit from Step 1
67
+ 4. IF gaps == 0:
68
+ - CERTIFIED COMPLETE
69
+ ```
70
+
71
+ ### Completion Requirement
72
+
73
+ | Scenario | Action |
74
+ |----------|--------|
75
+ | Audit finds 3 issues | Fix all 3, re-run ENTIRE audit |
76
+ | Re-audit finds 1 issue | Fix it, re-run ENTIRE audit |
77
+ | Re-audit finds 0 issues | **NOW** complete |
78
+
79
+ **Partial re-checks are NOT valid. The ENTIRE audit must pass in a SINGLE run.**
80
+
81
+ ---
82
+
83
+ ## DOMAIN-SPECIFIC PATTERN LOADING
84
+
85
+ Based on verification scope, load relevant pattern files:
86
+
87
+ | Domain | Pattern File | Load When |
88
+ |--------|--------------|-----------|
89
+ | Tool modules | `.claude/patterns/tool-patterns.md` | Verifying MCP tools |
90
+ | Config | `.claude/patterns/config-patterns.md` | Verifying config changes |
91
+ | Hooks | `.claude/patterns/hook-patterns.md` | Verifying hook changes |
92
+ | Build | `.claude/patterns/build-patterns.md` | Investigating failures |
93
+
94
+ ---
95
+
96
+ ## VR-* VERIFICATION PROTOCOLS
97
+
98
+ ### VR-FILE: File Existence Verification
99
+ ```bash
100
+ # For each file claimed to be created/modified:
101
+ ls -la [file_path]
102
+ # Expected: File listed with size > 0
103
+ # Failure: File not found or size 0
104
+ ```
105
+
106
+ ### VR-GREP: Code Presence Verification
107
+ ```bash
108
+ # For each code pattern claimed to be added:
109
+ grep -n "[pattern]" [file]
110
+ # Expected: Match with line number
111
+ # Failure: No matches found
112
+ ```
113
+
114
+ ### VR-NEGATIVE: Removal Verification (CRITICAL)
115
+ ```bash
116
+ # For each pattern claimed to be removed:
117
+ grep -rn "[removed_pattern]" packages/core/src/ | wc -l
118
+ # Expected: 0
119
+ # Failure: Any matches found
120
+ ```
121
+
122
+ ### VR-BUILD: Build Integrity Verification
123
+ ```bash
124
+ npm run build
125
+ # Expected: Exit 0
126
+ # Failure: Exit non-zero or errors
127
+ ```
128
+
129
+ ### VR-TYPE: Type Safety Verification
130
+ ```bash
131
+ cd packages/core && npx tsc --noEmit
132
+ # Expected: 0 errors
133
+ # Failure: Any type errors
134
+ ```
135
+
136
+ ### VR-COUNT: Instance Count Verification
137
+ ```bash
138
+ # For verifying all instances updated:
139
+ grep -c "[pattern]" [file]
140
+ # Expected: Exact count matching plan
141
+ ```
142
+
143
+ ### VR-CONFIG: Config-Code Alignment Verification (CRITICAL)
144
+
145
+ **Config existence does not equal correctness. A config key can exist with completely wrong values.**
146
+
147
+ ```bash
148
+ # VR-CONFIG-001: Parse and validate massu.config.yaml
149
+ node -e "const yaml = require('yaml'); const fs = require('fs'); yaml.parse(fs.readFileSync('massu.config.yaml', 'utf-8'));"
150
+
151
+ # VR-CONFIG-002: Extract ALL config keys used in code
152
+ grep -rn "getConfig()" packages/core/src/ | grep -oP 'config\.\w+' | sort -u
153
+
154
+ # VR-CONFIG-003: Verify config values match code expectations
155
+ grep -rn "toolPrefix\|config\." packages/core/src/ | head -20
156
+ ```
157
+
158
+ **VR-CONFIG Alignment Checklist:**
159
+ ```markdown
160
+ | Config Key | Code Expects | Match? | Status |
161
+ |------------|--------------|--------|--------|
162
+ | toolPrefix | string | YES/NO | PASS/FAIL |
163
+ | paths.source | valid path | YES/NO | PASS/FAIL |
164
+ ```
165
+
166
+ | When to Run VR-CONFIG | Situation |
167
+ |----------------------|-----------|
168
+ | ALWAYS | Feature uses config-driven values |
169
+ | ALWAYS | Bug fix for "tool not found" or "wrong prefix" |
170
+ | ALWAYS | After config changes |
171
+ | ALWAYS | Planning/auditing config-driven features |
172
+
173
+ ### VR-TOOL-REG: Tool Registration Verification (CRITICAL)
174
+ ```bash
175
+ # For EACH MCP tool claimed to be "implemented":
176
+
177
+ # 1. Verify tool module file exists
178
+ ls -la packages/core/src/[module].ts
179
+
180
+ # 2. Verify definitions are exported
181
+ grep "export.*getXToolDefinitions" packages/core/src/[module].ts
182
+
183
+ # 3. CRITICAL: Verify tool is REGISTERED in tools.ts
184
+ grep "getXToolDefinitions\|isXTool\|handleXToolCall" packages/core/src/tools.ts
185
+ # Expected: Match found for the tool module
186
+ # Failure: 0 matches = tool NOT callable (just created)
187
+ ```
188
+
189
+ **Why this matters**: Build/type checks pass when code compiles, but don't verify tools are REGISTERED. A tool module that exists but isn't wired into tools.ts is USELESS to users.
190
+
191
+ ### VR-INTEGRATION: Full Integration Verification
192
+ ```bash
193
+ # Tool is imported AND registered AND build passes
194
+ grep "[ModuleName]" packages/core/src/tools.ts && npm run build
195
+ # Expected: Both checks pass
196
+ ```
197
+
198
+ ### VR-HOOK-BUILD: Hook Compilation Verification
199
+ ```bash
200
+ cd packages/core && npm run build:hooks
201
+ # Expected: Exit 0
202
+ # Failure: Compilation error
203
+ ```
204
+
205
+ ### VR-REUSE: Component/Code Reuse Verification
206
+ ```bash
207
+ # BEFORE creating new module, search for existing:
208
+ grep -rn "[functionality]" packages/core/src/
209
+
210
+ # Expected: Use existing or document why new needed
211
+ ```
212
+
213
+ ### VR-STATES: State Completeness Verification
214
+ ```bash
215
+ # For tool handlers, verify all states:
216
+ # Success response
217
+ grep "content.*text" [file]
218
+
219
+ # Error handling
220
+ grep "try\|catch\|error" [file]
221
+
222
+ # Expected: All states handled
223
+ ```
224
+
225
+ ### VR-PROPS: Interface Chain Verification (CRITICAL)
226
+
227
+ **Trace EVERY interface/type through the module hierarchy to verify it reaches its destination.**
228
+
229
+ ```bash
230
+ # Step 1: Find where type is defined
231
+ grep "interface\|type.*=" [source_file]
232
+
233
+ # Step 2: Verify type is exported
234
+ grep "export.*TypeName" [source_file]
235
+
236
+ # Step 3: Verify type is imported where needed
237
+ grep "import.*TypeName" [consumer_file]
238
+
239
+ # Step 4: Verify type is used correctly
240
+ grep "TypeName" [consumer_file] | grep -v "import"
241
+ ```
242
+
243
+ ```markdown
244
+ ### VR-PROPS Chain Trace
245
+ | Type | Source | Consumer 1 | Consumer 2 | Used? | Status |
246
+ |------|--------|------------|------------|-------|--------|
247
+ | ToolResult | tools.ts | module.ts | handler | YES/NO | PASS/FAIL |
248
+ ```
249
+
250
+ ### VR-HANDLER: Tool Handler Verification (CRITICAL)
251
+
252
+ **For EVERY tool, verify the handler exists AND does something.**
253
+
254
+ ```bash
255
+ # Step 1: Find all tool definitions
256
+ grep -rn "name:.*_tool_" packages/core/src/
257
+
258
+ # Step 2: For each tool, find the handler
259
+ grep "case.*tool_name" packages/core/src/
260
+
261
+ # Step 3: Verify handler does something (not empty)
262
+ grep -A 10 "case.*tool_name" packages/core/src/ | grep "return"
263
+ ```
264
+
265
+ ```markdown
266
+ ### VR-HANDLER Verification
267
+ | Tool | Handler | Defined? | Does Something? | Status |
268
+ |------|---------|----------|-----------------|--------|
269
+ | tool_action | handleAction | YES | Returns result | PASS |
270
+ | tool_other | undefined | NO | N/A | FAIL |
271
+ ```
272
+
273
+ ### VR-ENV: Environment Variable Parity
274
+ ```bash
275
+ # Step 1: Find all env var usage
276
+ grep -rn "process.env\." packages/core/src/ | grep -oP 'process\.env\.\w+' | sort -u
277
+
278
+ # Step 2: Verify each env var is documented
279
+ ```
280
+
281
+ ### VR-DEFAULTS: Default Value Alignment
282
+
283
+ **Verify default values in code match default values in config.**
284
+
285
+ ```bash
286
+ # Find code defaults
287
+ grep -rn "default:" packages/core/src/
288
+ grep -rn "?? '" packages/core/src/ | grep -v node_modules
289
+ ```
290
+
291
+ ```markdown
292
+ ### VR-DEFAULTS Matrix
293
+ | Field | Config Default | Code Default | Match? | Status |
294
+ |-------|---------------|--------------|--------|--------|
295
+ | toolPrefix | 'massu' | 'massu' | YES | PASS |
296
+ ```
297
+
298
+ ### VR-PLAN-COVERAGE: Plan Item Coverage Verification (CRITICAL)
299
+ ```markdown
300
+ ## Plan Coverage Verification
301
+
302
+ ### Step 1: Extract Plan Items
303
+ Read the plan document and extract ALL deliverables:
304
+
305
+ | Item # | Type | Description | Expected Location | Verification | Status |
306
+ |--------|------|-------------|-------------------|--------------|--------|
307
+ | P-001 | FILE | module.ts | packages/core/src/ | ls -la | PENDING |
308
+ | P-002 | TOOL | tool_action | tools.ts | grep | PENDING |
309
+ | P-003 | REMOVAL | old_pattern | all files | grep = 0 | PENDING |
310
+
311
+ ### Step 2: Verify EACH Item
312
+ For each plan item, run appropriate VR-* check:
313
+ - FILE items: VR-FILE (ls -la)
314
+ - TOOL items: VR-GREP + VR-TOOL-REG
315
+ - MODULE items: VR-GREP
316
+ - REMOVAL items: VR-NEGATIVE
317
+ - CONFIG items: VR-CONFIG
318
+
319
+ ### Step 3: Calculate Coverage
320
+ Coverage = (Verified Items / Total Items) * 100
321
+
322
+ | Metric | Value |
323
+ |--------|-------|
324
+ | Total Plan Items | [N] |
325
+ | Verified | [X] |
326
+ | Coverage | [X/N]% |
327
+
328
+ ### Step 4: Gate Check
329
+ - Coverage 100%: PASS
330
+ - Coverage < 100%: FAIL (list missing items)
331
+ ```
332
+
333
+ **Why this matters**: Code quality verification proves code is CORRECT. Plan coverage verification proves code is COMPLETE. Both are required.
334
+
335
+ ---
336
+
337
+ ## PATTERN COMPLIANCE CHECKS
338
+
339
+ ### Mandatory Pattern Scanner
340
+ ```bash
341
+ bash scripts/massu-pattern-scanner.sh
342
+ # Exit 0 = PASS
343
+ # Non-zero = FAIL (show violations)
344
+ ```
345
+
346
+ ---
347
+
348
+ ## SECURITY VERIFICATION
349
+
350
+ ### No Secrets Staged
351
+ ```bash
352
+ git diff --cached --name-only | grep -E '\.(env|pem|key|secret)' && echo "FAIL: Secrets staged" || echo "PASS: No secrets staged"
353
+ ```
354
+
355
+ ### No Credentials in Code
356
+ ```bash
357
+ grep -rn "sk-\|password.*=.*['\"]" --include="*.ts" packages/core/src/ | grep -v "process.env" | wc -l
358
+ # Expected: 0
359
+ ```
360
+
361
+ ---
362
+
363
+ ## VERIFICATION REPORT FORMAT
364
+
365
+ ```markdown
366
+ ## MASSU VERIFY REPORT
367
+
368
+ ### Timestamp
369
+ [Date/Time]
370
+
371
+ ### Work Being Verified
372
+ [Description of work/changes]
373
+
374
+ ---
375
+
376
+ ## VR-FILE Verification
377
+ | File | Status | Proof |
378
+ |------|--------|-------|
379
+ | [path] | PASS/FAIL | [ls -la output] |
380
+
381
+ ---
382
+
383
+ ## VR-GREP Verification
384
+ | Pattern | File | Status | Proof |
385
+ |---------|------|--------|-------|
386
+ | [pattern] | [file] | PASS/FAIL | Line N: [match] |
387
+
388
+ ---
389
+
390
+ ## VR-NEGATIVE Verification
391
+ | Removed Pattern | Status | Count | Proof |
392
+ |-----------------|--------|-------|-------|
393
+ | [pattern] | PASS/FAIL | 0/N | [grep output] |
394
+
395
+ ---
396
+
397
+ ## VR-BUILD Verification
398
+ ```bash
399
+ npm run build
400
+ ```
401
+ **Status**: PASS/FAIL
402
+ **Output**: [build output summary]
403
+
404
+ ---
405
+
406
+ ## VR-TYPE Verification
407
+ ```bash
408
+ cd packages/core && npx tsc --noEmit
409
+ ```
410
+ **Status**: PASS/FAIL
411
+ **Errors**: 0/N
412
+
413
+ ---
414
+
415
+ ## VR-CONFIG Verification (Config Changes Only)
416
+
417
+ ### Config-Code Alignment Analysis
418
+ **Config File**: massu.config.yaml
419
+
420
+ #### Config Keys (Actual)
421
+ **Result**: `[list of keys found]`
422
+
423
+ #### Code Expected Keys
424
+ **Result**: `[list of keys code expects]`
425
+
426
+ #### Alignment Matrix
427
+ | Config Key | Code Expects | Match? | Status |
428
+ |------------|--------------|--------|--------|
429
+ | [key1] | [expected1] | YES/NO | PASS/FAIL |
430
+
431
+ **VR-CONFIG Status**: PASS (100% alignment) / FAIL (X mismatches)
432
+
433
+ ---
434
+
435
+ ## Pattern Compliance
436
+ | Check | Command | Result | Status |
437
+ |-------|---------|--------|--------|
438
+ | Pattern Scanner | bash scripts/massu-pattern-scanner.sh | Exit 0/N | PASS/FAIL |
439
+
440
+ ---
441
+
442
+ ## Security Checks
443
+ | Check | Status | Proof |
444
+ |-------|--------|-------|
445
+ | Secrets staged | PASS/FAIL | [output] |
446
+ | Credentials in code | PASS/FAIL | 0/N matches |
447
+
448
+ ---
449
+
450
+ ## SUMMARY
451
+
452
+ ### Pass/Fail Counts
453
+
454
+ **Code Quality Gate:**
455
+ - VR-FILE: X/X PASS
456
+ - VR-GREP: X/X PASS
457
+ - VR-NEGATIVE: X/X PASS
458
+ - VR-BUILD: PASS/FAIL
459
+ - VR-TYPE: PASS/FAIL
460
+ - VR-CONFIG: X/X PASS (config-code alignment verified)
461
+ - VR-TOOL-REG: X/X PASS (tools registered in tools.ts)
462
+ - Patterns: X/X PASS
463
+ - Security: X/X PASS
464
+
465
+ **Plan Coverage Gate:**
466
+ - Total Plan Items: [N]
467
+ - Verified: [X]
468
+ - Coverage: [X/N]% (MUST be 100%)
469
+ - Plan Coverage: PASS/FAIL
470
+
471
+ ### Overall Status
472
+ **DUAL VERIFICATION: PASSED / FAILED**
473
+
474
+ | Gate | Status |
475
+ |------|--------|
476
+ | Code Quality | PASS/FAIL |
477
+ | Plan Coverage | PASS/FAIL ([X]/[N] = [X]%) |
478
+
479
+ **BOTH gates must PASS for verification to be complete.**
480
+
481
+ ### Gaps Found (If Any)
482
+ | # | Type | Issue | Required Fix |
483
+ |---|------|-------|--------------|
484
+ | 1 | [type] | [description] | [fix needed] |
485
+ ```
486
+
487
+ ---
488
+
489
+ ## PARALLEL VERIFICATION WITH AGENTS
490
+
491
+ For faster verification, use **Task agents** to run independent checks simultaneously.
492
+
493
+ ### Agent-Based Parallel Verification (RECOMMENDED)
494
+
495
+ ```markdown
496
+ ### Launch Parallel Verification Agents (single message, all at once)
497
+ - Agent 1: "Run pattern scanner" -> bash scripts/massu-pattern-scanner.sh
498
+ - Agent 2: "Run TypeScript check" -> cd packages/core && npx tsc --noEmit
499
+ - Agent 3: "Run unit tests" -> npm test
500
+ - Agent 4: "Run hook build" -> cd packages/core && npm run build:hooks
501
+ ```
502
+
503
+ ### Benefits
504
+
505
+ | Approach | Time | Notes |
506
+ |----------|------|-------|
507
+ | Sequential | 5-10 min | Each check waits for previous |
508
+ | **Agent Parallel** | **2-4 min** | All checks run simultaneously |
509
+
510
+ ---
511
+
512
+ ## QUICK VERIFICATION (Minimal)
513
+
514
+ For quick checks without full report:
515
+
516
+ ```bash
517
+ # Run all critical checks
518
+ bash scripts/massu-pattern-scanner.sh && \
519
+ cd packages/core && npx tsc --noEmit && \
520
+ npm run build && \
521
+ echo "QUICK VERIFY: PASS"
522
+ ```
523
+
524
+ ---
525
+
526
+ ## SESSION STATE UPDATE
527
+
528
+ After verification, update `session-state/CURRENT.md`:
529
+
530
+ ```markdown
531
+ ## MASSU VERIFY SESSION
532
+
533
+ ### Verification Run
534
+ - **Date**: [timestamp]
535
+ - **Work Verified**: [description]
536
+ - **Result**: VERIFIED / FAILED
537
+
538
+ ### Verification Summary
539
+ | Category | Checks | Passed | Failed |
540
+ |----------|--------|--------|--------|
541
+ | VR-FILE | N | N | 0 |
542
+ | VR-GREP | N | N | 0 |
543
+ | VR-NEGATIVE | N | N | 0 |
544
+ | VR-BUILD | 1 | 1 | 0 |
545
+ | VR-TYPE | 1 | 1 | 0 |
546
+ | VR-CONFIG | N | N | 0 |
547
+ | Patterns | N | N | 0 |
548
+ | Security | N | N | 0 |
549
+
550
+ ### Gaps Found (If Any)
551
+ [List of issues requiring fixes]
552
+
553
+ ### Next Action
554
+ [What needs to happen next]
555
+ ```
556
+
557
+ ---
558
+
559
+ ## MANDATORY: PLAN DOCUMENT UPDATE (If Verifying Plan Work)
560
+
561
+ **If verification was for work from a plan document, the plan MUST be updated.**
562
+
563
+ ### Plan Document Update (Add to TOP of plan)
564
+
565
+ ```markdown
566
+ # IMPLEMENTATION STATUS
567
+
568
+ **Plan**: [Plan Name]
569
+ **Status**: VERIFIED COMPLETE / VERIFIED PARTIAL
570
+ **Last Updated**: [YYYY-MM-DD HH:MM]
571
+ **Verified By**: Claude Code (Massu Verify)
572
+
573
+ ## Verification Summary
574
+
575
+ | # | Task/Item | Status | VR-* Proof | Date |
576
+ |---|-----------|--------|------------|------|
577
+ | 1 | [Task] | VERIFIED | VR-BUILD: Pass | [date] |
578
+ | 2 | [Task] | VERIFIED | VR-GREP: Found | [date] |
579
+
580
+ ## Verification Evidence
581
+
582
+ ### All VR-* Checks
583
+ - VR-FILE: [N] files verified
584
+ - VR-GREP: [N] patterns found
585
+ - VR-BUILD: Exit 0
586
+ - VR-TYPE: 0 errors
587
+ - VR-CONFIG: Config-code alignment confirmed
588
+ - Pattern Scanner: Exit 0
589
+ ```
590
+
591
+ ### VR-PLAN-STATUS Verification
592
+
593
+ ```bash
594
+ grep "IMPLEMENTATION STATUS" [plan_file]
595
+ grep "VERIFIED\|COMPLETE" [plan_file]
596
+ # Expected: Matches found
597
+ ```
598
+
599
+ ---
600
+
601
+ ## VR-PLAN: VERIFICATION PLANNING STEP
602
+
603
+ **Before executing ANY verification checks, ENUMERATE all applicable VR-* checks first.**
604
+
605
+ Complete this enumeration before running any commands:
606
+
607
+ ```markdown
608
+ ### VR-PLAN: Verification Strategy
609
+
610
+ **Work being verified**: [description]
611
+ **Domains touched**: [tools / config / hooks / build / tests]
612
+
613
+ | # | VR-* Check | Target | Why Applicable | Status |
614
+ |---|------------|--------|----------------|--------|
615
+ | 1 | VR-BUILD | Full project | Always required | PENDING |
616
+ | 2 | VR-TYPE | Full project | Always required | PENDING |
617
+ | 3 | VR-TEST | Full project | Always required (CR-7) | PENDING |
618
+ | ... | ... | ... | ... | ... |
619
+
620
+ **Total checks planned**: [N]
621
+ ```
622
+
623
+ ### Always Include These
624
+
625
+ | Check | Condition |
626
+ |-------|-----------|
627
+ | VR-BUILD, VR-TYPE, VR-TEST | ALWAYS |
628
+ | VR-FILE, VR-GREP | Files created/modified |
629
+ | VR-NEGATIVE | Code removed |
630
+ | VR-CONFIG | Config changes |
631
+ | VR-TOOL-REG | New MCP tools |
632
+ | VR-HOOK-BUILD | Hook changes |
633
+ | VR-HANDLER | Tool handlers added |
634
+ | VR-PLAN-COVERAGE | Implementing a plan |
635
+
636
+ ---
637
+
638
+ ## AUTO-LEARNING PROTOCOL (MANDATORY after every fix/finding)
639
+
640
+ **After EVERY fix or finding, the system MUST automatically learn. This is NOT optional.**
641
+
642
+ ### Step 1: Record Correct vs Incorrect Pattern
643
+ Update session state with the WRONG vs CORRECT pattern discovered.
644
+
645
+ ### Step 2: Add to Pattern Scanner (if grep-able)
646
+ If the bad pattern is detectable by grep, add check to `scripts/massu-pattern-scanner.sh`.
647
+
648
+ ### Step 3: Search Codebase-Wide (CR-9)
649
+ `grep -rn "[bad_pattern]" packages/core/src/` - fix ALL instances of the same issue.
650
+
651
+ ---
652
+
653
+ ## START NOW
654
+
655
+ 1. Identify work to verify
656
+ 2. **Self-review**: Before running any automated checks, review your own changes and challenge your assumptions. Ask: "What did I assume about the schema, imports, or edge cases? What could break?" This catches cheap errors before the heavy machinery runs.
657
+ 3. **Run VR-PLAN: Enumerate ALL applicable VR-* checks with targets**
658
+ 4. Load relevant domain patterns
659
+ 5. Run pattern scanner first
660
+ 6. Execute all VR-* checks **from VR-PLAN enumeration** in dependency order
661
+ 7. Run security checks
662
+ 8. Produce verification report
663
+ 9. Update session state
664
+ 10. If ANY gaps: list fixes needed
665
+ 11. If ZERO gaps: report VERIFIED
666
+
667
+ **Remember: Show the actual command output, not summaries.**