@massu/core 0.5.0 → 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 (118) 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 +146 -95
  97. package/package.json +6 -2
  98. package/patterns/build-patterns.md +302 -0
  99. package/patterns/component-patterns.md +246 -0
  100. package/patterns/display-patterns.md +185 -0
  101. package/patterns/form-patterns.md +890 -0
  102. package/patterns/integration-testing-checklist.md +445 -0
  103. package/patterns/security-patterns.md +219 -0
  104. package/patterns/testing-patterns.md +569 -0
  105. package/patterns/tool-routing.md +81 -0
  106. package/patterns/ui-patterns.md +371 -0
  107. package/protocols/plan-implementation.md +267 -0
  108. package/protocols/recovery.md +225 -0
  109. package/protocols/verification.md +404 -0
  110. package/reference/command-taxonomy.md +178 -0
  111. package/reference/cr-rules-reference.md +76 -0
  112. package/reference/hook-execution-order.md +148 -0
  113. package/reference/lessons-learned.md +175 -0
  114. package/reference/patterns-quickref.md +208 -0
  115. package/reference/standards.md +135 -0
  116. package/reference/subagents-reference.md +17 -0
  117. package/reference/vr-verification-reference.md +867 -0
  118. package/src/commands/install-commands.ts +149 -53
@@ -0,0 +1,371 @@
1
+ # UI Patterns
2
+
3
+ **Purpose**: Layout, theming, component selection, and UI quality standards.
4
+
5
+ **When to Read**: Before creating or modifying UI components, pages, or styles.
6
+
7
+ ---
8
+
9
+ ## Layout Architecture
10
+
11
+ ### Page Container Pattern
12
+
13
+ ```
14
+ page-container (no padding - just width + centering)
15
+ └── main-content (10px padding)
16
+ ├── Header section
17
+ ├── Content area
18
+ └── Footer/actions
19
+ ```
20
+
21
+ ```typescript
22
+ // Standard page layout
23
+ export default function MyPage() {
24
+ return (
25
+ <div className="page-container">
26
+ <div className="main-content">
27
+ <h1 className="text-2xl font-bold">Page Title</h1>
28
+ {/* Page content */}
29
+ </div>
30
+ </div>
31
+ );
32
+ }
33
+ ```
34
+
35
+ **Rule**: ALL pages MUST use the `page-container` class. Never create custom width/centering.
36
+
37
+ ### Mobile Chat Layout
38
+
39
+ For full-height mobile layouts (chat, messaging):
40
+
41
+ ```typescript
42
+ // Use sm:page-container for mobile-first full height
43
+ <div className="sm:page-container">
44
+ <div className="main-content h-full">
45
+ {/* Full-height content */}
46
+ </div>
47
+ </div>
48
+ ```
49
+
50
+ ---
51
+
52
+ ## Dark Mode
53
+
54
+ ### Theme-Aware Components
55
+
56
+ ```typescript
57
+ import { useTheme } from 'next-themes';
58
+
59
+ function Logo() {
60
+ const { resolvedTheme } = useTheme();
61
+ return (
62
+ <Image
63
+ src={resolvedTheme === 'dark' ? '/logo-dark.png' : '/logo-light.png'}
64
+ alt="Logo"
65
+ />
66
+ );
67
+ }
68
+ ```
69
+
70
+ ### WCAG AA Contrast
71
+
72
+ When using colored backgrounds in dark mode, ensure text contrast meets WCAG AA (4.5:1 ratio):
73
+
74
+ ```css
75
+ /* WRONG - Low contrast in dark mode */
76
+ .badge-success {
77
+ background-color: hsl(142 76% 36%);
78
+ color: hsl(142 76% 36%); /* Same hue, no contrast */
79
+ }
80
+
81
+ /* CORRECT - High contrast */
82
+ .badge-success {
83
+ background-color: hsl(142 76% 36% / 0.2);
84
+ color: var(--color-success-foreground);
85
+ }
86
+ ```
87
+
88
+ ---
89
+
90
+ ## Semantic CSS Color Classes
91
+
92
+ Use semantic color classes instead of hardcoded values:
93
+
94
+ ```css
95
+ /* Badge variants */
96
+ .badge-primary { ... }
97
+ .badge-success { ... }
98
+ .badge-warning { ... }
99
+ .badge-error { ... }
100
+ .badge-info { ... }
101
+
102
+ /* Stats text */
103
+ .stats-text-success { color: var(--color-success); }
104
+ .stats-text-warning { color: var(--color-warning); }
105
+ .stats-text-error { color: var(--color-error); }
106
+ ```
107
+
108
+ **Rule**: NEVER use hardcoded hex/rgb colors. Always use CSS variables or semantic classes.
109
+
110
+ ---
111
+
112
+ ## Suspense Boundaries
113
+
114
+ ALL pages using `use(params)` or `useSearchParams()` MUST be wrapped in Suspense:
115
+
116
+ ```typescript
117
+ import { Suspense } from 'react';
118
+ import { LoadingState } from '@/components/common/LoadingState';
119
+
120
+ export default function Page() {
121
+ return (
122
+ <Suspense fallback={<LoadingState />}>
123
+ <PageContent />
124
+ </Suspense>
125
+ );
126
+ }
127
+
128
+ function PageContent() {
129
+ const searchParams = useSearchParams();
130
+ // ...
131
+ }
132
+ ```
133
+
134
+ Without Suspense, static generation fails with cryptic errors.
135
+
136
+ ---
137
+
138
+ ## Null Guards
139
+
140
+ Always guard nullable values before calling string methods:
141
+
142
+ ```typescript
143
+ // WRONG - TypeError if status is null
144
+ <span>{status.replace(/_/g, ' ')}</span>
145
+
146
+ // CORRECT - Null guard
147
+ <span>{(status || "pending").replace(/_/g, ' ')}</span>
148
+
149
+ // CORRECT - Optional chaining with fallback
150
+ <span>{status?.replace(/_/g, ' ') ?? 'Pending'}</span>
151
+ ```
152
+
153
+ ---
154
+
155
+ ## Select.Item Value
156
+
157
+ NEVER use `value=""` on Select.Item — causes React crash:
158
+
159
+ ```typescript
160
+ // WRONG - React crash
161
+ <SelectItem value="">All</SelectItem>
162
+
163
+ // CORRECT - Use __none__ placeholder
164
+ <SelectItem value="__none__">All</SelectItem>
165
+ ```
166
+
167
+ ---
168
+
169
+ ## Toast Standardization
170
+
171
+ Use Sonner for all toast notifications:
172
+
173
+ ```typescript
174
+ import { toast } from 'sonner';
175
+
176
+ // Success
177
+ toast.success('Changes saved');
178
+
179
+ // Error with description
180
+ toast.error('Failed to save', {
181
+ description: 'Please check your connection and try again'
182
+ });
183
+
184
+ // Promise toast
185
+ toast.promise(saveMutation.mutateAsync(data), {
186
+ loading: 'Saving...',
187
+ success: 'Saved!',
188
+ error: 'Failed to save'
189
+ });
190
+ ```
191
+
192
+ **Setup**: Ensure `<Toaster />` from Sonner is in your root layout/Providers.
193
+
194
+ ---
195
+
196
+ ## Sheet Pattern (CR-40)
197
+
198
+ ALL overlays MUST use `Sheet` (slide-out panel), NEVER `Dialog`:
199
+
200
+ ```typescript
201
+ import {
202
+ Sheet,
203
+ SheetContent,
204
+ SheetHeader,
205
+ SheetTitle,
206
+ SheetDescription,
207
+ } from '@/components/ui/sheet';
208
+
209
+ <Sheet open={isOpen} onOpenChange={setIsOpen}>
210
+ <SheetContent>
211
+ <SheetHeader>
212
+ <SheetTitle>Edit Contact</SheetTitle>
213
+ <SheetDescription>
214
+ Update contact information
215
+ </SheetDescription>
216
+ </SheetHeader>
217
+ {/* Form content */}
218
+ </SheetContent>
219
+ </Sheet>
220
+ ```
221
+
222
+ **Exception**: `AlertDialog` is allowed ONLY for destructive confirmations (delete, discard changes).
223
+
224
+ ### Close Button Pattern
225
+
226
+ ```typescript
227
+ // Ensure close button has data attribute for testing
228
+ <SheetContent>
229
+ <button data-close-button onClick={() => setIsOpen(false)}>
230
+ <X className="h-4 w-4" />
231
+ </button>
232
+ {/* Content */}
233
+ </SheetContent>
234
+ ```
235
+
236
+ ---
237
+
238
+ ## DataTable Component
239
+
240
+ For tabular data, use the DataTable component:
241
+
242
+ ```typescript
243
+ import { DataTable } from '@/components/common/DataTable';
244
+
245
+ const columns = [
246
+ {
247
+ accessorKey: 'name',
248
+ header: 'Name',
249
+ },
250
+ {
251
+ accessorKey: 'email',
252
+ header: 'Email',
253
+ },
254
+ {
255
+ accessorKey: 'status',
256
+ header: 'Status',
257
+ cell: ({ row }) => <StatusBadge status={row.original.status} />,
258
+ },
259
+ ];
260
+
261
+ <DataTable
262
+ columns={columns}
263
+ data={contacts}
264
+ searchKey="name"
265
+ searchPlaceholder="Search contacts..."
266
+ />
267
+ ```
268
+
269
+ ---
270
+
271
+ ## Touch/Tablet Patterns
272
+
273
+ ### Stylus Events
274
+
275
+ ```typescript
276
+ // WRONG - Unreliable on tablets
277
+ <canvas onClick={handleDraw} />
278
+
279
+ // CORRECT - Pointer events for stylus support
280
+ <canvas
281
+ onPointerDown={handlePointerDown}
282
+ onPointerMove={handlePointerMove}
283
+ onPointerUp={handlePointerUp}
284
+ />
285
+ ```
286
+
287
+ **Rule**: Min 44px touch targets for all interactive elements.
288
+
289
+ ### Pinch-to-Zoom
290
+
291
+ ```typescript
292
+ // Detect 2-finger gestures
293
+ const handleTouchStart = (e: TouchEvent) => {
294
+ if (e.touches.length === 2) {
295
+ // Set pointer-events-none on canvas to allow native zoom
296
+ canvasRef.current?.style.setProperty('pointer-events', 'none');
297
+ }
298
+ };
299
+ ```
300
+
301
+ ---
302
+
303
+ ## Accessibility
304
+
305
+ ### No Zoom Disable
306
+
307
+ NEVER disable user zoom — breaks WCAG accessibility:
308
+
309
+ ```html
310
+ <!-- WRONG -->
311
+ <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no" />
312
+
313
+ <!-- CORRECT -->
314
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
315
+ ```
316
+
317
+ ### Proper Heading Hierarchy
318
+
319
+ ```typescript
320
+ // CORRECT - Sequential heading levels
321
+ <h1>Page Title</h1>
322
+ <h2>Section</h2>
323
+ <h3>Subsection</h3>
324
+
325
+ // WRONG - Skipping levels
326
+ <h1>Page Title</h1>
327
+ <h3>Subsection</h3> {/* Skipped h2 */}
328
+ ```
329
+
330
+ ---
331
+
332
+ ## Design System
333
+
334
+ ### Token Reference
335
+
336
+ Before CSS work, read the token reference for available CSS variables:
337
+
338
+ | Category | Prefix | Example |
339
+ |----------|--------|---------|
340
+ | Colors | `--color-` | `var(--color-primary)` |
341
+ | Spacing | `--spacing-` | `var(--spacing-4)` |
342
+ | Typography | `--font-` | `var(--font-sans)` |
343
+ | Radius | `--radius-` | `var(--radius-md)` |
344
+
345
+ ### Token Audit
346
+
347
+ After CSS changes, run the token audit:
348
+
349
+ ```bash
350
+ bash scripts/audit-design-tokens.sh
351
+ # Expected: Exit 0 (zero hardcoded colors)
352
+ ```
353
+
354
+ ---
355
+
356
+ ## Quick Reference
357
+
358
+ | Rule | Pattern | Error if Violated |
359
+ |------|---------|-------------------|
360
+ | Select.Item value | Never `value=""`, use `__none__` | React crash |
361
+ | Null guards | `(status \|\| "pending").replace()` | TypeError |
362
+ | Page layout | Always use `page-container` class | Inconsistent gaps |
363
+ | Stylus events | `onPointerDown` not `onClick` | Unreliable on tablets |
364
+ | NO Modal Dialogs | Use `Sheet` for overlays; `AlertDialog` only for destructive | CR-40 violation |
365
+ | No user-scalable=no | Never disable zoom | WCAG violation |
366
+ | Suspense boundaries | Wrap `use(params)` pages | Static generation fails |
367
+
368
+ ---
369
+
370
+ **Document Status**: ACTIVE
371
+ **Compliance**: Mandatory for all UI work
@@ -0,0 +1,267 @@
1
+ # Plan Implementation Protocol
2
+
3
+ **Purpose**: Unified protocol for implementing and auditing multi-step plans. Merges Plan Implementation, Plan Audit, and Pre-Completion protocols.
4
+
5
+ **When to Read**: When implementing any multi-step plan, before claiming a plan is complete.
6
+
7
+ ---
8
+
9
+ ## ABSOLUTE RULE: 100% COMPLETION OR NOTHING (CR-7)
10
+
11
+ **Plans are NEVER partially complete. They are either 100% complete or NOT complete.**
12
+
13
+ | Coverage | Status | Action Required |
14
+ |----------|--------|-----------------|
15
+ | 100% | COMPLETE | Can claim complete with proof |
16
+ | 99% | NOT COMPLETE | Continue working until 100% |
17
+ | 80% | NOT COMPLETE | Continue working until 100% |
18
+ | Any < 100% | NOT COMPLETE | NEVER stop, NEVER claim complete |
19
+
20
+ **There is NO valid reason to stop implementing a plan before 100% coverage.**
21
+ **"Most items done" = NOT DONE. "Main features work" = NOT DONE.**
22
+
23
+ ---
24
+
25
+ ## Phase 1: Before Starting Implementation
26
+
27
+ ### Step 1: Create TodoWrite Checklist IMMEDIATELY
28
+ ```
29
+ Before writing ANY code, create a todo for EVERY item in the plan.
30
+ Do not start implementation until the todo list exists.
31
+ ```
32
+
33
+ ### Step 2: Read Plan File as Source of Truth
34
+ - The plan file is the SPECIFICATION
35
+ - Memory/summaries are NOT reliable
36
+ - Re-read the plan file before claiming ANY feature is complete
37
+
38
+ ### Step 3: Identify All Deliverables
39
+ For EACH item in the plan, categorize:
40
+ - [ ] ADD - Component/feature to add
41
+ - [ ] REMOVE - Code/component to delete (CRITICAL)
42
+ - [ ] SWAP - Replace A with B
43
+ - [ ] MODIFY - Change existing behavior
44
+ - [ ] VALUE_CHANGE - Constant/path/enum being changed (TRIGGERS BLAST RADIUS)
45
+
46
+ ### Step 4: Blast Radius Analysis (For VALUE_CHANGE Items)
47
+
48
+ **MANDATORY** when ANY plan item changes a constant value, redirect path, route, enum, or config key.
49
+
50
+ For EACH value being changed:
51
+ ```bash
52
+ # Grep ENTIRE codebase for the old value
53
+ grep -rn '"[OLD_VALUE]"' src/ --include="*.ts" --include="*.tsx" | grep -v node_modules
54
+ ```
55
+
56
+ Categorize EVERY match as:
57
+ - **CHANGE** - Must be updated (add to plan deliverables)
58
+ - **KEEP** - Intentionally stays (document reason)
59
+ - **INVESTIGATE** - Unclear (must resolve before implementation)
60
+
61
+ **Zero INVESTIGATE items allowed before starting implementation.**
62
+ **Every CHANGE item must be a plan deliverable with a verification command.**
63
+
64
+ If the plan does NOT include a blast radius analysis, CREATE ONE before implementing.
65
+
66
+ ---
67
+
68
+ ## Phase 2: During Implementation
69
+
70
+ ### Step 1: Mark In-Progress BEFORE Starting
71
+ - Set todo to "in_progress" BEFORE writing code
72
+ - Only ONE feature should be in_progress at a time
73
+ - This prevents "I thought I did that" errors
74
+
75
+ ### Step 2: Implement One Feature at a Time
76
+ - Complete each feature fully before moving to next
77
+ - Do not batch or parallelize unless explicitly required
78
+
79
+ ### Step 3: Verify BEFORE Marking Complete
80
+ - Test the feature actually works (not just that code exists)
81
+ - Check ALL locations mentioned in the plan (not just one file)
82
+ - Show proof: grep results, type check output, or explicit verification
83
+ - NEVER mark complete based on memory
84
+
85
+ ### Step 4: Update Session State
86
+ After each significant step, update `session-state/CURRENT.md`:
87
+ - Current position in plan
88
+ - Completed items
89
+ - Failed attempts (DO NOT RETRY)
90
+ - Decisions made + rationale
91
+
92
+ ---
93
+
94
+ ## Phase 3: Plan Audit (Before Claiming Complete)
95
+
96
+ ### Step 1: READ THE PLAN FILE - Not Memory
97
+ ```
98
+ Open the actual plan file.
99
+ Do NOT rely on summaries or memory.
100
+ The plan file is the ONLY source of truth.
101
+ ```
102
+
103
+ ### Step 2: Create Verification Checklist
104
+ For EACH item in the plan, create explicit verification:
105
+
106
+ | Plan Item | VR Type | Command | Result |
107
+ |-----------|---------|---------|--------|
108
+ | ADD component X to Y | VR-GREP | `grep "X" src/.../Y.tsx` | Found |
109
+ | REMOVE tab Z | VR-NEGATIVE | `grep "Z" src/app/` | 0 matches |
110
+ | SWAP A with B | VR-GREP + VR-NEGATIVE | Both commands | Both pass |
111
+ | "Tabs: A \| B \| C" | VR-PLAN-TABS | `grep -c "TabsTrigger" [file]` | Count = 3 |
112
+ | "More Menu: X items" | VR-PLAN-ITEMS | `grep -c "DropdownMenuItem" [file]` | Count = X |
113
+ | "ViewSwitcher" | VR-GREP | `grep "ViewSwitcher\|DropdownMenuTrigger" [file]` | Found |
114
+
115
+ ### Step 2.5: Verify UI Structure Matches Plan (VR-PLAN-SPEC)
116
+
117
+ **CRITICAL**: If plan specifies tabs, menus, or UI structure, verify with COUNTS not just existence.
118
+
119
+ For plans with tab specifications:
120
+ ```bash
121
+ # If plan says "Tabs: All Users | Roles | Permissions | Access Control"
122
+ grep -c "TabsTrigger" src/app/admin/users/page.tsx
123
+ # Expected: 4 (NOT just "found a tab component")
124
+
125
+ # Verify EACH tab label
126
+ grep "TabsTrigger" src/app/admin/users/page.tsx | grep -c "users\|roles\|permissions\|access"
127
+ # Expected: 4
128
+ ```
129
+
130
+ **Why This Matters**:
131
+ - VR-RENDER passed (component existed)
132
+ - VR-GREP passed (found component in page)
133
+ - But TABS were NOT implemented
134
+ - Items became inaccessible
135
+ - User found the bug, not the audit
136
+
137
+ ### Step 3: Check REMOVALS Explicitly
138
+ **CRITICAL**: REMOVALS are invisible to positive grep searches.
139
+
140
+ 1. Identify what should NOT exist
141
+ 2. Grep for the thing that should be GONE
142
+ 3. Verify grep returns ZERO matches
143
+ 4. Example: `grep "TabsContent value=\"drawings\"" src/app/` -> must return 0 files
144
+
145
+ ### Step 4: Check EACH Location in Plan
146
+ If plan says "Add to pages: A, B, C, D, E":
147
+ - [ ] Verify page A (grep proof)
148
+ - [ ] Verify page B (grep proof)
149
+ - [ ] Verify page C (grep proof)
150
+ - [ ] Verify page D (grep proof)
151
+ - [ ] Verify page E (grep proof)
152
+
153
+ **Do NOT stop at 3 and assume the rest are done.**
154
+
155
+ ### Step 5: Run Build and Type Check
156
+ ```bash
157
+ npm run build # VR-BUILD
158
+ npx tsc --noEmit # VR-TYPE
159
+ ```
160
+
161
+ ### Step 6: Complete Verification Template
162
+ Fill out the plan verification template with:
163
+ - Every deliverable listed
164
+ - Every verification command run
165
+ - Every result shown
166
+
167
+ ---
168
+
169
+ ## Phase 4: Completion Claims
170
+
171
+ ### What "Complete" Means
172
+ A feature is NOT complete unless:
173
+ - [ ] Code exists in ALL files specified in plan
174
+ - [ ] Feature has been tested/verified to work
175
+ - [ ] Type check passes
176
+ - [ ] Proof of completion can be shown
177
+ - [ ] **100% of plan items verified complete (not 99%, not "most")**
178
+ - [ ] **Production verification passed** (immediate checks PASS; deferred items tracked in `session-state/deferred-verifications.md`)
179
+
180
+ ### NEVER Claim Complete When
181
+
182
+ | Situation | Why It's Wrong | Correct Action |
183
+ |-----------|----------------|----------------|
184
+ | "Most items done" | Most != All | Complete remaining items |
185
+ | "Main features work" | All features must work | Complete ALL features |
186
+ | "Code quality passes" | Coverage may be <100% | Verify ALL plan items |
187
+ | "Build passes" | Build doesn't verify plan coverage | Check each plan item |
188
+ | "Ready for review" when <100% | Partial = incomplete | Finish first |
189
+
190
+ ### Pre-Completion Checklist (NON-NEGOTIABLE)
191
+
192
+ 1. [ ] Plan file OPEN (not from memory)
193
+ 2. [ ] Every line of plan READ
194
+ 3. [ ] Verification entry for EVERY deliverable
195
+ 4. [ ] Verification command RUN for every entry
196
+ 5. [ ] Command output SHOWN as proof
197
+ 6. [ ] All failing items FIXED
198
+ 7. [ ] Fixed items RE-VERIFIED
199
+ 8. [ ] Verification template COMPLETED
200
+ 9. [ ] Checklist PRESENTED to user
201
+ 10. [ ] User acknowledgment RECEIVED
202
+ 11. [ ] **Production verification** -- features confirmed working in production (not just deployed)
203
+
204
+ **Only after ALL 11 steps may "complete" be claimed.**
205
+
206
+ ---
207
+
208
+ ## Red Flags - Stop and Verify
209
+
210
+ | Red Flag | Required Response |
211
+ |----------|-------------------|
212
+ | "I already did that" | VERIFY by reading the file |
213
+ | "That should be working" | TEST it |
214
+ | "The audit shows everything is done" | READ THE PLAN FILE |
215
+ | Session was compacted | RE-READ THE PLAN FILE |
216
+ | "I did most of them" | VERIFY ALL of them |
217
+ | Only ran positive greps | Also run NEGATIVE greps |
218
+
219
+ ---
220
+
221
+ ## User Discovery = Audit Failure
222
+
223
+ If the USER finds a bug that an audit should have caught:
224
+ - The audit FAILED
225
+ - Previous "complete" claims were LIES
226
+ - Trust has been damaged
227
+ - Must rebuild trust with PROOF, not words
228
+
229
+ ---
230
+
231
+ ## Verification Command Templates
232
+
233
+ ```bash
234
+ # For ADDITIONS - verify component exists in all required files
235
+ grep -l "ComponentName" src/app/path1/page.tsx src/app/path2/page.tsx ...
236
+
237
+ # For REMOVALS - verify old code is GONE (should return nothing)
238
+ grep -rn "OldComponentName" src/app/ | wc -l # Must be 0
239
+
240
+ # For SWAPS - verify BOTH old removed AND new added
241
+ grep -rn "OldComponent" src/app/ # Should be 0
242
+ grep -rn "NewComponent" src/app/ # Should match expected count
243
+
244
+ # For RENAMES - verify old name gone, new name present
245
+ grep -rn 'value="oldname"' src/app/ # Should be 0
246
+ grep -rn 'value="newname"' src/app/ # Should match
247
+
248
+ # Count instances
249
+ grep -c "Pattern" file.tsx # Expected count
250
+ ```
251
+
252
+ ---
253
+
254
+ ## Multi-Session Plan Implementation
255
+
256
+ For plans spanning multiple sessions:
257
+
258
+ 1. **Verify current phase status** via todo list, git log, schema state
259
+ 2. **Re-execute Pre-Phase Protocol** for current phase
260
+ 3. **Update session state** at each checkpoint
261
+ 4. **Commit at checkpoints only** - Do NOT commit mid-phase
262
+ 5. **No push until explicitly told** - User controls when code goes to remote
263
+
264
+ ---
265
+
266
+ **Document Status**: ACTIVE
267
+ **Compliance**: Mandatory for all plan implementations