@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,216 @@
1
+ # Approval Points
2
+
3
+ > Reference doc for `/massu-golden-path`. Return to main file for overview.
4
+
5
+ There are exactly 4 approval points (5 when using `--competitive` mode) where the golden path pauses for user input. Everything else runs automatically.
6
+
7
+ ## Approval Point Format
8
+
9
+ ```
10
+ ===============================================================================
11
+ APPROVAL REQUIRED: [TYPE]
12
+ ===============================================================================
13
+
14
+ [Details]
15
+
16
+ OPTIONS:
17
+ "approve" / "yes" to continue
18
+ "modify" to request changes
19
+ "abort" to stop the golden path
20
+
21
+ ===============================================================================
22
+ ```
23
+
24
+ After receiving approval, immediately continue. Do NOT ask "shall I continue?" -- just proceed.
25
+
26
+ ---
27
+
28
+ ## Approval Point #1: PLAN
29
+
30
+ Triggered at: End of Phase 1 (after plan creation + audit loop).
31
+
32
+ ```
33
+ ===============================================================================
34
+ APPROVAL REQUIRED: PLAN
35
+ ===============================================================================
36
+
37
+ Plan created and audited ({iteration} audit passes, 0 gaps).
38
+
39
+ PLAN SUMMARY:
40
+ --------------------------------------------------------------------------
41
+ Feature: [name]
42
+ File: [plan path]
43
+ Total Items: [N]
44
+ Phases: [list]
45
+
46
+ Requirements Coverage: [X]/10 dimensions resolved
47
+ Feasibility: VERIFIED (DB, files, patterns, security)
48
+ Audit Passes: {iteration} (final pass: 0 gaps)
49
+ --------------------------------------------------------------------------
50
+
51
+ OPTIONS:
52
+ "approve" to begin implementation
53
+ "modify: [changes]" to adjust plan
54
+ "abort" to stop
55
+
56
+ ===============================================================================
57
+ ```
58
+
59
+ ---
60
+
61
+ ## Approval Point #2: NEW PATTERN
62
+
63
+ Triggered at: Any phase, when a new pattern is needed that does not exist in CLAUDE.md or patterns/*.md.
64
+
65
+ ```
66
+ ===============================================================================
67
+ APPROVAL REQUIRED: NEW PATTERN
68
+ ===============================================================================
69
+
70
+ A new pattern is needed for: [functionality]
71
+
72
+ Existing patterns checked:
73
+ - [pattern 1]: Not suitable because [reason]
74
+
75
+ PROPOSED NEW PATTERN:
76
+ --------------------------------------------------------------------------
77
+ Name: [Pattern Name]
78
+ Domain: [UI/Database/Auth/etc.]
79
+
80
+ WRONG: [code]
81
+ CORRECT: [code]
82
+ Error if violated: [What breaks]
83
+ --------------------------------------------------------------------------
84
+
85
+ OPTIONS:
86
+ "approve" to save and continue
87
+ "modify: [changes]" to adjust
88
+ "abort" to stop
89
+
90
+ ===============================================================================
91
+ ```
92
+
93
+ ---
94
+
95
+ ## Approval Point #3: COMMIT
96
+
97
+ Triggered at: End of Phase 4 (after all verification gates pass).
98
+
99
+ ```
100
+ ===============================================================================
101
+ APPROVAL REQUIRED: COMMIT
102
+ ===============================================================================
103
+
104
+ All verification checks passed. Ready to commit.
105
+
106
+ VERIFICATION RESULTS:
107
+ --------------------------------------------------------------------------
108
+ Pattern scanner: Exit 0
109
+ Type check: 0 errors
110
+ Build: Exit 0
111
+ Lint: Exit 0
112
+ Prisma: Valid
113
+ Security: No secrets staged, no credentials in code
114
+ VR-RENDER: All UI components rendered
115
+ VR-COUPLING: All backend features exposed in UI
116
+ VR-COLOR: No hardcoded Tailwind colors
117
+ Plan Coverage: [X]/[X] = 100%
118
+ Database: All environments verified
119
+ Help site: UP TO DATE / N/A
120
+ Quality Score: [X.X]/5.0
121
+ --------------------------------------------------------------------------
122
+
123
+ FILES TO BE COMMITTED:
124
+ [list]
125
+
126
+ PROPOSED COMMIT MESSAGE:
127
+ --------------------------------------------------------------------------
128
+ [type]: [description]
129
+
130
+ [body]
131
+
132
+ Co-Authored-By: Claude <noreply@anthropic.com>
133
+ --------------------------------------------------------------------------
134
+
135
+ OPTIONS:
136
+ "approve" to commit and continue to push
137
+ "message: [new message]" to change commit message
138
+ "abort" to stop (changes remain staged)
139
+
140
+ ===============================================================================
141
+ ```
142
+
143
+ ---
144
+
145
+ ## Approval Point #4: PUSH
146
+
147
+ Triggered at: End of Phase 5 (after all push verification tiers pass).
148
+
149
+ ```
150
+ ===============================================================================
151
+ APPROVAL REQUIRED: PUSH TO REMOTE
152
+ ===============================================================================
153
+
154
+ All verification tiers passed. Ready to push.
155
+
156
+ PUSH GATE SUMMARY:
157
+ --------------------------------------------------------------------------
158
+ Commit: [hash]
159
+ Message: [message]
160
+ Files changed: [N] | +[N] / -[N]
161
+ Branch: [branch] -> origin
162
+
163
+ Tier 1 (Quick): PASS
164
+ Tier 2 (Tests): PASS -- Unit: X/X, E2E: X/X, Regression: 0
165
+ Tier 3 (Security): PASS -- Audit: 0 high/crit, RLS: verified, Secrets: clean
166
+ --------------------------------------------------------------------------
167
+
168
+ OPTIONS:
169
+ "approve" / "push" to push to remote
170
+ "abort" to stop (commit remains local)
171
+
172
+ ===============================================================================
173
+ ```
174
+
175
+ ---
176
+
177
+ ## Approval Point #5: WINNER SELECTION (--competitive only)
178
+
179
+ Triggered at: End of Phase 2-COMP-D (after competitive scoring completes). Only present when `--competitive` flag is used.
180
+
181
+ ```
182
+ ===============================================================================
183
+ APPROVAL REQUIRED: WINNER SELECTION
184
+ ===============================================================================
185
+
186
+ Competitive implementation complete. {N} agents scored.
187
+
188
+ COMPETITIVE SCORECARD:
189
+ --------------------------------------------------------------------------
190
+ | Dimension | Agent A ({bias_a}) | Agent B ({bias_b}) | Agent C ({bias_c}) |
191
+ |--------------------|--------------------|--------------------|---------------------|
192
+ | Code Clarity | X/5 | X/5 | X/5 |
193
+ | Pattern Compliance | X/5 | X/5 | X/5 |
194
+ | Error Handling | X/5 | X/5 | X/5 |
195
+ | UX Quality | X/5 | X/5 | X/5 |
196
+ | Test Coverage | X/5 | X/5 | X/5 |
197
+ | **Raw Total** | **XX/25** | **XX/25** | **XX/25** |
198
+ | **Weighted Total** | **XX.X** | **XX.X** | **XX.X** |
199
+
200
+ NOTABLE DIFFERENCES:
201
+ [Aspect]: Agent A did [X], Agent B did [Y]
202
+
203
+ RECOMMENDATION: Agent {X} ({bias}) — [reason]
204
+ --------------------------------------------------------------------------
205
+
206
+ PER-AGENT NOTES:
207
+ Agent A ({bias_a}): [approach summary, strengths, weaknesses]
208
+ Agent B ({bias_b}): [approach summary, strengths, weaknesses]
209
+
210
+ OPTIONS:
211
+ "approve" to accept recommended winner (Agent {X})
212
+ "override [agent_id]" to select a different winner
213
+ "abort" to stop (worktrees remain for manual inspection)
214
+
215
+ ===============================================================================
216
+ ```
@@ -0,0 +1,273 @@
1
+ # Competitive Mode Protocol
2
+
3
+ > Reference doc for `/massu-golden-path --competitive`. Return to main file for overview.
4
+
5
+ **Purpose**: Spawn 2-3 competing implementations of the same plan with different optimization biases, score all implementations, and select the winner before proceeding with Massu's verification rigor.
6
+
7
+ **Triggering**: Only when `/massu-golden-path --competitive` is explicitly used. Never automatic.
8
+
9
+ ---
10
+
11
+ ## Pre-Flight Guard (MANDATORY)
12
+
13
+ Before spawning agents, scan the plan for database migration items:
14
+
15
+ ```
16
+ SCAN plan for:
17
+ - Items with type = MIGRATION
18
+ - Items containing ALTER TABLE, CREATE TABLE, DROP TABLE
19
+ - Items containing RLS policies or grants
20
+ - Items referencing database migrations
21
+
22
+ IF any found:
23
+ ABORT competitive mode with message:
24
+ "Competitive mode cannot run plans with database migrations.
25
+ Apply migrations first, then re-run with --competitive."
26
+ ```
27
+
28
+ This mirrors the `/massu-batch` DB guard pattern (`scripts/batch-db-guard.sh`).
29
+
30
+ ---
31
+
32
+ ## Phase 2-COMP-A: Agent Spawning
33
+
34
+ ### Determine Agent Count & Bias Assignments
35
+
36
+ | Flag | Agents | Bias Assignments |
37
+ |------|--------|-----------------|
38
+ | `--competitive` (default) | 2 | `quality` + `robust` |
39
+ | `--competitive --agents 3` | 3 | `quality` + `ux` + `robust` |
40
+ | `--competitive --biases quality,ux` | 2 | Custom assignment |
41
+
42
+ ### Spawn Agents
43
+
44
+ For each agent, spawn using worktree isolation:
45
+
46
+ ```
47
+ FOR each agent (A, B, [C]):
48
+ Agent(
49
+ isolation: "worktree",
50
+ prompt: [See Phase 2-COMP-B template],
51
+ model: "opus"
52
+ )
53
+ ```
54
+
55
+ All agents spawn in PARALLEL. Each gets an isolated git worktree branch.
56
+
57
+ ---
58
+
59
+ ## Phase 2-COMP-B: Agent Prompt Template
60
+
61
+ Each competing agent receives this prompt, customized with their bias preset:
62
+
63
+ ```
64
+ You are implementing a plan in competitive mode. Your implementation will be
65
+ scored against other agents implementing the same plan with different priorities.
66
+
67
+ PLAN FILE: {plan_path}
68
+ YOUR BIAS: {bias_preset}
69
+ YOUR BRANCH: {worktree_branch}
70
+
71
+ BIAS INSTRUCTIONS:
72
+ {bias_prompt_fragment}
73
+
74
+ IMPLEMENTATION RULES:
75
+ 1. Read the plan from disk and implement ALL items
76
+ 2. Follow ALL CLAUDE.md patterns (ctx.db, protectedProcedure, etc.)
77
+ 3. Do NOT run database migrations (handled separately)
78
+ 4. Run pattern-scanner after each file: ./scripts/pattern-scanner.sh
79
+ 5. Run tsc after implementation: npx tsc --noEmit
80
+ 6. Fix any issues before declaring done
81
+
82
+ OUTPUT FORMAT (at completion):
83
+ ```
84
+ COMPETITIVE_AGENT_RESULT:
85
+ BIAS: {bias}
86
+ BRANCH: {branch}
87
+ STATUS: COMPLETE | FAILED
88
+ FILES_CHANGED: [list]
89
+ SELF_SCORE:
90
+ code_clarity: X/5
91
+ pattern_compliance: X/5
92
+ error_handling: X/5
93
+ ux_quality: X/5
94
+ test_coverage: X/5
95
+ NOTES: [key decisions, trade-offs made]
96
+ ERROR: [if failed, what went wrong]
97
+ ```
98
+ ```
99
+
100
+ ---
101
+
102
+ ## Phase 2-COMP-B.1: Bias Preset Definitions
103
+
104
+ ### Quality Bias
105
+ ```
106
+ YOUR OPTIMIZATION PRIORITY: CODE QUALITY
107
+
108
+ Focus on:
109
+ - Crystal-clear naming for all variables, functions, and components
110
+ - Consistent code structure following established patterns exactly
111
+ - Minimal complexity — prefer simple, readable solutions over clever ones
112
+ - Strong typing with meaningful type names
113
+ - Functions under 50 lines, files under 500 lines
114
+ - Comments only where logic is non-obvious
115
+
116
+ When in doubt between two approaches, choose the one that is easier to read
117
+ and maintain, even if the alternative has slightly better performance or
118
+ handles one more edge case.
119
+ ```
120
+
121
+ ### UX Bias
122
+ ```
123
+ YOUR OPTIMIZATION PRIORITY: USER EXPERIENCE
124
+
125
+ Focus on:
126
+ - Loading states with skeletons for every async operation
127
+ - Error states with clear messages and recovery actions
128
+ - Empty states with helpful guidance
129
+ - Responsive design across mobile, tablet, and desktop
130
+ - Accessibility: aria labels, keyboard navigation, focus management
131
+ - Dark mode support with proper contrast
132
+ - Smooth transitions and micro-interactions
133
+ - Toast notifications for all user actions (success, error, info)
134
+
135
+ When in doubt between two approaches, choose the one that provides the
136
+ better user experience, even if it requires slightly more code.
137
+ ```
138
+
139
+ ### Robust Bias
140
+ ```
141
+ YOUR OPTIMIZATION PRIORITY: ROBUSTNESS & ERROR HANDLING
142
+
143
+ Focus on:
144
+ - Comprehensive input validation at every boundary
145
+ - Try/catch around all async operations with specific error messages
146
+ - Null/undefined guards for all optional data
147
+ - Edge cases: empty arrays, single items, maximum values, concurrent access
148
+ - Defensive coding: never trust external input, always validate
149
+ - Graceful degradation when services are unavailable
150
+ - Proper error propagation with context
151
+
152
+ When in doubt between two approaches, choose the one that handles more
153
+ failure modes, even if it requires slightly more code or complexity.
154
+ ```
155
+
156
+ ---
157
+
158
+ ## Phase 2-COMP-C: Monitoring & Collection
159
+
160
+ ```
161
+ WAIT for all agents to complete
162
+
163
+ FOR each agent result:
164
+ PARSE COMPETITIVE_AGENT_RESULT from output
165
+ IF STATUS == FAILED:
166
+ INCREMENT failure_count
167
+ LOG failure details
168
+
169
+ IF failure_count == total_agents:
170
+ ABORT with total failure error (see error-handling.md)
171
+ ELSE IF failure_count > 0:
172
+ LOG: "{failure_count} agent(s) failed, continuing with {remaining} successful"
173
+ CONTINUE with successful agents only
174
+ ELSE:
175
+ ALL agents completed successfully
176
+ ```
177
+
178
+ ---
179
+
180
+ ## Phase 2-COMP-D: Scoring & Comparison
181
+
182
+ Spawn the `massu-competitive-scorer` agent:
183
+
184
+ ```
185
+ Task(
186
+ subagent_type: "massu-competitive-scorer",
187
+ model: "opus",
188
+ prompt: "
189
+ Score and compare competing implementations.
190
+ Plan: {plan_path}
191
+ Branches: {list of successful worktree branches}
192
+ Bias assignments: {map of branch -> bias}
193
+
194
+ Execute your full scoring workflow and return the structured comparison.
195
+ "
196
+ )
197
+ ```
198
+
199
+ Parse the scorer output for:
200
+ - `WINNER`: branch name
201
+ - `WINNER_BIAS`: bias preset
202
+ - `WINNER_SCORE`: weighted total
203
+ - `RUNNER_UP`: branch name
204
+ - `RUNNER_UP_SCORE`: weighted total
205
+ - `SCORE_MARGIN`: difference
206
+
207
+ ---
208
+
209
+ ## Phase 2-COMP-E: Winner Selection
210
+
211
+ **APPROVAL POINT #5: WINNER SELECTION**
212
+
213
+ Present the scorer's comparative scorecard to the user. See `approval-points.md` for exact format.
214
+
215
+ ### After Approval
216
+
217
+ | User Response | Action |
218
+ |---------------|--------|
219
+ | `approve` | Accept recommended winner, proceed to Phase 2-COMP-F |
220
+ | `override [agent_id]` | Select the specified agent as winner instead |
221
+ | `abort` | Stop golden path, leave worktrees for inspection |
222
+
223
+ ---
224
+
225
+ ## Phase 2-COMP-F: Winner Merge
226
+
227
+ ### Merge Winning Branch
228
+
229
+ ```
230
+ 1. Identify winning worktree branch
231
+ 2. git merge {winning_branch} --no-ff -m "competitive-mode: merge winner ({bias})"
232
+ 3. IF merge conflict:
233
+ Present to user for resolution (see error-handling.md)
234
+ 4. ELSE:
235
+ Merge successful
236
+ ```
237
+
238
+ ### Cleanup Losing Worktrees
239
+
240
+ ```
241
+ FOR each non-winning worktree:
242
+ git worktree remove {path} --force
243
+ git branch -D {branch_name}
244
+
245
+ IF cleanup fails:
246
+ Log warning (non-blocking, see error-handling.md)
247
+ ```
248
+
249
+ ### Post-Merge Verification
250
+
251
+ ```
252
+ 1. Run ./scripts/pattern-scanner.sh (exit 0 required)
253
+ 2. Run npx tsc --noEmit (0 errors required)
254
+ 3. IF either fails:
255
+ Fix issues from merge
256
+ Re-run verification
257
+ ```
258
+
259
+ ### Continue to Phase 2.5
260
+
261
+ After successful merge and verification, proceed directly to Phase 2.5 (Gap & Enhancement Analysis). The winner's implementation is now on the current branch and all subsequent phases (2.5, 3, 4, 5, 6) run normally.
262
+
263
+ ---
264
+
265
+ ## Cost Implications
266
+
267
+ | Mode | Phase 2 Token Multiplier | When to Use |
268
+ |------|-------------------------|-------------|
269
+ | Standard (no flag) | 1x | Most features, incremental changes |
270
+ | `--competitive` (2 agents) | ~2.2x | New modules, critical features, UI-heavy work |
271
+ | `--competitive --agents 3` | ~3.3x | High-stakes features, new domain areas |
272
+
273
+ The multiplier applies ONLY to Phase 2 (implementation). All other phases run once regardless.
@@ -0,0 +1,121 @@
1
+ # Error Handling
2
+
3
+ > Reference doc for `/massu-golden-path`. Return to main file for overview.
4
+
5
+ ## Recoverable Errors
6
+
7
+ Fix automatically -> re-run failed step -> if fixed, continue without pausing -> if not fixable after 3 attempts, pause and report.
8
+
9
+ ## Non-Recoverable Errors
10
+
11
+ ```
12
+ ===============================================================================
13
+ GOLDEN PATH BLOCKED
14
+ ===============================================================================
15
+
16
+ BLOCKER: [Description]
17
+ Required: [Steps to resolve]
18
+ After resolving, run /massu-golden-path again.
19
+
20
+ ===============================================================================
21
+ ```
22
+
23
+ ---
24
+
25
+ ## Abort Handling
26
+
27
+ When user says "abort" at any approval point:
28
+
29
+ ```
30
+ ===============================================================================
31
+ GOLDEN PATH ABORTED
32
+ ===============================================================================
33
+
34
+ Stopped at: [Phase N -- Approval Point]
35
+
36
+ CURRENT STATE:
37
+ Completed phases: [list]
38
+ Pending phases: [list]
39
+ Plan file: [path]
40
+ Files changed: [list]
41
+ Commit created: YES/NO
42
+ Pushed: NO
43
+
44
+ TO RESUME:
45
+ Run /massu-golden-path again with the same plan
46
+ Or run individual commands:
47
+ /massu-loop -- Continue implementation
48
+ /massu-simplify -- Run quality analysis
49
+ /massu-commit -- Run commit verification
50
+ /massu-push -- Run push verification
51
+
52
+ ===============================================================================
53
+ ```
54
+
55
+ ---
56
+
57
+ ## Post-Compaction Re-Verification (CR-42)
58
+
59
+ **After ANY context compaction during a golden path run**, BEFORE continuing implementation:
60
+
61
+ 1. **Re-read the FULL plan document** from disk (CR-5 -- never from memory)
62
+ 2. **Diff every completed item against actual code**: For each item marked complete in the tracking table, re-run its VR-* verification command
63
+ 3. **VR-SPEC-MATCH audit**: For every completed UI item with specific CSS classes/structure in the plan, grep for those EXACT strings in the implementation
64
+ 4. **Flag mismatches**: Any item where implementation doesn't match the plan's exact spec -> mark as gap, fix before continuing
65
+
66
+ This prevents the common failure mode where compaction loses spec details and the agent continues implementing without matching the plan's precise requirements.
67
+
68
+ ---
69
+
70
+ ## Competitive Mode Errors (--competitive only)
71
+
72
+ ### Agent Failure During Implementation
73
+
74
+ **Partial failure** (1 agent fails, 2+ remain): Continue with remaining agents. Log the failure. Score only the successful implementations.
75
+
76
+ **Total failure** (all agents fail):
77
+ ```
78
+ ===============================================================================
79
+ GOLDEN PATH BLOCKED
80
+ ===============================================================================
81
+
82
+ BLOCKER: All competing agents failed during Phase 2-COMP
83
+ Agent A ({bias_a}): [error summary]
84
+ Agent B ({bias_b}): [error summary]
85
+
86
+ Required: Fix the underlying issue, then re-run /massu-golden-path --competitive
87
+ Or run without --competitive to use standard single-agent implementation.
88
+
89
+ ===============================================================================
90
+ ```
91
+
92
+ ### Merge Conflict When Applying Winner
93
+
94
+ If the winning worktree branch cannot be cleanly merged:
95
+ ```
96
+ ===============================================================================
97
+ GOLDEN PATH BLOCKED
98
+ ===============================================================================
99
+
100
+ BLOCKER: Merge conflict when applying winner (Agent {X})
101
+ Conflicting files: [list]
102
+
103
+ Required: Resolve conflicts manually, then continue with Phase 2.5
104
+ Or select a different winner: "override [agent_id]"
105
+
106
+ ===============================================================================
107
+ ```
108
+
109
+ ### Scoring Tie
110
+
111
+ If two or more agents have weighted scores within 0.5 of each other, flag as TIE and present to user for decision via the Winner Selection approval point. The scorer will note `SCORE_MARGIN: < 0.5 (TIE)` and the user must use `override [agent_id]` to select.
112
+
113
+ ### Worktree Cleanup Failure
114
+
115
+ If worktree cleanup fails after winner selection:
116
+ ```
117
+ Warning: Failed to clean up worktree branches. Manual cleanup:
118
+ git worktree remove [path] --force
119
+ git branch -D [branch_name]
120
+ ```
121
+ This is non-blocking — continue with the golden path.
@@ -0,0 +1,53 @@
1
+ # Phase 0: Requirements & Context Loading
2
+
3
+ > Reference doc for `/massu-golden-path`. Return to main file for overview.
4
+
5
+ ## 0.1 Session Context Loading
6
+
7
+ ```
8
+ [GOLDEN PATH -- PHASE 0: REQUIREMENTS & CONTEXT]
9
+ ```
10
+
11
+ - Call `massu_memory_sessions` for recent session context
12
+ - Call `massu_memory_search` + `massu_memory_failures` with feature keywords
13
+ - Read `session-state/CURRENT.md` for any prior state
14
+
15
+ ## 0.2 Requirements Coverage Map
16
+
17
+ Initialize ALL dimensions as `pending`:
18
+
19
+ | # | Dimension | Status | Resolved By |
20
+ |---|-----------|--------|-------------|
21
+ | D1 | Problem & Scope | pending | User request + interview |
22
+ | D2 | Users & Personas | pending | Interview |
23
+ | D3 | Data Model | pending | Phase 1A (DB Reality Check) |
24
+ | D4 | Backend / API | pending | Phase 1A (Codebase Reality Check) |
25
+ | D5 | Frontend / UX | pending | Interview + Phase 1A |
26
+ | D6 | Auth & Permissions | pending | Phase 1A (Security Pre-Screen) |
27
+ | D7 | Error Handling | pending | Phase 1A (Pattern Compliance) |
28
+ | D8 | Security | pending | Phase 1A (Security Pre-Screen) |
29
+ | D9 | Edge Cases | pending | Phase 1A (Question Filtering) |
30
+ | D10 | Performance | pending | Phase 1A (Pattern Compliance) |
31
+
32
+ ## 0.3 Ambiguity Detection (7 Signals)
33
+
34
+ | Signal | Description |
35
+ |--------|-------------|
36
+ | A1 | Vague scope -- no clear boundary |
37
+ | A2 | No success criteria -- no measurable outcome |
38
+ | A3 | Implicit requirements -- unstated but necessary |
39
+ | A4 | Multi-domain -- spans 3+ domains |
40
+ | A5 | Contradictions -- conflicting constraints |
41
+ | A6 | No persona -- unclear who benefits |
42
+ | A7 | New integration -- external service not yet in codebase |
43
+
44
+ **Score >= 2**: Enter interview loop (0.4). **Score 0-1**: Fast-track to Phase 1A.
45
+
46
+ ## 0.4 Interview Loop (When Triggered)
47
+
48
+ Ask via AskUserQuestion, one question at a time:
49
+ 1. Show compact coverage status: `Coverage: D1:done D2:pending ...`
50
+ 2. Provide 2-4 curated options (never open-ended)
51
+ 3. Push back on contradictions and over-engineering
52
+ 4. Self-terminate when D1, D2, D5 covered
53
+ 5. Escape hatch: user says "skip" / "enough" / "just do it" -> mark remaining as `n/a`