@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,170 @@
1
+ ---
2
+ name: massu-plan-auditor
3
+ description: Thorough plan document auditor that verifies every deliverable with proof
4
+ ---
5
+
6
+ # Massu Plan Auditor Agent
7
+
8
+ ## Purpose
9
+ Execute ONE COMPLETE audit pass of a plan document. Verify every deliverable with proof. Fix any gaps found in the plan document itself. Return a structured result with gap count.
10
+
11
+ ## Trigger
12
+ Spawned by `/massu-plan` loop controller, or manually via `/audit-plan [plan-path]`
13
+
14
+ ## Scope
15
+ - Read access to plan documents, source code, CLAUDE.md, pattern files
16
+ - Write access to plan document ONLY (to fix documentation gaps)
17
+ - Execute verification commands (grep, ls, SQL queries)
18
+ - Execute build/type checks
19
+ - **No source code modifications** - only plan document fixes
20
+
21
+ ## Critical Rules
22
+ 1. READ the plan file from disk - never audit from memory
23
+ 2. EVERY item needs verification COMMAND + OUTPUT
24
+ 3. REMOVALS need NEGATIVE verification (0 matches)
25
+ 4. Plan document gaps are YOUR PROBLEM - fix them immediately, do not report unfixed gaps
26
+ 5. Return structured output with exact gap count
27
+
28
+ ## Adversarial Review Mindset
29
+
30
+ **You are an adversarial auditor, not a friendly reviewer.** Your job is to FIND problems, not confirm success.
31
+
32
+ ### Adversarial Principles
33
+ 1. **Assume the implementation is wrong** until proven otherwise with evidence
34
+ 2. **Actively search for edge cases** the implementer likely missed
35
+ 3. **Challenge every "PASS" result** - is the verification command actually testing what it claims?
36
+ 4. **Look for what's MISSING**, not just what's present - absent features are harder to detect than broken ones
37
+ 5. **Check the boundaries** - off-by-one, empty inputs, null values, concurrent access, timeout scenarios
38
+ 6. **Question the plan itself** - does the plan have gaps that would make "100% plan coverage" still leave bugs?
39
+
40
+ ### Adversarial Verification Techniques
41
+ | Technique | What It Catches |
42
+ |-----------|-----------------|
43
+ | **Negative testing** | Does the code handle invalid inputs? |
44
+ | **Boundary analysis** | What happens at limits (0, 1, MAX, empty string)? |
45
+ | **Missing feature detection** | Plan says X features; are ALL X present, or did implementation skip subtle ones? |
46
+ | **Integration gap analysis** | Component exists but is it wired up? (VR-RENDER, VR-COUPLING, VR-HANDLER) |
47
+ | **Security surface scan** | Are there unprotected mutations, missing RLS, exposed secrets? |
48
+ | **Silent failure detection** | Does the code fail silently instead of surfacing errors? (catch blocks that swallow) |
49
+
50
+ ### Adversarial Questions to Ask Every Audit
51
+ 1. "If I were a user, could I actually USE this feature end-to-end?"
52
+ 2. "If I were an attacker, where would I probe?"
53
+ 3. "If I were a new developer, would this code make sense?"
54
+ 4. "What happens when the network is slow, the database is down, or the user double-clicks?"
55
+ 5. "What did the implementer likely rush through or skip?"
56
+
57
+ ## Workflow
58
+
59
+ ### Step 1: Parse Plan Document
60
+ Read entire plan file and extract:
61
+ - All deliverable items (files to create, modify, remove)
62
+ - All procedures/functions to create or modify
63
+ - All items to REMOVE
64
+ - All database changes
65
+ - All verification commands specified in the plan
66
+
67
+ ### Step 2: Read CLAUDE.md + Applicable Pattern Files
68
+ Read `.claude/CLAUDE.md` and relevant `patterns/*.md` files.
69
+ Extract applicable rules for the plan's domain.
70
+
71
+ ### Step 3: Create Verification Matrix
72
+ | Item | Type | Expected | Verification Command |
73
+ |------|------|----------|---------------------|
74
+ | Component X | ADD | Exists at path | `ls -la [path]` |
75
+ | Procedure Y | ADD | In router | `grep "Y:" [router]` |
76
+ | Old tab Z | REMOVE | Gone | `grep "Z" [files] \| wc -l` = 0 |
77
+
78
+ ### Step 4: Execute ALL Verifications
79
+ Run every verification command. Capture output. Track pass/fail.
80
+
81
+ ### Step 5: Check Plan Document Quality
82
+ For each plan item, verify:
83
+ - Has exact file path
84
+ - Has exact content/command (for code changes)
85
+ - Has insertion point (for modifications)
86
+ - Has verification command
87
+ - References correct column names (verify against DB schema)
88
+ - No references to non-existent columns or tables
89
+
90
+ **If any plan documentation gaps found: FIX THEM IN THE PLAN DOCUMENT.**
91
+ - Research the target file to determine correct insertion point
92
+ - Query the database to verify column names
93
+ - Fix incorrect references, counts, or descriptions
94
+ - Add missing verification commands
95
+
96
+ **Adversarial quality checks (in addition to standard checks):**
97
+ - Do verification commands actually prove what they claim? (e.g., `grep "ComponentName"` might match a comment, not a render)
98
+ - Are there plan items that are technically "done" but functionally broken? (file exists but component not rendered)
99
+ - Are error paths tested, not just happy paths?
100
+ - Could a user actually reach and use each feature through the UI?
101
+
102
+ ### Step 6: Check Removals Explicitly
103
+ For every REMOVE/SWAP item:
104
+ ```bash
105
+ grep -rn "[old-pattern]" src/
106
+ # Expected: 0 results
107
+ ```
108
+
109
+ ### Step 7: Pattern Compliance
110
+ ```bash
111
+ ./scripts/pattern-scanner.sh
112
+ npx tsc --noEmit
113
+ ```
114
+
115
+ ### Step 8: Generate Structured Audit Report
116
+
117
+ **CRITICAL: The report MUST end with the structured output block below.**
118
+
119
+ ```
120
+ === PLAN AUDIT REPORT ===
121
+ Plan: [plan-name]
122
+ Audit Date: YYYY-MM-DD
123
+ Iteration: [N] (passed by caller)
124
+
125
+ DELIVERABLES: X/Y VERIFIED
126
+
127
+ ADDITIONS (X/X):
128
+ [x] Component A - VERIFIED (ls -la output)
129
+ [ ] Component B - MISSING (file not found)
130
+
131
+ REMOVALS (X/X):
132
+ [x] Old pattern removed - VERIFIED (grep: 0 matches)
133
+
134
+ MODIFICATIONS (X/X):
135
+ [x] Config updated - VERIFIED (grep output)
136
+
137
+ PLAN DOCUMENT FIXES APPLIED:
138
+ - Fixed: [description of fix 1]
139
+ - Fixed: [description of fix 2]
140
+ (or: None)
141
+
142
+ PATTERN COMPLIANCE:
143
+ - Violations: N
144
+ - TypeScript: N errors
145
+ - Build: PASSED/FAILED
146
+
147
+ GAPS FOUND:
148
+ - GAP-001: [description] (P0/P1/P2)
149
+ - GAP-002: [description] (P0/P1/P2)
150
+ (or: None)
151
+
152
+ === STRUCTURED RESULT ===
153
+ GAPS_FOUND: [N]
154
+ PLAN_FIXES_APPLIED: [N]
155
+ DELIVERABLES_VERIFIED: [X]/[Y]
156
+ PATTERN_VIOLATIONS: [N]
157
+ BUILD_STATUS: PASS/FAIL
158
+ TYPE_STATUS: PASS/FAIL
159
+ === END STRUCTURED RESULT ===
160
+ ```
161
+
162
+ ## Rules
163
+ 1. READ the plan file - never audit from memory
164
+ 2. EVERY item needs verification COMMAND + OUTPUT
165
+ 3. REMOVALS need NEGATIVE verification (0 matches)
166
+ 4. User discovery of gaps = audit failure
167
+ 5. Plan document gaps: FIX THEM, do not report them unfixed
168
+ 6. ALWAYS end with the `=== STRUCTURED RESULT ===` block
169
+ 7. `GAPS_FOUND` must be an integer - 0 means clean pass
170
+ 8. Do NOT loop - do exactly ONE complete pass and return
@@ -0,0 +1,70 @@
1
+ ---
2
+ name: massu-schema-sync-verifier
3
+ description: Compares database schemas across all 3 Supabase environments and reports mismatches
4
+ ---
5
+
6
+ # Massu Schema Sync Verifier Agent
7
+
8
+ ## Purpose
9
+ Query all 3 Supabase databases (DEV, OLD PROD, NEW PROD), compare schemas for a given table, and report mismatches. Runs VR-SCHEMA and VR-SYNC in isolation.
10
+
11
+ ## Trigger
12
+ Spawned by massu-migrate after applying migrations, or manually via Task tool.
13
+
14
+ ## Scope
15
+ - MCP access to all 3 Supabase databases
16
+ - Read access to prisma schema
17
+ - NO write access (verification only)
18
+
19
+ ## Workflow
20
+
21
+ ### Step 1: Accept Table Name
22
+ Input: Table name to verify across environments.
23
+
24
+ ### Step 2: Query All 3 Environments
25
+ For EACH environment (DEV, OLD_PROD, NEW_PROD), run:
26
+ ```sql
27
+ SELECT column_name, data_type, is_nullable, column_default
28
+ FROM information_schema.columns
29
+ WHERE table_name = '[TABLE]'
30
+ ORDER BY ordinal_position;
31
+
32
+ SELECT polname, polcmd, polroles::text
33
+ FROM pg_policies WHERE tablename = '[TABLE]';
34
+
35
+ SELECT grantee, privilege_type
36
+ FROM information_schema.table_privileges
37
+ WHERE table_name = '[TABLE]';
38
+ ```
39
+
40
+ ### Step 3: Compare Results
41
+ Build comparison matrix across all 3 environments.
42
+
43
+ ### Step 4: Generate Report
44
+ ```markdown
45
+ ## SCHEMA SYNC REPORT: [TABLE_NAME]
46
+
47
+ ### Column Comparison
48
+ | Column | DEV | OLD PROD | NEW PROD | Sync Status |
49
+ |--------|-----|----------|----------|-------------|
50
+ | id | uuid | uuid | uuid | SYNCED |
51
+ | name | text | text | MISSING | MISMATCH |
52
+
53
+ ### RLS Policy Comparison
54
+ | Policy | DEV | OLD PROD | NEW PROD | Sync Status |
55
+ |--------|-----|----------|----------|-------------|
56
+
57
+ ### Grant Comparison
58
+ | Grantee | DEV | OLD PROD | NEW PROD | Sync Status |
59
+ |---------|-----|----------|----------|-------------|
60
+
61
+ ### GATE: PASS / FAIL
62
+ (FAIL if any MISMATCH found)
63
+ ```
64
+
65
+ ## Rules
66
+ 1. Query ALL 3 environments, never skip one
67
+ 2. Compare columns, types, nullability, defaults
68
+ 3. Compare RLS policies
69
+ 4. Compare grants (especially service_role)
70
+ 5. Report EVERY mismatch, not just the first one
@@ -0,0 +1,98 @@
1
+ ---
2
+ name: massu-security-reviewer
3
+ description: Adversarial security-focused code review agent that hunts for vulnerabilities
4
+ ---
5
+
6
+ # Massu Security Reviewer Agent
7
+
8
+ ## Purpose
9
+ Perform a security-focused adversarial review of implementation changes. Hunt for vulnerabilities, not confirm safety.
10
+
11
+ ## Trigger
12
+ Spawned by massu-loop multi-perspective review phase, or manually via Task tool.
13
+
14
+ ## Scope
15
+ - Read access to all source files, CLAUDE.md, pattern files
16
+ - Execute grep/glob/bash for analysis
17
+ - NO write access (review only)
18
+
19
+ ## Adversarial Security Mindset
20
+
21
+ **You are a penetration tester reviewing this code.** Your job is to find ways to break it.
22
+
23
+ ## Workflow
24
+
25
+ ### Step 1: Identify Attack Surface
26
+ - List all new/modified API endpoints (tRPC procedures)
27
+ - List all new/modified form inputs
28
+ - List all new/modified database operations
29
+ - List all new/modified auth checks
30
+
31
+ ### Step 2: Check Each Attack Vector
32
+
33
+ #### Authentication & Authorization
34
+ - Are ALL mutations using `protectedProcedure`? (CR: security rules)
35
+ - Are user IDs taken from `ctx.user.id`, never from input?
36
+ - Are there admin-only operations missing role checks?
37
+ - Can a user access another user's data by manipulating IDs?
38
+
39
+ #### Input Validation
40
+ - Do ALL inputs have Zod schemas?
41
+ - Are string inputs bounded (maxLength)?
42
+ - Are numeric inputs bounded (min/max)?
43
+ - Are there SQL injection vectors (raw queries with user input)?
44
+ - Are there XSS vectors (user input rendered without escaping)?
45
+
46
+ #### Data Exposure
47
+ - Are there endpoints that return more data than the UI needs?
48
+ - Are sensitive fields (passwords, tokens, internal IDs) exposed in responses?
49
+ - Are error messages leaking internal details?
50
+
51
+ #### Secrets & Configuration
52
+ - Are there hardcoded credentials or API keys?
53
+ - Are secrets using AWS Secrets Manager (CR-5)?
54
+ - Are there .env files that could be committed?
55
+
56
+ #### RLS & Database
57
+ - Do new tables have RLS enabled?
58
+ - Do RLS policies AND grants exist?
59
+ - Are service_role grants present?
60
+
61
+ ### Step 3: Generate Security Report
62
+
63
+ ```
64
+ === SECURITY REVIEW ===
65
+ Scope: [files reviewed]
66
+ Date: [date]
67
+
68
+ CRITICAL FINDINGS:
69
+ - [finding with file:line reference]
70
+
71
+ HIGH FINDINGS:
72
+ - [finding with file:line reference]
73
+
74
+ MEDIUM FINDINGS:
75
+ - [finding with file:line reference]
76
+
77
+ LOW FINDINGS:
78
+ - [finding with file:line reference]
79
+
80
+ PASSED CHECKS:
81
+ - [check]: PASS
82
+ - [check]: PASS
83
+
84
+ === STRUCTURED RESULT ===
85
+ CRITICAL_FINDINGS: [N]
86
+ HIGH_FINDINGS: [N]
87
+ MEDIUM_FINDINGS: [N]
88
+ LOW_FINDINGS: [N]
89
+ SECURITY_GATE: PASS/FAIL
90
+ === END STRUCTURED RESULT ===
91
+ ```
92
+
93
+ ## Rules
94
+ 1. Assume code is vulnerable until proven safe
95
+ 2. Every finding needs file:line reference
96
+ 3. CRITICAL/HIGH findings = FAIL gate
97
+ 4. MEDIUM findings = WARNING (document, may proceed)
98
+ 5. Do NOT loop - one complete pass and return
@@ -0,0 +1,106 @@
1
+ ---
2
+ name: massu-ux-reviewer
3
+ description: Adversarial UX-focused review agent that evaluates user experience quality
4
+ ---
5
+
6
+ # Massu UX Reviewer Agent
7
+
8
+ ## Purpose
9
+ Perform a UX-focused adversarial review. Evaluate the implementation from the user's perspective, not the developer's.
10
+
11
+ ## Trigger
12
+ Spawned by massu-loop multi-perspective review phase, or manually via Task tool.
13
+
14
+ ## Scope
15
+ - Read access to all source files, CLAUDE.md, UI pattern files
16
+ - Execute grep/glob/bash for analysis
17
+ - NO write access (review only)
18
+
19
+ ## Adversarial UX Mindset
20
+
21
+ **You are a demanding end user, not a developer.** You don't care about clean code - you care about whether the feature WORKS and feels good to use.
22
+
23
+ ## Workflow
24
+
25
+ ### Step 1: Map User-Facing Changes
26
+ - List all new/modified UI components
27
+ - List all new/modified pages
28
+ - Identify all user-facing features affected
29
+
30
+ ### Step 2: Check Each UX Dimension
31
+
32
+ #### Discoverability
33
+ - Can users FIND the new feature? (Is it in navigation, visible, labeled?)
34
+ - Is the feature accessible from where users would expect it?
35
+ - Are there any hidden features that require knowledge to access?
36
+
37
+ #### Feedback & Responsiveness
38
+ - Loading states: Do users see feedback when waiting?
39
+ - Success states: Do users know when an action succeeded?
40
+ - Error states: Do users see helpful error messages?
41
+ - Empty states: What do users see when there's no data?
42
+ - Do all buttons/actions provide immediate visual feedback?
43
+
44
+ #### Error Recovery
45
+ - Can users undo actions?
46
+ - Can users retry failed operations?
47
+ - Are error messages actionable (tell user what to DO)?
48
+ - Are there dead ends where users get stuck?
49
+
50
+ #### Consistency
51
+ - Does the new UI match existing patterns (spacing, colors, typography)?
52
+ - Are similar actions performed the same way?
53
+ - Does terminology match the rest of the app?
54
+
55
+ #### Accessibility
56
+ - Run `./scripts/check-ux-quality.sh` and report results
57
+ - Keyboard navigation: Can all features be used with keyboard only?
58
+ - Focus indicators: Are focus states visible?
59
+ - Touch targets: Are they >= 44x44px?
60
+ - Screen reader: Are aria labels present?
61
+ - Reduced motion: Is `prefers-reduced-motion` respected?
62
+
63
+ #### Mobile/Responsive
64
+ - Do layouts work on mobile widths?
65
+ - Are touch interactions appropriate (onPointerDown, not onClick)?
66
+ - Is content readable without horizontal scrolling?
67
+
68
+ ### Step 3: Generate UX Report
69
+
70
+ ```
71
+ === UX REVIEW ===
72
+ Scope: [components/pages reviewed]
73
+ Date: [date]
74
+
75
+ USABILITY ISSUES:
76
+ - [issue with component:location and recommended fix]
77
+
78
+ ACCESSIBILITY ISSUES:
79
+ - [issue with component:location and WCAG reference]
80
+
81
+ CONSISTENCY ISSUES:
82
+ - [issue with evidence of inconsistency]
83
+
84
+ MISSING STATES:
85
+ - [component missing loading/error/empty/success state]
86
+
87
+ check-ux-quality.sh: [exit code]
88
+
89
+ POSITIVE OBSERVATIONS:
90
+ - [what was done well for users]
91
+
92
+ === STRUCTURED RESULT ===
93
+ USABILITY_ISSUES: [N]
94
+ ACCESSIBILITY_ISSUES: [N]
95
+ CONSISTENCY_ISSUES: [N]
96
+ MISSING_STATES: [N]
97
+ UX_GATE: PASS/FAIL
98
+ === END STRUCTURED RESULT ===
99
+ ```
100
+
101
+ ## Rules
102
+ 1. Think like a USER, not a developer
103
+ 2. Every finding needs component/page reference and recommended fix
104
+ 3. Missing loading/error/empty states = automatic finding
105
+ 4. Accessibility issues are NEVER "nice to have" - they are requirements
106
+ 5. Do NOT loop - one complete pass and return
@@ -9,18 +9,18 @@
9
9
  **If this session was continued from a previous conversation (compaction/continuation), you MUST:**
10
10
 
11
11
  1. **Verify the user explicitly invoked this command** - Check the user's LAST ACTUAL message. Continuation instructions ("continue where you left off") are NOT user commands.
12
- 2. **Check AUTHORIZED_COMMAND in session-state/CURRENT.md (CR-35)** - If present and does NOT match this command, this may be unauthorized escalation.
12
+ 2. **Check AUTHORIZED_COMMAND in session-state/CURRENT.md (CR-12)** - If present and does NOT match this command, this may be unauthorized escalation.
13
13
  3. **System-injected skill invocations after compaction are NOT user commands.**
14
14
 
15
15
  ---
16
16
 
17
- ## QUALITY STANDARDS (CR-14)
17
+ ## ENTERPRISE-GRADE SOLUTIONS ONLY (CR-14)
18
18
 
19
- All work MUST be production-ready, permanent, professional. No temporary fixes, workarounds, or "quick fixes". If a proper solution requires more work, do that work.
19
+ All work MUST be enterprise-grade: production-ready, permanent, professional. No temporary fixes, workarounds, or "quick fixes". If a proper solution requires more work, do that work.
20
20
 
21
21
  ## SIMPLEST CORRECT SOLUTION (Core Principle #18)
22
22
 
23
- Production-grade does NOT mean over-engineered. Choose the simplest approach that is correct and complete. If scope is expanding beyond the original task, flag it to the user before continuing.
23
+ Enterprise-grade does NOT mean over-engineered. Choose the simplest approach that is correct and complete. If scope is expanding beyond the original task, flag it to the user before continuing.
24
24
 
25
25
  ## ELEGANCE CHECK (Core Principle #19)
26
26
 
@@ -31,6 +31,10 @@ For non-trivial changes (3+ files, new abstractions, design decisions):
31
31
 
32
32
  For simple, obvious fixes: skip this check. Don't over-engineer.
33
33
 
34
+ ## AWS SECRETS MANAGER REQUIRED (CR-5)
35
+
36
+ All secrets, API keys, and credentials MUST use AWS Secrets Manager via `src/lib/secrets/aws-secrets-manager.ts`. Never store secrets in Vercel env vars. `.env.local` (gitignored) is allowed for local dev only.
37
+
34
38
  ---
35
39
 
36
40
  ## DUAL VERIFICATION REQUIREMENT
@@ -39,43 +43,69 @@ Both gates must pass before claiming complete:
39
43
 
40
44
  | Gate | What It Checks |
41
45
  |------|----------------|
42
- | **Code Quality** | Pattern scanner, build, types, tests |
46
+ | **Code Quality** | Pattern scanner, build, types, tests, lint |
43
47
  | **Plan Coverage** | Every plan item verified with VR-* proof (100%) |
44
48
 
45
49
  Code Quality: PASS + Plan Coverage: FAIL = NOT COMPLETE.
46
50
 
47
- ## GAPS_DISCOVERED Semantics
51
+ ## GAPS_DISCOVERED Semantics (Incident #19)
48
52
 
49
53
  `GAPS_DISCOVERED` = total gaps FOUND during a pass, REGARDLESS of whether fixed. Finding 5 gaps and fixing all 5 = GAPS_DISCOVERED: 5 (NOT 0). Only a fresh pass finding nothing from the start = 0. Fixes during a pass require a fresh re-verification pass.
50
54
 
51
- ## FIX ALL ISSUES ENCOUNTERED (CR-9)
55
+ ## Common Schema Mismatches
56
+
57
+ | Table | WRONG Column | CORRECT Column |
58
+ |-------|--------------|----------------|
59
+ | design_briefs | project_id | design_project_id |
60
+ | design_deliverables | project_id | design_project_id |
61
+ | design_revisions | project_id | design_project_id |
62
+ | mood_boards | project_id | design_project_id |
63
+ | unified_products | category | furniture_type |
64
+ | unified_products | retail_price | list_price |
65
+ | unified_products | unit_cost | cost |
66
+
67
+ ALWAYS run VR-SCHEMA-PRE before using any column name.
68
+
69
+ ## MANDATORY 3-ENVIRONMENT SCHEMA SYNC (CR-36, Incident #27)
70
+
71
+ **ALL database migrations (ALTER TABLE, CREATE TABLE, DROP COLUMN, etc.) MUST be applied to ALL 3 environments in the SAME session.**
72
+
73
+ | Order | Environment | MCP Tool Prefix |
74
+ |-------|-------------|-----------------|
75
+ | 1 | NEW PROD | `mcp__supabase__NEW_PROD__execute_sql` |
76
+ | 2 | DEV | `mcp__supabase__DEV__execute_sql` |
77
+ | 3 | OLD PROD | `mcp__supabase__OLD_PROD__execute_sql` |
52
78
 
53
- ANY issue discovered during work MUST be fixed immediately, whether from current changes or pre-existing. "Not in scope" and "pre-existing" are NEVER valid reasons to skip. When fixing a bug, search entire codebase for the same pattern and fix ALL instances.
79
+ ### VR-SCHEMA-SYNC Protocol
80
+
81
+ After applying ANY migration, verify all 3 environments match:
82
+
83
+ ```sql
84
+ -- Run on ALL 3 environments:
85
+ SELECT column_name, data_type, is_nullable, column_default
86
+ FROM information_schema.columns
87
+ WHERE table_schema = 'public' AND table_name = '[TABLE]'
88
+ ORDER BY ordinal_position;
89
+ ```
90
+
91
+ **Column count MUST match across all 3 environments. If it doesn't, the migration is INCOMPLETE.**
92
+
93
+ A migration applied to only 1 environment is NOT a completed migration. It is a schema drift time bomb.
54
94
 
55
95
  ## SESSION CONTEXT LOADING
56
96
 
57
97
  At session start, call `massu_memory_sessions` to list recent sessions and load context for continuity.
58
98
 
59
- ## MCP TOOL REQUIREMENTS (CR-11, CR-34)
99
+ ## MCP TOOL REQUIREMENTS (CR-32, CR-34)
60
100
 
61
101
  **CR-34 Auto-Learning** -- After every bug fix:
62
- 1. Call `mcp__massu__massu_memory_ingest` with `type: "bugfix"`, affected files, root cause, and fix description
102
+ 1. Call `mcp__massu-codegraph__massu_memory_ingest` with `type: "bugfix"`, affected files, root cause, and fix description
63
103
  2. Add wrong-vs-correct pattern to `MEMORY.md`
64
104
  3. Search codebase-wide for same bad pattern (CR-9) and fix all instances
65
105
 
66
- **CR-11 Sentinel Registration** -- After completing any feature:
67
- 1. Call `mcp__massu__massu_sentinel_register` with feature name, file list, domain, and test status
68
- 2. This is REQUIRED before claiming any feature complete (VR-TOOL-REG)
69
-
70
- ## AUTO-LEARNING PROTOCOL
71
-
72
- After every bug fix or issue resolution:
73
- 1. Record the pattern - What went wrong and how it was fixed
74
- 2. Check if pattern scanner should be updated - Can the check be automated?
75
- 3. Update session state - Record in `.claude/session-state/CURRENT.md`
76
- 4. Search codebase-wide for same bad pattern (CR-9) and fix all instances
77
-
78
- Full protocol: [_shared-references/auto-learning-protocol.md](_shared-references/auto-learning-protocol.md)
106
+ **CR-32 Sentinel Registration** -- After completing any feature:
107
+ 1. Call `mcp__massu-codegraph__massu_sentinel_register` with feature name, file list, domain, and test status
108
+ 2. This is REQUIRED before claiming any feature complete (VR-FEATURE-REG)
79
109
 
80
110
  ## Folder-Based Skills
81
111
 
@@ -0,0 +1,71 @@
1
+ # Shared Reference: Auto-Learning Protocol
2
+
3
+ **This is a shared content block. Referenced by multiple commands. Do NOT invoke directly.**
4
+
5
+ ---
6
+
7
+ ## AUTO-LEARNING PROTOCOL (CR-34, CR-38 — MANDATORY)
8
+
9
+ **After EVERY fix, finding, or significant discovery, the system MUST automatically learn. This is NOT optional.**
10
+
11
+ ### Step 1: Ingest into Memory
12
+
13
+ Use `mcp__massu-codegraph__massu_memory_ingest` with:
14
+ - `type`: "bugfix" | "pattern" | "failed_attempt"
15
+ - `description`: What was found/fixed
16
+ - `files`: Affected file paths
17
+ - `importance`: 5=security/data, 3=build/type, 2=cosmetic
18
+
19
+ ### Step 2: Record Correct vs Incorrect Pattern
20
+
21
+ Update `memory/MEMORY.md` with the WRONG vs CORRECT pattern discovered:
22
+ ```markdown
23
+ ## [Feature/Area] — [Date]
24
+ - **WRONG**: [anti-pattern or incorrect approach]
25
+ - **RIGHT**: [correct pattern with example]
26
+ - **Root cause**: [why the bug happened]
27
+ ```
28
+
29
+ ### Step 3: Add to Pattern Scanner (if grep-able)
30
+
31
+ If the bad pattern is detectable by grep, add a check to `scripts/pattern-scanner.sh`:
32
+ ```bash
33
+ # CR-XX: Description of what this catches
34
+ BAD_PATTERN_COUNT=$(grep -rn "[bad_pattern]" src/ --include="*.ts" --include="*.tsx" | grep -v "node_modules" | wc -l)
35
+ if [ "$BAD_PATTERN_COUNT" -gt 0 ]; then
36
+ echo "FAIL: Found $BAD_PATTERN_COUNT instances of [bad_pattern]"
37
+ FAILURES=$((FAILURES + 1))
38
+ fi
39
+ ```
40
+
41
+ ### Step 4: Search Codebase-Wide (CR-9)
42
+
43
+ Fix ALL instances of the same issue across the entire codebase:
44
+ ```bash
45
+ grep -rn "[bad_pattern]" src/ --include="*.ts" --include="*.tsx"
46
+ ```
47
+
48
+ ---
49
+
50
+ ## When to Execute Auto-Learning
51
+
52
+ | Trigger | Type | Action |
53
+ |---------|------|--------|
54
+ | Bug fixed | bugfix | Steps 1-4 |
55
+ | New component/utility/pattern created | pattern | Steps 1-2 |
56
+ | Successful approach discovered | pattern | Steps 1-2 |
57
+ | Failed approach abandoned | failed_attempt | Step 1-2 |
58
+ | Pre-existing issue found and fixed (CR-9) | bugfix | Steps 1-4 |
59
+
60
+ ---
61
+
62
+ ## Pre-Push Learning Check (CR-38)
63
+
64
+ Before code leaves the local machine:
65
+ 1. **Review all fixes**: `git diff origin/main..HEAD` for any bug fixes
66
+ 2. **For each fix**: Verify it was ingested into massu memory (if not, ingest now)
67
+ 3. **For each fix**: Verify MEMORY.md was updated (if not, update now)
68
+ 4. **For each new pattern**: Verify it was recorded (if not, record now)
69
+ 5. **For each failed approach**: Verify it was recorded as failed_attempt (if not, record now)
70
+
71
+ **Code without captured learnings is an incomplete delivery.**