@massu/core 0.6.1 → 0.6.2

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 (28) hide show
  1. package/commands/_shared-preamble.md +14 -0
  2. package/commands/_shared-references/verification-table.md +0 -3
  3. package/commands/massu-ci-fix.md +2 -2
  4. package/commands/massu-gap-enhancement-analyzer.md +85 -345
  5. package/commands/massu-golden-path/references/approval-points.md +9 -12
  6. package/commands/massu-golden-path/references/competitive-mode.md +9 -7
  7. package/commands/massu-golden-path/references/error-handling.md +4 -2
  8. package/commands/massu-golden-path/references/phase-0-requirements.md +3 -3
  9. package/commands/massu-golden-path/references/phase-1-plan-creation.md +41 -52
  10. package/commands/massu-golden-path/references/phase-2-implementation.md +50 -157
  11. package/commands/massu-golden-path/references/phase-2.5-gap-analyzer.md +14 -48
  12. package/commands/massu-golden-path/references/phase-3-simplify.md +5 -5
  13. package/commands/massu-golden-path/references/phase-4-commit.md +20 -46
  14. package/commands/massu-golden-path/references/phase-5-push.md +14 -47
  15. package/commands/massu-golden-path/references/phase-6-completion.md +8 -58
  16. package/commands/massu-golden-path.md +27 -43
  17. package/commands/massu-loop/references/checkpoint-audit.md +14 -18
  18. package/commands/massu-loop/references/guardrails.md +3 -3
  19. package/commands/massu-loop/references/iteration-structure.md +46 -14
  20. package/commands/massu-loop/references/loop-controller.md +72 -63
  21. package/commands/massu-loop/references/plan-extraction.md +19 -11
  22. package/commands/massu-loop/references/vr-plan-spec.md +20 -28
  23. package/commands/massu-loop.md +36 -56
  24. package/commands/massu-review.md +2 -2
  25. package/dist/cli.js +0 -0
  26. package/package.json +1 -1
  27. package/README.md +0 -40
  28. package/commands/massu-golden-path/references/phase-3.5-security-audit.md +0 -108
@@ -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(*), ToolSearch(mcp__supabase__*)
4
+ allowed-tools: Bash(*), Read(*), Write(*), Grep(*), Glob(*)
5
5
  ---
6
6
  name: massu-gap-enhancement-analyzer
7
7
 
8
- > **Shared rules apply.** Read `.claude/commands/_shared-preamble.md` before proceeding. CR-14, CR-5, CR-12 enforced.
8
+ > **Shared rules apply.** Read `.claude/commands/_shared-preamble.md` before proceeding.
9
9
 
10
10
  # Massu Gap & Enhancement Analyzer
11
11
 
@@ -15,7 +15,7 @@ Perform a comprehensive post-implementation review of a plan executed through ma
15
15
  1. **Gaps**: Missing functionality, incomplete implementations, untested paths, or deviations from plan
16
16
  2. **Enhancements**: Opportunities to improve UX, performance, security, or functionality beyond the original scope
17
17
 
18
- This is a READ-ONLY analysis tool. It does NOT make changes - it produces a detailed report for user review.
18
+ This tool produces a detailed analysis report. ALL gaps and enhancements identified MUST be fixed/implemented no severity is exempt (CR-45).
19
19
 
20
20
  ---
21
21
 
@@ -52,8 +52,8 @@ cat [PLAN_FILE_PATH]
52
52
 
53
53
  | Category | What to Extract |
54
54
  |----------|-----------------|
55
- | **Database** | Tables, columns, migrations, RLS policies, grants |
56
- | **API/Routers** | Procedures, inputs, outputs, mutations, queries |
55
+ | **Database** | Tables, columns, migrations, policies, grants (if applicable) |
56
+ | **API/Backend** | Endpoints, procedures, inputs, outputs, mutations, queries |
57
57
  | **Components** | UI components, their locations, dependencies |
58
58
  | **Pages** | Routes, page files, layouts |
59
59
  | **Features** | User-facing functionality, workflows, integrations |
@@ -69,58 +69,50 @@ cat [PLAN_FILE_PATH]
69
69
  | ID | Category | Item Description | Expected Location | Status |
70
70
  |----|----------|------------------|-------------------|--------|
71
71
  | P-001 | DB | [table_name] table | migration file | PENDING |
72
- | P-002 | API | [procedure_name] procedure | routers/[file].ts | PENDING |
73
- | P-003 | UI | [ComponentName] component | components/[path]/ | PENDING |
74
- | P-004 | Feature | [Feature description] | [location] | PENDING |
72
+ | P-002 | API | [endpoint_name] endpoint | [path from plan] | PENDING |
73
+ | P-003 | UI | [ComponentName] component | [path from plan] | PENDING |
74
+ | P-004 | Feature | [Feature description] | [path from plan] | PENDING |
75
75
  ```
76
76
 
77
77
  ---
78
78
 
79
79
  ## PHASE 2: IMPLEMENTATION VERIFICATION
80
80
 
81
+ > **IMPORTANT**: Derive all file paths from the plan document. Do NOT assume any specific framework directory structure. The plan specifies where files should live — use those paths for all verification commands below.
82
+
81
83
  ### Step 2.1: Database Verification
82
84
 
83
- For EACH database item in the plan:
85
+ > **Skip this section if the plan does not include database changes.**
84
86
 
85
- ```sql
86
- -- Verify table exists
87
- SELECT tablename FROM pg_tables WHERE schemaname = 'public' AND tablename = '[TABLE]';
87
+ For EACH database item in the plan, use the project's database CLI or query tool to verify:
88
88
 
89
- -- Verify columns match plan
90
- SELECT column_name, data_type, is_nullable
91
- FROM information_schema.columns
92
- WHERE table_name = '[TABLE]'
93
- ORDER BY ordinal_position;
89
+ - Table exists with expected name
90
+ - Columns match plan (names, types, nullability)
91
+ - Access policies exist (RLS, grants, permissions — whatever the project uses)
92
+ - Indexes or constraints mentioned in the plan are present
94
93
 
95
- -- Verify RLS policies
96
- SELECT polname, polcmd FROM pg_policies WHERE tablename = '[TABLE]';
94
+ ```bash
95
+ # Example: check migration files exist
96
+ ls -la [MIGRATION_PATH_FROM_PLAN]
97
97
 
98
- -- Verify grants
99
- SELECT grantee, privilege_type FROM information_schema.table_privileges
100
- WHERE table_name = '[TABLE]' AND grantee IN ('authenticated', 'service_role');
98
+ # Example: grep migration content for expected table/column names
99
+ grep -n "[TABLE_NAME]" [MIGRATION_FILE]
100
+ grep -n "[COLUMN_NAME]" [MIGRATION_FILE]
101
101
  ```
102
102
 
103
- **Check ALL 3 environments:**
104
- - DEV (gwqkbjymbarkufwvdmar)
105
- - OLD PROD (hwaxogapihsqleyzpqtj)
106
- - NEW PROD (cnfxxvrhhvjefyvpoqlq)
103
+ ### Step 2.2: API/Backend Verification
107
104
 
108
- ### Step 2.2: API/Router Verification
109
-
110
- For EACH procedure in the plan:
105
+ For EACH endpoint or procedure in the plan:
111
106
 
112
107
  ```bash
113
- # Verify procedure exists
114
- grep -n "[procedure_name]:" src/server/api/routers/[router].ts
115
-
116
- # Verify uses correct procedure type
117
- grep -B 2 "[procedure_name]:" src/server/api/routers/[router].ts | grep "protectedProcedure\|publicProcedure"
108
+ # Verify endpoint/procedure exists at the path specified in the plan
109
+ grep -n "[endpoint_name]" [BACKEND_FILE_FROM_PLAN]
118
110
 
119
- # Verify input schema
120
- grep -A 20 "[procedure_name]:" src/server/api/routers/[router].ts | grep -A 10 "input:"
111
+ # Verify input validation/schema
112
+ grep -A 20 "[endpoint_name]" [BACKEND_FILE_FROM_PLAN] | grep -A 10 "input\|schema\|validate"
121
113
 
122
- # Verify router is exported in root
123
- grep "[router]" src/server/api/root.ts
114
+ # Verify the backend module is registered/exported in the project's routing layer
115
+ grep "[module_name]" [ROUTER_OR_ENTRY_FILE_FROM_PLAN]
124
116
  ```
125
117
 
126
118
  ### Step 2.3: Component Verification
@@ -128,57 +120,36 @@ grep "[router]" src/server/api/root.ts
128
120
  For EACH UI component in the plan:
129
121
 
130
122
  ```bash
131
- # Verify component file exists
132
- ls -la src/components/[path]/[ComponentName].tsx
133
-
134
- # Verify component is exported
135
- grep "export.*[ComponentName]" src/components/[path]/index.ts
123
+ # Verify component file exists at the path specified in the plan
124
+ ls -la [COMPONENT_PATH_FROM_PLAN]
136
125
 
137
126
  # CRITICAL: Verify component is RENDERED in a page
138
- grep -rn "<[ComponentName]" src/app/
127
+ grep -rn "[ComponentName]" [PAGES_DIR_FROM_PLAN]
139
128
 
140
129
  # Verify component imports are correct
141
- grep -n "import.*[ComponentName]" src/app/**/page.tsx
142
- ```
143
-
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/
130
+ grep -rn "import.*[ComponentName]" [PAGES_DIR_FROM_PLAN]
161
131
  ```
162
132
 
163
- ### Step 2.6: Backend-Frontend Coupling Verification (CRITICAL - Added Jan 2026)
133
+ ### Step 2.4: Backend-Frontend Coupling Verification (CRITICAL)
164
134
 
165
135
  **MANDATORY**: Verify ALL backend features are exposed in frontend.
166
136
 
137
+ Use grep to check that every backend endpoint/procedure is called from at least one frontend file:
138
+
167
139
  ```bash
168
- # Run automated coupling check
169
- ./scripts/check-coupling.sh
140
+ # For each backend endpoint, verify frontend usage
141
+ grep -rn "[endpoint_or_procedure_name]" [FRONTEND_DIR_FROM_PLAN]
142
+ # If 0 results, the backend feature is unreachable from the UI
170
143
  ```
171
144
 
172
145
  **Manual verification for plan-specific items:**
173
146
 
174
147
  | Backend Item | Frontend Requirement | Verification |
175
148
  |--------------|---------------------|--------------|
176
- | z.enum values in router | SELECT options in form | grep values in constants.ts |
177
- | New API procedure | UI component calls it | grep api.[router].[proc] in components |
149
+ | Enum/constant values in backend | SELECT options in form | grep values in constants/config files |
150
+ | New API endpoint | UI component calls it | grep endpoint name in frontend files |
178
151
  | Input schema fields | Form has all fields | grep field names in form component |
179
- | Type definitions | Frontend types match | compare router types to component types |
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.
152
+ | Type definitions | Frontend types match | compare backend types to component types |
182
153
 
183
154
  ```markdown
184
155
  ### Backend-Frontend Coupling Status
@@ -201,22 +172,6 @@ grep -rn "process.env.[VAR_NAME]" src/
201
172
  | **MINOR** | Small missing piece, cosmetic issue | P2 |
202
173
  | **DEVIATION** | Implemented differently than planned (may be intentional) | P3 |
203
174
 
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
-
220
175
  ### Gap Detection Methods
221
176
 
222
177
  #### 3.1: Plan-to-Implementation Gaps
@@ -229,7 +184,7 @@ Compare plan items against actual implementation:
229
184
  | Plan Item | Expected | Actual | Gap Type | Severity |
230
185
  |-----------|----------|--------|----------|----------|
231
186
  | P-001 | Table X with columns A,B,C | Only A,B exist | MISSING_COLUMN | MAJOR |
232
- | P-002 | Procedure Y | Not found | MISSING_PROCEDURE | CRITICAL |
187
+ | P-002 | Endpoint Y | Not found | MISSING_ENDPOINT | CRITICAL |
233
188
  | P-003 | Component Z | File exists but not rendered | NOT_RENDERED | CRITICAL |
234
189
  ```
235
190
 
@@ -238,60 +193,25 @@ Compare plan items against actual implementation:
238
193
  Check for inconsistencies between layers:
239
194
 
240
195
  ```bash
241
- # API procedures without UI consumers
242
- grep -rn "api\.[router]\.[procedure]" src/components/ src/app/ | wc -l
243
- # If 0, procedure may be unused
244
-
245
- # Components without page integration
246
- find src/components/[feature]/ -name "*.tsx" | while read f; do
247
- name=$(basename "$f" .tsx)
248
- grep -rn "<$name" src/app/ || echo "ORPHAN: $name"
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] |
265
- ```
266
-
267
- #### 3.4: Error Handling Gaps
268
-
269
- ```bash
270
- # Check for try/catch in async operations
271
- grep -rn "async.*=>" src/server/api/routers/[feature]*.ts | grep -v "try" | head -20
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"
196
+ # Backend endpoints without UI consumers (use paths from plan)
197
+ grep -rn "[endpoint_name]" [FRONTEND_DIR_FROM_PLAN] | wc -l
198
+ # If 0, endpoint may be unused
199
+
200
+ # Components without page integration (use paths from plan)
201
+ find [COMPONENTS_DIR_FROM_PLAN] -name "*.tsx" -o -name "*.jsx" -o -name "*.vue" | while read f; do
202
+ name=$(basename "$f" | sed 's/\.[^.]*$//')
203
+ grep -rn "$name" [PAGES_DIR_FROM_PLAN] || echo "ORPHAN: $name"
276
204
  done
277
-
278
- # Check for loading states
279
- grep -rn "useState.*loading\|isLoading\|isPending" src/components/[feature]/ | wc -l
280
205
  ```
281
206
 
282
- #### 3.5: Test Coverage Gaps
207
+ #### 3.3: Error Handling Gaps
283
208
 
284
209
  ```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
210
+ # Check for try/catch in async operations (use paths from plan)
211
+ grep -rn "async" [BACKEND_FILES_FROM_PLAN] | grep -v "try" | head -20
290
212
 
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
213
+ # Check for loading states (use paths from plan)
214
+ grep -rn "loading\|isLoading\|isPending" [FRONTEND_FILES_FROM_PLAN] | wc -l
295
215
  ```
296
216
 
297
217
  ---
@@ -314,81 +234,41 @@ done
314
234
  #### 4.1: UX Enhancements
315
235
 
316
236
  ```bash
317
- # Empty states - are they helpful?
318
- grep -rn "length === 0\|EmptyState" src/components/[feature]/
237
+ # Empty states - are they helpful? (use paths from plan)
238
+ grep -rn "length === 0\|EmptyState\|empty" [FRONTEND_FILES_FROM_PLAN]
319
239
 
320
240
  # Loading states - are they smooth?
321
- grep -rn "isLoading\|Skeleton\|Spinner" src/components/[feature]/
241
+ grep -rn "isLoading\|Skeleton\|Spinner\|loading" [FRONTEND_FILES_FROM_PLAN]
322
242
 
323
243
  # Success feedback - is it clear?
324
- grep -rn "toast.success" src/components/[feature]/
325
-
326
- # Form validation - is it immediate?
327
- grep -rn "FormField\|FormMessage\|error" src/components/[feature]/
244
+ grep -rn "toast\|notification\|alert\|success" [FRONTEND_FILES_FROM_PLAN]
328
245
  ```
329
246
 
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
-
338
247
  #### 4.2: Performance Enhancements
339
248
 
340
249
  ```bash
341
- # Large list rendering - virtualization needed?
342
- grep -rn "map.*=>" src/components/[feature]/ | grep -v "slice\|virtualized"
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"
250
+ # Large list rendering - virtualization needed? (use paths from plan)
251
+ grep -rn "\.map(" [FRONTEND_FILES_FROM_PLAN] | grep -v "slice\|virtualized\|paginate"
349
252
 
350
253
  # API calls - batching opportunity?
351
- grep -rn "useQuery\|useMutation" src/components/[feature]/ | wc -l
254
+ grep -rn "fetch\|useQuery\|useMutation\|axios\|request" [FRONTEND_FILES_FROM_PLAN] | wc -l
352
255
  ```
353
256
 
354
257
  #### 4.3: Security Enhancements
355
258
 
356
259
  ```bash
357
- # Input sanitization
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"
260
+ # Input validation - are all string inputs constrained? (use paths from plan)
261
+ grep -rn "string\|text\|varchar" [BACKEND_FILES_FROM_PLAN] | grep -v "min\|max\|regex\|length\|validate"
365
262
  ```
366
263
 
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
264
+ #### 4.4: Accessibility Enhancements
379
265
 
380
266
  ```bash
381
- # ARIA attributes
382
- grep -rn "aria-\|role=" src/components/[feature]/
267
+ # ARIA attributes (use paths from plan)
268
+ grep -rn "aria-\|role=" [FRONTEND_FILES_FROM_PLAN]
383
269
 
384
270
  # Alt text
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
271
+ grep -rn "<img\|<Image" [FRONTEND_FILES_FROM_PLAN] | grep -v "alt="
392
272
  ```
393
273
 
394
274
  ---
@@ -423,7 +303,6 @@ grep -rn "text-\|bg-" src/components/[feature]/ | head -20
423
303
  |-------|-------|----------|------|----------|
424
304
  | Phase 1 | [N] | [X] | [G] | [%]% |
425
305
  | Phase 2 | [N] | [X] | [G] | [%]% |
426
- | ... | ... | ... | ... | ... |
427
306
  | **TOTAL** | [N] | [X] | [G] | [%]% |
428
307
 
429
308
  ---
@@ -440,19 +319,11 @@ grep -rn "text-\|bg-" src/components/[feature]/ | head -20
440
319
 
441
320
  | ID | Gap Description | Expected | Actual | Impact | Remediation |
442
321
  |----|-----------------|----------|--------|--------|-------------|
443
- | G-002 | [description] | [expected] | [actual] | [impact] | [fix steps] |
444
322
 
445
323
  ### Minor Gaps (P2) - Nice to Fix
446
324
 
447
325
  | ID | Gap Description | Expected | Actual | Impact | Remediation |
448
326
  |----|-----------------|----------|--------|--------|-------------|
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] |
456
327
 
457
328
  ---
458
329
 
@@ -464,40 +335,6 @@ grep -rn "text-\|bg-" src/components/[feature]/ | head -20
464
335
  |----|-------------|----------|--------|--------|----------|
465
336
  | E-001 | [description] | UX/Perf/Sec | High/Med/Low | High/Med/Low | [1-5] |
466
337
 
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
-
501
338
  ---
502
339
 
503
340
  ## Section 4: Technical Debt Identified
@@ -513,38 +350,14 @@ grep -rn "text-\|bg-" src/components/[feature]/ | head -20
513
350
  ### Immediate Actions (Gaps)
514
351
 
515
352
  - [ ] G-001: [fix description]
516
- - [ ] G-002: [fix description]
517
353
 
518
354
  ### Recommended Enhancements
519
355
 
520
356
  - [ ] E-001: [enhancement description]
521
- - [ ] E-002: [enhancement description]
522
357
 
523
358
  ### Technical Debt Items
524
359
 
525
360
  - [ ] 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 |
548
361
  ```
549
362
 
550
363
  ---
@@ -562,8 +375,8 @@ START
562
375
  |
563
376
  v
564
377
  [PHASE 2: Implementation Verification]
565
- - Database verification (all 3 envs)
566
- - API/Router verification
378
+ - Database verification (if applicable)
379
+ - API/Backend verification
567
380
  - Component verification
568
381
  - Feature verification
569
382
  - Configuration verification
@@ -572,16 +385,13 @@ START
572
385
  [PHASE 3: Gap Analysis]
573
386
  - Plan-to-implementation gaps
574
387
  - Cross-reference gaps
575
- - User flow gaps
576
388
  - Error handling gaps
577
- - Test coverage gaps
578
389
  |
579
390
  v
580
391
  [PHASE 4: Enhancement Analysis]
581
392
  - UX enhancements
582
393
  - Performance enhancements
583
394
  - Security enhancements
584
- - Functionality enhancements
585
395
  - Accessibility enhancements
586
396
  |
587
397
  v
@@ -593,9 +403,7 @@ START
593
403
  |
594
404
  v
595
405
  [PHASE 6: Report Saving]
596
- - Create reports directory
597
- - Save report to project docs reports/gap-analysis/
598
- - Update INDEX.md
406
+ - Save report to .claude/reports/gap-analysis/
599
407
  - Verify file saved
600
408
  |
601
409
  v
@@ -619,12 +427,10 @@ The final output MUST include:
619
427
 
620
428
  ## PHASE 6: REPORT SAVING (MANDATORY)
621
429
 
622
- **The report MUST be saved to the file system for future reference.**
623
-
624
430
  ### Report Storage Location
625
431
 
626
432
  ```
627
- reports/gap-analysis/
433
+ .claude/reports/gap-analysis/
628
434
  ```
629
435
 
630
436
  ### Report Naming Convention
@@ -633,99 +439,34 @@ reports/gap-analysis/
633
439
  [YYYY-MM-DD]-[plan-name-slug]-gap-analysis.md
634
440
  ```
635
441
 
636
- **Example**: `2026-01-23-development-intelligence-lead-qualification-gap-analysis.md`
637
-
638
442
  ### Step 6.1: Create Reports Directory (if needed)
639
443
 
640
444
  ```bash
641
- mkdir -p reports/gap-analysis
642
- ```
643
-
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
- ```
656
-
657
- ### Step 6.3: Save the Complete Report
658
-
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
445
+ mkdir -p .claude/reports/gap-analysis
664
446
  ```
665
447
 
666
- ### Step 6.4: Create/Update Reports Index
448
+ ### Step 6.2: Save the Complete Report
667
449
 
668
- Maintain an index file at `reports/gap-analysis/INDEX.md`:
450
+ Write the full report (from Phase 5) to the report file.
669
451
 
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
452
+ ### Step 6.3: Verification
679
453
 
680
454
  ```bash
681
455
  # Verify report was saved
682
- ls -la reports/gap-analysis/[REPORT_FILE]
456
+ ls -la .claude/reports/gap-analysis/[REPORT_FILE]
683
457
 
684
458
  # Verify report has content
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.*
459
+ wc -l .claude/reports/gap-analysis/[REPORT_FILE]
717
460
  ```
718
461
 
719
462
  ---
720
463
 
721
464
  ## IMPORTANT NOTES
722
465
 
723
- - This command is READ-ONLY - it does NOT make changes
724
- - All findings are recommendations - user decides what to act on
725
- - Enhancements are optional - focus on gaps first
726
- - Cross-reference findings with CLAUDE.md patterns
727
- - Use VR-* verification protocols for all checks
466
+ - **When invoked standalone**: This command produces a report. ALL identified gaps and enhancements MUST then be fixed/implemented before the task is considered complete (CR-45). No severity level is exempt — CRITICAL through MINOR, all get fixed.
467
+ - **When invoked as part of golden path/massu-loop**: Gaps and enhancements are fixed inline by the subagent during analysis.
728
468
  - Document evidence for every finding
469
+ - **Enhancements are NOT optional** — all identified enhancements must be implemented (CR-45)
729
470
 
730
471
  ---
731
472
 
@@ -735,6 +476,5 @@ analyzer: Claude Code (massu-gap-enhancement-analyzer)
735
476
  2. Read the complete plan document
736
477
  3. Execute Phase 1-5 in order
737
478
  4. Generate comprehensive report
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
479
+ 5. Save report to `.claude/reports/gap-analysis/`
480
+ 6. Present findings to user with report location