@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,188 @@
1
+ # Loop Controller
2
+
3
+ > Reference doc for `/massu-loop`. Return to main file for overview.
4
+
5
+ ## MANDATORY LOOP CONTROLLER (EXECUTE THIS - DO NOT SKIP)
6
+
7
+ **This section is the EXECUTION ENTRY POINT. You MUST follow these steps exactly.**
8
+
9
+ ### How This Command Works
10
+
11
+ This command is a **loop controller** for implementation + verification. Your job is to:
12
+ 1. Extract plan items and implement them
13
+ 2. After implementation, spawn a `massu-plan-auditor` subagent for verification
14
+ 3. Parse the structured result (`GAPS_DISCOVERED: N`)
15
+ 4. If gaps discovered > 0: fix gaps, then spawn ANOTHER FRESH auditor pass
16
+ 5. Only when a COMPLETE FRESH PASS discovers ZERO gaps can you declare complete
17
+
18
+ **The verification audit runs inside Task subagents. This prevents early termination.**
19
+
20
+ ### CRITICAL: GAPS_DISCOVERED Semantics (Incident #19, Feb 7, 2026)
21
+
22
+ **`GAPS_DISCOVERED` = total gaps FOUND during the pass, REGARDLESS of whether they were also fixed.**
23
+
24
+ | Scenario | GAPS_DISCOVERED | Loop Action |
25
+ |----------|----------------|-------------|
26
+ | Pass finds 0 gaps | 0 | **EXIT** - verification complete |
27
+ | Pass finds 5 gaps, fixes all 5 | **5** (NOT 0) | **CONTINUE** - must re-verify |
28
+ | Pass finds 3 gaps, fixes 1, 2 need controller | **3** | **CONTINUE** - fix remaining, re-verify |
29
+
30
+ **THE RULE**: A clean pass means zero gaps DISCOVERED from the start. Fixing gaps during a pass does NOT make it a clean pass. The fixes themselves could introduce new issues. Only a fresh pass starting clean and finding nothing proves correctness.
31
+
32
+ ### Execution Protocol
33
+
34
+ ```
35
+ PLAN_PATH = $ARGUMENTS (the plan file path or task description)
36
+ iteration = 0
37
+
38
+ # Phase 1: IMPLEMENT (do the work)
39
+ # Read plan, extract items, implement each one with VR-* proof
40
+
41
+ # Phase 1.5: MULTI-PERSPECTIVE REVIEW (after implementation, before verification)
42
+ # Spawn 3 focused review subagents IN PARALLEL for independent analysis
43
+ # Each reviewer has an adversarial mindset and a SINGLE focused concern (Principle #20)
44
+ # Elegance/simplicity assessment happens in Phase 2.1 POST-BUILD REFLECTION (Q4)
45
+
46
+ security_result = Task(subagent_type="massu-security-reviewer", model="opus", prompt="
47
+ Review implementation for plan: {PLAN_PATH}
48
+ Focus: Security vulnerabilities, auth gaps, input validation, data exposure
49
+ Check all new/modified files. Return structured result with SECURITY_GATE.
50
+ ")
51
+
52
+ architecture_result = Task(subagent_type="massu-architecture-reviewer", model="opus", prompt="
53
+ Review implementation for plan: {PLAN_PATH}
54
+ Focus: Design issues, coupling problems, pattern compliance, scalability
55
+ Check all new/modified files. Return structured result with ARCHITECTURE_GATE.
56
+ ")
57
+
58
+ ux_result = Task(subagent_type="massu-ux-reviewer", model="sonnet", prompt="
59
+ Review implementation for plan: {PLAN_PATH}
60
+ Focus: User experience, accessibility, loading/error/empty states, consistency
61
+ Check all new/modified UI files. Return structured result with UX_GATE.
62
+ ")
63
+
64
+ # Parse results and fix any CRITICAL/HIGH findings before proceeding to verification
65
+ # FAIL gate = must fix before proceeding
66
+ # WARN findings = document and proceed
67
+
68
+ # Phase 1.6: TEST-FIRST FOR CRITICAL FINDINGS
69
+ # If ANY Phase 1.5 reviewer flagged a CRITICAL-severity BUG (not pattern violation):
70
+ # 1. Read _shared-references/test-first-protocol.md
71
+ # 2. For EACH critical bug finding:
72
+ # - Write a failing test that demonstrates the bug (Step 1)
73
+ # - Verify the test fails for the expected reason (Step 2)
74
+ # - Apply the fix (Step 3)
75
+ # - Verify the test passes (Step 4)
76
+ # 3. Report TEST_FIRST_GATE: PASS or SKIPPED (with reason)
77
+ # If NO critical bug findings: skip this phase entirely
78
+
79
+ # Phase 2: VERIFY (audit loop - STRUCTURAL)
80
+ WHILE true:
81
+ iteration += 1
82
+
83
+ # Run circuit breaker check (CR-37: detect stagnation)
84
+ bash scripts/hooks/loop-circuit-breaker.sh --pass {iteration} --plan-trajectory .claude/loop-state/plan-trajectory.json
85
+ # Parse circuit breaker output - BAIL_AND_REPLAN is a structural halt
86
+ IF CIRCUIT_BREAKER_STATUS == "DEPTH_EXCEEDED":
87
+ Output: "CIRCUIT BREAKER: Loop depth exceeded (nested spawn detected)."
88
+ Output: "Current LOOP_DEPTH exceeds MAX_LOOP_DEPTH. Refusing to continue."
89
+ STOP loop immediately — cascade prevention.
90
+
91
+ IF CIRCUIT_BREAKER_STATUS == "BAIL_AND_REPLAN":
92
+ Output: "CIRCUIT BREAKER: The current approach is not converging after {iteration} passes."
93
+ Output: "No progress: {no_progress_count} passes | Same errors: {same_error_count} passes"
94
+ Output: "Options: (a) Re-plan with different approach (b) Continue current approach (c) Stop"
95
+ AskUserQuestion: "The loop has stalled. How should we proceed?"
96
+ IF user chooses re-plan: STOP loop, output current state, recommend /massu-create-plan
97
+ IF user chooses continue: CONTINUE loop (reset circuit breaker: bash scripts/hooks/loop-circuit-breaker.sh --reset)
98
+ IF user chooses stop: STOP loop, output current state as incomplete
99
+
100
+ IF CIRCUIT_BREAKER_STATUS == "PLAN_FUNDAMENTALLY_WRONG":
101
+ Output: "CIRCUIT BREAKER: Plan is fundamentally wrong — {distinct_failures} different items have failed."
102
+ Output: "This indicates a systemic plan issue, not isolated implementation problems."
103
+ Output: "Options:"
104
+ Output: " (a) DISPOSE plan and regenerate from scratch (preserves learnings)"
105
+ Output: " (b) Continue with current plan (override)"
106
+ Output: " (c) Stop and review manually"
107
+ AskUserQuestion: "The plan appears fundamentally flawed. How should we proceed?"
108
+ IF user chooses dispose:
109
+ - Save failed items + error context to plan trajectory file
110
+ - STOP loop, output current state
111
+ - Recommend: /massu-create-plan with failed items as constraints
112
+ - The NEW plan goes through the same zero-gaps audit loop before implementation
113
+ IF user chooses continue: CONTINUE loop (reset: bash scripts/hooks/loop-circuit-breaker.sh --reset)
114
+ IF user chooses stop: STOP loop, output current state as incomplete
115
+
116
+ # Spawn auditor subagent for ONE complete verification pass
117
+ result = Task(subagent_type="massu-plan-auditor", model="opus", prompt="
118
+ Audit iteration {iteration} for plan: {PLAN_PATH}
119
+ Execute ONE complete audit pass. Verify ALL deliverables.
120
+ Check code quality (patterns, build, types, tests).
121
+ Check plan coverage (every item verified with proof).
122
+ Fix any gaps you find (code or plan document).
123
+
124
+ CRITICAL INSTRUCTION FOR GAPS_DISCOVERED:
125
+ Report GAPS_DISCOVERED as the total number of gaps you FOUND during this pass,
126
+ EVEN IF you also fixed them. Finding 5 gaps and fixing all 5 = GAPS_DISCOVERED: 5.
127
+ A clean pass that finds nothing wrong from the start = GAPS_DISCOVERED: 0.
128
+ Do NOT report 0 just because you fixed everything. The loop controller needs to know
129
+ whether this was a clean pass (found nothing) or a dirty pass (found and fixed things).
130
+
131
+ Return the structured result block with GAPS_DISCOVERED (not GAPS_FOUND).
132
+ ")
133
+
134
+ # Parse structured result
135
+ gaps = parse GAPS_DISCOVERED from result
136
+
137
+ # Report iteration to user
138
+ Output: "Verification iteration {iteration}: {gaps} gaps discovered"
139
+
140
+ IF gaps == 0:
141
+ Output: "ALL GATES PASSED - Clean pass with zero gaps discovered in iteration {iteration}"
142
+ BREAK
143
+ ELSE:
144
+ Output: "{gaps} gaps discovered in iteration {iteration}, starting fresh re-verification..."
145
+ # Fix code-level gaps the auditor identified but couldn't fix
146
+ # Then continue the loop for re-verification
147
+ CONTINUE
148
+ END WHILE
149
+
150
+ # Phase 2.1: POST-BUILD REFLECTION + MANDATORY MEMORY PERSIST (CR-38)
151
+ # See references/auto-learning.md for full protocol
152
+ ```
153
+
154
+ ### Rules for the Loop Controller
155
+
156
+ | Rule | Meaning |
157
+ |------|---------|
158
+ | **NEVER output a final verdict while gaps discovered > 0** | Only a CLEAN zero-gap-from-start iteration produces the final report |
159
+ | **NEVER treat "found and fixed" as zero gaps** | Fixing during a pass still means gaps were discovered |
160
+ | **NEVER ask user "should I continue?"** | The loop is mandatory - just execute it |
161
+ | **NEVER stop after fixing gaps** | Fixing gaps requires a FRESH re-audit to verify the fixes |
162
+ | **ALWAYS use Task tool for verification passes** | Subagents keep context clean |
163
+ | **ALWAYS parse GAPS_DISCOVERED from result** | This is the loop control variable (DISCOVERED, not REMAINING) |
164
+ | **Maximum 10 iterations** | If still failing after 10, report to user with remaining gaps |
165
+ | **ALWAYS run multi-perspective review after implementation** | 3 reviewers catch different issues than 1 auditor |
166
+ | **Run review subagents IN PARALLEL** | Security, architecture, UX reviews are independent |
167
+ | **Fix CRITICAL/HIGH findings before verification** | Don't waste auditor passes on known issues |
168
+ | **VR-PIPELINE for data features (CR-43)** | After implementing any data pipeline (AI, cron, generation, ETL), trigger it manually and verify non-empty output before marking complete |
169
+
170
+ ### Why This Architecture Exists
171
+
172
+ **Incident #14 (Jan 30, 2026)**: Audit loop terminated after 1 pass with 6 open gaps. User had to manually intervene. Root cause: instructional "MUST loop" text competed with default "report and stop" behavior. By making the loop STRUCTURAL (spawn subagent, check result, loop), early termination becomes structurally impossible.
173
+
174
+ **Incident #19 (Feb 7, 2026)**: Auditor found 16 gaps and fixed all 16 in the same pass, reported GAPS_FOUND: 0. Loop exited after 1 iteration without verifying the fixes. GAPS_DISCOVERED (not GAPS_REMAINING) is the correct metric.
175
+
176
+ ---
177
+
178
+ ### Subagent Budget Discipline
179
+
180
+ The loop controller (main agent) coordinates; subagents execute scoped work. Follow these principles to prevent subagent sprawl:
181
+
182
+ | Principle | Meaning |
183
+ |-----------|---------|
184
+ | **One task per subagent** | Each Task call has a single, scoped objective (Principle #20) |
185
+ | **Main agent fixes, subagent verifies** | Controller fixes code-level gaps; auditor subagent re-verifies |
186
+ | **No nested spawns** | Subagents NEVER spawn their own subagents (circuit breaker enforces via LOOP_DEPTH) |
187
+ | **Parallel only when independent** | Review agents (security, architecture, UX) run in parallel; sequential passes run sequentially |
188
+ | **Budget awareness** | Each subagent pass costs ~20-40K tokens. 10 iterations = significant cost. Fix root causes, not symptoms |
@@ -0,0 +1,78 @@
1
+ # Plan Item Extraction
2
+
3
+ > Reference doc for `/massu-loop`. Return to main file for overview.
4
+
5
+ ## PLAN ITEM EXTRACTION PROTOCOL (MANDATORY - STEP 0)
6
+
7
+ **Before ANY implementation, extract ALL plan items into a trackable checklist.**
8
+
9
+ ### Step 0.1: Read Plan Document (Not Memory)
10
+
11
+ ```bash
12
+ cat [PLAN_FILE_PATH]
13
+ ```
14
+
15
+ **You MUST read the plan file. Do NOT rely on memory or summaries.**
16
+
17
+ ### Step 0.2: Extract ALL Deliverables
18
+
19
+ For EACH section of the plan, extract concrete items into a table:
20
+
21
+ ```markdown
22
+ ## PLAN ITEM EXTRACTION
23
+
24
+ ### Source Document
25
+ - **Plan File**: [path]
26
+ - **Total Sections**: [N]
27
+
28
+ ### Extracted Items
29
+ | Item # | Type | Description | Location | Verification Command | Status |
30
+ |--------|------|-------------|----------|---------------------|--------|
31
+ | P1-001 | FILE_CREATE | Component.tsx | src/components/ | ls -la [path] | PENDING |
32
+ | P1-002 | PROCEDURE | router.method | src/server/api/ | grep "method" [router] | PENDING |
33
+
34
+ ### Item Types
35
+ FILE_CREATE, FILE_MODIFY, COMPONENT, PROCEDURE, MIGRATION, FEATURE, REMOVAL (VR-NEGATIVE), REFACTOR
36
+
37
+ ### Coverage Summary
38
+ - **Total Items**: [N] | **Verified Complete**: 0 | **Coverage**: 0%
39
+ ```
40
+
41
+ ### Step 0.3: Create Verification Commands
42
+
43
+ | Item Type | Verification Method | Expected Result |
44
+ |-----------|---------------------|-----------------|
45
+ | FILE_CREATE | `ls -la [path]` | File exists, size > 0 |
46
+ | FILE_MODIFY | `grep "[change]" [file]` | Pattern found |
47
+ | COMPONENT | `grep "export.*ComponentName" [index]` | Export exists |
48
+ | PROCEDURE | `grep "[procedure]:" [router]` | Procedure defined |
49
+ | MIGRATION | `SELECT column_name FROM information_schema` | Column exists |
50
+ | FEATURE | Feature-specific grep | Functionality present |
51
+ | REMOVAL | `grep -rn "[old]" src/ \| wc -l` | 0 matches |
52
+
53
+ ### Step 0.4: Track Coverage Throughout
54
+
55
+ After EVERY implementation action, update coverage count and verify with proof.
56
+
57
+ ---
58
+
59
+ ## PLAN DOCUMENT COMPLETION TRACKING (MANDATORY)
60
+
61
+ Add completion table to TOP of plan document with status for each task:
62
+
63
+ ```markdown
64
+ # IMPLEMENTATION STATUS
65
+
66
+ **Plan**: [Name] | **Status**: COMPLETE/IN_PROGRESS | **Last Updated**: [date]
67
+
68
+ | # | Task/Phase | Status | Verification | Date |
69
+ |---|------------|--------|--------------|------|
70
+ | 1 | [description] | 100% COMPLETE | VR-GREP: 0 refs | 2026-01-20 |
71
+ ```
72
+
73
+ ### VR-PLAN-STATUS Verification
74
+
75
+ ```bash
76
+ grep "IMPLEMENTATION STATUS" [plan_file]
77
+ grep -c "100% COMPLETE\|DONE\|\*\*DONE\*\*" [plan_file]
78
+ ```
@@ -0,0 +1,140 @@
1
+ # VR-PLAN Verification Details
2
+
3
+ > Reference doc for `/massu-loop`. Return to main file for overview.
4
+
5
+ ## VR-PLAN: VERIFICATION PLANNING STEP
6
+
7
+ **Before executing ANY verification checks, ENUMERATE all applicable VR-* checks first.**
8
+
9
+ ```markdown
10
+ ### VR-PLAN: Verification Strategy
11
+
12
+ **Work being verified**: [description]
13
+ **Domains touched**: [database / UI / API / auth / build / config]
14
+
15
+ | # | VR-* Check | Target File/Component | Why Applicable | Status |
16
+ |---|------------|----------------------|----------------|--------|
17
+ | 1 | VR-BUILD | Full project | Always required | PENDING |
18
+ | 2 | VR-TYPE | Full project | Always required | PENDING |
19
+ | 3 | VR-TEST | Full project | Always required (CR-21) | PENDING |
20
+ | ... | ... | ... | ... | ... |
21
+
22
+ **Execution order**: VR-SCHEMA first -> VR-BUILD/VR-TYPE -> VR-TEST -> VR-RENDER/VR-COUPLING -> VR-RUNTIME
23
+ ```
24
+
25
+ ### Mandatory Checks (ALWAYS include)
26
+
27
+ | Check | When to Include |
28
+ |-------|----------------|
29
+ | VR-BUILD | ALWAYS |
30
+ | VR-TYPE | ALWAYS |
31
+ | VR-TEST | ALWAYS (CR-21) |
32
+ | VR-FILE | When files created |
33
+ | VR-GREP | When code added |
34
+ | VR-NEGATIVE | When code removed |
35
+ | VR-SCHEMA | When DB changed |
36
+ | VR-DATA | When config-driven features touched |
37
+ | VR-RENDER | When UI components created |
38
+ | VR-COUPLING | When backend features added |
39
+ | VR-HANDLER | When buttons/actions added |
40
+ | VR-API-CONTRACT | When frontend calls backend |
41
+ | VR-PLAN-COVERAGE | When implementing a plan |
42
+ | VR-SPEC-MATCH | When UI items specify CSS classes/structure (CR-42) |
43
+ | VR-PIPELINE | When data pipeline features implemented (CR-43) |
44
+ | VR-RUNTIME | After all other checks pass |
45
+
46
+ Do NOT start verification until VR-PLAN is complete with all domains, checks, targets, and execution order.
47
+
48
+ ---
49
+
50
+ ## COMPLETION CRITERIA
51
+
52
+ Massu Loop is COMPLETE **only when BOTH gates pass: Code Quality AND Plan Coverage**.
53
+
54
+ ### GATE 1: Code Quality Verification (All Must Pass in SAME Audit Run)
55
+ - [ ] All phases executed, all checkpoints passed with zero gaps
56
+ - [ ] Pattern scanner: Exit 0
57
+ - [ ] Type check: 0 errors
58
+ - [ ] Build: Exit 0
59
+ - [ ] Lint: Exit 0
60
+ - [ ] Prisma validate: Exit 0
61
+ - [ ] Tests: ALL PASS (MANDATORY)
62
+ - [ ] Security: No secrets staged
63
+ - [ ] VR-RENDER: All UI components rendered in pages
64
+
65
+ ### GATE 2: Plan Coverage Verification
66
+ - [ ] Plan file read (actual file, not memory)
67
+ - [ ] ALL items extracted into tracking table
68
+ - [ ] EACH item verified with VR-* proof
69
+ - [ ] Coverage = 100% (99% = FAIL)
70
+ - [ ] Plan document updated with completion status
71
+
72
+ ### DUAL VERIFICATION REQUIREMENT
73
+
74
+ **BOTH gates must pass:**
75
+
76
+ ```markdown
77
+ ## DUAL VERIFICATION RESULT
78
+ | Gate | Status | Details |
79
+ |------|--------|---------|
80
+ | Code Quality | PASS/FAIL | Pattern scanner, build, types |
81
+ | Plan Coverage | PASS/FAIL | X/Y items (Z%) |
82
+
83
+ **RESULT: COMPLETE** (only if both PASS)
84
+ ```
85
+
86
+ **Code Quality: PASS + Plan Coverage: FAIL = NOT COMPLETE**
87
+
88
+ ### Additional Verification
89
+ - [ ] User Flow: ALL buttons, navigation, props, callbacks, state, e2e flows verified
90
+ - [ ] Component Reuse: Checked existing before creating new
91
+ - [ ] DB verified: all environments
92
+ - [ ] Session state shows COMPLETED
93
+ - [ ] Phase archives created
94
+ - [ ] Help site updated for user-facing changes (or N/A)
95
+ - [ ] Plan document completion table added at TOP
96
+
97
+ ---
98
+
99
+ ## COMPLETION OUTPUT
100
+
101
+ ```markdown
102
+ ## [MASSU LOOP - COMPLETE]
103
+
104
+ ### Dual Verification Certification
105
+ - **Audit loops required**: N (loop #N achieved 0 gaps + 100% coverage)
106
+ - **Code Quality Gate**: PASS
107
+ - **Plan Coverage Gate**: PASS (X/X items = 100%)
108
+ - **CERTIFIED**: Both gates passed in single complete audit
109
+
110
+ ### Summary
111
+ - Total iterations: N
112
+ - Total checkpoints: N (all PASSED)
113
+ - Final audit loop: #N - ZERO GAPS + 100% COVERAGE
114
+
115
+ ### GATE 1: Code Quality Evidence
116
+ | Gate | Command | Result |
117
+ |------|---------|--------|
118
+ | Pattern scanner | `./scripts/pattern-scanner.sh` | Exit 0 |
119
+ | Type check | `npx tsc --noEmit` | 0 errors |
120
+ | Build | `npm run build` | Exit 0 |
121
+ | DB (DEV) | VR-SCHEMA | VERIFIED |
122
+ | DB (PROD) | VR-SCHEMA | VERIFIED |
123
+
124
+ ### GATE 2: Plan Coverage Evidence
125
+ | Item # | Description | Verification | Status |
126
+ |--------|-------------|--------------|--------|
127
+ | P1-001 | [description] | [VR-* output] | COMPLETE |
128
+ | ... | ... | ... | COMPLETE |
129
+
130
+ **Plan Coverage: X/X items (100%)**
131
+
132
+ ### Plan Document Updated
133
+ - File: [path]
134
+ - Completion table: ADDED at TOP
135
+ - Plan Status: COMPLETE
136
+
137
+ ### Session State
138
+ Updated: session-state/CURRENT.md
139
+ Status: COMPLETED
140
+ ```
@@ -1,13 +1,15 @@
1
1
  ---
2
2
  name: massu-loop-playwright
3
- description: Browser-based audit and fix loop — functional, visual, and performance testing with Playwright
3
+ description: "When user wants browser-based testing, says 'test in browser', 'playwright audit', or needs visual/functional verification with Playwright"
4
4
  allowed-tools: Bash(*), Read(*), Write(*), Edit(*), Grep(*), Glob(*), mcp__plugin_playwright_playwright__*, mcp__playwright__*
5
5
  ---
6
6
  name: massu-loop-playwright
7
7
 
8
+ > **Shared rules apply.** Read `.claude/commands/_shared-preamble.md` before proceeding. CR-5, CR-12 enforced.
9
+
8
10
  # Massu Loop Playwright: Browser-Based Audit & Fix Protocol
9
11
 
10
- **Shared rules**: Read `.claude/commands/_shared-preamble.md` for POST-COMPACTION (CR-35), QUALITY STANDARDS, and CR-9 (fix all issues) rules.
12
+ **Shared rules**: Read `.claude/commands/_shared-preamble.md` for POST-COMPACTION (CR-12), QUALITY STANDARDS, and CR-9 (fix all issues) rules.
11
13
 
12
14
  ---
13
15
 
@@ -30,8 +32,8 @@ name: massu-loop-playwright
30
32
  # Test a specific URL
31
33
  /massu-loop-playwright https://example.com/docs
32
34
 
33
- # Test a specific page path (requires a full URL)
34
- /massu-loop-playwright https://localhost:3000/docs/getting-started
35
+ # Test a local dev server page
36
+ /massu-loop-playwright http://localhost:3000/docs/getting-started
35
37
 
36
38
  # Test multiple pages
37
39
  /massu-loop-playwright https://example.com/docs https://example.com/pricing
@@ -66,8 +68,6 @@ ELSE:
66
68
  - Output artifacts generated by Massu (static sites, reports, etc.)
67
69
  - A local dev server (`http://localhost:...`)
68
70
 
69
- Alternatively, use `--url` to test specific pages when the target app routes are known.
70
-
71
71
  ---
72
72
 
73
73
  ## SAFETY RULE (ABSOLUTE)
@@ -496,7 +496,7 @@ FOR EACH issue in issues WHERE priority <= P2:
496
496
  - Follow ALL CLAUDE.md patterns (no shortcuts)
497
497
 
498
498
  3. VERIFY the fix
499
- - The live site requires a deployment/rebuild to verify browser-side
499
+ - The live site requires a rebuild/deployment to verify browser-side
500
500
  - For code-level verification: run applicable VR-* checks
501
501
  - VR-GREP: Confirm correct pattern is present
502
502
  - VR-NEGATIVE: Confirm incorrect pattern is removed
@@ -786,7 +786,7 @@ Ask the user how to proceed.
786
786
  After EVERY browser-discovered bug fix:
787
787
 
788
788
  ### Step 1: Ingest into Memory
789
- Use `mcp__massu__massu_memory_ingest` with:
789
+ Use `mcp__massu-codegraph__massu_memory_ingest` with:
790
790
  - type: "bugfix"
791
791
  - description: "[Browser symptom] -> [Code fix]"
792
792
  - files: [list of files changed]
@@ -815,7 +815,7 @@ Fix ALL instances, not just the one found on this page.
815
815
 
816
816
  ## START NOW
817
817
 
818
- **Step 0: Write AUTHORIZED_COMMAND to session state (CR-35)**
818
+ **Step 0: Write AUTHORIZED_COMMAND to session state (CR-12)**
819
819
 
820
820
  Before any other work, update `session-state/CURRENT.md` to include:
821
821
  ```