@massu/core 0.4.2 → 0.6.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 (125) hide show
  1. package/README.md +40 -0
  2. package/agents/massu-architecture-reviewer.md +104 -0
  3. package/agents/massu-blast-radius-analyzer.md +84 -0
  4. package/agents/massu-competitive-scorer.md +126 -0
  5. package/agents/massu-help-sync.md +73 -0
  6. package/agents/massu-migration-writer.md +94 -0
  7. package/agents/massu-output-scorer.md +87 -0
  8. package/agents/massu-pattern-reviewer.md +84 -0
  9. package/agents/massu-plan-auditor.md +170 -0
  10. package/agents/massu-schema-sync-verifier.md +70 -0
  11. package/agents/massu-security-reviewer.md +98 -0
  12. package/agents/massu-ux-reviewer.md +106 -0
  13. package/commands/_shared-preamble.md +53 -23
  14. package/commands/_shared-references/auto-learning-protocol.md +71 -0
  15. package/commands/_shared-references/blast-radius-protocol.md +76 -0
  16. package/commands/_shared-references/security-pre-screen.md +64 -0
  17. package/commands/_shared-references/test-first-protocol.md +87 -0
  18. package/commands/_shared-references/verification-table.md +52 -0
  19. package/commands/massu-article-review.md +343 -0
  20. package/commands/massu-autoresearch/references/eval-runner.md +84 -0
  21. package/commands/massu-autoresearch/references/safety-rails.md +125 -0
  22. package/commands/massu-autoresearch/references/scoring-protocol.md +151 -0
  23. package/commands/massu-autoresearch.md +258 -0
  24. package/commands/massu-batch.md +44 -12
  25. package/commands/massu-bearings.md +42 -8
  26. package/commands/massu-checkpoint.md +588 -0
  27. package/commands/massu-ci-fix.md +2 -2
  28. package/commands/massu-command-health.md +132 -0
  29. package/commands/massu-command-improve.md +232 -0
  30. package/commands/massu-commit.md +205 -44
  31. package/commands/massu-create-plan.md +239 -57
  32. package/commands/massu-data/references/common-queries.md +79 -0
  33. package/commands/massu-data/references/table-guide.md +50 -0
  34. package/commands/massu-data.md +66 -0
  35. package/commands/massu-dead-code.md +29 -34
  36. package/commands/massu-debug/references/auto-learning.md +61 -0
  37. package/commands/massu-debug/references/codegraph-tracing.md +80 -0
  38. package/commands/massu-debug/references/common-shortcuts.md +98 -0
  39. package/commands/massu-debug/references/investigation-phases.md +294 -0
  40. package/commands/massu-debug/references/report-format.md +107 -0
  41. package/commands/massu-debug.md +105 -386
  42. package/commands/massu-docs.md +1 -1
  43. package/commands/massu-full-audit.md +61 -0
  44. package/commands/massu-gap-enhancement-analyzer.md +276 -16
  45. package/commands/massu-golden-path/references/approval-points.md +216 -0
  46. package/commands/massu-golden-path/references/competitive-mode.md +273 -0
  47. package/commands/massu-golden-path/references/error-handling.md +121 -0
  48. package/commands/massu-golden-path/references/phase-0-requirements.md +53 -0
  49. package/commands/massu-golden-path/references/phase-1-plan-creation.md +168 -0
  50. package/commands/massu-golden-path/references/phase-2-implementation.md +397 -0
  51. package/commands/massu-golden-path/references/phase-2.5-gap-analyzer.md +156 -0
  52. package/commands/massu-golden-path/references/phase-3-simplify.md +40 -0
  53. package/commands/massu-golden-path/references/phase-4-commit.md +94 -0
  54. package/commands/massu-golden-path/references/phase-5-push.md +116 -0
  55. package/commands/massu-golden-path/references/phase-5.5-production-verify.md +170 -0
  56. package/commands/massu-golden-path/references/phase-6-completion.md +113 -0
  57. package/commands/massu-golden-path/references/qa-evaluator-spec.md +137 -0
  58. package/commands/massu-golden-path/references/sprint-contract-protocol.md +117 -0
  59. package/commands/massu-golden-path/references/vr-visual-calibration.md +73 -0
  60. package/commands/massu-golden-path.md +114 -848
  61. package/commands/massu-guide.md +72 -69
  62. package/commands/massu-hooks.md +27 -12
  63. package/commands/massu-hotfix.md +221 -144
  64. package/commands/massu-incident.md +49 -20
  65. package/commands/massu-infra-audit.md +187 -0
  66. package/commands/massu-learning-audit.md +211 -0
  67. package/commands/massu-loop/references/auto-learning.md +49 -0
  68. package/commands/massu-loop/references/checkpoint-audit.md +40 -0
  69. package/commands/massu-loop/references/guardrails.md +17 -0
  70. package/commands/massu-loop/references/iteration-structure.md +115 -0
  71. package/commands/massu-loop/references/loop-controller.md +188 -0
  72. package/commands/massu-loop/references/plan-extraction.md +78 -0
  73. package/commands/massu-loop/references/vr-plan-spec.md +140 -0
  74. package/commands/massu-loop-playwright.md +9 -9
  75. package/commands/massu-loop.md +115 -670
  76. package/commands/massu-new-pattern.md +423 -0
  77. package/commands/massu-perf.md +422 -0
  78. package/commands/massu-plan-audit.md +1 -1
  79. package/commands/massu-plan.md +389 -122
  80. package/commands/massu-production-verify.md +433 -0
  81. package/commands/massu-push.md +62 -378
  82. package/commands/massu-recap.md +29 -3
  83. package/commands/massu-rollback.md +613 -0
  84. package/commands/massu-scaffold-hook.md +2 -4
  85. package/commands/massu-scaffold-page.md +2 -3
  86. package/commands/massu-scaffold-router.md +1 -2
  87. package/commands/massu-security.md +619 -0
  88. package/commands/massu-simplify.md +115 -85
  89. package/commands/massu-squirrels.md +2 -2
  90. package/commands/massu-tdd.md +38 -22
  91. package/commands/massu-test.md +3 -3
  92. package/commands/massu-type-mismatch-audit.md +469 -0
  93. package/commands/massu-ui-audit.md +587 -0
  94. package/commands/massu-verify-playwright.md +287 -32
  95. package/commands/massu-verify.md +150 -46
  96. package/dist/cli.js +1451 -1047
  97. package/dist/hooks/post-tool-use.js +75 -6
  98. package/dist/hooks/user-prompt.js +16 -0
  99. package/package.json +6 -2
  100. package/patterns/build-patterns.md +302 -0
  101. package/patterns/component-patterns.md +246 -0
  102. package/patterns/display-patterns.md +185 -0
  103. package/patterns/form-patterns.md +890 -0
  104. package/patterns/integration-testing-checklist.md +445 -0
  105. package/patterns/security-patterns.md +219 -0
  106. package/patterns/testing-patterns.md +569 -0
  107. package/patterns/tool-routing.md +81 -0
  108. package/patterns/ui-patterns.md +371 -0
  109. package/protocols/plan-implementation.md +267 -0
  110. package/protocols/recovery.md +225 -0
  111. package/protocols/verification.md +404 -0
  112. package/reference/command-taxonomy.md +178 -0
  113. package/reference/cr-rules-reference.md +76 -0
  114. package/reference/hook-execution-order.md +148 -0
  115. package/reference/lessons-learned.md +175 -0
  116. package/reference/patterns-quickref.md +208 -0
  117. package/reference/standards.md +135 -0
  118. package/reference/subagents-reference.md +17 -0
  119. package/reference/vr-verification-reference.md +867 -0
  120. package/src/commands/init.ts +27 -0
  121. package/src/commands/install-commands.ts +149 -53
  122. package/src/hooks/post-tool-use.ts +17 -0
  123. package/src/hooks/user-prompt.ts +21 -0
  124. package/src/memory-file-ingest.ts +127 -0
  125. package/src/memory-tools.ts +34 -1
@@ -0,0 +1,61 @@
1
+ name: massu-full-audit
2
+
3
+ # Massu Full Audit
4
+
5
+ Run the full 5-layer verification audit across the entire application.
6
+
7
+ ## Layers
8
+
9
+ | Layer | Script | What It Checks |
10
+ |-------|--------|----------------|
11
+ | 1 | `codebase-audit-full.sh` | 19-phase static analysis (schema drift, security, patterns, coupling, ESLint, TypeScript, dead code) |
12
+ | 2 | `audit-feature-flags.sh` | Feature flag DB vs code reconciliation (dead flags, phantom flags, disabled-but-checked) |
13
+ | 3 | `validate-features.sh` | Sentinel feature registry integrity (orphaned features, missing components) |
14
+ | 4 | `audit-integration-health.sh` | OAuth tokens, integration status, webhook health, cron config, event backlogs |
15
+ | 5 | `check-coupling.sh` + `check-unwired-services.sh` + `check-page-reachability.sh` | Backend-frontend wiring, service connectivity, page navigation reachability |
16
+
17
+ ## Usage
18
+
19
+ Run the orchestrator script:
20
+
21
+ ```bash
22
+ # Full audit (all 5 layers)
23
+ ./scripts/full-audit.sh
24
+
25
+ # Quick mode (skip Layer 1 static analysis, ~2min)
26
+ ./scripts/full-audit.sh --quick
27
+
28
+ # Static analysis only (Layer 1)
29
+ ./scripts/full-audit.sh --static-only
30
+
31
+ # Generate markdown report
32
+ ./scripts/full-audit.sh --report
33
+ ```
34
+
35
+ ## Instructions
36
+
37
+ 1. Run `./scripts/full-audit.sh --quick` first for a fast check
38
+ 2. Review the summary output — each layer shows PASS/FAIL/WARN/SKIP
39
+ 3. For any FAIL layers, check the detailed log at `/tmp/full-audit-layer-N.log`
40
+ 4. Fix issues found, then re-run the failing layer individually
41
+ 5. For a full audit including static analysis, run without flags (takes ~10min)
42
+ 6. Use `--report` to save a markdown report to the project docs directory
43
+
44
+ ## Exit Codes
45
+
46
+ - `0` — All layers pass
47
+ - `N` — Number of layers with failures
48
+
49
+ ## Individual Layer Scripts
50
+
51
+ Each layer can be run independently:
52
+
53
+ ```bash
54
+ ./scripts/codebase-audit-full.sh # Layer 1
55
+ ./scripts/audit-feature-flags.sh # Layer 2
56
+ ./scripts/validate-features.sh # Layer 3
57
+ ./scripts/audit-integration-health.sh # Layer 4
58
+ ./scripts/check-coupling.sh # Layer 5a
59
+ ./scripts/check-unwired-services.sh # Layer 5b
60
+ ./scripts/check-page-reachability.sh # Layer 5c
61
+ ```
@@ -1,11 +1,11 @@
1
1
  ---
2
2
  name: massu-gap-enhancement-analyzer
3
3
  description: "When user says 'analyze gaps', 'find enhancements', 'gap analysis', or has completed a massu-loop implementation and needs to identify remaining gaps and enhancement opportunities"
4
- allowed-tools: Bash(*), Read(*), Write(*), Grep(*), Glob(*)
4
+ allowed-tools: Bash(*), Read(*), Write(*), Grep(*), Glob(*), ToolSearch(mcp__supabase__*)
5
5
  ---
6
6
  name: massu-gap-enhancement-analyzer
7
7
 
8
- > **Shared rules apply.** Read `.claude/commands/_shared-preamble.md` before proceeding.
8
+ > **Shared rules apply.** Read `.claude/commands/_shared-preamble.md` before proceeding. CR-14, CR-5, CR-12 enforced.
9
9
 
10
10
  # Massu Gap & Enhancement Analyzer
11
11
 
@@ -100,6 +100,11 @@ SELECT grantee, privilege_type FROM information_schema.table_privileges
100
100
  WHERE table_name = '[TABLE]' AND grantee IN ('authenticated', 'service_role');
101
101
  ```
102
102
 
103
+ **Check ALL 3 environments:**
104
+ - DEV (gwqkbjymbarkufwvdmar)
105
+ - OLD PROD (hwaxogapihsqleyzpqtj)
106
+ - NEW PROD (cnfxxvrhhvjefyvpoqlq)
107
+
103
108
  ### Step 2.2: API/Router Verification
104
109
 
105
110
  For EACH procedure in the plan:
@@ -126,6 +131,9 @@ For EACH UI component in the plan:
126
131
  # Verify component file exists
127
132
  ls -la src/components/[path]/[ComponentName].tsx
128
133
 
134
+ # Verify component is exported
135
+ grep "export.*[ComponentName]" src/components/[path]/index.ts
136
+
129
137
  # CRITICAL: Verify component is RENDERED in a page
130
138
  grep -rn "<[ComponentName]" src/app/
131
139
 
@@ -133,7 +141,26 @@ grep -rn "<[ComponentName]" src/app/
133
141
  grep -n "import.*[ComponentName]" src/app/**/page.tsx
134
142
  ```
135
143
 
136
- ### Step 2.4: Backend-Frontend Coupling Verification (CRITICAL)
144
+ ### Step 2.4: Feature Verification
145
+
146
+ For EACH feature in the plan:
147
+
148
+ ```bash
149
+ # Feature-specific verification based on plan requirements
150
+ # This varies by feature type - document what was checked
151
+ ```
152
+
153
+ ### Step 2.5: Configuration Verification
154
+
155
+ ```bash
156
+ # Verify feature flags exist and are enabled
157
+ # Use MCP tools to query feature_flags table in all environments
158
+
159
+ # Verify environment variables are documented
160
+ grep -rn "process.env.[VAR_NAME]" src/
161
+ ```
162
+
163
+ ### Step 2.6: Backend-Frontend Coupling Verification (CRITICAL - Added Jan 2026)
137
164
 
138
165
  **MANDATORY**: Verify ALL backend features are exposed in frontend.
139
166
 
@@ -151,6 +178,8 @@ grep -n "import.*[ComponentName]" src/app/**/page.tsx
151
178
  | Input schema fields | Form has all fields | grep field names in form component |
152
179
  | Type definitions | Frontend types match | compare router types to component types |
153
180
 
181
+ **Why this matters**: Jan 2026 Incident - Backend had tier-based scraper types (browserless, persistent_browser, manual_assist, auto) but UI form only showed original 7 options. ALL other verifications passed. VR-COUPLING catches this class of gap.
182
+
154
183
  ```markdown
155
184
  ### Backend-Frontend Coupling Status
156
185
  | Backend Feature | Frontend Exposure | Status |
@@ -172,6 +201,22 @@ grep -n "import.*[ComponentName]" src/app/**/page.tsx
172
201
  | **MINOR** | Small missing piece, cosmetic issue | P2 |
173
202
  | **DEVIATION** | Implemented differently than planned (may be intentional) | P3 |
174
203
 
204
+ ### Gap Type: COUPLING (Added Jan 2026)
205
+
206
+ **Definition**: Backend has a feature (enum value, procedure, type) that frontend doesn't expose.
207
+
208
+ **Why P0 (Critical)**: Users cannot access the feature even though the code exists. This is a complete failure from the user's perspective.
209
+
210
+ **Examples**:
211
+ - Backend z.enum has value "auto" but UI SELECT doesn't show it
212
+ - Backend has procedure `analyze` but UI never calls it
213
+ - Backend input schema has field `maxRetries` but form doesn't include it
214
+
215
+ **How to detect**:
216
+ ```bash
217
+ ./scripts/check-coupling.sh
218
+ ```
219
+
175
220
  ### Gap Detection Methods
176
221
 
177
222
  #### 3.1: Plan-to-Implementation Gaps
@@ -202,18 +247,53 @@ find src/components/[feature]/ -name "*.tsx" | while read f; do
202
247
  name=$(basename "$f" .tsx)
203
248
  grep -rn "<$name" src/app/ || echo "ORPHAN: $name"
204
249
  done
250
+
251
+ # Database columns not used in routers
252
+ # Compare schema columns against router select/where clauses
253
+ ```
254
+
255
+ #### 3.3: User Flow Gaps
256
+
257
+ Trace complete user journeys:
258
+
259
+ ```markdown
260
+ ### USER FLOW ANALYSIS
261
+
262
+ | Flow | Entry Point | Steps | Completion | Gaps |
263
+ |------|-------------|-------|------------|------|
264
+ | [Flow name] | [route] | 1. Click X, 2. Enter Y | Complete/Broken | [gaps] |
205
265
  ```
206
266
 
207
- #### 3.3: Error Handling Gaps
267
+ #### 3.4: Error Handling Gaps
208
268
 
209
269
  ```bash
210
270
  # Check for try/catch in async operations
211
271
  grep -rn "async.*=>" src/server/api/routers/[feature]*.ts | grep -v "try" | head -20
212
272
 
273
+ # Check for toast.error on mutations
274
+ grep -rn "useMutation" src/components/[feature]/ | while read f; do
275
+ grep -L "toast.error\|onError" "$f"
276
+ done
277
+
213
278
  # Check for loading states
214
279
  grep -rn "useState.*loading\|isLoading\|isPending" src/components/[feature]/ | wc -l
215
280
  ```
216
281
 
282
+ #### 3.5: Test Coverage Gaps
283
+
284
+ ```bash
285
+ # Find files without corresponding tests
286
+ find src/server/api/routers/[feature]*.ts | while read f; do
287
+ test="${f%.ts}.test.ts"
288
+ [ ! -f "$test" ] && echo "NO TEST: $f"
289
+ done
290
+
291
+ find src/components/[feature]/ -name "*.tsx" | while read f; do
292
+ test="${f%.tsx}.test.tsx"
293
+ [ ! -f "$test" ] && echo "NO TEST: $f"
294
+ done
295
+ ```
296
+
217
297
  ---
218
298
 
219
299
  ## PHASE 4: ENHANCEMENT ANALYSIS
@@ -242,14 +322,31 @@ grep -rn "isLoading\|Skeleton\|Spinner" src/components/[feature]/
242
322
 
243
323
  # Success feedback - is it clear?
244
324
  grep -rn "toast.success" src/components/[feature]/
325
+
326
+ # Form validation - is it immediate?
327
+ grep -rn "FormField\|FormMessage\|error" src/components/[feature]/
245
328
  ```
246
329
 
330
+ **UX Enhancement Checklist:**
331
+ - [ ] Keyboard navigation supported?
332
+ - [ ] Focus management correct?
333
+ - [ ] Transitions smooth?
334
+ - [ ] Error messages helpful?
335
+ - [ ] Success states clear?
336
+ - [ ] Undo/recovery options?
337
+
247
338
  #### 4.2: Performance Enhancements
248
339
 
249
340
  ```bash
250
341
  # Large list rendering - virtualization needed?
251
342
  grep -rn "map.*=>" src/components/[feature]/ | grep -v "slice\|virtualized"
252
343
 
344
+ # Unnecessary re-renders - memo needed?
345
+ grep -rn "useMemo\|useCallback\|React.memo" src/components/[feature]/ | wc -l
346
+
347
+ # Heavy computations - should be cached?
348
+ grep -rn "filter\|reduce\|sort" src/components/[feature]/ | grep -v "useMemo"
349
+
253
350
  # API calls - batching opportunity?
254
351
  grep -rn "useQuery\|useMutation" src/components/[feature]/ | wc -l
255
352
  ```
@@ -259,9 +356,26 @@ grep -rn "useQuery\|useMutation" src/components/[feature]/ | wc -l
259
356
  ```bash
260
357
  # Input sanitization
261
358
  grep -rn "z\.string()" src/server/api/routers/[feature]*.ts | grep -v "min\|max\|regex"
359
+
360
+ # Rate limiting considerations
361
+ grep -rn "rateLimit\|throttle" src/server/api/routers/[feature]*.ts
362
+
363
+ # Audit logging
364
+ grep -rn "log\.\|console\." src/server/api/routers/[feature]*.ts | grep -v "error"
262
365
  ```
263
366
 
264
- #### 4.4: Accessibility Enhancements
367
+ #### 4.4: Functionality Enhancements
368
+
369
+ Review the feature for natural extensions:
370
+ - Bulk operations where only single exists
371
+ - Export/import capabilities
372
+ - Filtering/sorting options
373
+ - Search functionality
374
+ - Pagination improvements
375
+ - Notification/alert options
376
+ - Integration opportunities
377
+
378
+ #### 4.5: Accessibility Enhancements
265
379
 
266
380
  ```bash
267
381
  # ARIA attributes
@@ -269,6 +383,12 @@ grep -rn "aria-\|role=" src/components/[feature]/
269
383
 
270
384
  # Alt text
271
385
  grep -rn "<img\|<Image" src/components/[feature]/ | grep -v "alt="
386
+
387
+ # Focus indicators
388
+ grep -rn "focus:\|:focus" src/components/[feature]/
389
+
390
+ # Color contrast (manual check needed)
391
+ grep -rn "text-\|bg-" src/components/[feature]/ | head -20
272
392
  ```
273
393
 
274
394
  ---
@@ -303,6 +423,7 @@ grep -rn "<img\|<Image" src/components/[feature]/ | grep -v "alt="
303
423
  |-------|-------|----------|------|----------|
304
424
  | Phase 1 | [N] | [X] | [G] | [%]% |
305
425
  | Phase 2 | [N] | [X] | [G] | [%]% |
426
+ | ... | ... | ... | ... | ... |
306
427
  | **TOTAL** | [N] | [X] | [G] | [%]% |
307
428
 
308
429
  ---
@@ -319,11 +440,19 @@ grep -rn "<img\|<Image" src/components/[feature]/ | grep -v "alt="
319
440
 
320
441
  | ID | Gap Description | Expected | Actual | Impact | Remediation |
321
442
  |----|-----------------|----------|--------|--------|-------------|
443
+ | G-002 | [description] | [expected] | [actual] | [impact] | [fix steps] |
322
444
 
323
445
  ### Minor Gaps (P2) - Nice to Fix
324
446
 
325
447
  | ID | Gap Description | Expected | Actual | Impact | Remediation |
326
448
  |----|-----------------|----------|--------|--------|-------------|
449
+ | G-003 | [description] | [expected] | [actual] | [impact] | [fix steps] |
450
+
451
+ ### Deviations (P3) - Review Needed
452
+
453
+ | ID | Deviation | Plan Specified | Implemented As | Reason (if known) |
454
+ |----|-----------|----------------|----------------|-------------------|
455
+ | D-001 | [description] | [plan] | [actual] | [reason] |
327
456
 
328
457
  ---
329
458
 
@@ -335,6 +464,40 @@ grep -rn "<img\|<Image" src/components/[feature]/ | grep -v "alt="
335
464
  |----|-------------|----------|--------|--------|----------|
336
465
  | E-001 | [description] | UX/Perf/Sec | High/Med/Low | High/Med/Low | [1-5] |
337
466
 
467
+ **Detailed Recommendations:**
468
+
469
+ #### E-001: [Enhancement Title]
470
+
471
+ **Current State**: [what exists now]
472
+
473
+ **Proposed Enhancement**: [what should be added/changed]
474
+
475
+ **Benefits**:
476
+ - [benefit 1]
477
+ - [benefit 2]
478
+
479
+ **Implementation Notes**:
480
+ - [note 1]
481
+ - [note 2]
482
+
483
+ **Estimated Scope**: [small/medium/large]
484
+
485
+ ---
486
+
487
+ ### Medium-Impact Enhancements (Consider)
488
+
489
+ | ID | Enhancement | Category | Impact | Effort | Priority |
490
+ |----|-------------|----------|--------|--------|----------|
491
+ | E-002 | [description] | [category] | Medium | [effort] | [priority] |
492
+
493
+ ---
494
+
495
+ ### Low-Impact Enhancements (Backlog)
496
+
497
+ | ID | Enhancement | Category | Notes |
498
+ |----|-------------|----------|-------|
499
+ | E-003 | [description] | [category] | [notes] |
500
+
338
501
  ---
339
502
 
340
503
  ## Section 4: Technical Debt Identified
@@ -350,14 +513,38 @@ grep -rn "<img\|<Image" src/components/[feature]/ | grep -v "alt="
350
513
  ### Immediate Actions (Gaps)
351
514
 
352
515
  - [ ] G-001: [fix description]
516
+ - [ ] G-002: [fix description]
353
517
 
354
518
  ### Recommended Enhancements
355
519
 
356
520
  - [ ] E-001: [enhancement description]
521
+ - [ ] E-002: [enhancement description]
357
522
 
358
523
  ### Technical Debt Items
359
524
 
360
525
  - [ ] TD-001: [debt resolution]
526
+
527
+ ---
528
+
529
+ ## Appendix: Verification Evidence
530
+
531
+ ### Database Verification
532
+
533
+ | Table | DEV | OLD PROD | NEW PROD | Status |
534
+ |-------|-----|----------|----------|--------|
535
+ | [table] | [result] | [result] | [result] | PASS/FAIL |
536
+
537
+ ### API Verification
538
+
539
+ | Procedure | File | Line | Protected | Status |
540
+ |-----------|------|------|-----------|--------|
541
+ | [proc] | [file] | [line] | YES/NO | PASS/FAIL |
542
+
543
+ ### Component Verification
544
+
545
+ | Component | File Exists | Exported | Rendered | Status |
546
+ |-----------|-------------|----------|----------|--------|
547
+ | [comp] | YES/NO | YES/NO | YES/NO | PASS/FAIL |
361
548
  ```
362
549
 
363
550
  ---
@@ -375,7 +562,7 @@ START
375
562
  |
376
563
  v
377
564
  [PHASE 2: Implementation Verification]
378
- - Database verification
565
+ - Database verification (all 3 envs)
379
566
  - API/Router verification
380
567
  - Component verification
381
568
  - Feature verification
@@ -385,13 +572,16 @@ START
385
572
  [PHASE 3: Gap Analysis]
386
573
  - Plan-to-implementation gaps
387
574
  - Cross-reference gaps
575
+ - User flow gaps
388
576
  - Error handling gaps
577
+ - Test coverage gaps
389
578
  |
390
579
  v
391
580
  [PHASE 4: Enhancement Analysis]
392
581
  - UX enhancements
393
582
  - Performance enhancements
394
583
  - Security enhancements
584
+ - Functionality enhancements
395
585
  - Accessibility enhancements
396
586
  |
397
587
  v
@@ -403,7 +593,9 @@ START
403
593
  |
404
594
  v
405
595
  [PHASE 6: Report Saving]
406
- - Save report to .claude/reports/gap-analysis/
596
+ - Create reports directory
597
+ - Save report to project docs reports/gap-analysis/
598
+ - Update INDEX.md
407
599
  - Verify file saved
408
600
  |
409
601
  v
@@ -427,10 +619,12 @@ The final output MUST include:
427
619
 
428
620
  ## PHASE 6: REPORT SAVING (MANDATORY)
429
621
 
622
+ **The report MUST be saved to the file system for future reference.**
623
+
430
624
  ### Report Storage Location
431
625
 
432
626
  ```
433
- .claude/reports/gap-analysis/
627
+ reports/gap-analysis/
434
628
  ```
435
629
 
436
630
  ### Report Naming Convention
@@ -439,24 +633,87 @@ The final output MUST include:
439
633
  [YYYY-MM-DD]-[plan-name-slug]-gap-analysis.md
440
634
  ```
441
635
 
636
+ **Example**: `2026-01-23-development-intelligence-lead-qualification-gap-analysis.md`
637
+
442
638
  ### Step 6.1: Create Reports Directory (if needed)
443
639
 
444
640
  ```bash
445
- mkdir -p .claude/reports/gap-analysis
641
+ mkdir -p reports/gap-analysis
446
642
  ```
447
643
 
448
- ### Step 6.2: Save the Complete Report
644
+ ### Step 6.2: Generate Report Filename
645
+
646
+ Extract plan name from the plan file path and create slug:
647
+
648
+ ```bash
649
+ # Example: /path/to/2026-01-22-development-intelligence-lead-qualification-system.md
650
+ # Becomes: development-intelligence-lead-qualification-system
651
+
652
+ PLAN_NAME=$(basename "[PLAN_FILE_PATH]" .md | sed 's/^[0-9-]*//')
653
+ DATE=$(date +%Y-%m-%d)
654
+ REPORT_FILE="reports/gap-analysis/${DATE}-${PLAN_NAME}-gap-analysis.md"
655
+ ```
449
656
 
450
- Write the full report (from Phase 5) to the report file.
657
+ ### Step 6.3: Save the Complete Report
451
658
 
452
- ### Step 6.3: Verification
659
+ Write the full report (from Phase 5) to the report file:
660
+
661
+ ```bash
662
+ # Use the Write tool to save the complete report to:
663
+ # reports/gap-analysis/[DATE]-[plan-name]-gap-analysis.md
664
+ ```
665
+
666
+ ### Step 6.4: Create/Update Reports Index
667
+
668
+ Maintain an index file at `reports/gap-analysis/INDEX.md`:
669
+
670
+ ```markdown
671
+ # Gap & Enhancement Analysis Reports
672
+
673
+ | Date | Plan | Gaps | Enhancements | Coverage | Report |
674
+ |------|------|------|--------------|----------|--------|
675
+ | 2026-01-23 | [Plan Name] | [G] | [E] | [%]% | [link to report] |
676
+ ```
677
+
678
+ ### Step 6.5: Verification
453
679
 
454
680
  ```bash
455
681
  # Verify report was saved
456
- ls -la .claude/reports/gap-analysis/[REPORT_FILE]
682
+ ls -la reports/gap-analysis/[REPORT_FILE]
457
683
 
458
684
  # Verify report has content
459
- wc -l .claude/reports/gap-analysis/[REPORT_FILE]
685
+ wc -l reports/gap-analysis/[REPORT_FILE]
686
+ ```
687
+
688
+ ### Report Header (Include in Saved File)
689
+
690
+ The saved report MUST include this metadata header:
691
+
692
+ ```markdown
693
+ ---
694
+ title: Gap & Enhancement Analysis Report
695
+ plan: [PLAN_FILE_PATH]
696
+ plan_name: [Plan Title]
697
+ analyzed_date: [YYYY-MM-DD HH:MM]
698
+ analyzer: Claude Code (massu-gap-enhancement-analyzer)
699
+ ---
700
+ ```
701
+
702
+ ### Report Footer (Include in Saved File)
703
+
704
+ ```markdown
705
+ ---
706
+
707
+ ## Report Metadata
708
+
709
+ - **Generated**: [YYYY-MM-DD HH:MM]
710
+ - **Plan File**: [PLAN_FILE_PATH]
711
+ - **Report Location**: reports/gap-analysis/[REPORT_FILE]
712
+ - **Analyzer**: massu-gap-enhancement-analyzer v1.0
713
+
714
+ ---
715
+
716
+ *This report was generated by Claude Code using the massu-gap-enhancement-analyzer command.*
460
717
  ```
461
718
 
462
719
  ---
@@ -466,6 +723,8 @@ wc -l .claude/reports/gap-analysis/[REPORT_FILE]
466
723
  - This command is READ-ONLY - it does NOT make changes
467
724
  - All findings are recommendations - user decides what to act on
468
725
  - Enhancements are optional - focus on gaps first
726
+ - Cross-reference findings with CLAUDE.md patterns
727
+ - Use VR-* verification protocols for all checks
469
728
  - Document evidence for every finding
470
729
 
471
730
  ---
@@ -476,5 +735,6 @@ wc -l .claude/reports/gap-analysis/[REPORT_FILE]
476
735
  2. Read the complete plan document
477
736
  3. Execute Phase 1-5 in order
478
737
  4. Generate comprehensive report
479
- 5. Save report to `.claude/reports/gap-analysis/`
480
- 6. Present findings to user with report location
738
+ 5. **Save report to `reports/gap-analysis/[DATE]-[plan-name]-gap-analysis.md`**
739
+ 6. **Update INDEX.md with report entry**
740
+ 7. Present findings to user with report location