@su-record/vibe 2.6.13 → 2.6.15

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 (234) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +497 -497
  3. package/agents/architect-low.md +41 -41
  4. package/agents/architect-medium.md +59 -59
  5. package/agents/architect.md +80 -80
  6. package/agents/build-error-resolver.md +115 -115
  7. package/agents/compounder.md +261 -261
  8. package/agents/diagrammer.md +178 -178
  9. package/agents/e2e-tester.md +266 -266
  10. package/agents/explorer-low.md +42 -42
  11. package/agents/explorer-medium.md +59 -59
  12. package/agents/explorer.md +48 -48
  13. package/agents/implementer-low.md +43 -43
  14. package/agents/implementer-medium.md +52 -52
  15. package/agents/implementer.md +54 -54
  16. package/agents/refactor-cleaner.md +143 -143
  17. package/agents/research/best-practices-agent.md +199 -199
  18. package/agents/research/codebase-patterns-agent.md +157 -157
  19. package/agents/research/framework-docs-agent.md +188 -188
  20. package/agents/research/security-advisory-agent.md +213 -213
  21. package/agents/review/architecture-reviewer.md +107 -107
  22. package/agents/review/complexity-reviewer.md +116 -116
  23. package/agents/review/data-integrity-reviewer.md +88 -88
  24. package/agents/review/git-history-reviewer.md +103 -103
  25. package/agents/review/performance-reviewer.md +86 -86
  26. package/agents/review/python-reviewer.md +150 -150
  27. package/agents/review/rails-reviewer.md +139 -139
  28. package/agents/review/react-reviewer.md +144 -144
  29. package/agents/review/security-reviewer.md +80 -80
  30. package/agents/review/simplicity-reviewer.md +140 -140
  31. package/agents/review/test-coverage-reviewer.md +116 -116
  32. package/agents/review/typescript-reviewer.md +127 -127
  33. package/agents/searcher.md +54 -54
  34. package/agents/simplifier.md +120 -120
  35. package/agents/tester.md +49 -49
  36. package/agents/ui-previewer.md +268 -268
  37. package/commands/vibe.analyze.md +356 -356
  38. package/commands/vibe.reason.md +329 -329
  39. package/commands/vibe.review.md +412 -412
  40. package/commands/vibe.run.md +1266 -1266
  41. package/commands/vibe.spec.md +1054 -1054
  42. package/commands/vibe.spec.review.md +319 -319
  43. package/commands/vibe.trace.md +161 -161
  44. package/commands/vibe.utils.md +376 -376
  45. package/commands/vibe.verify.md +375 -375
  46. package/dist/cli/collaborator.js +52 -52
  47. package/dist/cli/detect.d.ts.map +1 -1
  48. package/dist/cli/detect.js +118 -44
  49. package/dist/cli/detect.js.map +1 -1
  50. package/dist/cli/hud.js +20 -20
  51. package/dist/cli/index.js +118 -118
  52. package/dist/cli/index.js.map +1 -1
  53. package/dist/cli/llm.js +144 -144
  54. package/dist/cli/mcp.d.ts +49 -0
  55. package/dist/cli/mcp.d.ts.map +1 -0
  56. package/dist/cli/mcp.js +169 -0
  57. package/dist/cli/mcp.js.map +1 -0
  58. package/dist/cli/postinstall.js +858 -858
  59. package/dist/cli/setup/ProjectSetup.d.ts +3 -0
  60. package/dist/cli/setup/ProjectSetup.d.ts.map +1 -1
  61. package/dist/cli/setup/ProjectSetup.js +28 -6
  62. package/dist/cli/setup/ProjectSetup.js.map +1 -1
  63. package/dist/lib/DeepInit.js +24 -24
  64. package/dist/lib/IterationTracker.js +11 -11
  65. package/dist/lib/PythonParser.js +108 -108
  66. package/dist/lib/ReviewRace.js +96 -96
  67. package/dist/lib/SkillFrontmatter.js +28 -28
  68. package/dist/lib/SkillQualityGate.js +9 -9
  69. package/dist/lib/SkillRepository.js +159 -159
  70. package/dist/lib/UltraQA.js +77 -77
  71. package/dist/lib/gemini-api.js +5 -5
  72. package/dist/lib/gemini-mcp.d.ts +10 -0
  73. package/dist/lib/gemini-mcp.d.ts.map +1 -0
  74. package/dist/lib/gemini-mcp.js +353 -0
  75. package/dist/lib/gemini-mcp.js.map +1 -0
  76. package/dist/lib/gpt-api.js +4 -4
  77. package/dist/lib/gpt-mcp.d.ts +10 -0
  78. package/dist/lib/gpt-mcp.d.ts.map +1 -0
  79. package/dist/lib/gpt-mcp.js +352 -0
  80. package/dist/lib/gpt-mcp.js.map +1 -0
  81. package/dist/lib/memory/KnowledgeGraph.js +4 -4
  82. package/dist/lib/memory/MemorySearch.js +20 -20
  83. package/dist/lib/memory/MemoryStorage.js +64 -64
  84. package/dist/orchestrator/AgentManager.js +12 -12
  85. package/dist/orchestrator/MultiLlmResearch.js +8 -8
  86. package/dist/orchestrator/SmartRouter.js +11 -11
  87. package/dist/orchestrator/parallelResearch.js +24 -24
  88. package/dist/tools/analytics/getUsageAnalytics.d.ts +10 -0
  89. package/dist/tools/analytics/getUsageAnalytics.d.ts.map +1 -0
  90. package/dist/tools/analytics/getUsageAnalytics.js +246 -0
  91. package/dist/tools/analytics/getUsageAnalytics.js.map +1 -0
  92. package/dist/tools/analytics/index.d.ts +5 -0
  93. package/dist/tools/analytics/index.d.ts.map +1 -0
  94. package/dist/tools/analytics/index.js +5 -0
  95. package/dist/tools/analytics/index.js.map +1 -0
  96. package/dist/tools/convention/analyzeComplexity.test.js +115 -115
  97. package/dist/tools/convention/getCodingGuide.d.ts +7 -0
  98. package/dist/tools/convention/getCodingGuide.d.ts.map +1 -0
  99. package/dist/tools/convention/getCodingGuide.js +69 -0
  100. package/dist/tools/convention/getCodingGuide.js.map +1 -0
  101. package/dist/tools/convention/validateCodeQuality.test.js +104 -104
  102. package/dist/tools/planning/analyzeRequirements.d.ts +9 -0
  103. package/dist/tools/planning/analyzeRequirements.d.ts.map +1 -0
  104. package/dist/tools/planning/analyzeRequirements.js +171 -0
  105. package/dist/tools/planning/analyzeRequirements.js.map +1 -0
  106. package/dist/tools/planning/createUserStories.d.ts +9 -0
  107. package/dist/tools/planning/createUserStories.d.ts.map +1 -0
  108. package/dist/tools/planning/createUserStories.js +124 -0
  109. package/dist/tools/planning/createUserStories.js.map +1 -0
  110. package/dist/tools/planning/featureRoadmap.d.ts +10 -0
  111. package/dist/tools/planning/featureRoadmap.d.ts.map +1 -0
  112. package/dist/tools/planning/featureRoadmap.js +207 -0
  113. package/dist/tools/planning/featureRoadmap.js.map +1 -0
  114. package/dist/tools/planning/generatePrd.d.ts +11 -0
  115. package/dist/tools/planning/generatePrd.d.ts.map +1 -0
  116. package/dist/tools/planning/generatePrd.js +161 -0
  117. package/dist/tools/planning/generatePrd.js.map +1 -0
  118. package/dist/tools/planning/index.d.ts +8 -0
  119. package/dist/tools/planning/index.d.ts.map +1 -0
  120. package/dist/tools/planning/index.js +8 -0
  121. package/dist/tools/planning/index.js.map +1 -0
  122. package/dist/tools/prompt/analyzePrompt.d.ts +7 -0
  123. package/dist/tools/prompt/analyzePrompt.d.ts.map +1 -0
  124. package/dist/tools/prompt/analyzePrompt.js +150 -0
  125. package/dist/tools/prompt/analyzePrompt.js.map +1 -0
  126. package/dist/tools/prompt/enhancePrompt.d.ts +8 -0
  127. package/dist/tools/prompt/enhancePrompt.d.ts.map +1 -0
  128. package/dist/tools/prompt/enhancePrompt.js +110 -0
  129. package/dist/tools/prompt/enhancePrompt.js.map +1 -0
  130. package/dist/tools/prompt/enhancePromptGemini.d.ts +8 -0
  131. package/dist/tools/prompt/enhancePromptGemini.d.ts.map +1 -0
  132. package/dist/tools/prompt/enhancePromptGemini.js +332 -0
  133. package/dist/tools/prompt/enhancePromptGemini.js.map +1 -0
  134. package/dist/tools/prompt/index.d.ts +7 -0
  135. package/dist/tools/prompt/index.d.ts.map +1 -0
  136. package/dist/tools/prompt/index.js +7 -0
  137. package/dist/tools/prompt/index.js.map +1 -0
  138. package/dist/tools/reasoning/applyReasoningFramework.d.ts +8 -0
  139. package/dist/tools/reasoning/applyReasoningFramework.d.ts.map +1 -0
  140. package/dist/tools/reasoning/applyReasoningFramework.js +266 -0
  141. package/dist/tools/reasoning/applyReasoningFramework.js.map +1 -0
  142. package/dist/tools/reasoning/index.d.ts +5 -0
  143. package/dist/tools/reasoning/index.d.ts.map +1 -0
  144. package/dist/tools/reasoning/index.js +5 -0
  145. package/dist/tools/reasoning/index.js.map +1 -0
  146. package/dist/tools/spec/prdParser.test.js +171 -171
  147. package/dist/tools/spec/specGenerator.js +169 -169
  148. package/dist/tools/spec/traceabilityMatrix.js +64 -64
  149. package/dist/tools/spec/traceabilityMatrix.test.js +28 -28
  150. package/dist/tools/thinking/analyzeProblem.d.ts +7 -0
  151. package/dist/tools/thinking/analyzeProblem.d.ts.map +1 -0
  152. package/dist/tools/thinking/analyzeProblem.js +55 -0
  153. package/dist/tools/thinking/analyzeProblem.js.map +1 -0
  154. package/dist/tools/thinking/breakDownProblem.d.ts +8 -0
  155. package/dist/tools/thinking/breakDownProblem.d.ts.map +1 -0
  156. package/dist/tools/thinking/breakDownProblem.js +145 -0
  157. package/dist/tools/thinking/breakDownProblem.js.map +1 -0
  158. package/dist/tools/thinking/createThinkingChain.d.ts +7 -0
  159. package/dist/tools/thinking/createThinkingChain.d.ts.map +1 -0
  160. package/dist/tools/thinking/createThinkingChain.js +44 -0
  161. package/dist/tools/thinking/createThinkingChain.js.map +1 -0
  162. package/dist/tools/thinking/formatAsPlan.d.ts +9 -0
  163. package/dist/tools/thinking/formatAsPlan.d.ts.map +1 -0
  164. package/dist/tools/thinking/formatAsPlan.js +78 -0
  165. package/dist/tools/thinking/formatAsPlan.js.map +1 -0
  166. package/dist/tools/thinking/index.d.ts +10 -0
  167. package/dist/tools/thinking/index.d.ts.map +1 -0
  168. package/dist/tools/thinking/index.js +10 -0
  169. package/dist/tools/thinking/index.js.map +1 -0
  170. package/dist/tools/thinking/stepByStepAnalysis.d.ts +8 -0
  171. package/dist/tools/thinking/stepByStepAnalysis.d.ts.map +1 -0
  172. package/dist/tools/thinking/stepByStepAnalysis.js +63 -0
  173. package/dist/tools/thinking/stepByStepAnalysis.js.map +1 -0
  174. package/dist/tools/thinking/thinkAloudProcess.d.ts +8 -0
  175. package/dist/tools/thinking/thinkAloudProcess.d.ts.map +1 -0
  176. package/dist/tools/thinking/thinkAloudProcess.js +80 -0
  177. package/dist/tools/thinking/thinkAloudProcess.js.map +1 -0
  178. package/hooks/hooks.json +222 -222
  179. package/hooks/scripts/code-check.js +22 -22
  180. package/hooks/scripts/code-review.js +22 -22
  181. package/hooks/scripts/complexity.js +22 -22
  182. package/hooks/scripts/compound.js +23 -23
  183. package/hooks/scripts/context-save.js +33 -33
  184. package/hooks/scripts/gemini-ui-gen.js +281 -281
  185. package/hooks/scripts/generate-brand-assets.js +474 -474
  186. package/hooks/scripts/hud-multiline.js +262 -262
  187. package/hooks/scripts/hud-status.js +291 -291
  188. package/hooks/scripts/keyword-detector.js +214 -214
  189. package/hooks/scripts/llm-orchestrate.js +171 -171
  190. package/hooks/scripts/post-edit.js +97 -97
  191. package/hooks/scripts/post-tool-verify.js +210 -210
  192. package/hooks/scripts/pre-tool-guard.js +125 -125
  193. package/hooks/scripts/recall.js +22 -22
  194. package/hooks/scripts/session-start.js +30 -30
  195. package/hooks/scripts/skill-injector.js +191 -191
  196. package/hooks/scripts/utils.js +97 -97
  197. package/languages/csharp-unity.md +515 -515
  198. package/languages/gdscript-godot.md +470 -470
  199. package/languages/ruby-rails.md +489 -489
  200. package/languages/typescript-angular.md +433 -433
  201. package/languages/typescript-astro.md +416 -416
  202. package/languages/typescript-electron.md +406 -406
  203. package/languages/typescript-nestjs.md +524 -524
  204. package/languages/typescript-svelte.md +407 -407
  205. package/languages/typescript-tauri.md +365 -365
  206. package/package.json +84 -84
  207. package/skills/brand-assets.md +141 -141
  208. package/skills/commerce-patterns.md +361 -361
  209. package/skills/context7-usage.md +102 -102
  210. package/skills/e2e-commerce.md +304 -304
  211. package/skills/frontend-design.md +92 -92
  212. package/skills/git-worktree.md +181 -181
  213. package/skills/parallel-research.md +77 -77
  214. package/skills/priority-todos.md +239 -239
  215. package/skills/seo-checklist.md +244 -244
  216. package/skills/tool-fallback.md +190 -190
  217. package/skills/vibe-capabilities.md +161 -161
  218. package/vibe/constitution.md +227 -227
  219. package/vibe/rules/core/communication-guide.md +98 -98
  220. package/vibe/rules/core/development-philosophy.md +52 -52
  221. package/vibe/rules/core/quick-start.md +102 -102
  222. package/vibe/rules/quality/bdd-contract-testing.md +393 -393
  223. package/vibe/rules/quality/checklist.md +276 -276
  224. package/vibe/rules/quality/testing-strategy.md +440 -440
  225. package/vibe/rules/standards/anti-patterns.md +541 -541
  226. package/vibe/rules/standards/code-structure.md +291 -291
  227. package/vibe/rules/standards/complexity-metrics.md +313 -313
  228. package/vibe/rules/standards/naming-conventions.md +198 -198
  229. package/vibe/setup.sh +31 -31
  230. package/vibe/templates/constitution-template.md +252 -252
  231. package/vibe/templates/contract-backend-template.md +526 -526
  232. package/vibe/templates/contract-frontend-template.md +599 -599
  233. package/vibe/templates/feature-template.md +96 -96
  234. package/vibe/templates/spec-template.md +221 -221
@@ -1,1266 +1,1266 @@
1
- ---
2
- description: Execute implementation from SPEC
3
- argument-hint: "feature name" or --phase N
4
- ---
5
-
6
- # /vibe.run
7
-
8
- Execute **Scenario-Driven Implementation** with automatic quality verification.
9
-
10
- > **Core Principle**: Scenarios are both the implementation unit and verification criteria. All scenarios passing = Quality guaranteed.
11
-
12
- ## Usage
13
-
14
- ```
15
- /vibe.run "feature-name" # Full implementation
16
- /vibe.run "feature-name" --phase 1 # Specific Phase only
17
- /vibe.run "feature-name" ultrawork # ULTRAWORK mode (recommended)
18
- /vibe.run "feature-name" ulw # Short alias for ultrawork
19
- ```
20
-
21
- ---
22
-
23
- ## **Scenario-Driven Development (SDD)**
24
-
25
- > Automate **Scenario = Implementation = Verification** so even non-developers can trust quality
26
-
27
- ### Core Flow
28
-
29
- ```
30
- ┌─────────────────────────────────────────────────────────────────┐
31
- │ SCENARIO-DRIVEN IMPLEMENTATION │
32
- │ │
33
- │ Load Feature file │
34
- │ ↓ │
35
- │ ┌──────────────────────────────────────────────────────────┐ │
36
- │ │ Scenario 1: Happy Path │ │
37
- │ │ Given → When → Then │ │
38
- │ │ ↓ │ │
39
- │ │ [Implement] → [Verify immediately] → ✅ Pass │ │
40
- │ └──────────────────────────────────────────────────────────┘ │
41
- │ ↓ │
42
- │ ┌──────────────────────────────────────────────────────────┐ │
43
- │ │ Scenario 2: Edge Case │ │
44
- │ │ Given → When → Then │ │
45
- │ │ ↓ │ │
46
- │ │ [Implement] → [Verify] → ❌ Fail → [Fix] → ✅ Pass │ │
47
- │ └──────────────────────────────────────────────────────────┘ │
48
- │ ↓ │
49
- │ ┌──────────────────────────────────────────────────────────┐ │
50
- │ │ Scenario N: ... │ │
51
- │ │ [Implement] → [Verify immediately] → ✅ Pass │ │
52
- │ └──────────────────────────────────────────────────────────┘ │
53
- │ ↓ │
54
- │ ┌──────────────────────────────────────────────────────────┐ │
55
- │ │ 📊 QUALITY REPORT │ │
56
- │ │ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ │ │
57
- │ │ Scenarios: 5/5 passed ✅ │ │
58
- │ │ Quality score: 94/100 │ │
59
- │ │ Build: ✅ | Tests: ✅ │ │
60
- │ └──────────────────────────────────────────────────────────┘ │
61
- └─────────────────────────────────────────────────────────────────┘
62
- ```
63
-
64
- ### Scenario = Implementation Unit
65
-
66
- **Traditional approach (Phase-based)**:
67
- ```
68
- Phase 1 → Phase 2 → Phase 3 → ... → Verify at the end
69
-
70
- "Where did it go wrong?"
71
- ```
72
-
73
- **SDD approach (Scenario-based)**:
74
- ```
75
- Scenario 1 → Implement → Verify ✅
76
- Scenario 2 → Implement → Verify ✅
77
- Scenario 3 → Implement → Verify ❌ → Fix → ✅
78
- ...
79
- All pass = Quality guaranteed
80
- ```
81
-
82
- ### Automated Verification
83
-
84
- After implementing each scenario, **automatic verification**:
85
-
86
- | Verification Item | Auto Check |
87
- |-------------------|------------|
88
- | Given (precondition) | State/data preparation confirmed |
89
- | When (action) | Feature execution possible |
90
- | Then (result) | Expected result matches |
91
- | Code quality | Complexity, style, security |
92
-
93
- ### Auto-Fix on Failure
94
-
95
- ```
96
- Scenario verification failed
97
-
98
- [Root cause analysis] - Which Then condition failed?
99
-
100
- [Implement fix] - Fix only that part
101
-
102
- [Re-verify] - Check again
103
-
104
- Repeat until pass (max 3 times)
105
- ```
106
-
107
- ---
108
-
109
- ## **ULTRAWORK Mode** (ulw)
110
-
111
- > Include `ultrawork` or `ulw` in your command to activate **maximum performance mode**.
112
-
113
- ### What ULTRAWORK Enables
114
-
115
- When you include `ultrawork` (or `ulw`), ALL of these activate automatically:
116
-
117
- | Feature | Description |
118
- |---------|-------------|
119
- | **Parallel Exploration** | 3+ Task(haiku) agents run simultaneously |
120
- | **Boulder Loop** | Auto-continues until ALL phases complete |
121
- | **Context Compression** | Aggressive auto-save at 70%+ context |
122
- | **No Pause** | Doesn't wait for confirmation between phases |
123
- | **External LLMs** | Auto-consults GPT/Gemini if enabled |
124
- | **Error Recovery** | Auto-retries on failure (up to 3 times) |
125
- | **Race Review (v2.6.9)** | Multi-LLM review (GPT+Gemini) with cross-validation |
126
-
127
- ### Boulder Loop (Inspired by Sisyphus)
128
-
129
- Like Sisyphus rolling the boulder, ULTRAWORK **keeps going until done**:
130
-
131
- ```
132
- ┌─────────────────────────────────────────────────────────────────┐
133
- │ BOULDER LOOP (ultrawork) │
134
- │ │
135
- │ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐ │
136
- │ │ Phase 1 │───→│ Phase 2 │───→│ Phase 3 │───→│ Phase N │ │
137
- │ └──────────┘ └──────────┘ └──────────┘ └──────────┘ │
138
- │ │ │ │ │ │
139
- │ ↓ ↓ ↓ ↓ │
140
- │ [Parallel] [Parallel] [Parallel] [Parallel] │
141
- │ [Implement] [Implement] [Implement] [Implement] │
142
- │ [Test] [Test] [Test] [Test] │
143
- │ │ │ │ │ │
144
- │ └───────────────┴───────────────┴───────────────┘ │
145
- │ │ │
146
- │ ↓ │
147
- │ ┌──────────────┐ │
148
- │ │ ALL DONE? │ │
149
- │ └──────────────┘ │
150
- │ │ │ │
151
- │ NO YES │
152
- │ │ │ │
153
- │ ↓ ↓ │
154
- │ [Continue] [🎉 Complete!] │
155
- │ │
156
- │ NO STOPPING until acceptance criteria met or error limit hit │
157
- └─────────────────────────────────────────────────────────────────┘
158
- ```
159
-
160
- ### Ralph Loop (Completion Verification) - CRITICAL
161
-
162
- > **Inspired by [ghuntley.com/ralph](https://ghuntley.com/ralph)**: "Deterministically bad in an undeterministic world" - Keep iterating until TRULY complete.
163
-
164
- **Problem**: AI often claims "complete" when implementation is partial.
165
-
166
- **Solution**: RTM-based automated coverage verification with iteration tracking.
167
-
168
- ```
169
- ┌─────────────────────────────────────────────────────────────────┐
170
- │ RALPH LOOP (Mandatory) │
171
- │ │
172
- │ After ALL phases complete: │
173
- │ │
174
- │ ┌──────────────────────────────────────────────────────────┐ │
175
- │ │ RTM COVERAGE VERIFICATION [Iteration {{ITER}}/{{MAX}}] │ │
176
- │ │ │ │
177
- │ │ Generate RTM via vibe tools: │ │
178
- │ │ → generateTraceabilityMatrix("{feature-name}") │ │
179
- │ │ │ │
180
- │ │ Coverage Metrics (automated): │ │
181
- │ │ □ Requirements coverage: {coveragePercent}% │ │
182
- │ │ □ SPEC → Feature mapping: {featureCovered}/{total} │ │
183
- │ │ □ Feature → Test mapping: {testCovered}/{total} │ │
184
- │ │ □ Build successful? │ │
185
- │ │ □ Tests passing? │ │
186
- │ │ │ │
187
- │ │ UNCOVERED: {uncoveredRequirements[]} │ │
188
- │ └──────────────────────────────────────────────────────────┘ │
189
- │ │ │
190
- │ ┌──────────┴──────────┐ │
191
- │ │ Coverage ≥ 95%? │ │
192
- │ └──────────┬──────────┘ │
193
- │ │ │ │
194
- │ NO YES │
195
- │ │ │ │
196
- │ ↓ ↓ │
197
- │ ┌────────────────┐ ┌────────────────┐ │
198
- │ │ IMPLEMENT │ │ ✅ TRULY DONE │ │
199
- │ │ UNCOVERED │ │ │ │
200
- │ │ REQUIREMENTS │ │ Report final │ │
201
- │ │ (auto-extract) │ │ RTM coverage │ │
202
- │ └───────┬────────┘ └────────────────┘ │
203
- │ │ │
204
- │ └──────────→ [Re-generate RTM] │
205
- │ │
206
- │ MAX_ITERATIONS: 5 (prevent infinite loops) │
207
- │ COVERAGE_THRESHOLD: 95% (quality gate) │
208
- │ ZERO TOLERANCE for scope reduction │
209
- └─────────────────────────────────────────────────────────────────┘
210
- ```
211
-
212
- **Ralph Loop with RTM:**
213
-
214
- ```bash
215
- # Generate RTM for coverage verification
216
- node -e "import('@su-record/vibe/tools').then(t => t.generateTraceabilityMatrix('{feature-name}', {projectPath: process.cwd()}).then(r => console.log(JSON.stringify(r, null, 2))))"
217
- ```
218
-
219
- **RTM provides automated metrics:**
220
-
221
- | Metric | Description |
222
- |--------|-------------|
223
- | `totalRequirements` | Total REQ-* items in SPEC |
224
- | `specCovered` | Requirements with SPEC mapping |
225
- | `featureCovered` | Requirements with Feature scenarios |
226
- | `testCovered` | Requirements with test files |
227
- | `coveragePercent` | Overall coverage percentage |
228
- | `uncoveredRequirements` | List of missing REQ-* IDs |
229
-
230
- **Ralph Loop Rules:**
231
-
232
- | Rule | Description |
233
- |------|-------------|
234
- | **No Scope Reduction** | Never say "simplified" or "basic version" - implement FULL request |
235
- | **Iteration Tracking** | Display `[{{ITER}}/{{MAX}}]` to show progress |
236
- | **RTM-Based Gap List** | Use `uncoveredRequirements` array - no manual comparison |
237
- | **Coverage Threshold** | Must reach 95% coverage to complete |
238
- | **Max Iterations** | Stop at 5 iterations (report remaining gaps) |
239
-
240
- **Ralph Loop Output Format:**
241
-
242
- ```
243
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
244
- 🔄 RALPH VERIFICATION [Iteration 1/5]
245
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
246
-
247
- 📊 RTM Coverage Report: login
248
-
249
- Requirements Traceability:
250
- Total Requirements: 9
251
- SPEC Covered: 9/9 (100%)
252
- Feature Covered: 5/9 (55%)
253
- Test Covered: 4/9 (44%)
254
-
255
- ✅ REQ-login-001: Login form UI → Scenario 1 → login.test.ts
256
- ✅ REQ-login-002: Email validation → Scenario 2 → validation.test.ts
257
- ✅ REQ-login-003: Password validation → Scenario 2 → validation.test.ts
258
- ❌ REQ-login-004: Remember me checkbox → NOT IMPLEMENTED
259
- ❌ REQ-login-005: Forgot password link → NOT IMPLEMENTED
260
- ✅ REQ-login-006: API integration → Scenario 3 → api.test.ts
261
- ❌ REQ-login-007: Loading state → NOT IMPLEMENTED
262
- ❌ REQ-login-008: Error toast → NOT IMPLEMENTED
263
- ✅ REQ-login-009: Session storage → Scenario 4 → (no test)
264
-
265
- Overall Coverage: 55% ⚠️ BELOW 95% THRESHOLD
266
-
267
- UNCOVERED REQUIREMENTS (auto-extracted from RTM):
268
- 1. REQ-login-004: Remember me checkbox
269
- 2. REQ-login-005: Forgot password link
270
- 3. REQ-login-007: Loading state
271
- 4. REQ-login-008: Error toast notifications
272
-
273
- ⚠️ NOT COMPLETE - Implementing uncovered requirements...
274
-
275
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
276
- 🔄 RALPH VERIFICATION [Iteration 2/5]
277
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
278
-
279
- 📊 RTM Coverage Report: login
280
-
281
- Requirements Traceability:
282
- Total Requirements: 9
283
- SPEC Covered: 9/9 (100%)
284
- Feature Covered: 9/9 (100%)
285
- Test Covered: 9/9 (100%)
286
-
287
- Overall Coverage: 100% ✅ ABOVE 95% THRESHOLD
288
-
289
- Build: ✅ Passed
290
- Tests: ✅ 12/12 Passed
291
- Type Check: ✅ No errors
292
-
293
- ✅ RALPH VERIFIED COMPLETE!
294
-
295
- 📄 RTM saved: .claude/vibe/rtm/login-rtm.md
296
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
297
- ```
298
-
299
- **When to Trigger Ralph Loop:**
300
-
301
- 1. After all phases complete
302
- 2. Before final quality report
303
- 3. Whenever user says "ultrawork" or "ralph"
304
-
305
- **Forbidden Responses (VIOLATIONS):**
306
-
307
- | ❌ NEVER Say | ✅ Instead |
308
- |-------------|-----------|
309
- | "I've implemented a basic version" | Implement the FULL version |
310
- | "This is a simplified approach" | Implement as specified |
311
- | "You can add X later" | Add X now |
312
- | "For demonstration purposes" | Implement production-ready |
313
- | "The core functionality is done" | ALL functionality must be done |
314
-
315
- ### ULTRAWORK Example
316
-
317
- ```
318
- User: /vibe.run "brick-game" ultrawork
319
-
320
- Claude:
321
- 🚀 ULTRAWORK MODE ACTIVATED
322
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
323
-
324
- 📄 SPEC: .claude/vibe/specs/brick-game.md
325
- 🎯 4 Phases detected
326
- ⚡ Boulder Loop: ENABLED (will continue until all phases complete)
327
- 🔄 Auto-retry: ON (max 3 per phase)
328
- 💾 Context compression: AGGRESSIVE
329
-
330
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
331
- 🏔️ BOULDER ROLLING... Phase 1/4
332
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
333
-
334
- ⚡ [PARALLEL] Launching 3 exploration agents...
335
- ✅ Exploration complete (7.2s)
336
- 🔨 Implementing...
337
- ✅ Phase 1 complete
338
-
339
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
340
- 🏔️ BOULDER ROLLING... Phase 2/4
341
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
342
-
343
- ⚡ [PARALLEL] Launching 3 exploration agents...
344
- ✅ Exploration complete (6.8s)
345
- 🔨 Implementing...
346
- ❌ Test failed: collision detection
347
- 🔄 Auto-retry 1/3...
348
- 🔨 Fixing...
349
- ✅ Phase 2 complete
350
-
351
- [...continues automatically...]
352
-
353
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
354
- 🎉 BOULDER REACHED THE TOP!
355
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
356
-
357
- ✅ All 4 phases complete
358
- ✅ All acceptance criteria passed
359
- ✅ Build succeeded
360
- ✅ Tests passed
361
-
362
- ⏱️ Total: 8m 24s
363
- 📊 Retries: 2
364
- 💾 Context saved: 3 checkpoints
365
- ```
366
-
367
- ### Normal vs ULTRAWORK Comparison
368
-
369
- | Aspect | Normal | ULTRAWORK |
370
- |--------|--------|-----------|
371
- | Phase transition | May pause | Auto-continues |
372
- | On error | Reports and stops | Auto-retries (3x) |
373
- | Context 70%+ | Warning only | Auto-compress + save |
374
- | Exploration | Sequential possible | FORCED parallel |
375
- | Completion | Phase-by-phase | Until ALL done |
376
-
377
- ---
378
-
379
- ## Rules Reference
380
-
381
- **Must follow `~/.claude/vibe/rules/` (global):**
382
-
383
- - `core/development-philosophy.md` - Surgical precision, modify only requested scope
384
- - `core/quick-start.md` - Korean, DRY, SRP, YAGNI
385
- - `standards/complexity-metrics.md` - Functions ≤20 lines, nesting ≤3 levels
386
- - `quality/checklist.md` - Code quality checklist
387
-
388
- **Language guide:** `~/.claude/vibe/languages/{stack}.md` (global reference)
389
-
390
- ## Description
391
-
392
- Read PTCF structured SPEC document and execute implementation immediately.
393
-
394
- > **PLAN, TASKS documents unnecessary** - SPEC is the executable prompt
395
-
396
- ## Model Orchestration (Intelligent Routing)
397
-
398
- Automatically select optimal model based on **task complexity analysis**.
399
-
400
- ### Complexity-Based Model Selection
401
-
402
- | Complexity Score | Model | When to Use |
403
- |------------------|-------|-------------|
404
- | 0-7 (Low) | **Haiku** | Simple fixes, searches, single file changes |
405
- | 8-19 (Medium) | **Sonnet** | Standard features, 3-5 files, integrations |
406
- | 20+ (High) | **Opus** | Architecture, security, multi-service, 6+ files |
407
-
408
- ### Complexity Signals
409
-
410
- The following signals increase complexity score:
411
-
412
- | Signal | Score |
413
- |--------|-------|
414
- | Architecture change | +15 |
415
- | Security implication | +12 |
416
- | Multi-service | +8 |
417
- | Refactoring | +12 |
418
- | 6+ files | +15 |
419
- | 3-5 files | +8 |
420
- | New feature | +5 |
421
- | Bug fix | -3 |
422
- | Documentation | -5 |
423
-
424
- ### Agent Tier System
425
-
426
- Each agent has tier variants for cost optimization:
427
-
428
- | Agent | Low (Haiku) | Medium (Sonnet) | High (Opus) |
429
- |-------|-------------|-----------------|-------------|
430
- | explorer | explorer-low | explorer-medium | explorer |
431
- | implementer | implementer-low | implementer-medium | implementer |
432
- | architect | architect-low | architect-medium | architect |
433
-
434
- ### Task Calls by Role
435
-
436
- | Task Type | Model | Task Parameter |
437
- |-----------|-------|----------------|
438
- | Simple search | Haiku | `model: "haiku"` |
439
- | Codebase exploration | Haiku/Sonnet | Auto-selected |
440
- | Core implementation | Sonnet | `model: "sonnet"` |
441
- | Test writing | Haiku | `model: "haiku"` |
442
- | Architecture decisions | Opus | Main session |
443
- | Final review | Opus | Main session |
444
-
445
- ### External LLM Usage (When Enabled)
446
-
447
- When external LLMs are enabled in `.claude/vibe/config.json`:
448
-
449
- | Role | Method | Condition |
450
- |------|--------|-----------|
451
- | User direct query | `gpt.question`, `gemini.question` | Hook auto-handles |
452
- | Internal orchestration | Call global script via Bash | Claude calls directly |
453
-
454
- **User questions (Hook auto-handles):**
455
- - `gpt.question` - GPT architecture consultation
456
- - `gemini.question` - Gemini Q&A/consultation
457
-
458
- **Claude internal calls (directly via Bash):**
459
- ```bash
460
- # Usage: node llm-orchestrate.js <provider> <mode> [systemPrompt] [prompt]
461
- # - If systemPrompt omitted, uses default
462
- # - If systemPrompt is "-", uses default and treats next argument as prompt
463
-
464
- # Cross-platform path (works on Windows/macOS/Linux)
465
- VIBE_SCRIPTS="$(node -p "process.env.APPDATA || require('os').homedir() + '/.config'")/vibe/hooks/scripts"
466
-
467
- # GPT call
468
- node "$VIBE_SCRIPTS/llm-orchestrate.js" gpt orchestrate-json "[question content]"
469
-
470
- # Gemini call
471
- node "$VIBE_SCRIPTS/llm-orchestrate.js" gemini orchestrate-json "[question content]"
472
-
473
- # Custom system prompt usage
474
- node "$VIBE_SCRIPTS/llm-orchestrate.js" gpt orchestrate-json "You are a code reviewer" "[question content]"
475
- ```
476
-
477
- ### External LLM Fallback
478
-
479
- **IMPORTANT**: When GPT/Gemini hook fails, Claude MUST handle the task directly:
480
-
481
- **Fallback behavior**:
482
- - Do NOT retry the external LLM call
483
- - Claude handles the task using its own capabilities
484
- - Continue with the implementation without interruption
485
- - Log the fallback but don't block progress
486
-
487
- ## Vibe Tools (Semantic Analysis & Memory)
488
-
489
- Use vibe tools for accurate codebase understanding and session continuity.
490
-
491
- ### Tool Invocation
492
-
493
- All tools are called via:
494
- ```bash
495
- node -e "import('@su-record/vibe/tools').then(t => t.TOOL_NAME({...args}).then(r => console.log(r.content[0].text)))"
496
- ```
497
-
498
- ### Semantic Analysis Tools
499
-
500
- | Tool | Purpose | Usage |
501
- |------|---------|-------|
502
- | `findSymbol` | Find symbol definitions | `{symbolName: 'functionName', searchPath: '.'}` |
503
- | `findReferences` | Find all references | `{symbolName: 'functionName', searchPath: '.'}` |
504
- | `analyzeComplexity` | Analyze code complexity | `{filePath: 'src/file.ts'}` |
505
- | `validateCodeQuality` | Validate code quality | `{filePath: 'src/file.ts'}` |
506
-
507
- **Example - Find symbol:**
508
- ```bash
509
- node -e "import('@su-record/vibe/tools').then(t => t.findSymbol({symbolName: 'login', searchPath: '.'}).then(r => console.log(r.content[0].text)))"
510
- ```
511
-
512
- ### Memory Tools
513
-
514
- | Tool | Purpose | Usage |
515
- |------|---------|-------|
516
- | `saveMemory` | Save important decisions | `{key: 'decision-name', value: 'content', category: 'project'}` |
517
- | `recallMemory` | Recall saved memory | `{key: 'decision-name'}` |
518
- | `listMemories` | List all memories | `{category: 'project'}` |
519
-
520
- **Example - Save important decision:**
521
- ```bash
522
- node -e "import('@su-record/vibe/tools').then(t => t.saveMemory({key: 'auth-pattern', value: 'Using JWT with refresh tokens', category: 'project'}).then(r => console.log(r.content[0].text)))"
523
- ```
524
-
525
- ### Session Management (Auto via Hooks)
526
-
527
- - **Session start**: Hook auto-calls `startSession` to restore previous context
528
- - **Context 80%+**: Hook auto-calls `autoSaveContext` to preserve state
529
-
530
- ## Process
531
-
532
- ### 1. Load SPEC + Feature
533
-
534
- ```
535
- 📄 .claude/vibe/specs/{feature-name}.md → SPEC (structure, constraints, context)
536
- 📄 .claude/vibe/features/{feature-name}.feature → Feature (scenario = implementation unit)
537
- ```
538
-
539
- **Error if Feature file missing**:
540
- ```
541
- ❌ Feature file not found.
542
- Run /vibe.spec "{feature-name}" first.
543
- ```
544
-
545
- ### 2. Extract Scenario List
546
-
547
- Extract all Scenarios from Feature file:
548
-
549
- ```markdown
550
- ## Scenarios to Implement
551
-
552
- | # | Scenario | Status |
553
- |---|----------|--------|
554
- | 1 | Valid login success | ⬜ |
555
- | 2 | Invalid password error | ⬜ |
556
- | 3 | Email format validation | ⬜ |
557
- | 4 | Password reset link | ⬜ |
558
-
559
- Total: 4 scenarios
560
- ```
561
-
562
- ### 3. Scenario-by-Scenario Implementation (Core)
563
-
564
- **For each scenario**:
565
-
566
- ```
567
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
568
- 🎯 Scenario 1/4: Valid login success
569
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
570
-
571
- Given: User is registered
572
- When: Login with valid email and password
573
- Then: Login success + JWT token returned
574
-
575
- [Step 1] Analyzing implementation...
576
- - Required files: auth.service.ts, login.controller.ts
577
- - Exploring related code...
578
-
579
- [Step 2] Implementing...
580
- ✅ auth.service.ts - Added login() method
581
- ✅ login.controller.ts - POST /login endpoint
582
-
583
- [Step 3] Verifying...
584
- ✅ Given: Test user creation possible
585
- ✅ When: Login API call succeeded
586
- ✅ Then: JWT token return confirmed
587
-
588
- ✅ Scenario 1 passed!
589
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
590
- ```
591
-
592
- **On failure**:
593
-
594
- ```
595
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
596
- 🎯 Scenario 2/4: Invalid password error
597
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
598
-
599
- [Step 3] Verifying...
600
- ✅ Given: Test user exists
601
- ✅ When: Login attempt with wrong password
602
- ❌ Then: "Invalid credentials" error message
603
- Actual: "Error occurred" returned
604
-
605
- [Auto-fix 1/3]
606
- Cause: Error message not properly set
607
- Fix: auth.service.ts line 42
608
-
609
- [Re-verify]
610
- ✅ Then: "Invalid credentials" error message
611
-
612
- ✅ Scenario 2 passed! (1 fix)
613
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
614
- ```
615
-
616
- ---
617
-
618
- ## **CRITICAL: Parallel Sub-Agent Execution**
619
-
620
- > **MUST USE PARALLEL TASK CALLS** - This is REQUIRED, not optional.
621
- > Sequential execution when parallel is possible = VIOLATION of this workflow.
622
-
623
- ### Mandatory Parallel Exploration (Phase Start)
624
-
625
- **BEFORE any implementation, you MUST launch these Task calls IN PARALLEL (single message, multiple tool calls):**
626
-
627
- ```
628
- ┌─────────────────────────────────────────────────────────────────┐
629
- │ STEP 1: PARALLEL EXPLORATION (REQUIRED) │
630
- │ │
631
- │ Launch ALL of these in ONE message: │
632
- │ │
633
- │ Task(haiku) ─┬─→ "Analyze related files in <context>" │
634
- │ │ │
635
- │ Task(haiku) ─┼─→ "Check dependencies and imports" │
636
- │ │ │
637
- │ Task(haiku) ─┴─→ "Find existing patterns and conventions" │
638
- │ │
639
- │ [If GPT enabled] Bash: node {{VIBE_PATH}}/hooks/scripts/llm-orchestrate.js gpt orchestrate-json "[question]"
640
- │ [If Gemini enabled] Bash: node {{VIBE_PATH}}/hooks/scripts/llm-orchestrate.js gemini orchestrate-json "[question]"
641
- └─────────────────────────────────────────────────────────────────┘
642
-
643
- ↓ (wait for all to complete)
644
- ┌─────────────────────────────────────────────────────────────────┐
645
- │ STEP 2: SYNTHESIZE (Opus) │
646
- │ - Review all exploration results │
647
- │ - Decide implementation approach │
648
- │ - Identify files to modify/create │
649
- └─────────────────────────────────────────────────────────────────┘
650
-
651
-
652
- ┌─────────────────────────────────────────────────────────────────┐
653
- │ STEP 3: IMPLEMENT + BACKGROUND AGENTS (PARALLEL) │
654
- │ │
655
- │ Main Agent (sonnet): │
656
- │ └─→ Execute current phase implementation │
657
- │ │
658
- │ Background Agents (haiku, run_in_background=true): │
659
- │ ├─→ Task: "Prepare Phase N+1 - analyze required files" │
660
- │ ├─→ Task: "Pre-generate test cases for current implementation" │
661
- │ └─→ Task: "Search for related types/interfaces needed" │
662
- │ │
663
- │ [ULTRAWORK] All 4 agents run simultaneously! │
664
- └─────────────────────────────────────────────────────────────────┘
665
-
666
- ↓ (main completes, check backgrounds)
667
- ┌─────────────────────────────────────────────────────────────────┐
668
- │ STEP 4: TEST + PHASE PIPELINING │
669
- │ │
670
- │ Current Phase: │
671
- │ └─→ Task(haiku): Write tests using pre-generated cases │
672
- │ │
673
- │ Next Phase Prep (from background results): │
674
- │ └─→ Already have file analysis, ready to start immediately │
675
- └─────────────────────────────────────────────────────────────────┘
676
- ```
677
-
678
- ### Parallel Task Call Pattern (MUST FOLLOW)
679
-
680
- **Correct - Single message with multiple parallel Tasks:**
681
- ```
682
- <message>
683
- Task(haiku, "Analyze src/components/ for existing patterns")
684
- Task(haiku, "Check package.json dependencies")
685
- Task(haiku, "Find usage of similar features in codebase")
686
- </message>
687
- → All 3 run simultaneously, ~3x faster
688
- ```
689
-
690
- **WRONG - Sequential calls (DO NOT DO THIS):**
691
- ```
692
- <message>Task(haiku, "Analyze...")</message>
693
- <message>Task(haiku, "Check...")</message>
694
- <message>Task(haiku, "Find...")</message>
695
- → 3x slower, wastes time
696
- ```
697
-
698
- ### Background Agent Pattern (ULTRAWORK) via Orchestrator
699
-
700
- **Launch background agents for next phase via Orchestrator:**
701
- ```bash
702
- # Start background agent (doesn't block)
703
- node -e "import('@su-record/vibe/orchestrator').then(o => o.runAgent('Phase 2 prep: Analyze auth API endpoints', 'phase2-prep').then(r => console.log(r.content[0].text)))"
704
-
705
- # Multiple backgrounds in parallel
706
- node -e "import('@su-record/vibe/orchestrator').then(async o => {
707
- await Promise.all([
708
- o.runAgent('Phase 2 prep: Analyze auth API endpoints', 'phase2-prep'),
709
- o.runAgent('Pre-generate test cases for login form', 'test-prep'),
710
- o.runAgent('Find existing validation patterns', 'pattern-finder')
711
- ]);
712
- console.log('All background agents started');
713
- })"
714
- ```
715
-
716
- **Check background agent status:**
717
- ```bash
718
- node -e "import('@su-record/vibe/orchestrator').then(o => console.log(o.status().content[0].text))"
719
- ```
720
-
721
- **Get result when ready:**
722
- ```bash
723
- node -e "import('@su-record/vibe/orchestrator').then(o => o.getResult('SESSION_ID').then(r => console.log(r.content[0].text)))"
724
- ```
725
-
726
- **Why Background Agents Matter:**
727
-
728
- | Without Background | With Background |
729
- |--------------------|-----------------|
730
- | Phase 1: 60s | Phase 1: 60s (+ backgrounds running) |
731
- | Phase 2 prep: 20s | Phase 2 prep: 0s (already done!) |
732
- | Phase 2: 60s | Phase 2: 60s |
733
- | **Total: 140s** | **Total: 120s** |
734
-
735
- For 5 phases: 4 × 20s saved = **80s faster**
736
-
737
- ### Why Parallel Matters
738
-
739
- | Approach | Time | Cache Benefit |
740
- |----------|------|---------------|
741
- | Sequential (3 Tasks) | ~30s | Cache cold on each |
742
- | **Parallel (3 Tasks)** | **~10s** | **Cache warmed once, shared** |
743
-
744
- vibe ProjectCache (LRU) caches ts-morph parsing results. Parallel calls share the warmed cache.
745
-
746
- ### Phase Execution Flow (ULTRAWORK Pipeline)
747
-
748
- ```
749
- Phase N Start
750
-
751
- ├─→ [PARALLEL] Task(haiku) × 3: Exploration
752
- │ - Related code analysis
753
- │ - Dependency check
754
- │ - Pattern discovery
755
-
756
- ↓ (all complete)
757
-
758
- ├─→ Opus: Synthesize and decide
759
-
760
- ├─→ [PARALLEL PIPELINE] ←── KEY SPEED OPTIMIZATION
761
- │ │
762
- │ ├─→ Main: Task(sonnet) Implementation
763
- │ │
764
- │ └─→ Background (run_in_background=true):
765
- │ ├─→ Task(haiku): Phase N+1 file analysis
766
- │ ├─→ Task(haiku): Test case preparation
767
- │ └─→ Task(haiku): Type/interface lookup
768
-
769
- ↓ (main completes)
770
-
771
- ├─→ Task(haiku): Tests (uses pre-generated cases)
772
-
773
-
774
- Phase N Complete
775
-
776
- ↓ (Background results ready - NO WAIT for Phase N+1 exploration!)
777
-
778
- Phase N+1 Start (IMMEDIATE - exploration already done!)
779
- ```
780
-
781
- **Speed Comparison:**
782
-
783
- | Mode | Phase Time | 5 Phases Total |
784
- |------|------------|----------------|
785
- | Sequential | ~2min/phase | ~10min |
786
- | Parallel Exploration | ~1.5min/phase | ~7.5min |
787
- | **ULTRAWORK Pipeline** | **~1min/phase** | **~5min** |
788
-
789
- **Why Pipeline is Faster:**
790
- - Background agents prepare next phase WHILE current phase implements
791
- - No idle time between phases
792
- - Test cases pre-generated during implementation
793
- - Cache stays warm across parallel tasks
794
-
795
- ---
796
-
797
- 1. **Related code analysis**: Task(haiku) explores `<context>` related code
798
- 2. **File creation/modification**: Task(sonnet) implements per `<output_format>`
799
- 3. **Constraint compliance**: Check `<constraints>`
800
- 4. **Run verification**: Execute verification commands
801
-
802
- ### 4. Brand Assets Generation (Optional)
803
-
804
- When starting a **new project** with brand context in SPEC, auto-generate app icons and favicons:
805
-
806
- ```
807
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
808
- 🎨 BRAND ASSETS GENERATION
809
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
810
-
811
- [Check] Brand assets exist? → Skip if favicon.ico exists
812
- [Check] Gemini API configured? → Required for image generation
813
- [Check] SPEC has brand context? → Extract app name, colors, style
814
-
815
- [Generate] Creating app icon with Gemini Image API...
816
- - Prompt: "App icon for [AppName], [style], [color]..."
817
- - Generated: 512x512 master icon
818
-
819
- [Resize] Creating platform variants...
820
- ✅ favicon.ico (16/32/48)
821
- ✅ favicon-16x16.png
822
- ✅ favicon-32x32.png
823
- ✅ apple-touch-icon.png (180x180)
824
- ✅ android-chrome-192x192.png
825
- ✅ android-chrome-512x512.png
826
- ✅ site.webmanifest
827
-
828
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
829
- ✅ Brand assets generated in public/
830
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
831
- ```
832
-
833
- **SPEC Brand Context Example:**
834
-
835
- ```xml
836
- <context>
837
- Brand:
838
- - App Name: MyApp
839
- - Primary Color: #2F6BFF
840
- - Style: Modern, minimalist, flat design
841
- - Icon Concept: Abstract geometric shape
842
- </context>
843
- ```
844
-
845
- **Trigger Conditions:**
846
- - First `/vibe.run` execution (no existing icons)
847
- - SPEC contains brand/design context
848
- - Gemini API key configured (`vibe gemini auth`)
849
-
850
- **Manual Generation:**
851
- ```bash
852
- node hooks/scripts/generate-brand-assets.js \
853
- --spec ".claude/vibe/specs/my-feature.md" \
854
- --output "./public"
855
-
856
- # Or with explicit values
857
- node hooks/scripts/generate-brand-assets.js \
858
- --name "MyApp" \
859
- --color "#2F6BFF" \
860
- --style "modern minimal" \
861
- --output "./public"
862
- ```
863
-
864
- **Fallback:** If Gemini Image fails, generates text monogram icon (first letter + primary color).
865
-
866
- ---
867
-
868
- ### 5. Race Code Review (GPT + Gemini) + Auto-Fix (v2.6.9)
869
-
870
- After all scenarios are implemented, **GPT and Gemini review in parallel with cross-validation**:
871
-
872
- > **ULTRAWORK Default**: In ULTRAWORK mode, race review is automatically enabled.
873
-
874
- ```
875
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
876
- 🏁 RACE CODE REVIEW (GPT + Gemini)
877
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
878
-
879
- [Step 1] Parallel review execution...
880
- ├─ GPT-5.2-Codex: Reviewing...
881
- └─ Gemini-3-Flash: Reviewing...
882
-
883
- [Step 2] Cross-validation results:
884
- ┌───────────────────────────────────────────────────────────┐
885
- │ Issue │ GPT │ Gemini │ Confidence│
886
- │────────────────────────────────│─────│────────│───────────│
887
- │ Timing attack in password │ ✅ │ ✅ │ 100% → P1 │
888
- │ Rate limiting missing │ ✅ │ ✅ │ 100% → P1 │
889
- │ Magic number usage │ ✅ │ ❌ │ 50% → P2 │
890
- └───────────────────────────────────────────────────────────┘
891
-
892
- Summary: 3 issues (P1: 2, P2: 1)
893
-
894
- [Step 3] Auto-fixing P1/P2 issues...
895
- ✅ auth.service.ts:24 - Applied timingSafeEqual (P1)
896
- ✅ auth.controller.ts:15 - Added rate limiter (P1)
897
- ✅ auth.service.ts:42 - Extracted constant (P2)
898
-
899
- [Step 4] Re-verifying...
900
- ✅ Build succeeded
901
- ✅ Tests passed
902
-
903
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
904
- ✅ Race review complete! 3 improvements (2 P1, 1 P2)
905
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
906
- ```
907
-
908
- **Race Review Invocation:**
909
-
910
- ```bash
911
- # Via vibe tools
912
- node -e "import('@su-record/vibe/tools').then(t => t.raceReview({reviewType: 'security', code: '[code]'}).then(r => console.log(t.formatRaceResult(r))))"
913
- ```
914
-
915
- **Confidence-based Priority:**
916
-
917
- | Confidence | Priority | Action |
918
- |------------|----------|--------|
919
- | 100% (2/2) | P1 | Auto-fix immediately |
920
- | 50% (1/2) | P2 | Auto-fix with review |
921
-
922
- **Fallback handling:**
923
- - If one LLM fails → Use single LLM result (reduced confidence)
924
- - If both fail → Skip and proceed (log warning)
925
-
926
- **Review application rules:**
927
-
928
- | Feedback Type | Action |
929
- |---------------|--------|
930
- | Security vulnerability (P1) | Auto-fix immediately |
931
- | Performance improvement (P1/P2) | Auto-fix immediately |
932
- | Best practices (P2) | Auto-fix |
933
- | Style/preference (P3) | Apply selectively |
934
-
935
- **Conditions:**
936
- - **ULTRAWORK**: Race review enabled by default
937
- - **Normal mode**: Use `--race` flag to enable
938
- - Must re-verify build/tests after fixes
939
-
940
- ### 6. Quality Report (Auto-generated)
941
-
942
- After all scenarios complete + Gemini review, **quality report is auto-generated**:
943
-
944
- ```
945
- ┌─────────────────────────────────────────────────────────────────┐
946
- │ 📊 QUALITY REPORT: login │
947
- ├─────────────────────────────────────────────────────────────────┤
948
- │ │
949
- │ ✅ Scenarios: 4/4 passed │
950
- │ │
951
- │ ┌───────────────────────────────────────────────────────────┐ │
952
- │ │ # │ Scenario │ Status │ Retries │ │ │
953
- │ │───│───────────────────────────│────────│─────────│ │ │
954
- │ │ 1 │ Valid login success │ ✅ │ 0 │ │ │
955
- │ │ 2 │ Invalid password error │ ✅ │ 1 │ │ │
956
- │ │ 3 │ Email format validation │ ✅ │ 0 │ │ │
957
- │ │ 4 │ Password reset link │ ✅ │ 0 │ │ │
958
- │ └───────────────────────────────────────────────────────────┘ │
959
- │ │
960
- │ 📈 Quality score: 94/100 │
961
- │ │
962
- │ ┌─────────────────────────────────────────────────────────┐ │
963
- │ │ Item │ Result │ Notes │ │
964
- │ │───────────────────│────────│─────────────────────────────│ │
965
- │ │ Build │ ✅ │ npm run build succeeded │ │
966
- │ │ Tests │ ✅ │ 12/12 passed │ │
967
- │ │ Type check │ ✅ │ 0 errors │ │
968
- │ │ Complexity │ ✅ │ All functions ≤30 lines │ │
969
- │ │ Security │ ✅ │ 0 vulnerabilities │ │
970
- │ │ Gemini review │ ✅ │ 3 improvements applied │ │
971
- │ └─────────────────────────────────────────────────────────┘ │
972
- │ │
973
- │ ⏱️ Total time: 3m 42s │
974
- │ │
975
- └─────────────────────────────────────────────────────────────────┘
976
- ```
977
-
978
- **What users should check**:
979
- - Scenario pass rate (4/4 = 100%)
980
- - Quality score (94/100)
981
- - Build/test status
982
-
983
- **This alone is enough to trust quality.**
984
-
985
- ### 7. Update Feature File
986
-
987
- Auto-update scenario status:
988
-
989
- ```markdown
990
- ## Coverage
991
-
992
- | Scenario | SPEC AC | Status |
993
- |----------|---------|--------|
994
- | Valid login success | AC-1 | ✅ |
995
- | Invalid password error | AC-2 | ✅ |
996
- | Email format validation | AC-3 | ✅ |
997
- | Password reset link | AC-4 | ✅ |
998
-
999
- **Last verified**: 2024-01-15 14:32
1000
- **Quality score**: 94/100
1001
- ```
1002
-
1003
- ## TRUST 5 Principles
1004
-
1005
- Follow during implementation:
1006
-
1007
- | Principle | Description |
1008
- |-----------|-------------|
1009
- | **T**est-first | Write tests first |
1010
- | **R**eadable | Clear code |
1011
- | **U**nified | Consistent style |
1012
- | **S**ecured | Consider security |
1013
- | **T**rackable | Logging, monitoring |
1014
-
1015
- ## Input
1016
-
1017
- - `.claude/vibe/specs/{feature-name}.md` (PTCF SPEC)
1018
- - `.claude/vibe/features/{feature-name}.feature` (BDD)
1019
- - `CLAUDE.md` (project context)
1020
-
1021
- ## Output
1022
-
1023
- - Implemented code files
1024
- - Test files
1025
- - Updated SPEC document (checkmarks)
1026
-
1027
- ## Example
1028
-
1029
- ```
1030
- User: /vibe.run "login"
1031
-
1032
- Claude:
1033
- 📄 Loading SPEC: .claude/vibe/specs/login.md
1034
- 📄 Loading Feature: .claude/vibe/features/login.feature
1035
-
1036
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1037
- 📋 Scenarios to Implement
1038
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1039
-
1040
- | # | Scenario | Status |
1041
- |---|----------|--------|
1042
- | 1 | Valid login success | ⬜ |
1043
- | 2 | Invalid password error | ⬜ |
1044
- | 3 | Email format validation | ⬜ |
1045
- | 4 | Password reset link | ⬜ |
1046
-
1047
- Total: 4 scenarios
1048
-
1049
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1050
- 🎯 Scenario 1/4: Valid login success
1051
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1052
-
1053
- Given: User is registered
1054
- When: Login with valid email and password
1055
- Then: Login success + JWT token returned
1056
-
1057
- ⚡ [PARALLEL] Exploring...
1058
- ✅ Exploration complete (2.1s)
1059
-
1060
- 🔨 Implementing...
1061
- ✅ auth.service.ts - Added login()
1062
- ✅ auth.controller.ts - POST /login
1063
-
1064
- 🔍 Verifying...
1065
- ✅ Given: OK
1066
- ✅ When: OK
1067
- ✅ Then: OK
1068
-
1069
- ✅ Scenario 1 passed!
1070
-
1071
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1072
- 🎯 Scenario 2/4: Invalid password error
1073
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1074
-
1075
- 🔨 Implementing...
1076
- ✅ auth.service.ts - Password validation logic
1077
-
1078
- 🔍 Verifying...
1079
- ✅ Given: OK
1080
- ✅ When: OK
1081
- ❌ Then: "Invalid credentials" error message
1082
- Actual: "Error" returned
1083
-
1084
- 🔄 Auto-fix 1/3...
1085
- Fix: auth.service.ts line 42
1086
-
1087
- 🔍 Re-verifying...
1088
- ✅ Then: OK
1089
-
1090
- ✅ Scenario 2 passed! (1 fix)
1091
-
1092
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1093
- 🎯 Scenario 3/4: Email format validation
1094
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1095
-
1096
- 🔨 Implementing...
1097
- 🔍 Verifying...
1098
- ✅ Scenario 3 passed!
1099
-
1100
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1101
- 🎯 Scenario 4/4: Password reset link
1102
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1103
-
1104
- 🔨 Implementing...
1105
- 🔍 Verifying...
1106
- ✅ Scenario 4 passed!
1107
-
1108
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1109
- 🔍 GEMINI CODE REVIEW
1110
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1111
-
1112
- 📤 Sending code to Gemini...
1113
- 📝 Gemini feedback:
1114
- 1. [Security] Need timing attack prevention → Fixing...
1115
- 2. [Performance] Unnecessary DB call → Fixing...
1116
-
1117
- ✅ 2 improvements auto-applied
1118
- 🔍 Re-verifying... ✅ Passed
1119
-
1120
- ┌─────────────────────────────────────────────────────────────────┐
1121
- │ 📊 QUALITY REPORT: login │
1122
- ├─────────────────────────────────────────────────────────────────┤
1123
- │ │
1124
- │ ✅ Scenarios: 4/4 passed │
1125
- │ │
1126
- │ | # | Scenario | Status | Retries | │
1127
- │ |---|───────────────────────|───────|─────────| │
1128
- │ | 1 | Valid login success | ✅ | 0 | │
1129
- │ | 2 | Invalid password error| ✅ | 1 | │
1130
- │ | 3 | Email format validation| ✅ | 0 | │
1131
- │ | 4 | Password reset link | ✅ | 0 | │
1132
- │ │
1133
- │ 📈 Quality score: 94/100 │
1134
- │ Build: ✅ | Tests: ✅ | Types: ✅ | Gemini: ✅ (2 applied) │
1135
- │ │
1136
- │ ⏱️ Total time: 3m 42s │
1137
- └─────────────────────────────────────────────────────────────────┘
1138
-
1139
- 🎉 Implementation complete! All scenarios passed + Gemini review applied.
1140
-
1141
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1142
- 🔍 AUTO REVIEW (13+ Agents)
1143
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1144
-
1145
- ⚡ [PARALLEL] 13 expert agents reviewing...
1146
- - security-reviewer ✅
1147
- - performance-reviewer ✅
1148
- - architecture-reviewer ✅
1149
- - ...
1150
-
1151
- 📋 Review results:
1152
- - P1 Critical: 0
1153
- - P2 Important: 2
1154
- - P3 Nice-to-have: 1
1155
-
1156
- 🔧 Auto-fixing P2 issues...
1157
- 1. [PERF] N+1 query → Fixed
1158
- 2. [ARCH] Circular dependency → Fixed
1159
-
1160
- ✅ Auto Review complete! 2 issues auto-resolved.
1161
- ```
1162
-
1163
- ### Phase-specific Execution
1164
-
1165
- ```
1166
- User: /vibe.run "brick-game" --phase 2
1167
-
1168
- Claude:
1169
- 📄 Reading SPEC: .claude/vibe/specs/brick-game.md
1170
- 🎯 Executing Phase 2 only.
1171
-
1172
- Phase 2: Game Logic
1173
- 1. [ ] Paddle movement implementation
1174
- 2. [ ] Ball physics engine
1175
- 3. [ ] Brick collision handling
1176
- 4. [ ] Score system
1177
- 5. [ ] Game over conditions
1178
-
1179
- ⚡ Launching parallel exploration...
1180
- [Task(haiku) × 3 launched in parallel]
1181
-
1182
- 🚀 Starting implementation...
1183
- ```
1184
-
1185
- ## Error Handling
1186
-
1187
- On failure:
1188
- 1. Check error message
1189
- 2. Review `<constraints>`
1190
- 3. Fix code and retry
1191
- 4. If continues to fail, report to user
1192
-
1193
- ---
1194
-
1195
- ## Quality Gate (Mandatory)
1196
-
1197
- ### Implementation Quality Checklist
1198
-
1199
- Before marking any scenario as complete, ALL items must pass:
1200
-
1201
- | Category | Check Item | Weight |
1202
- |----------|------------|--------|
1203
- | **Functionality** | All Given/When/Then conditions verified | 20% |
1204
- | **Functionality** | Edge cases handled per scenario | 10% |
1205
- | **Code Quality** | No `any` types in TypeScript | 10% |
1206
- | **Code Quality** | Functions ≤30 lines, nesting ≤3 levels | 10% |
1207
- | **Code Quality** | No hardcoded values (use constants) | 5% |
1208
- | **Security** | Input validation implemented | 10% |
1209
- | **Security** | Authentication/authorization checked | 5% |
1210
- | **Error Handling** | Try-catch or error states present | 10% |
1211
- | **Error Handling** | User-friendly error messages | 5% |
1212
- | **Testing** | Unit tests exist for core logic | 10% |
1213
- | **Performance** | No N+1 queries or unnecessary loops | 5% |
1214
-
1215
- ### Quality Score Calculation
1216
-
1217
- ```
1218
- Score = Σ(checked items × weight) / 100
1219
-
1220
- Grades:
1221
- - 95-100: ✅ EXCELLENT - Ready to merge
1222
- - 90-94: ⚠️ GOOD - Minor improvements required before merge
1223
- - 80-89: ⚠️ FAIR - Significant improvements required
1224
- - 0-79: ❌ POOR - Major fixes needed
1225
- ```
1226
-
1227
- ### Quality Gate Thresholds
1228
-
1229
- | Gate | Minimum Score | Condition |
1230
- |------|---------------|-----------|
1231
- | **Scenario Complete** | 95 | Each scenario must score ≥95 |
1232
- | **Phase Complete** | 95 | Average of all scenarios ≥95 |
1233
- | **Feature Complete** | 95 | All phases complete + Gemini review |
1234
-
1235
- ### Auto-Fix Triggers
1236
-
1237
- | Issue Type | Auto-Fix Action |
1238
- |------------|-----------------|
1239
- | Missing error handling | Add try-catch wrapper |
1240
- | Hardcoded values | Extract to constants file |
1241
- | Missing input validation | Add validation schema |
1242
- | Function too long | Suggest split points |
1243
- | N+1 query detected | Add eager loading |
1244
-
1245
- ### Forbidden Patterns (Block Merge)
1246
-
1247
- | Pattern | Why Forbidden | Detection |
1248
- |---------|---------------|-----------|
1249
- | `console.log` | Debug code in production | Regex scan |
1250
- | `// TODO` without issue | Untracked work | Comment scan |
1251
- | `any` type | Type safety bypass | TypeScript check |
1252
- | `@ts-ignore` | Type error suppression | TypeScript check |
1253
- | Empty catch blocks | Silent error swallowing | AST analysis |
1254
- | Commented-out code | Dead code | Comment scan |
1255
-
1256
- ---
1257
-
1258
- ## Next Step
1259
-
1260
- ```
1261
- /vibe.verify "brick-game"
1262
- ```
1263
-
1264
- ---
1265
-
1266
- ARGUMENTS: $ARGUMENTS
1
+ ---
2
+ description: Execute implementation from SPEC
3
+ argument-hint: "feature name" or --phase N
4
+ ---
5
+
6
+ # /vibe.run
7
+
8
+ Execute **Scenario-Driven Implementation** with automatic quality verification.
9
+
10
+ > **Core Principle**: Scenarios are both the implementation unit and verification criteria. All scenarios passing = Quality guaranteed.
11
+
12
+ ## Usage
13
+
14
+ ```
15
+ /vibe.run "feature-name" # Full implementation
16
+ /vibe.run "feature-name" --phase 1 # Specific Phase only
17
+ /vibe.run "feature-name" ultrawork # ULTRAWORK mode (recommended)
18
+ /vibe.run "feature-name" ulw # Short alias for ultrawork
19
+ ```
20
+
21
+ ---
22
+
23
+ ## **Scenario-Driven Development (SDD)**
24
+
25
+ > Automate **Scenario = Implementation = Verification** so even non-developers can trust quality
26
+
27
+ ### Core Flow
28
+
29
+ ```
30
+ ┌─────────────────────────────────────────────────────────────────┐
31
+ │ SCENARIO-DRIVEN IMPLEMENTATION │
32
+ │ │
33
+ │ Load Feature file │
34
+ │ ↓ │
35
+ │ ┌──────────────────────────────────────────────────────────┐ │
36
+ │ │ Scenario 1: Happy Path │ │
37
+ │ │ Given → When → Then │ │
38
+ │ │ ↓ │ │
39
+ │ │ [Implement] → [Verify immediately] → ✅ Pass │ │
40
+ │ └──────────────────────────────────────────────────────────┘ │
41
+ │ ↓ │
42
+ │ ┌──────────────────────────────────────────────────────────┐ │
43
+ │ │ Scenario 2: Edge Case │ │
44
+ │ │ Given → When → Then │ │
45
+ │ │ ↓ │ │
46
+ │ │ [Implement] → [Verify] → ❌ Fail → [Fix] → ✅ Pass │ │
47
+ │ └──────────────────────────────────────────────────────────┘ │
48
+ │ ↓ │
49
+ │ ┌──────────────────────────────────────────────────────────┐ │
50
+ │ │ Scenario N: ... │ │
51
+ │ │ [Implement] → [Verify immediately] → ✅ Pass │ │
52
+ │ └──────────────────────────────────────────────────────────┘ │
53
+ │ ↓ │
54
+ │ ┌──────────────────────────────────────────────────────────┐ │
55
+ │ │ 📊 QUALITY REPORT │ │
56
+ │ │ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ │ │
57
+ │ │ Scenarios: 5/5 passed ✅ │ │
58
+ │ │ Quality score: 94/100 │ │
59
+ │ │ Build: ✅ | Tests: ✅ │ │
60
+ │ └──────────────────────────────────────────────────────────┘ │
61
+ └─────────────────────────────────────────────────────────────────┘
62
+ ```
63
+
64
+ ### Scenario = Implementation Unit
65
+
66
+ **Traditional approach (Phase-based)**:
67
+ ```
68
+ Phase 1 → Phase 2 → Phase 3 → ... → Verify at the end
69
+
70
+ "Where did it go wrong?"
71
+ ```
72
+
73
+ **SDD approach (Scenario-based)**:
74
+ ```
75
+ Scenario 1 → Implement → Verify ✅
76
+ Scenario 2 → Implement → Verify ✅
77
+ Scenario 3 → Implement → Verify ❌ → Fix → ✅
78
+ ...
79
+ All pass = Quality guaranteed
80
+ ```
81
+
82
+ ### Automated Verification
83
+
84
+ After implementing each scenario, **automatic verification**:
85
+
86
+ | Verification Item | Auto Check |
87
+ |-------------------|------------|
88
+ | Given (precondition) | State/data preparation confirmed |
89
+ | When (action) | Feature execution possible |
90
+ | Then (result) | Expected result matches |
91
+ | Code quality | Complexity, style, security |
92
+
93
+ ### Auto-Fix on Failure
94
+
95
+ ```
96
+ Scenario verification failed
97
+
98
+ [Root cause analysis] - Which Then condition failed?
99
+
100
+ [Implement fix] - Fix only that part
101
+
102
+ [Re-verify] - Check again
103
+
104
+ Repeat until pass (max 3 times)
105
+ ```
106
+
107
+ ---
108
+
109
+ ## **ULTRAWORK Mode** (ulw)
110
+
111
+ > Include `ultrawork` or `ulw` in your command to activate **maximum performance mode**.
112
+
113
+ ### What ULTRAWORK Enables
114
+
115
+ When you include `ultrawork` (or `ulw`), ALL of these activate automatically:
116
+
117
+ | Feature | Description |
118
+ |---------|-------------|
119
+ | **Parallel Exploration** | 3+ Task(haiku) agents run simultaneously |
120
+ | **Boulder Loop** | Auto-continues until ALL phases complete |
121
+ | **Context Compression** | Aggressive auto-save at 70%+ context |
122
+ | **No Pause** | Doesn't wait for confirmation between phases |
123
+ | **External LLMs** | Auto-consults GPT/Gemini if enabled |
124
+ | **Error Recovery** | Auto-retries on failure (up to 3 times) |
125
+ | **Race Review (v2.6.9)** | Multi-LLM review (GPT+Gemini) with cross-validation |
126
+
127
+ ### Boulder Loop (Inspired by Sisyphus)
128
+
129
+ Like Sisyphus rolling the boulder, ULTRAWORK **keeps going until done**:
130
+
131
+ ```
132
+ ┌─────────────────────────────────────────────────────────────────┐
133
+ │ BOULDER LOOP (ultrawork) │
134
+ │ │
135
+ │ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐ │
136
+ │ │ Phase 1 │───→│ Phase 2 │───→│ Phase 3 │───→│ Phase N │ │
137
+ │ └──────────┘ └──────────┘ └──────────┘ └──────────┘ │
138
+ │ │ │ │ │ │
139
+ │ ↓ ↓ ↓ ↓ │
140
+ │ [Parallel] [Parallel] [Parallel] [Parallel] │
141
+ │ [Implement] [Implement] [Implement] [Implement] │
142
+ │ [Test] [Test] [Test] [Test] │
143
+ │ │ │ │ │ │
144
+ │ └───────────────┴───────────────┴───────────────┘ │
145
+ │ │ │
146
+ │ ↓ │
147
+ │ ┌──────────────┐ │
148
+ │ │ ALL DONE? │ │
149
+ │ └──────────────┘ │
150
+ │ │ │ │
151
+ │ NO YES │
152
+ │ │ │ │
153
+ │ ↓ ↓ │
154
+ │ [Continue] [🎉 Complete!] │
155
+ │ │
156
+ │ NO STOPPING until acceptance criteria met or error limit hit │
157
+ └─────────────────────────────────────────────────────────────────┘
158
+ ```
159
+
160
+ ### Ralph Loop (Completion Verification) - CRITICAL
161
+
162
+ > **Inspired by [ghuntley.com/ralph](https://ghuntley.com/ralph)**: "Deterministically bad in an undeterministic world" - Keep iterating until TRULY complete.
163
+
164
+ **Problem**: AI often claims "complete" when implementation is partial.
165
+
166
+ **Solution**: RTM-based automated coverage verification with iteration tracking.
167
+
168
+ ```
169
+ ┌─────────────────────────────────────────────────────────────────┐
170
+ │ RALPH LOOP (Mandatory) │
171
+ │ │
172
+ │ After ALL phases complete: │
173
+ │ │
174
+ │ ┌──────────────────────────────────────────────────────────┐ │
175
+ │ │ RTM COVERAGE VERIFICATION [Iteration {{ITER}}/{{MAX}}] │ │
176
+ │ │ │ │
177
+ │ │ Generate RTM via vibe tools: │ │
178
+ │ │ → generateTraceabilityMatrix("{feature-name}") │ │
179
+ │ │ │ │
180
+ │ │ Coverage Metrics (automated): │ │
181
+ │ │ □ Requirements coverage: {coveragePercent}% │ │
182
+ │ │ □ SPEC → Feature mapping: {featureCovered}/{total} │ │
183
+ │ │ □ Feature → Test mapping: {testCovered}/{total} │ │
184
+ │ │ □ Build successful? │ │
185
+ │ │ □ Tests passing? │ │
186
+ │ │ │ │
187
+ │ │ UNCOVERED: {uncoveredRequirements[]} │ │
188
+ │ └──────────────────────────────────────────────────────────┘ │
189
+ │ │ │
190
+ │ ┌──────────┴──────────┐ │
191
+ │ │ Coverage ≥ 95%? │ │
192
+ │ └──────────┬──────────┘ │
193
+ │ │ │ │
194
+ │ NO YES │
195
+ │ │ │ │
196
+ │ ↓ ↓ │
197
+ │ ┌────────────────┐ ┌────────────────┐ │
198
+ │ │ IMPLEMENT │ │ ✅ TRULY DONE │ │
199
+ │ │ UNCOVERED │ │ │ │
200
+ │ │ REQUIREMENTS │ │ Report final │ │
201
+ │ │ (auto-extract) │ │ RTM coverage │ │
202
+ │ └───────┬────────┘ └────────────────┘ │
203
+ │ │ │
204
+ │ └──────────→ [Re-generate RTM] │
205
+ │ │
206
+ │ MAX_ITERATIONS: 5 (prevent infinite loops) │
207
+ │ COVERAGE_THRESHOLD: 95% (quality gate) │
208
+ │ ZERO TOLERANCE for scope reduction │
209
+ └─────────────────────────────────────────────────────────────────┘
210
+ ```
211
+
212
+ **Ralph Loop with RTM:**
213
+
214
+ ```bash
215
+ # Generate RTM for coverage verification
216
+ node -e "import('@su-record/vibe/tools').then(t => t.generateTraceabilityMatrix('{feature-name}', {projectPath: process.cwd()}).then(r => console.log(JSON.stringify(r, null, 2))))"
217
+ ```
218
+
219
+ **RTM provides automated metrics:**
220
+
221
+ | Metric | Description |
222
+ |--------|-------------|
223
+ | `totalRequirements` | Total REQ-* items in SPEC |
224
+ | `specCovered` | Requirements with SPEC mapping |
225
+ | `featureCovered` | Requirements with Feature scenarios |
226
+ | `testCovered` | Requirements with test files |
227
+ | `coveragePercent` | Overall coverage percentage |
228
+ | `uncoveredRequirements` | List of missing REQ-* IDs |
229
+
230
+ **Ralph Loop Rules:**
231
+
232
+ | Rule | Description |
233
+ |------|-------------|
234
+ | **No Scope Reduction** | Never say "simplified" or "basic version" - implement FULL request |
235
+ | **Iteration Tracking** | Display `[{{ITER}}/{{MAX}}]` to show progress |
236
+ | **RTM-Based Gap List** | Use `uncoveredRequirements` array - no manual comparison |
237
+ | **Coverage Threshold** | Must reach 95% coverage to complete |
238
+ | **Max Iterations** | Stop at 5 iterations (report remaining gaps) |
239
+
240
+ **Ralph Loop Output Format:**
241
+
242
+ ```
243
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
244
+ 🔄 RALPH VERIFICATION [Iteration 1/5]
245
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
246
+
247
+ 📊 RTM Coverage Report: login
248
+
249
+ Requirements Traceability:
250
+ Total Requirements: 9
251
+ SPEC Covered: 9/9 (100%)
252
+ Feature Covered: 5/9 (55%)
253
+ Test Covered: 4/9 (44%)
254
+
255
+ ✅ REQ-login-001: Login form UI → Scenario 1 → login.test.ts
256
+ ✅ REQ-login-002: Email validation → Scenario 2 → validation.test.ts
257
+ ✅ REQ-login-003: Password validation → Scenario 2 → validation.test.ts
258
+ ❌ REQ-login-004: Remember me checkbox → NOT IMPLEMENTED
259
+ ❌ REQ-login-005: Forgot password link → NOT IMPLEMENTED
260
+ ✅ REQ-login-006: API integration → Scenario 3 → api.test.ts
261
+ ❌ REQ-login-007: Loading state → NOT IMPLEMENTED
262
+ ❌ REQ-login-008: Error toast → NOT IMPLEMENTED
263
+ ✅ REQ-login-009: Session storage → Scenario 4 → (no test)
264
+
265
+ Overall Coverage: 55% ⚠️ BELOW 95% THRESHOLD
266
+
267
+ UNCOVERED REQUIREMENTS (auto-extracted from RTM):
268
+ 1. REQ-login-004: Remember me checkbox
269
+ 2. REQ-login-005: Forgot password link
270
+ 3. REQ-login-007: Loading state
271
+ 4. REQ-login-008: Error toast notifications
272
+
273
+ ⚠️ NOT COMPLETE - Implementing uncovered requirements...
274
+
275
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
276
+ 🔄 RALPH VERIFICATION [Iteration 2/5]
277
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
278
+
279
+ 📊 RTM Coverage Report: login
280
+
281
+ Requirements Traceability:
282
+ Total Requirements: 9
283
+ SPEC Covered: 9/9 (100%)
284
+ Feature Covered: 9/9 (100%)
285
+ Test Covered: 9/9 (100%)
286
+
287
+ Overall Coverage: 100% ✅ ABOVE 95% THRESHOLD
288
+
289
+ Build: ✅ Passed
290
+ Tests: ✅ 12/12 Passed
291
+ Type Check: ✅ No errors
292
+
293
+ ✅ RALPH VERIFIED COMPLETE!
294
+
295
+ 📄 RTM saved: .claude/vibe/rtm/login-rtm.md
296
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
297
+ ```
298
+
299
+ **When to Trigger Ralph Loop:**
300
+
301
+ 1. After all phases complete
302
+ 2. Before final quality report
303
+ 3. Whenever user says "ultrawork" or "ralph"
304
+
305
+ **Forbidden Responses (VIOLATIONS):**
306
+
307
+ | ❌ NEVER Say | ✅ Instead |
308
+ |-------------|-----------|
309
+ | "I've implemented a basic version" | Implement the FULL version |
310
+ | "This is a simplified approach" | Implement as specified |
311
+ | "You can add X later" | Add X now |
312
+ | "For demonstration purposes" | Implement production-ready |
313
+ | "The core functionality is done" | ALL functionality must be done |
314
+
315
+ ### ULTRAWORK Example
316
+
317
+ ```
318
+ User: /vibe.run "brick-game" ultrawork
319
+
320
+ Claude:
321
+ 🚀 ULTRAWORK MODE ACTIVATED
322
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
323
+
324
+ 📄 SPEC: .claude/vibe/specs/brick-game.md
325
+ 🎯 4 Phases detected
326
+ ⚡ Boulder Loop: ENABLED (will continue until all phases complete)
327
+ 🔄 Auto-retry: ON (max 3 per phase)
328
+ 💾 Context compression: AGGRESSIVE
329
+
330
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
331
+ 🏔️ BOULDER ROLLING... Phase 1/4
332
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
333
+
334
+ ⚡ [PARALLEL] Launching 3 exploration agents...
335
+ ✅ Exploration complete (7.2s)
336
+ 🔨 Implementing...
337
+ ✅ Phase 1 complete
338
+
339
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
340
+ 🏔️ BOULDER ROLLING... Phase 2/4
341
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
342
+
343
+ ⚡ [PARALLEL] Launching 3 exploration agents...
344
+ ✅ Exploration complete (6.8s)
345
+ 🔨 Implementing...
346
+ ❌ Test failed: collision detection
347
+ 🔄 Auto-retry 1/3...
348
+ 🔨 Fixing...
349
+ ✅ Phase 2 complete
350
+
351
+ [...continues automatically...]
352
+
353
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
354
+ 🎉 BOULDER REACHED THE TOP!
355
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
356
+
357
+ ✅ All 4 phases complete
358
+ ✅ All acceptance criteria passed
359
+ ✅ Build succeeded
360
+ ✅ Tests passed
361
+
362
+ ⏱️ Total: 8m 24s
363
+ 📊 Retries: 2
364
+ 💾 Context saved: 3 checkpoints
365
+ ```
366
+
367
+ ### Normal vs ULTRAWORK Comparison
368
+
369
+ | Aspect | Normal | ULTRAWORK |
370
+ |--------|--------|-----------|
371
+ | Phase transition | May pause | Auto-continues |
372
+ | On error | Reports and stops | Auto-retries (3x) |
373
+ | Context 70%+ | Warning only | Auto-compress + save |
374
+ | Exploration | Sequential possible | FORCED parallel |
375
+ | Completion | Phase-by-phase | Until ALL done |
376
+
377
+ ---
378
+
379
+ ## Rules Reference
380
+
381
+ **Must follow `~/.claude/vibe/rules/` (global):**
382
+
383
+ - `core/development-philosophy.md` - Surgical precision, modify only requested scope
384
+ - `core/quick-start.md` - Korean, DRY, SRP, YAGNI
385
+ - `standards/complexity-metrics.md` - Functions ≤20 lines, nesting ≤3 levels
386
+ - `quality/checklist.md` - Code quality checklist
387
+
388
+ **Language guide:** `~/.claude/vibe/languages/{stack}.md` (global reference)
389
+
390
+ ## Description
391
+
392
+ Read PTCF structured SPEC document and execute implementation immediately.
393
+
394
+ > **PLAN, TASKS documents unnecessary** - SPEC is the executable prompt
395
+
396
+ ## Model Orchestration (Intelligent Routing)
397
+
398
+ Automatically select optimal model based on **task complexity analysis**.
399
+
400
+ ### Complexity-Based Model Selection
401
+
402
+ | Complexity Score | Model | When to Use |
403
+ |------------------|-------|-------------|
404
+ | 0-7 (Low) | **Haiku** | Simple fixes, searches, single file changes |
405
+ | 8-19 (Medium) | **Sonnet** | Standard features, 3-5 files, integrations |
406
+ | 20+ (High) | **Opus** | Architecture, security, multi-service, 6+ files |
407
+
408
+ ### Complexity Signals
409
+
410
+ The following signals increase complexity score:
411
+
412
+ | Signal | Score |
413
+ |--------|-------|
414
+ | Architecture change | +15 |
415
+ | Security implication | +12 |
416
+ | Multi-service | +8 |
417
+ | Refactoring | +12 |
418
+ | 6+ files | +15 |
419
+ | 3-5 files | +8 |
420
+ | New feature | +5 |
421
+ | Bug fix | -3 |
422
+ | Documentation | -5 |
423
+
424
+ ### Agent Tier System
425
+
426
+ Each agent has tier variants for cost optimization:
427
+
428
+ | Agent | Low (Haiku) | Medium (Sonnet) | High (Opus) |
429
+ |-------|-------------|-----------------|-------------|
430
+ | explorer | explorer-low | explorer-medium | explorer |
431
+ | implementer | implementer-low | implementer-medium | implementer |
432
+ | architect | architect-low | architect-medium | architect |
433
+
434
+ ### Task Calls by Role
435
+
436
+ | Task Type | Model | Task Parameter |
437
+ |-----------|-------|----------------|
438
+ | Simple search | Haiku | `model: "haiku"` |
439
+ | Codebase exploration | Haiku/Sonnet | Auto-selected |
440
+ | Core implementation | Sonnet | `model: "sonnet"` |
441
+ | Test writing | Haiku | `model: "haiku"` |
442
+ | Architecture decisions | Opus | Main session |
443
+ | Final review | Opus | Main session |
444
+
445
+ ### External LLM Usage (When Enabled)
446
+
447
+ When external LLMs are enabled in `.claude/vibe/config.json`:
448
+
449
+ | Role | Method | Condition |
450
+ |------|--------|-----------|
451
+ | User direct query | `gpt.question`, `gemini.question` | Hook auto-handles |
452
+ | Internal orchestration | Call global script via Bash | Claude calls directly |
453
+
454
+ **User questions (Hook auto-handles):**
455
+ - `gpt.question` - GPT architecture consultation
456
+ - `gemini.question` - Gemini Q&A/consultation
457
+
458
+ **Claude internal calls (directly via Bash):**
459
+ ```bash
460
+ # Usage: node llm-orchestrate.js <provider> <mode> [systemPrompt] [prompt]
461
+ # - If systemPrompt omitted, uses default
462
+ # - If systemPrompt is "-", uses default and treats next argument as prompt
463
+
464
+ # Cross-platform path (works on Windows/macOS/Linux)
465
+ VIBE_SCRIPTS="$(node -p "process.env.APPDATA || require('os').homedir() + '/.config'")/vibe/hooks/scripts"
466
+
467
+ # GPT call
468
+ node "$VIBE_SCRIPTS/llm-orchestrate.js" gpt orchestrate-json "[question content]"
469
+
470
+ # Gemini call
471
+ node "$VIBE_SCRIPTS/llm-orchestrate.js" gemini orchestrate-json "[question content]"
472
+
473
+ # Custom system prompt usage
474
+ node "$VIBE_SCRIPTS/llm-orchestrate.js" gpt orchestrate-json "You are a code reviewer" "[question content]"
475
+ ```
476
+
477
+ ### External LLM Fallback
478
+
479
+ **IMPORTANT**: When GPT/Gemini hook fails, Claude MUST handle the task directly:
480
+
481
+ **Fallback behavior**:
482
+ - Do NOT retry the external LLM call
483
+ - Claude handles the task using its own capabilities
484
+ - Continue with the implementation without interruption
485
+ - Log the fallback but don't block progress
486
+
487
+ ## Vibe Tools (Semantic Analysis & Memory)
488
+
489
+ Use vibe tools for accurate codebase understanding and session continuity.
490
+
491
+ ### Tool Invocation
492
+
493
+ All tools are called via:
494
+ ```bash
495
+ node -e "import('@su-record/vibe/tools').then(t => t.TOOL_NAME({...args}).then(r => console.log(r.content[0].text)))"
496
+ ```
497
+
498
+ ### Semantic Analysis Tools
499
+
500
+ | Tool | Purpose | Usage |
501
+ |------|---------|-------|
502
+ | `findSymbol` | Find symbol definitions | `{symbolName: 'functionName', searchPath: '.'}` |
503
+ | `findReferences` | Find all references | `{symbolName: 'functionName', searchPath: '.'}` |
504
+ | `analyzeComplexity` | Analyze code complexity | `{filePath: 'src/file.ts'}` |
505
+ | `validateCodeQuality` | Validate code quality | `{filePath: 'src/file.ts'}` |
506
+
507
+ **Example - Find symbol:**
508
+ ```bash
509
+ node -e "import('@su-record/vibe/tools').then(t => t.findSymbol({symbolName: 'login', searchPath: '.'}).then(r => console.log(r.content[0].text)))"
510
+ ```
511
+
512
+ ### Memory Tools
513
+
514
+ | Tool | Purpose | Usage |
515
+ |------|---------|-------|
516
+ | `saveMemory` | Save important decisions | `{key: 'decision-name', value: 'content', category: 'project'}` |
517
+ | `recallMemory` | Recall saved memory | `{key: 'decision-name'}` |
518
+ | `listMemories` | List all memories | `{category: 'project'}` |
519
+
520
+ **Example - Save important decision:**
521
+ ```bash
522
+ node -e "import('@su-record/vibe/tools').then(t => t.saveMemory({key: 'auth-pattern', value: 'Using JWT with refresh tokens', category: 'project'}).then(r => console.log(r.content[0].text)))"
523
+ ```
524
+
525
+ ### Session Management (Auto via Hooks)
526
+
527
+ - **Session start**: Hook auto-calls `startSession` to restore previous context
528
+ - **Context 80%+**: Hook auto-calls `autoSaveContext` to preserve state
529
+
530
+ ## Process
531
+
532
+ ### 1. Load SPEC + Feature
533
+
534
+ ```
535
+ 📄 .claude/vibe/specs/{feature-name}.md → SPEC (structure, constraints, context)
536
+ 📄 .claude/vibe/features/{feature-name}.feature → Feature (scenario = implementation unit)
537
+ ```
538
+
539
+ **Error if Feature file missing**:
540
+ ```
541
+ ❌ Feature file not found.
542
+ Run /vibe.spec "{feature-name}" first.
543
+ ```
544
+
545
+ ### 2. Extract Scenario List
546
+
547
+ Extract all Scenarios from Feature file:
548
+
549
+ ```markdown
550
+ ## Scenarios to Implement
551
+
552
+ | # | Scenario | Status |
553
+ |---|----------|--------|
554
+ | 1 | Valid login success | ⬜ |
555
+ | 2 | Invalid password error | ⬜ |
556
+ | 3 | Email format validation | ⬜ |
557
+ | 4 | Password reset link | ⬜ |
558
+
559
+ Total: 4 scenarios
560
+ ```
561
+
562
+ ### 3. Scenario-by-Scenario Implementation (Core)
563
+
564
+ **For each scenario**:
565
+
566
+ ```
567
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
568
+ 🎯 Scenario 1/4: Valid login success
569
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
570
+
571
+ Given: User is registered
572
+ When: Login with valid email and password
573
+ Then: Login success + JWT token returned
574
+
575
+ [Step 1] Analyzing implementation...
576
+ - Required files: auth.service.ts, login.controller.ts
577
+ - Exploring related code...
578
+
579
+ [Step 2] Implementing...
580
+ ✅ auth.service.ts - Added login() method
581
+ ✅ login.controller.ts - POST /login endpoint
582
+
583
+ [Step 3] Verifying...
584
+ ✅ Given: Test user creation possible
585
+ ✅ When: Login API call succeeded
586
+ ✅ Then: JWT token return confirmed
587
+
588
+ ✅ Scenario 1 passed!
589
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
590
+ ```
591
+
592
+ **On failure**:
593
+
594
+ ```
595
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
596
+ 🎯 Scenario 2/4: Invalid password error
597
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
598
+
599
+ [Step 3] Verifying...
600
+ ✅ Given: Test user exists
601
+ ✅ When: Login attempt with wrong password
602
+ ❌ Then: "Invalid credentials" error message
603
+ Actual: "Error occurred" returned
604
+
605
+ [Auto-fix 1/3]
606
+ Cause: Error message not properly set
607
+ Fix: auth.service.ts line 42
608
+
609
+ [Re-verify]
610
+ ✅ Then: "Invalid credentials" error message
611
+
612
+ ✅ Scenario 2 passed! (1 fix)
613
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
614
+ ```
615
+
616
+ ---
617
+
618
+ ## **CRITICAL: Parallel Sub-Agent Execution**
619
+
620
+ > **MUST USE PARALLEL TASK CALLS** - This is REQUIRED, not optional.
621
+ > Sequential execution when parallel is possible = VIOLATION of this workflow.
622
+
623
+ ### Mandatory Parallel Exploration (Phase Start)
624
+
625
+ **BEFORE any implementation, you MUST launch these Task calls IN PARALLEL (single message, multiple tool calls):**
626
+
627
+ ```
628
+ ┌─────────────────────────────────────────────────────────────────┐
629
+ │ STEP 1: PARALLEL EXPLORATION (REQUIRED) │
630
+ │ │
631
+ │ Launch ALL of these in ONE message: │
632
+ │ │
633
+ │ Task(haiku) ─┬─→ "Analyze related files in <context>" │
634
+ │ │ │
635
+ │ Task(haiku) ─┼─→ "Check dependencies and imports" │
636
+ │ │ │
637
+ │ Task(haiku) ─┴─→ "Find existing patterns and conventions" │
638
+ │ │
639
+ │ [If GPT enabled] Bash: node {{VIBE_PATH}}/hooks/scripts/llm-orchestrate.js gpt orchestrate-json "[question]"
640
+ │ [If Gemini enabled] Bash: node {{VIBE_PATH}}/hooks/scripts/llm-orchestrate.js gemini orchestrate-json "[question]"
641
+ └─────────────────────────────────────────────────────────────────┘
642
+
643
+ ↓ (wait for all to complete)
644
+ ┌─────────────────────────────────────────────────────────────────┐
645
+ │ STEP 2: SYNTHESIZE (Opus) │
646
+ │ - Review all exploration results │
647
+ │ - Decide implementation approach │
648
+ │ - Identify files to modify/create │
649
+ └─────────────────────────────────────────────────────────────────┘
650
+
651
+
652
+ ┌─────────────────────────────────────────────────────────────────┐
653
+ │ STEP 3: IMPLEMENT + BACKGROUND AGENTS (PARALLEL) │
654
+ │ │
655
+ │ Main Agent (sonnet): │
656
+ │ └─→ Execute current phase implementation │
657
+ │ │
658
+ │ Background Agents (haiku, run_in_background=true): │
659
+ │ ├─→ Task: "Prepare Phase N+1 - analyze required files" │
660
+ │ ├─→ Task: "Pre-generate test cases for current implementation" │
661
+ │ └─→ Task: "Search for related types/interfaces needed" │
662
+ │ │
663
+ │ [ULTRAWORK] All 4 agents run simultaneously! │
664
+ └─────────────────────────────────────────────────────────────────┘
665
+
666
+ ↓ (main completes, check backgrounds)
667
+ ┌─────────────────────────────────────────────────────────────────┐
668
+ │ STEP 4: TEST + PHASE PIPELINING │
669
+ │ │
670
+ │ Current Phase: │
671
+ │ └─→ Task(haiku): Write tests using pre-generated cases │
672
+ │ │
673
+ │ Next Phase Prep (from background results): │
674
+ │ └─→ Already have file analysis, ready to start immediately │
675
+ └─────────────────────────────────────────────────────────────────┘
676
+ ```
677
+
678
+ ### Parallel Task Call Pattern (MUST FOLLOW)
679
+
680
+ **Correct - Single message with multiple parallel Tasks:**
681
+ ```
682
+ <message>
683
+ Task(haiku, "Analyze src/components/ for existing patterns")
684
+ Task(haiku, "Check package.json dependencies")
685
+ Task(haiku, "Find usage of similar features in codebase")
686
+ </message>
687
+ → All 3 run simultaneously, ~3x faster
688
+ ```
689
+
690
+ **WRONG - Sequential calls (DO NOT DO THIS):**
691
+ ```
692
+ <message>Task(haiku, "Analyze...")</message>
693
+ <message>Task(haiku, "Check...")</message>
694
+ <message>Task(haiku, "Find...")</message>
695
+ → 3x slower, wastes time
696
+ ```
697
+
698
+ ### Background Agent Pattern (ULTRAWORK) via Orchestrator
699
+
700
+ **Launch background agents for next phase via Orchestrator:**
701
+ ```bash
702
+ # Start background agent (doesn't block)
703
+ node -e "import('@su-record/vibe/orchestrator').then(o => o.runAgent('Phase 2 prep: Analyze auth API endpoints', 'phase2-prep').then(r => console.log(r.content[0].text)))"
704
+
705
+ # Multiple backgrounds in parallel
706
+ node -e "import('@su-record/vibe/orchestrator').then(async o => {
707
+ await Promise.all([
708
+ o.runAgent('Phase 2 prep: Analyze auth API endpoints', 'phase2-prep'),
709
+ o.runAgent('Pre-generate test cases for login form', 'test-prep'),
710
+ o.runAgent('Find existing validation patterns', 'pattern-finder')
711
+ ]);
712
+ console.log('All background agents started');
713
+ })"
714
+ ```
715
+
716
+ **Check background agent status:**
717
+ ```bash
718
+ node -e "import('@su-record/vibe/orchestrator').then(o => console.log(o.status().content[0].text))"
719
+ ```
720
+
721
+ **Get result when ready:**
722
+ ```bash
723
+ node -e "import('@su-record/vibe/orchestrator').then(o => o.getResult('SESSION_ID').then(r => console.log(r.content[0].text)))"
724
+ ```
725
+
726
+ **Why Background Agents Matter:**
727
+
728
+ | Without Background | With Background |
729
+ |--------------------|-----------------|
730
+ | Phase 1: 60s | Phase 1: 60s (+ backgrounds running) |
731
+ | Phase 2 prep: 20s | Phase 2 prep: 0s (already done!) |
732
+ | Phase 2: 60s | Phase 2: 60s |
733
+ | **Total: 140s** | **Total: 120s** |
734
+
735
+ For 5 phases: 4 × 20s saved = **80s faster**
736
+
737
+ ### Why Parallel Matters
738
+
739
+ | Approach | Time | Cache Benefit |
740
+ |----------|------|---------------|
741
+ | Sequential (3 Tasks) | ~30s | Cache cold on each |
742
+ | **Parallel (3 Tasks)** | **~10s** | **Cache warmed once, shared** |
743
+
744
+ vibe ProjectCache (LRU) caches ts-morph parsing results. Parallel calls share the warmed cache.
745
+
746
+ ### Phase Execution Flow (ULTRAWORK Pipeline)
747
+
748
+ ```
749
+ Phase N Start
750
+
751
+ ├─→ [PARALLEL] Task(haiku) × 3: Exploration
752
+ │ - Related code analysis
753
+ │ - Dependency check
754
+ │ - Pattern discovery
755
+
756
+ ↓ (all complete)
757
+
758
+ ├─→ Opus: Synthesize and decide
759
+
760
+ ├─→ [PARALLEL PIPELINE] ←── KEY SPEED OPTIMIZATION
761
+ │ │
762
+ │ ├─→ Main: Task(sonnet) Implementation
763
+ │ │
764
+ │ └─→ Background (run_in_background=true):
765
+ │ ├─→ Task(haiku): Phase N+1 file analysis
766
+ │ ├─→ Task(haiku): Test case preparation
767
+ │ └─→ Task(haiku): Type/interface lookup
768
+
769
+ ↓ (main completes)
770
+
771
+ ├─→ Task(haiku): Tests (uses pre-generated cases)
772
+
773
+
774
+ Phase N Complete
775
+
776
+ ↓ (Background results ready - NO WAIT for Phase N+1 exploration!)
777
+
778
+ Phase N+1 Start (IMMEDIATE - exploration already done!)
779
+ ```
780
+
781
+ **Speed Comparison:**
782
+
783
+ | Mode | Phase Time | 5 Phases Total |
784
+ |------|------------|----------------|
785
+ | Sequential | ~2min/phase | ~10min |
786
+ | Parallel Exploration | ~1.5min/phase | ~7.5min |
787
+ | **ULTRAWORK Pipeline** | **~1min/phase** | **~5min** |
788
+
789
+ **Why Pipeline is Faster:**
790
+ - Background agents prepare next phase WHILE current phase implements
791
+ - No idle time between phases
792
+ - Test cases pre-generated during implementation
793
+ - Cache stays warm across parallel tasks
794
+
795
+ ---
796
+
797
+ 1. **Related code analysis**: Task(haiku) explores `<context>` related code
798
+ 2. **File creation/modification**: Task(sonnet) implements per `<output_format>`
799
+ 3. **Constraint compliance**: Check `<constraints>`
800
+ 4. **Run verification**: Execute verification commands
801
+
802
+ ### 4. Brand Assets Generation (Optional)
803
+
804
+ When starting a **new project** with brand context in SPEC, auto-generate app icons and favicons:
805
+
806
+ ```
807
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
808
+ 🎨 BRAND ASSETS GENERATION
809
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
810
+
811
+ [Check] Brand assets exist? → Skip if favicon.ico exists
812
+ [Check] Gemini API configured? → Required for image generation
813
+ [Check] SPEC has brand context? → Extract app name, colors, style
814
+
815
+ [Generate] Creating app icon with Gemini Image API...
816
+ - Prompt: "App icon for [AppName], [style], [color]..."
817
+ - Generated: 512x512 master icon
818
+
819
+ [Resize] Creating platform variants...
820
+ ✅ favicon.ico (16/32/48)
821
+ ✅ favicon-16x16.png
822
+ ✅ favicon-32x32.png
823
+ ✅ apple-touch-icon.png (180x180)
824
+ ✅ android-chrome-192x192.png
825
+ ✅ android-chrome-512x512.png
826
+ ✅ site.webmanifest
827
+
828
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
829
+ ✅ Brand assets generated in public/
830
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
831
+ ```
832
+
833
+ **SPEC Brand Context Example:**
834
+
835
+ ```xml
836
+ <context>
837
+ Brand:
838
+ - App Name: MyApp
839
+ - Primary Color: #2F6BFF
840
+ - Style: Modern, minimalist, flat design
841
+ - Icon Concept: Abstract geometric shape
842
+ </context>
843
+ ```
844
+
845
+ **Trigger Conditions:**
846
+ - First `/vibe.run` execution (no existing icons)
847
+ - SPEC contains brand/design context
848
+ - Gemini API key configured (`vibe gemini auth`)
849
+
850
+ **Manual Generation:**
851
+ ```bash
852
+ node hooks/scripts/generate-brand-assets.js \
853
+ --spec ".claude/vibe/specs/my-feature.md" \
854
+ --output "./public"
855
+
856
+ # Or with explicit values
857
+ node hooks/scripts/generate-brand-assets.js \
858
+ --name "MyApp" \
859
+ --color "#2F6BFF" \
860
+ --style "modern minimal" \
861
+ --output "./public"
862
+ ```
863
+
864
+ **Fallback:** If Gemini Image fails, generates text monogram icon (first letter + primary color).
865
+
866
+ ---
867
+
868
+ ### 5. Race Code Review (GPT + Gemini) + Auto-Fix (v2.6.9)
869
+
870
+ After all scenarios are implemented, **GPT and Gemini review in parallel with cross-validation**:
871
+
872
+ > **ULTRAWORK Default**: In ULTRAWORK mode, race review is automatically enabled.
873
+
874
+ ```
875
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
876
+ 🏁 RACE CODE REVIEW (GPT + Gemini)
877
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
878
+
879
+ [Step 1] Parallel review execution...
880
+ ├─ GPT-5.2-Codex: Reviewing...
881
+ └─ Gemini-3-Flash: Reviewing...
882
+
883
+ [Step 2] Cross-validation results:
884
+ ┌───────────────────────────────────────────────────────────┐
885
+ │ Issue │ GPT │ Gemini │ Confidence│
886
+ │────────────────────────────────│─────│────────│───────────│
887
+ │ Timing attack in password │ ✅ │ ✅ │ 100% → P1 │
888
+ │ Rate limiting missing │ ✅ │ ✅ │ 100% → P1 │
889
+ │ Magic number usage │ ✅ │ ❌ │ 50% → P2 │
890
+ └───────────────────────────────────────────────────────────┘
891
+
892
+ Summary: 3 issues (P1: 2, P2: 1)
893
+
894
+ [Step 3] Auto-fixing P1/P2 issues...
895
+ ✅ auth.service.ts:24 - Applied timingSafeEqual (P1)
896
+ ✅ auth.controller.ts:15 - Added rate limiter (P1)
897
+ ✅ auth.service.ts:42 - Extracted constant (P2)
898
+
899
+ [Step 4] Re-verifying...
900
+ ✅ Build succeeded
901
+ ✅ Tests passed
902
+
903
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
904
+ ✅ Race review complete! 3 improvements (2 P1, 1 P2)
905
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
906
+ ```
907
+
908
+ **Race Review Invocation:**
909
+
910
+ ```bash
911
+ # Via vibe tools
912
+ node -e "import('@su-record/vibe/tools').then(t => t.raceReview({reviewType: 'security', code: '[code]'}).then(r => console.log(t.formatRaceResult(r))))"
913
+ ```
914
+
915
+ **Confidence-based Priority:**
916
+
917
+ | Confidence | Priority | Action |
918
+ |------------|----------|--------|
919
+ | 100% (2/2) | P1 | Auto-fix immediately |
920
+ | 50% (1/2) | P2 | Auto-fix with review |
921
+
922
+ **Fallback handling:**
923
+ - If one LLM fails → Use single LLM result (reduced confidence)
924
+ - If both fail → Skip and proceed (log warning)
925
+
926
+ **Review application rules:**
927
+
928
+ | Feedback Type | Action |
929
+ |---------------|--------|
930
+ | Security vulnerability (P1) | Auto-fix immediately |
931
+ | Performance improvement (P1/P2) | Auto-fix immediately |
932
+ | Best practices (P2) | Auto-fix |
933
+ | Style/preference (P3) | Apply selectively |
934
+
935
+ **Conditions:**
936
+ - **ULTRAWORK**: Race review enabled by default
937
+ - **Normal mode**: Use `--race` flag to enable
938
+ - Must re-verify build/tests after fixes
939
+
940
+ ### 6. Quality Report (Auto-generated)
941
+
942
+ After all scenarios complete + Gemini review, **quality report is auto-generated**:
943
+
944
+ ```
945
+ ┌─────────────────────────────────────────────────────────────────┐
946
+ │ 📊 QUALITY REPORT: login │
947
+ ├─────────────────────────────────────────────────────────────────┤
948
+ │ │
949
+ │ ✅ Scenarios: 4/4 passed │
950
+ │ │
951
+ │ ┌───────────────────────────────────────────────────────────┐ │
952
+ │ │ # │ Scenario │ Status │ Retries │ │ │
953
+ │ │───│───────────────────────────│────────│─────────│ │ │
954
+ │ │ 1 │ Valid login success │ ✅ │ 0 │ │ │
955
+ │ │ 2 │ Invalid password error │ ✅ │ 1 │ │ │
956
+ │ │ 3 │ Email format validation │ ✅ │ 0 │ │ │
957
+ │ │ 4 │ Password reset link │ ✅ │ 0 │ │ │
958
+ │ └───────────────────────────────────────────────────────────┘ │
959
+ │ │
960
+ │ 📈 Quality score: 94/100 │
961
+ │ │
962
+ │ ┌─────────────────────────────────────────────────────────┐ │
963
+ │ │ Item │ Result │ Notes │ │
964
+ │ │───────────────────│────────│─────────────────────────────│ │
965
+ │ │ Build │ ✅ │ npm run build succeeded │ │
966
+ │ │ Tests │ ✅ │ 12/12 passed │ │
967
+ │ │ Type check │ ✅ │ 0 errors │ │
968
+ │ │ Complexity │ ✅ │ All functions ≤30 lines │ │
969
+ │ │ Security │ ✅ │ 0 vulnerabilities │ │
970
+ │ │ Gemini review │ ✅ │ 3 improvements applied │ │
971
+ │ └─────────────────────────────────────────────────────────┘ │
972
+ │ │
973
+ │ ⏱️ Total time: 3m 42s │
974
+ │ │
975
+ └─────────────────────────────────────────────────────────────────┘
976
+ ```
977
+
978
+ **What users should check**:
979
+ - Scenario pass rate (4/4 = 100%)
980
+ - Quality score (94/100)
981
+ - Build/test status
982
+
983
+ **This alone is enough to trust quality.**
984
+
985
+ ### 7. Update Feature File
986
+
987
+ Auto-update scenario status:
988
+
989
+ ```markdown
990
+ ## Coverage
991
+
992
+ | Scenario | SPEC AC | Status |
993
+ |----------|---------|--------|
994
+ | Valid login success | AC-1 | ✅ |
995
+ | Invalid password error | AC-2 | ✅ |
996
+ | Email format validation | AC-3 | ✅ |
997
+ | Password reset link | AC-4 | ✅ |
998
+
999
+ **Last verified**: 2024-01-15 14:32
1000
+ **Quality score**: 94/100
1001
+ ```
1002
+
1003
+ ## TRUST 5 Principles
1004
+
1005
+ Follow during implementation:
1006
+
1007
+ | Principle | Description |
1008
+ |-----------|-------------|
1009
+ | **T**est-first | Write tests first |
1010
+ | **R**eadable | Clear code |
1011
+ | **U**nified | Consistent style |
1012
+ | **S**ecured | Consider security |
1013
+ | **T**rackable | Logging, monitoring |
1014
+
1015
+ ## Input
1016
+
1017
+ - `.claude/vibe/specs/{feature-name}.md` (PTCF SPEC)
1018
+ - `.claude/vibe/features/{feature-name}.feature` (BDD)
1019
+ - `CLAUDE.md` (project context)
1020
+
1021
+ ## Output
1022
+
1023
+ - Implemented code files
1024
+ - Test files
1025
+ - Updated SPEC document (checkmarks)
1026
+
1027
+ ## Example
1028
+
1029
+ ```
1030
+ User: /vibe.run "login"
1031
+
1032
+ Claude:
1033
+ 📄 Loading SPEC: .claude/vibe/specs/login.md
1034
+ 📄 Loading Feature: .claude/vibe/features/login.feature
1035
+
1036
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1037
+ 📋 Scenarios to Implement
1038
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1039
+
1040
+ | # | Scenario | Status |
1041
+ |---|----------|--------|
1042
+ | 1 | Valid login success | ⬜ |
1043
+ | 2 | Invalid password error | ⬜ |
1044
+ | 3 | Email format validation | ⬜ |
1045
+ | 4 | Password reset link | ⬜ |
1046
+
1047
+ Total: 4 scenarios
1048
+
1049
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1050
+ 🎯 Scenario 1/4: Valid login success
1051
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1052
+
1053
+ Given: User is registered
1054
+ When: Login with valid email and password
1055
+ Then: Login success + JWT token returned
1056
+
1057
+ ⚡ [PARALLEL] Exploring...
1058
+ ✅ Exploration complete (2.1s)
1059
+
1060
+ 🔨 Implementing...
1061
+ ✅ auth.service.ts - Added login()
1062
+ ✅ auth.controller.ts - POST /login
1063
+
1064
+ 🔍 Verifying...
1065
+ ✅ Given: OK
1066
+ ✅ When: OK
1067
+ ✅ Then: OK
1068
+
1069
+ ✅ Scenario 1 passed!
1070
+
1071
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1072
+ 🎯 Scenario 2/4: Invalid password error
1073
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1074
+
1075
+ 🔨 Implementing...
1076
+ ✅ auth.service.ts - Password validation logic
1077
+
1078
+ 🔍 Verifying...
1079
+ ✅ Given: OK
1080
+ ✅ When: OK
1081
+ ❌ Then: "Invalid credentials" error message
1082
+ Actual: "Error" returned
1083
+
1084
+ 🔄 Auto-fix 1/3...
1085
+ Fix: auth.service.ts line 42
1086
+
1087
+ 🔍 Re-verifying...
1088
+ ✅ Then: OK
1089
+
1090
+ ✅ Scenario 2 passed! (1 fix)
1091
+
1092
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1093
+ 🎯 Scenario 3/4: Email format validation
1094
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1095
+
1096
+ 🔨 Implementing...
1097
+ 🔍 Verifying...
1098
+ ✅ Scenario 3 passed!
1099
+
1100
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1101
+ 🎯 Scenario 4/4: Password reset link
1102
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1103
+
1104
+ 🔨 Implementing...
1105
+ 🔍 Verifying...
1106
+ ✅ Scenario 4 passed!
1107
+
1108
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1109
+ 🔍 GEMINI CODE REVIEW
1110
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1111
+
1112
+ 📤 Sending code to Gemini...
1113
+ 📝 Gemini feedback:
1114
+ 1. [Security] Need timing attack prevention → Fixing...
1115
+ 2. [Performance] Unnecessary DB call → Fixing...
1116
+
1117
+ ✅ 2 improvements auto-applied
1118
+ 🔍 Re-verifying... ✅ Passed
1119
+
1120
+ ┌─────────────────────────────────────────────────────────────────┐
1121
+ │ 📊 QUALITY REPORT: login │
1122
+ ├─────────────────────────────────────────────────────────────────┤
1123
+ │ │
1124
+ │ ✅ Scenarios: 4/4 passed │
1125
+ │ │
1126
+ │ | # | Scenario | Status | Retries | │
1127
+ │ |---|───────────────────────|───────|─────────| │
1128
+ │ | 1 | Valid login success | ✅ | 0 | │
1129
+ │ | 2 | Invalid password error| ✅ | 1 | │
1130
+ │ | 3 | Email format validation| ✅ | 0 | │
1131
+ │ | 4 | Password reset link | ✅ | 0 | │
1132
+ │ │
1133
+ │ 📈 Quality score: 94/100 │
1134
+ │ Build: ✅ | Tests: ✅ | Types: ✅ | Gemini: ✅ (2 applied) │
1135
+ │ │
1136
+ │ ⏱️ Total time: 3m 42s │
1137
+ └─────────────────────────────────────────────────────────────────┘
1138
+
1139
+ 🎉 Implementation complete! All scenarios passed + Gemini review applied.
1140
+
1141
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1142
+ 🔍 AUTO REVIEW (13+ Agents)
1143
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1144
+
1145
+ ⚡ [PARALLEL] 13 expert agents reviewing...
1146
+ - security-reviewer ✅
1147
+ - performance-reviewer ✅
1148
+ - architecture-reviewer ✅
1149
+ - ...
1150
+
1151
+ 📋 Review results:
1152
+ - P1 Critical: 0
1153
+ - P2 Important: 2
1154
+ - P3 Nice-to-have: 1
1155
+
1156
+ 🔧 Auto-fixing P2 issues...
1157
+ 1. [PERF] N+1 query → Fixed
1158
+ 2. [ARCH] Circular dependency → Fixed
1159
+
1160
+ ✅ Auto Review complete! 2 issues auto-resolved.
1161
+ ```
1162
+
1163
+ ### Phase-specific Execution
1164
+
1165
+ ```
1166
+ User: /vibe.run "brick-game" --phase 2
1167
+
1168
+ Claude:
1169
+ 📄 Reading SPEC: .claude/vibe/specs/brick-game.md
1170
+ 🎯 Executing Phase 2 only.
1171
+
1172
+ Phase 2: Game Logic
1173
+ 1. [ ] Paddle movement implementation
1174
+ 2. [ ] Ball physics engine
1175
+ 3. [ ] Brick collision handling
1176
+ 4. [ ] Score system
1177
+ 5. [ ] Game over conditions
1178
+
1179
+ ⚡ Launching parallel exploration...
1180
+ [Task(haiku) × 3 launched in parallel]
1181
+
1182
+ 🚀 Starting implementation...
1183
+ ```
1184
+
1185
+ ## Error Handling
1186
+
1187
+ On failure:
1188
+ 1. Check error message
1189
+ 2. Review `<constraints>`
1190
+ 3. Fix code and retry
1191
+ 4. If continues to fail, report to user
1192
+
1193
+ ---
1194
+
1195
+ ## Quality Gate (Mandatory)
1196
+
1197
+ ### Implementation Quality Checklist
1198
+
1199
+ Before marking any scenario as complete, ALL items must pass:
1200
+
1201
+ | Category | Check Item | Weight |
1202
+ |----------|------------|--------|
1203
+ | **Functionality** | All Given/When/Then conditions verified | 20% |
1204
+ | **Functionality** | Edge cases handled per scenario | 10% |
1205
+ | **Code Quality** | No `any` types in TypeScript | 10% |
1206
+ | **Code Quality** | Functions ≤30 lines, nesting ≤3 levels | 10% |
1207
+ | **Code Quality** | No hardcoded values (use constants) | 5% |
1208
+ | **Security** | Input validation implemented | 10% |
1209
+ | **Security** | Authentication/authorization checked | 5% |
1210
+ | **Error Handling** | Try-catch or error states present | 10% |
1211
+ | **Error Handling** | User-friendly error messages | 5% |
1212
+ | **Testing** | Unit tests exist for core logic | 10% |
1213
+ | **Performance** | No N+1 queries or unnecessary loops | 5% |
1214
+
1215
+ ### Quality Score Calculation
1216
+
1217
+ ```
1218
+ Score = Σ(checked items × weight) / 100
1219
+
1220
+ Grades:
1221
+ - 95-100: ✅ EXCELLENT - Ready to merge
1222
+ - 90-94: ⚠️ GOOD - Minor improvements required before merge
1223
+ - 80-89: ⚠️ FAIR - Significant improvements required
1224
+ - 0-79: ❌ POOR - Major fixes needed
1225
+ ```
1226
+
1227
+ ### Quality Gate Thresholds
1228
+
1229
+ | Gate | Minimum Score | Condition |
1230
+ |------|---------------|-----------|
1231
+ | **Scenario Complete** | 95 | Each scenario must score ≥95 |
1232
+ | **Phase Complete** | 95 | Average of all scenarios ≥95 |
1233
+ | **Feature Complete** | 95 | All phases complete + Gemini review |
1234
+
1235
+ ### Auto-Fix Triggers
1236
+
1237
+ | Issue Type | Auto-Fix Action |
1238
+ |------------|-----------------|
1239
+ | Missing error handling | Add try-catch wrapper |
1240
+ | Hardcoded values | Extract to constants file |
1241
+ | Missing input validation | Add validation schema |
1242
+ | Function too long | Suggest split points |
1243
+ | N+1 query detected | Add eager loading |
1244
+
1245
+ ### Forbidden Patterns (Block Merge)
1246
+
1247
+ | Pattern | Why Forbidden | Detection |
1248
+ |---------|---------------|-----------|
1249
+ | `console.log` | Debug code in production | Regex scan |
1250
+ | `// TODO` without issue | Untracked work | Comment scan |
1251
+ | `any` type | Type safety bypass | TypeScript check |
1252
+ | `@ts-ignore` | Type error suppression | TypeScript check |
1253
+ | Empty catch blocks | Silent error swallowing | AST analysis |
1254
+ | Commented-out code | Dead code | Comment scan |
1255
+
1256
+ ---
1257
+
1258
+ ## Next Step
1259
+
1260
+ ```
1261
+ /vibe.verify "brick-game"
1262
+ ```
1263
+
1264
+ ---
1265
+
1266
+ ARGUMENTS: $ARGUMENTS