@su-record/vibe 2.5.9 → 2.5.11

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 (233) hide show
  1. package/CLAUDE.md +448 -348
  2. package/LICENSE +21 -21
  3. package/README.md +262 -262
  4. package/agents/architect-low.md +41 -0
  5. package/agents/architect-medium.md +59 -0
  6. package/agents/architect.md +80 -0
  7. package/agents/build-error-resolver.md +115 -115
  8. package/agents/compounder.md +261 -261
  9. package/agents/diagrammer.md +178 -178
  10. package/agents/e2e-tester.md +266 -266
  11. package/agents/explorer-low.md +42 -0
  12. package/agents/explorer-medium.md +59 -0
  13. package/agents/explorer.md +48 -48
  14. package/agents/implementer-low.md +43 -0
  15. package/agents/implementer-medium.md +52 -0
  16. package/agents/implementer.md +54 -54
  17. package/agents/refactor-cleaner.md +143 -143
  18. package/agents/research/best-practices-agent.md +189 -189
  19. package/agents/research/codebase-patterns-agent.md +147 -147
  20. package/agents/research/framework-docs-agent.md +178 -178
  21. package/agents/research/security-advisory-agent.md +203 -203
  22. package/agents/review/architecture-reviewer.md +107 -107
  23. package/agents/review/complexity-reviewer.md +116 -116
  24. package/agents/review/data-integrity-reviewer.md +88 -88
  25. package/agents/review/git-history-reviewer.md +103 -103
  26. package/agents/review/performance-reviewer.md +86 -86
  27. package/agents/review/python-reviewer.md +150 -150
  28. package/agents/review/rails-reviewer.md +139 -139
  29. package/agents/review/react-reviewer.md +144 -144
  30. package/agents/review/security-reviewer.md +80 -80
  31. package/agents/review/simplicity-reviewer.md +140 -140
  32. package/agents/review/test-coverage-reviewer.md +116 -116
  33. package/agents/review/typescript-reviewer.md +127 -127
  34. package/agents/searcher.md +54 -54
  35. package/agents/simplifier.md +120 -120
  36. package/agents/tester.md +49 -49
  37. package/agents/ui-previewer.md +129 -129
  38. package/commands/vibe.analyze.md +356 -356
  39. package/commands/vibe.reason.md +329 -329
  40. package/commands/vibe.review.md +326 -326
  41. package/commands/vibe.run.md +1051 -1031
  42. package/commands/vibe.spec.md +1058 -1022
  43. package/commands/vibe.utils.md +296 -296
  44. package/commands/vibe.verify.md +375 -375
  45. package/dist/cli/collaborator.js +52 -52
  46. package/dist/cli/detect.js +32 -32
  47. package/dist/cli/index.js +102 -102
  48. package/dist/cli/llm.js +144 -144
  49. package/dist/lib/DeepInit.d.ts +62 -0
  50. package/dist/lib/DeepInit.d.ts.map +1 -0
  51. package/dist/lib/DeepInit.js +247 -0
  52. package/dist/lib/DeepInit.js.map +1 -0
  53. package/dist/lib/IterationTracker.d.ts +81 -0
  54. package/dist/lib/IterationTracker.d.ts.map +1 -0
  55. package/dist/lib/IterationTracker.js +190 -0
  56. package/dist/lib/IterationTracker.js.map +1 -0
  57. package/dist/lib/ModelRouter.d.ts +50 -0
  58. package/dist/lib/ModelRouter.d.ts.map +1 -0
  59. package/dist/lib/ModelRouter.js +218 -0
  60. package/dist/lib/ModelRouter.js.map +1 -0
  61. package/dist/lib/OrchestrateWorkflow.d.ts +90 -0
  62. package/dist/lib/OrchestrateWorkflow.d.ts.map +1 -0
  63. package/dist/lib/OrchestrateWorkflow.js +261 -0
  64. package/dist/lib/OrchestrateWorkflow.js.map +1 -0
  65. package/dist/lib/PythonParser.js +108 -108
  66. package/dist/lib/SkillFrontmatter.d.ts +64 -0
  67. package/dist/lib/SkillFrontmatter.d.ts.map +1 -0
  68. package/dist/lib/SkillFrontmatter.js +221 -0
  69. package/dist/lib/SkillFrontmatter.js.map +1 -0
  70. package/dist/lib/SkillQualityGate.d.ts +40 -0
  71. package/dist/lib/SkillQualityGate.d.ts.map +1 -0
  72. package/dist/lib/SkillQualityGate.js +218 -0
  73. package/dist/lib/SkillQualityGate.js.map +1 -0
  74. package/dist/lib/UltraQA.d.ts +70 -0
  75. package/dist/lib/UltraQA.d.ts.map +1 -0
  76. package/dist/lib/UltraQA.js +234 -0
  77. package/dist/lib/UltraQA.js.map +1 -0
  78. package/dist/lib/gpt-api.js +4 -4
  79. package/dist/lib/memory/KnowledgeGraph.js +4 -4
  80. package/dist/lib/memory/MemorySearch.js +20 -20
  81. package/dist/lib/memory/MemoryStorage.js +64 -64
  82. package/dist/tools/convention/analyzeComplexity.test.js +115 -115
  83. package/dist/tools/convention/validateCodeQuality.test.js +104 -104
  84. package/dist/tools/index.d.ts +7 -0
  85. package/dist/tools/index.d.ts.map +1 -1
  86. package/dist/tools/index.js +12 -0
  87. package/dist/tools/index.js.map +1 -1
  88. package/hooks/hooks.json +222 -204
  89. package/hooks/scripts/code-check.js +22 -22
  90. package/hooks/scripts/code-review.js +22 -22
  91. package/hooks/scripts/complexity.js +22 -22
  92. package/hooks/scripts/compound.js +23 -23
  93. package/hooks/scripts/context-save.js +33 -33
  94. package/hooks/scripts/hud-multiline.js +264 -0
  95. package/hooks/scripts/hud-status.js +293 -0
  96. package/hooks/scripts/keyword-detector.js +216 -0
  97. package/hooks/scripts/llm-orchestrate.js +171 -171
  98. package/hooks/scripts/post-edit.js +97 -97
  99. package/hooks/scripts/post-tool-verify.js +212 -0
  100. package/hooks/scripts/pre-tool-guard.js +127 -0
  101. package/hooks/scripts/recall.js +22 -22
  102. package/hooks/scripts/session-start.js +30 -30
  103. package/hooks/scripts/skill-injector.js +193 -0
  104. package/hooks/scripts/utils.js +97 -97
  105. package/languages/csharp-unity.md +515 -515
  106. package/languages/gdscript-godot.md +470 -470
  107. package/languages/ruby-rails.md +489 -489
  108. package/languages/typescript-angular.md +433 -433
  109. package/languages/typescript-astro.md +416 -416
  110. package/languages/typescript-electron.md +406 -406
  111. package/languages/typescript-nestjs.md +524 -524
  112. package/languages/typescript-svelte.md +407 -407
  113. package/languages/typescript-tauri.md +365 -365
  114. package/package.json +83 -83
  115. package/skills/context7-usage.md +102 -102
  116. package/skills/git-worktree.md +181 -181
  117. package/skills/parallel-research.md +77 -77
  118. package/skills/priority-todos.md +239 -239
  119. package/skills/tool-fallback.md +190 -190
  120. package/skills/vibe-capabilities.md +161 -161
  121. package/vibe/constitution.md +227 -227
  122. package/vibe/rules/core/communication-guide.md +98 -98
  123. package/vibe/rules/core/development-philosophy.md +52 -52
  124. package/vibe/rules/core/quick-start.md +102 -102
  125. package/vibe/rules/quality/bdd-contract-testing.md +393 -393
  126. package/vibe/rules/quality/checklist.md +276 -276
  127. package/vibe/rules/quality/testing-strategy.md +440 -440
  128. package/vibe/rules/standards/anti-patterns.md +541 -541
  129. package/vibe/rules/standards/code-structure.md +291 -291
  130. package/vibe/rules/standards/complexity-metrics.md +313 -313
  131. package/vibe/rules/standards/naming-conventions.md +198 -198
  132. package/vibe/setup.sh +31 -31
  133. package/vibe/templates/constitution-template.md +252 -252
  134. package/vibe/templates/contract-backend-template.md +526 -526
  135. package/vibe/templates/contract-frontend-template.md +599 -599
  136. package/vibe/templates/feature-template.md +96 -96
  137. package/vibe/templates/spec-template.md +221 -221
  138. package/dist/cli/mcp.d.ts +0 -49
  139. package/dist/cli/mcp.d.ts.map +0 -1
  140. package/dist/cli/mcp.js +0 -169
  141. package/dist/cli/mcp.js.map +0 -1
  142. package/dist/lib/gemini-mcp.d.ts +0 -10
  143. package/dist/lib/gemini-mcp.d.ts.map +0 -1
  144. package/dist/lib/gemini-mcp.js +0 -353
  145. package/dist/lib/gemini-mcp.js.map +0 -1
  146. package/dist/lib/gpt-mcp.d.ts +0 -10
  147. package/dist/lib/gpt-mcp.d.ts.map +0 -1
  148. package/dist/lib/gpt-mcp.js +0 -352
  149. package/dist/lib/gpt-mcp.js.map +0 -1
  150. package/dist/tools/analytics/getUsageAnalytics.d.ts +0 -10
  151. package/dist/tools/analytics/getUsageAnalytics.d.ts.map +0 -1
  152. package/dist/tools/analytics/getUsageAnalytics.js +0 -246
  153. package/dist/tools/analytics/getUsageAnalytics.js.map +0 -1
  154. package/dist/tools/analytics/index.d.ts +0 -5
  155. package/dist/tools/analytics/index.d.ts.map +0 -1
  156. package/dist/tools/analytics/index.js +0 -5
  157. package/dist/tools/analytics/index.js.map +0 -1
  158. package/dist/tools/convention/getCodingGuide.d.ts +0 -7
  159. package/dist/tools/convention/getCodingGuide.d.ts.map +0 -1
  160. package/dist/tools/convention/getCodingGuide.js +0 -69
  161. package/dist/tools/convention/getCodingGuide.js.map +0 -1
  162. package/dist/tools/planning/analyzeRequirements.d.ts +0 -9
  163. package/dist/tools/planning/analyzeRequirements.d.ts.map +0 -1
  164. package/dist/tools/planning/analyzeRequirements.js +0 -171
  165. package/dist/tools/planning/analyzeRequirements.js.map +0 -1
  166. package/dist/tools/planning/createUserStories.d.ts +0 -9
  167. package/dist/tools/planning/createUserStories.d.ts.map +0 -1
  168. package/dist/tools/planning/createUserStories.js +0 -124
  169. package/dist/tools/planning/createUserStories.js.map +0 -1
  170. package/dist/tools/planning/featureRoadmap.d.ts +0 -10
  171. package/dist/tools/planning/featureRoadmap.d.ts.map +0 -1
  172. package/dist/tools/planning/featureRoadmap.js +0 -207
  173. package/dist/tools/planning/featureRoadmap.js.map +0 -1
  174. package/dist/tools/planning/generatePrd.d.ts +0 -11
  175. package/dist/tools/planning/generatePrd.d.ts.map +0 -1
  176. package/dist/tools/planning/generatePrd.js +0 -161
  177. package/dist/tools/planning/generatePrd.js.map +0 -1
  178. package/dist/tools/planning/index.d.ts +0 -8
  179. package/dist/tools/planning/index.d.ts.map +0 -1
  180. package/dist/tools/planning/index.js +0 -8
  181. package/dist/tools/planning/index.js.map +0 -1
  182. package/dist/tools/prompt/analyzePrompt.d.ts +0 -7
  183. package/dist/tools/prompt/analyzePrompt.d.ts.map +0 -1
  184. package/dist/tools/prompt/analyzePrompt.js +0 -150
  185. package/dist/tools/prompt/analyzePrompt.js.map +0 -1
  186. package/dist/tools/prompt/enhancePrompt.d.ts +0 -8
  187. package/dist/tools/prompt/enhancePrompt.d.ts.map +0 -1
  188. package/dist/tools/prompt/enhancePrompt.js +0 -110
  189. package/dist/tools/prompt/enhancePrompt.js.map +0 -1
  190. package/dist/tools/prompt/enhancePromptGemini.d.ts +0 -8
  191. package/dist/tools/prompt/enhancePromptGemini.d.ts.map +0 -1
  192. package/dist/tools/prompt/enhancePromptGemini.js +0 -332
  193. package/dist/tools/prompt/enhancePromptGemini.js.map +0 -1
  194. package/dist/tools/prompt/index.d.ts +0 -7
  195. package/dist/tools/prompt/index.d.ts.map +0 -1
  196. package/dist/tools/prompt/index.js +0 -7
  197. package/dist/tools/prompt/index.js.map +0 -1
  198. package/dist/tools/reasoning/applyReasoningFramework.d.ts +0 -8
  199. package/dist/tools/reasoning/applyReasoningFramework.d.ts.map +0 -1
  200. package/dist/tools/reasoning/applyReasoningFramework.js +0 -266
  201. package/dist/tools/reasoning/applyReasoningFramework.js.map +0 -1
  202. package/dist/tools/reasoning/index.d.ts +0 -5
  203. package/dist/tools/reasoning/index.d.ts.map +0 -1
  204. package/dist/tools/reasoning/index.js +0 -5
  205. package/dist/tools/reasoning/index.js.map +0 -1
  206. package/dist/tools/thinking/analyzeProblem.d.ts +0 -7
  207. package/dist/tools/thinking/analyzeProblem.d.ts.map +0 -1
  208. package/dist/tools/thinking/analyzeProblem.js +0 -55
  209. package/dist/tools/thinking/analyzeProblem.js.map +0 -1
  210. package/dist/tools/thinking/breakDownProblem.d.ts +0 -8
  211. package/dist/tools/thinking/breakDownProblem.d.ts.map +0 -1
  212. package/dist/tools/thinking/breakDownProblem.js +0 -145
  213. package/dist/tools/thinking/breakDownProblem.js.map +0 -1
  214. package/dist/tools/thinking/createThinkingChain.d.ts +0 -7
  215. package/dist/tools/thinking/createThinkingChain.d.ts.map +0 -1
  216. package/dist/tools/thinking/createThinkingChain.js +0 -44
  217. package/dist/tools/thinking/createThinkingChain.js.map +0 -1
  218. package/dist/tools/thinking/formatAsPlan.d.ts +0 -9
  219. package/dist/tools/thinking/formatAsPlan.d.ts.map +0 -1
  220. package/dist/tools/thinking/formatAsPlan.js +0 -78
  221. package/dist/tools/thinking/formatAsPlan.js.map +0 -1
  222. package/dist/tools/thinking/index.d.ts +0 -10
  223. package/dist/tools/thinking/index.d.ts.map +0 -1
  224. package/dist/tools/thinking/index.js +0 -10
  225. package/dist/tools/thinking/index.js.map +0 -1
  226. package/dist/tools/thinking/stepByStepAnalysis.d.ts +0 -8
  227. package/dist/tools/thinking/stepByStepAnalysis.d.ts.map +0 -1
  228. package/dist/tools/thinking/stepByStepAnalysis.js +0 -63
  229. package/dist/tools/thinking/stepByStepAnalysis.js.map +0 -1
  230. package/dist/tools/thinking/thinkAloudProcess.d.ts +0 -8
  231. package/dist/tools/thinking/thinkAloudProcess.d.ts.map +0 -1
  232. package/dist/tools/thinking/thinkAloudProcess.js +0 -80
  233. package/dist/tools/thinking/thinkAloudProcess.js.map +0 -1
@@ -1,1031 +1,1051 @@
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
-
126
- ### Boulder Loop (Inspired by Sisyphus)
127
-
128
- Like Sisyphus rolling the boulder, ULTRAWORK **keeps going until done**:
129
-
130
- ```
131
- ┌─────────────────────────────────────────────────────────────────┐
132
- │ BOULDER LOOP (ultrawork) │
133
- │ │
134
- │ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐ │
135
- │ │ Phase 1 │───→│ Phase 2 │───→│ Phase 3 │───→│ Phase N │ │
136
- │ └──────────┘ └──────────┘ └──────────┘ └──────────┘ │
137
- │ │ │ │ │ │
138
- │ ↓ ↓ ↓ ↓ │
139
- │ [Parallel] [Parallel] [Parallel] [Parallel] │
140
- │ [Implement] [Implement] [Implement] [Implement] │
141
- │ [Test] [Test] [Test] [Test] │
142
- │ │ │ │ │ │
143
- │ └───────────────┴───────────────┴───────────────┘ │
144
- │ │ │
145
- │ ↓ │
146
- │ ┌──────────────┐ │
147
- │ │ ALL DONE? │ │
148
- │ └──────────────┘ │
149
- │ │ │ │
150
- │ NO YES │
151
- │ │ │ │
152
- │ ↓ ↓ │
153
- │ [Continue] [🎉 Complete!] │
154
- │ │
155
- │ NO STOPPING until acceptance criteria met or error limit hit │
156
- └─────────────────────────────────────────────────────────────────┘
157
- ```
158
-
159
- ### ULTRAWORK Example
160
-
161
- ```
162
- User: /vibe.run "brick-game" ultrawork
163
-
164
- Claude:
165
- 🚀 ULTRAWORK MODE ACTIVATED
166
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
167
-
168
- 📄 SPEC: .claude/vibe/specs/brick-game.md
169
- 🎯 4 Phases detected
170
- ⚡ Boulder Loop: ENABLED (will continue until all phases complete)
171
- 🔄 Auto-retry: ON (max 3 per phase)
172
- 💾 Context compression: AGGRESSIVE
173
-
174
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
175
- 🏔️ BOULDER ROLLING... Phase 1/4
176
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
177
-
178
- ⚡ [PARALLEL] Launching 3 exploration agents...
179
- ✅ Exploration complete (7.2s)
180
- 🔨 Implementing...
181
- ✅ Phase 1 complete
182
-
183
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
184
- 🏔️ BOULDER ROLLING... Phase 2/4
185
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
186
-
187
- ⚡ [PARALLEL] Launching 3 exploration agents...
188
- ✅ Exploration complete (6.8s)
189
- 🔨 Implementing...
190
- ❌ Test failed: collision detection
191
- 🔄 Auto-retry 1/3...
192
- 🔨 Fixing...
193
- ✅ Phase 2 complete
194
-
195
- [...continues automatically...]
196
-
197
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
198
- 🎉 BOULDER REACHED THE TOP!
199
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
200
-
201
- ✅ All 4 phases complete
202
- ✅ All acceptance criteria passed
203
- ✅ Build succeeded
204
- ✅ Tests passed
205
-
206
- ⏱️ Total: 8m 24s
207
- 📊 Retries: 2
208
- 💾 Context saved: 3 checkpoints
209
- ```
210
-
211
- ### Normal vs ULTRAWORK Comparison
212
-
213
- | Aspect | Normal | ULTRAWORK |
214
- |--------|--------|-----------|
215
- | Phase transition | May pause | Auto-continues |
216
- | On error | Reports and stops | Auto-retries (3x) |
217
- | Context 70%+ | Warning only | Auto-compress + save |
218
- | Exploration | Sequential possible | FORCED parallel |
219
- | Completion | Phase-by-phase | Until ALL done |
220
-
221
- ---
222
-
223
- ## Rules Reference
224
-
225
- **Must follow `~/.claude/vibe/rules/` (global):**
226
-
227
- - `core/development-philosophy.md` - Surgical precision, modify only requested scope
228
- - `core/quick-start.md` - Korean, DRY, SRP, YAGNI
229
- - `standards/complexity-metrics.md` - Functions ≤20 lines, nesting ≤3 levels
230
- - `quality/checklist.md` - Code quality checklist
231
-
232
- **Language guide:** `~/.claude/vibe/languages/{stack}.md` (global reference)
233
-
234
- ## Description
235
-
236
- Read PTCF structured SPEC document and execute implementation immediately.
237
-
238
- > **PLAN, TASKS documents unnecessary** - SPEC is the executable prompt
239
-
240
- ## Model Orchestration
241
-
242
- Automatically select optimal model based on task type:
243
-
244
- ```
245
- ┌─────────────────────────────────────────────────────────────┐
246
- │ Opus 4.5 (Orchestrator) │
247
- │ - Coordinate overall flow │
248
- - Final decisions/review │
249
- └─────────────────────────┬───────────────────────────────────┘
250
-
251
- ┌─────────────────────┼─────────────────────┐
252
- ↓ ↓ ↓
253
- ┌─────────┐ ┌─────────┐ ┌─────────┐
254
- Haiku │ │ Sonnet │ │ Haiku │
255
- │(Explore)│ │ (Impl) │ │ (Test) │
256
- └─────────┘ └─────────┘ └─────────┘
257
- ```
258
-
259
- ### Task Calls by Role
260
-
261
- | Task Type | Model | Task Parameter |
262
- |-----------|-------|----------------|
263
- | Codebase exploration | Haiku 4.5 | `model: "haiku"` |
264
- | Core implementation | Sonnet 4 | `model: "sonnet"` |
265
- | Test writing | Haiku 4.5 | `model: "haiku"` |
266
- | Architecture decisions | Opus 4.5 | Main session |
267
- | Final review | Opus 4.5 | Main session |
268
-
269
- ### External LLM Usage (When Enabled)
270
-
271
- When external LLMs are enabled in `.claude/vibe/config.json`:
272
-
273
- | Role | Method | Condition |
274
- |------|--------|-----------|
275
- | User direct query | `gpt.question`, `gemini.question` | Hook auto-handles |
276
- | Internal orchestration | Call global script via Bash | Claude calls directly |
277
-
278
- **User questions (Hook auto-handles):**
279
- - `gpt.question` - GPT architecture consultation
280
- - `gemini.question` - Gemini Q&A/consultation
281
-
282
- **Claude internal calls (directly via Bash):**
283
- ```bash
284
- # Usage: node llm-orchestrate.js <provider> <mode> [systemPrompt] [prompt]
285
- # - If systemPrompt omitted, uses default
286
- # - If systemPrompt is "-", uses default and treats next argument as prompt
287
-
288
- # Cross-platform path (works on Windows/macOS/Linux)
289
- VIBE_SCRIPTS="$(node -p "process.env.APPDATA || require('os').homedir() + '/.config'")/vibe/hooks/scripts"
290
-
291
- # GPT call
292
- node "$VIBE_SCRIPTS/llm-orchestrate.js" gpt orchestrate-json "[question content]"
293
-
294
- # Gemini call
295
- node "$VIBE_SCRIPTS/llm-orchestrate.js" gemini orchestrate-json "[question content]"
296
-
297
- # Custom system prompt usage
298
- node "$VIBE_SCRIPTS/llm-orchestrate.js" gpt orchestrate-json "You are a code reviewer" "[question content]"
299
- ```
300
-
301
- ### External LLM Fallback
302
-
303
- **IMPORTANT**: When GPT/Gemini hook fails, Claude MUST handle the task directly:
304
-
305
- **Fallback behavior**:
306
- - Do NOT retry the external LLM call
307
- - Claude handles the task using its own capabilities
308
- - Continue with the implementation without interruption
309
- - Log the fallback but don't block progress
310
-
311
- ## Vibe Tools (Semantic Analysis & Memory)
312
-
313
- Use vibe tools for accurate codebase understanding and session continuity.
314
-
315
- ### Tool Invocation
316
-
317
- All tools are called via:
318
- ```bash
319
- node -e "import('@su-record/vibe/tools').then(t => t.TOOL_NAME({...args}).then(r => console.log(r.content[0].text)))"
320
- ```
321
-
322
- ### Semantic Analysis Tools
323
-
324
- | Tool | Purpose | Usage |
325
- |------|---------|-------|
326
- | `findSymbol` | Find symbol definitions | `{symbolName: 'functionName', searchPath: '.'}` |
327
- | `findReferences` | Find all references | `{symbolName: 'functionName', searchPath: '.'}` |
328
- | `analyzeComplexity` | Analyze code complexity | `{filePath: 'src/file.ts'}` |
329
- | `validateCodeQuality` | Validate code quality | `{filePath: 'src/file.ts'}` |
330
-
331
- **Example - Find symbol:**
332
- ```bash
333
- node -e "import('@su-record/vibe/tools').then(t => t.findSymbol({symbolName: 'login', searchPath: '.'}).then(r => console.log(r.content[0].text)))"
334
- ```
335
-
336
- ### Memory Tools
337
-
338
- | Tool | Purpose | Usage |
339
- |------|---------|-------|
340
- | `saveMemory` | Save important decisions | `{key: 'decision-name', value: 'content', category: 'project'}` |
341
- | `recallMemory` | Recall saved memory | `{key: 'decision-name'}` |
342
- | `listMemories` | List all memories | `{category: 'project'}` |
343
-
344
- **Example - Save important decision:**
345
- ```bash
346
- 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)))"
347
- ```
348
-
349
- ### Session Management (Auto via Hooks)
350
-
351
- - **Session start**: Hook auto-calls `startSession` to restore previous context
352
- - **Context 80%+**: Hook auto-calls `autoSaveContext` to preserve state
353
-
354
- ## Process
355
-
356
- ### 1. Load SPEC + Feature
357
-
358
- ```
359
- 📄 .claude/vibe/specs/{feature-name}.md → SPEC (structure, constraints, context)
360
- 📄 .claude/vibe/features/{feature-name}.feature Feature (scenario = implementation unit)
361
- ```
362
-
363
- **Error if Feature file missing**:
364
- ```
365
- ❌ Feature file not found.
366
- Run /vibe.spec "{feature-name}" first.
367
- ```
368
-
369
- ### 2. Extract Scenario List
370
-
371
- Extract all Scenarios from Feature file:
372
-
373
- ```markdown
374
- ## Scenarios to Implement
375
-
376
- | # | Scenario | Status |
377
- |---|----------|--------|
378
- | 1 | Valid login success | ⬜ |
379
- | 2 | Invalid password error | ⬜ |
380
- | 3 | Email format validation | ⬜ |
381
- | 4 | Password reset link | ⬜ |
382
-
383
- Total: 4 scenarios
384
- ```
385
-
386
- ### 3. Scenario-by-Scenario Implementation (Core)
387
-
388
- **For each scenario**:
389
-
390
- ```
391
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
392
- 🎯 Scenario 1/4: Valid login success
393
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
394
-
395
- Given: User is registered
396
- When: Login with valid email and password
397
- Then: Login success + JWT token returned
398
-
399
- [Step 1] Analyzing implementation...
400
- - Required files: auth.service.ts, login.controller.ts
401
- - Exploring related code...
402
-
403
- [Step 2] Implementing...
404
- ✅ auth.service.ts - Added login() method
405
- ✅ login.controller.ts - POST /login endpoint
406
-
407
- [Step 3] Verifying...
408
- Given: Test user creation possible
409
- ✅ When: Login API call succeeded
410
- ✅ Then: JWT token return confirmed
411
-
412
- Scenario 1 passed!
413
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
414
- ```
415
-
416
- **On failure**:
417
-
418
- ```
419
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
420
- 🎯 Scenario 2/4: Invalid password error
421
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
422
-
423
- [Step 3] Verifying...
424
- Given: Test user exists
425
- When: Login attempt with wrong password
426
- ❌ Then: "Invalid credentials" error message
427
- Actual: "Error occurred" returned
428
-
429
- [Auto-fix 1/3]
430
- Cause: Error message not properly set
431
- Fix: auth.service.ts line 42
432
-
433
- [Re-verify]
434
- ✅ Then: "Invalid credentials" error message
435
-
436
- Scenario 2 passed! (1 fix)
437
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
438
- ```
439
-
440
- ---
441
-
442
- ## **CRITICAL: Parallel Sub-Agent Execution**
443
-
444
- > **MUST USE PARALLEL TASK CALLS** - This is REQUIRED, not optional.
445
- > Sequential execution when parallel is possible = VIOLATION of this workflow.
446
-
447
- ### Mandatory Parallel Exploration (Phase Start)
448
-
449
- **BEFORE any implementation, you MUST launch these Task calls IN PARALLEL (single message, multiple tool calls):**
450
-
451
- ```
452
- ┌─────────────────────────────────────────────────────────────────┐
453
- │ STEP 1: PARALLEL EXPLORATION (REQUIRED) │
454
- │ │
455
- │ Launch ALL of these in ONE message: │
456
- │ │
457
- │ Task(haiku) ─┬─→ "Analyze related files in <context>" │
458
- │ │ │
459
- │ Task(haiku) ─┼─→ "Check dependencies and imports" │
460
- │ │ │
461
- │ Task(haiku) ─┴─→ "Find existing patterns and conventions" │
462
- │ │
463
- │ [If GPT enabled] Bash: node {{VIBE_PATH}}/hooks/scripts/llm-orchestrate.js gpt orchestrate-json "[question]"
464
- │ [If Gemini enabled] Bash: node {{VIBE_PATH}}/hooks/scripts/llm-orchestrate.js gemini orchestrate-json "[question]"
465
- └─────────────────────────────────────────────────────────────────┘
466
-
467
- (wait for all to complete)
468
- ┌─────────────────────────────────────────────────────────────────┐
469
- │ STEP 2: SYNTHESIZE (Opus)
470
- │ - Review all exploration results │
471
- │ - Decide implementation approach │
472
- │ - Identify files to modify/create │
473
- └─────────────────────────────────────────────────────────────────┘
474
-
475
-
476
- ┌─────────────────────────────────────────────────────────────────┐
477
- STEP 3: IMPLEMENT + BACKGROUND AGENTS (PARALLEL)
478
-
479
- Main Agent (sonnet):
480
- └─→ Execute current phase implementation
481
-
482
- Background Agents (haiku, run_in_background=true):
483
- ├─→ Task: "Prepare Phase N+1 - analyze required files"
484
- ├─→ Task: "Pre-generate test cases for current implementation"
485
- │ └─→ Task: "Search for related types/interfaces needed" │
486
-
487
- │ [ULTRAWORK] All 4 agents run simultaneously! │
488
- └─────────────────────────────────────────────────────────────────┘
489
-
490
- (main completes, check backgrounds)
491
- ┌─────────────────────────────────────────────────────────────────┐
492
- STEP 4: TEST + PHASE PIPELINING
493
- │ │
494
- Current Phase: │
495
- │ └─→ Task(haiku): Write tests using pre-generated cases │
496
- │ │
497
- Next Phase Prep (from background results):
498
- └─→ Already have file analysis, ready to start immediately
499
- └─────────────────────────────────────────────────────────────────┘
500
- ```
501
-
502
- ### Parallel Task Call Pattern (MUST FOLLOW)
503
-
504
- **Correct - Single message with multiple parallel Tasks:**
505
- ```
506
- <message>
507
- Task(haiku, "Analyze src/components/ for existing patterns")
508
- Task(haiku, "Check package.json dependencies")
509
- Task(haiku, "Find usage of similar features in codebase")
510
- </message>
511
- → All 3 run simultaneously, ~3x faster
512
- ```
513
-
514
- **WRONG - Sequential calls (DO NOT DO THIS):**
515
- ```
516
- <message>Task(haiku, "Analyze...")</message>
517
- <message>Task(haiku, "Check...")</message>
518
- <message>Task(haiku, "Find...")</message>
519
- → 3x slower, wastes time
520
- ```
521
-
522
- ### Background Agent Pattern (ULTRAWORK) via Orchestrator
523
-
524
- **Launch background agents for next phase via Orchestrator:**
525
- ```bash
526
- # Start background agent (doesn't block)
527
- 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)))"
528
-
529
- # Multiple backgrounds in parallel
530
- node -e "import('@su-record/vibe/orchestrator').then(async o => {
531
- await Promise.all([
532
- o.runAgent('Phase 2 prep: Analyze auth API endpoints', 'phase2-prep'),
533
- o.runAgent('Pre-generate test cases for login form', 'test-prep'),
534
- o.runAgent('Find existing validation patterns', 'pattern-finder')
535
- ]);
536
- console.log('All background agents started');
537
- })"
538
- ```
539
-
540
- **Check background agent status:**
541
- ```bash
542
- node -e "import('@su-record/vibe/orchestrator').then(o => console.log(o.status().content[0].text))"
543
- ```
544
-
545
- **Get result when ready:**
546
- ```bash
547
- node -e "import('@su-record/vibe/orchestrator').then(o => o.getResult('SESSION_ID').then(r => console.log(r.content[0].text)))"
548
- ```
549
-
550
- **Why Background Agents Matter:**
551
-
552
- | Without Background | With Background |
553
- |--------------------|-----------------|
554
- | Phase 1: 60s | Phase 1: 60s (+ backgrounds running) |
555
- | Phase 2 prep: 20s | Phase 2 prep: 0s (already done!) |
556
- | Phase 2: 60s | Phase 2: 60s |
557
- | **Total: 140s** | **Total: 120s** |
558
-
559
- For 5 phases: 4 × 20s saved = **80s faster**
560
-
561
- ### Why Parallel Matters
562
-
563
- | Approach | Time | Cache Benefit |
564
- |----------|------|---------------|
565
- | Sequential (3 Tasks) | ~30s | Cache cold on each |
566
- | **Parallel (3 Tasks)** | **~10s** | **Cache warmed once, shared** |
567
-
568
- vibe ProjectCache (LRU) caches ts-morph parsing results. Parallel calls share the warmed cache.
569
-
570
- ### Phase Execution Flow (ULTRAWORK Pipeline)
571
-
572
- ```
573
- Phase N Start
574
-
575
- ├─→ [PARALLEL] Task(haiku) × 3: Exploration
576
- │ - Related code analysis
577
- │ - Dependency check
578
- │ - Pattern discovery
579
-
580
- ↓ (all complete)
581
-
582
- ├─→ Opus: Synthesize and decide
583
-
584
- ├─→ [PARALLEL PIPELINE] ←── KEY SPEED OPTIMIZATION
585
- │ │
586
- │ ├─→ Main: Task(sonnet) Implementation
587
- │ │
588
- │ └─→ Background (run_in_background=true):
589
- │ ├─→ Task(haiku): Phase N+1 file analysis
590
- │ ├─→ Task(haiku): Test case preparation
591
- │ └─→ Task(haiku): Type/interface lookup
592
-
593
- (main completes)
594
-
595
- ├─→ Task(haiku): Tests (uses pre-generated cases)
596
-
597
-
598
- Phase N Complete
599
-
600
- ↓ (Background results ready - NO WAIT for Phase N+1 exploration!)
601
-
602
- Phase N+1 Start (IMMEDIATE - exploration already done!)
603
- ```
604
-
605
- **Speed Comparison:**
606
-
607
- | Mode | Phase Time | 5 Phases Total |
608
- |------|------------|----------------|
609
- | Sequential | ~2min/phase | ~10min |
610
- | Parallel Exploration | ~1.5min/phase | ~7.5min |
611
- | **ULTRAWORK Pipeline** | **~1min/phase** | **~5min** |
612
-
613
- **Why Pipeline is Faster:**
614
- - Background agents prepare next phase WHILE current phase implements
615
- - No idle time between phases
616
- - Test cases pre-generated during implementation
617
- - Cache stays warm across parallel tasks
618
-
619
- ---
620
-
621
- 1. **Related code analysis**: Task(haiku) explores `<context>` related code
622
- 2. **File creation/modification**: Task(sonnet) implements per `<output_format>`
623
- 3. **Constraint compliance**: Check `<constraints>`
624
- 4. **Run verification**: Execute verification commands
625
-
626
- ### 4. Gemini Code Review + Auto-Fix (NEW)
627
-
628
- After all scenarios are implemented, **Gemini reviews the code and auto-fixes based on feedback**:
629
-
630
- ```
631
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
632
- 🔍 GEMINI CODE REVIEW
633
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
634
-
635
- [Step 1] Sending implementation code to Gemini...
636
- - Changed files: auth.service.ts, auth.controller.ts, ...
637
-
638
- [Step 2] Gemini review results:
639
- ┌─────────────────────────────────────────────────────┐
640
- │ 📝 Gemini Feedback │
641
- │ │
642
- │ 1. [Improvement] auth.service.ts:24 │
643
- │ Need timing attack prevention for password compare│
644
- │ → Recommend using crypto.timingSafeEqual() │
645
- │ │
646
- 2. [Improvement] auth.controller.ts:15 │
647
- │ Rate limiting not applied │
648
- │ → Recommend adding login attempt limit │
649
- │ │
650
- │ 3. [Style] auth.service.ts:42 │
651
- │ Magic number usage │
652
- │ → Recommend extracting to constant │
653
- └─────────────────────────────────────────────────────┘
654
-
655
- [Step 3] Auto-fixing based on feedback...
656
- auth.service.ts:24 - Applied timingSafeEqual
657
- ✅ auth.controller.ts:15 - Added rate limiter
658
- auth.service.ts:42 - Extracted constant
659
-
660
- [Step 4] Re-verifying...
661
- ✅ Build succeeded
662
- Tests passed
663
-
664
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
665
- ✅ Gemini review complete! 3 improvements applied
666
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
667
- ```
668
-
669
- **MUST: Gemini Code Review (Required)**
670
-
671
- When Gemini is enabled, **must** use global hook script for code review:
672
-
673
- ```bash
674
- # Cross-platform path (works on Windows/macOS/Linux)
675
- VIBE_SCRIPTS="$(node -p "process.env.APPDATA || require('os').homedir() + '/.config'")/vibe/hooks/scripts"
676
-
677
- node "$VIBE_SCRIPTS/llm-orchestrate.js" gemini orchestrate-json "Review this code for security, performance, best-practices: [code summary]. SPEC: [summary]. Scenarios: [list]"
678
- ```
679
-
680
- **Call sequence:**
681
- 1. Summarize key content of changed files
682
- 2. Add SPEC requirements summary
683
- 3. Execute global script call
684
- 4. Fix code for each feedback item in response
685
- 5. Re-run build/tests
686
-
687
- **Fallback handling:**
688
- - On `"status": "fallback"` response → Skip and proceed to next step
689
- - On network error → Retry once, then skip
690
-
691
- **Review application rules:**
692
-
693
- | Feedback Type | Action |
694
- |---------------|--------|
695
- | Security vulnerability | Auto-fix immediately |
696
- | Performance improvement | Auto-fix immediately |
697
- | Best practices | Auto-fix |
698
- | Style/preference | Apply selectively (project convention takes priority) |
699
-
700
- **Conditions:**
701
- - Only runs when Gemini MCP is enabled (`vibe gemini auth`)
702
- - Skip and proceed on fallback response
703
- - Must re-verify build/tests after fixes
704
-
705
- ### 5. Quality Report (Auto-generated)
706
-
707
- After all scenarios complete + Gemini review, **quality report is auto-generated**:
708
-
709
- ```
710
- ┌─────────────────────────────────────────────────────────────────┐
711
- │ 📊 QUALITY REPORT: login │
712
- ├─────────────────────────────────────────────────────────────────┤
713
- │ │
714
- │ ✅ Scenarios: 4/4 passed │
715
- │ │
716
- │ ┌───────────────────────────────────────────────────────────┐ │
717
- │ │ # Scenario │ Status │ Retries │ │ │
718
- │ │───│───────────────────────────│────────│─────────│ │ │
719
- │ │ 1 │ Valid login success │ ✅ │ 0 │ │ │
720
- │ │ 2 │ Invalid password error │ ✅ │ 1 │ │ │
721
- │ │ 3 Email format validation │ ✅ │ 0 │ │ │
722
- │ │ 4 Password reset link │ ✅ │ 0 │ │ │
723
- │ └───────────────────────────────────────────────────────────┘ │
724
- │ │
725
- │ 📈 Quality score: 94/100 │
726
- │ │
727
- │ ┌─────────────────────────────────────────────────────────┐ │
728
- │ │ Item │ Result │ Notes │ │
729
- │ │───────────────────│────────│─────────────────────────────│ │
730
- │ │ Build │ ✅ │ npm run build succeeded │ │
731
- Tests │ ✅ │ 12/12 passed
732
- │ │ Type check │ ✅ │ 0 errors │ │
733
- Complexity │ ✅ │ All functions ≤30 lines │ │
734
- Security │ ✅ │ 0 vulnerabilities
735
- Gemini review │ ✅ │ 3 improvements applied │ │
736
- └─────────────────────────────────────────────────────────┘
737
-
738
- ⏱️ Total time: 3m 42s
739
-
740
- └─────────────────────────────────────────────────────────────────┘
741
- ```
742
-
743
- **What users should check**:
744
- - Scenario pass rate (4/4 = 100%)
745
- - Quality score (94/100)
746
- - Build/test status
747
-
748
- **This alone is enough to trust quality.**
749
-
750
- ### 6. Update Feature File
751
-
752
- Auto-update scenario status:
753
-
754
- ```markdown
755
- ## Coverage
756
-
757
- | Scenario | SPEC AC | Status |
758
- |----------|---------|--------|
759
- | Valid login success | AC-1 | ✅ |
760
- | Invalid password error | AC-2 | ✅ |
761
- | Email format validation | AC-3 | ✅ |
762
- | Password reset link | AC-4 | ✅ |
763
-
764
- **Last verified**: 2024-01-15 14:32
765
- **Quality score**: 94/100
766
- ```
767
-
768
- ## TRUST 5 Principles
769
-
770
- Follow during implementation:
771
-
772
- | Principle | Description |
773
- |-----------|-------------|
774
- | **T**est-first | Write tests first |
775
- | **R**eadable | Clear code |
776
- | **U**nified | Consistent style |
777
- | **S**ecured | Consider security |
778
- | **T**rackable | Logging, monitoring |
779
-
780
- ## Input
781
-
782
- - `.claude/vibe/specs/{feature-name}.md` (PTCF SPEC)
783
- - `.claude/vibe/features/{feature-name}.feature` (BDD)
784
- - `CLAUDE.md` (project context)
785
-
786
- ## Output
787
-
788
- - Implemented code files
789
- - Test files
790
- - Updated SPEC document (checkmarks)
791
-
792
- ## Example
793
-
794
- ```
795
- User: /vibe.run "login"
796
-
797
- Claude:
798
- 📄 Loading SPEC: .claude/vibe/specs/login.md
799
- 📄 Loading Feature: .claude/vibe/features/login.feature
800
-
801
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
802
- 📋 Scenarios to Implement
803
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
804
-
805
- | # | Scenario | Status |
806
- |---|----------|--------|
807
- | 1 | Valid login success | ⬜ |
808
- | 2 | Invalid password error | ⬜ |
809
- | 3 | Email format validation | ⬜ |
810
- | 4 | Password reset link | ⬜ |
811
-
812
- Total: 4 scenarios
813
-
814
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
815
- 🎯 Scenario 1/4: Valid login success
816
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
817
-
818
- Given: User is registered
819
- When: Login with valid email and password
820
- Then: Login success + JWT token returned
821
-
822
- [PARALLEL] Exploring...
823
- ✅ Exploration complete (2.1s)
824
-
825
- 🔨 Implementing...
826
- ✅ auth.service.ts - Added login()
827
- auth.controller.ts - POST /login
828
-
829
- 🔍 Verifying...
830
- Given: OK
831
- ✅ When: OK
832
- ✅ Then: OK
833
-
834
- ✅ Scenario 1 passed!
835
-
836
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
837
- 🎯 Scenario 2/4: Invalid password error
838
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
839
-
840
- 🔨 Implementing...
841
- ✅ auth.service.ts - Password validation logic
842
-
843
- 🔍 Verifying...
844
- ✅ Given: OK
845
- When: OK
846
- Then: "Invalid credentials" error message
847
- Actual: "Error" returned
848
-
849
- 🔄 Auto-fix 1/3...
850
- Fix: auth.service.ts line 42
851
-
852
- 🔍 Re-verifying...
853
- ✅ Then: OK
854
-
855
- ✅ Scenario 2 passed! (1 fix)
856
-
857
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
858
- 🎯 Scenario 3/4: Email format validation
859
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
860
-
861
- 🔨 Implementing...
862
- 🔍 Verifying...
863
- Scenario 3 passed!
864
-
865
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
866
- 🎯 Scenario 4/4: Password reset link
867
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
868
-
869
- 🔨 Implementing...
870
- 🔍 Verifying...
871
- ✅ Scenario 4 passed!
872
-
873
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
874
- 🔍 GEMINI CODE REVIEW
875
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
876
-
877
- 📤 Sending code to Gemini...
878
- 📝 Gemini feedback:
879
- 1. [Security] Need timing attack prevention → Fixing...
880
- 2. [Performance] Unnecessary DB call → Fixing...
881
-
882
- 2 improvements auto-applied
883
- 🔍 Re-verifying... Passed
884
-
885
- ┌─────────────────────────────────────────────────────────────────┐
886
- │ 📊 QUALITY REPORT: login │
887
- ├─────────────────────────────────────────────────────────────────┤
888
- │ │
889
- │ ✅ Scenarios: 4/4 passed │
890
- │ │
891
- │ | # | Scenario | Status | Retries | │
892
- │ |---|───────────────────────|───────|─────────| │
893
- │ | 1 | Valid login success | ✅ | 0 | │
894
- │ | 2 | Invalid password error| ✅ | 1 | │
895
- │ | 3 | Email format validation| ✅ | 0 | │
896
- │ | 4 | Password reset link | ✅ | 0 | │
897
- │ │
898
- │ 📈 Quality score: 94/100 │
899
- Build: | Tests: | Types: ✅ | Gemini: ✅ (2 applied) │
900
- │ │
901
- │ ⏱️ Total time: 3m 42s │
902
- └─────────────────────────────────────────────────────────────────┘
903
-
904
- 🎉 Implementation complete! All scenarios passed + Gemini review applied.
905
-
906
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
907
- 🔍 AUTO REVIEW (13+ Agents)
908
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
909
-
910
- ⚡ [PARALLEL] 13 expert agents reviewing...
911
- - security-reviewer
912
- - performance-reviewer ✅
913
- - architecture-reviewer
914
- - ...
915
-
916
- 📋 Review results:
917
- - P1 Critical: 0
918
- - P2 Important: 2
919
- - P3 Nice-to-have: 1
920
-
921
- 🔧 Auto-fixing P2 issues...
922
- 1. [PERF] N+1 query → Fixed
923
- 2. [ARCH] Circular dependency → Fixed
924
-
925
- ✅ Auto Review complete! 2 issues auto-resolved.
926
- ```
927
-
928
- ### Phase-specific Execution
929
-
930
- ```
931
- User: /vibe.run "brick-game" --phase 2
932
-
933
- Claude:
934
- 📄 Reading SPEC: .claude/vibe/specs/brick-game.md
935
- 🎯 Executing Phase 2 only.
936
-
937
- Phase 2: Game Logic
938
- 1. [ ] Paddle movement implementation
939
- 2. [ ] Ball physics engine
940
- 3. [ ] Brick collision handling
941
- 4. [ ] Score system
942
- 5. [ ] Game over conditions
943
-
944
- ⚡ Launching parallel exploration...
945
- [Task(haiku) × 3 launched in parallel]
946
-
947
- 🚀 Starting implementation...
948
- ```
949
-
950
- ## Error Handling
951
-
952
- On failure:
953
- 1. Check error message
954
- 2. Review `<constraints>`
955
- 3. Fix code and retry
956
- 4. If continues to fail, report to user
957
-
958
- ---
959
-
960
- ## Quality Gate (Mandatory)
961
-
962
- ### Implementation Quality Checklist
963
-
964
- Before marking any scenario as complete, ALL items must pass:
965
-
966
- | Category | Check Item | Weight |
967
- |----------|------------|--------|
968
- | **Functionality** | All Given/When/Then conditions verified | 20% |
969
- | **Functionality** | Edge cases handled per scenario | 10% |
970
- | **Code Quality** | No `any` types in TypeScript | 10% |
971
- | **Code Quality** | Functions ≤30 lines, nesting ≤3 levels | 10% |
972
- | **Code Quality** | No hardcoded values (use constants) | 5% |
973
- | **Security** | Input validation implemented | 10% |
974
- | **Security** | Authentication/authorization checked | 5% |
975
- | **Error Handling** | Try-catch or error states present | 10% |
976
- | **Error Handling** | User-friendly error messages | 5% |
977
- | **Testing** | Unit tests exist for core logic | 10% |
978
- | **Performance** | No N+1 queries or unnecessary loops | 5% |
979
-
980
- ### Quality Score Calculation
981
-
982
- ```
983
- Score = Σ(checked items × weight) / 100
984
-
985
- Grades:
986
- - 95-100: EXCELLENT - Ready to merge
987
- - 85-94: ✅ GOOD - Minor improvements recommended
988
- - 70-84: ⚠️ FAIR - Improvements required before merge
989
- - 0-69: ❌ POOR - Major fixes needed
990
- ```
991
-
992
- ### Quality Gate Thresholds
993
-
994
- | Gate | Minimum Score | Condition |
995
- |------|---------------|-----------|
996
- | **Scenario Complete** | 85 | Each scenario must score ≥85 |
997
- | **Phase Complete** | 90 | Average of all scenarios ≥90 |
998
- | **Feature Complete** | 90 | All phases complete + Gemini review |
999
-
1000
- ### Auto-Fix Triggers
1001
-
1002
- | Issue Type | Auto-Fix Action |
1003
- |------------|-----------------|
1004
- | Missing error handling | Add try-catch wrapper |
1005
- | Hardcoded values | Extract to constants file |
1006
- | Missing input validation | Add validation schema |
1007
- | Function too long | Suggest split points |
1008
- | N+1 query detected | Add eager loading |
1009
-
1010
- ### Forbidden Patterns (Block Merge)
1011
-
1012
- | Pattern | Why Forbidden | Detection |
1013
- |---------|---------------|-----------|
1014
- | `console.log` | Debug code in production | Regex scan |
1015
- | `// TODO` without issue | Untracked work | Comment scan |
1016
- | `any` type | Type safety bypass | TypeScript check |
1017
- | `@ts-ignore` | Type error suppression | TypeScript check |
1018
- | Empty catch blocks | Silent error swallowing | AST analysis |
1019
- | Commented-out code | Dead code | Comment scan |
1020
-
1021
- ---
1022
-
1023
- ## Next Step
1024
-
1025
- ```
1026
- /vibe.verify "brick-game"
1027
- ```
1028
-
1029
- ---
1030
-
1031
- 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
+
126
+ ### Boulder Loop (Inspired by Sisyphus)
127
+
128
+ Like Sisyphus rolling the boulder, ULTRAWORK **keeps going until done**:
129
+
130
+ ```
131
+ ┌─────────────────────────────────────────────────────────────────┐
132
+ │ BOULDER LOOP (ultrawork) │
133
+ │ │
134
+ │ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐ │
135
+ │ │ Phase 1 │───→│ Phase 2 │───→│ Phase 3 │───→│ Phase N │ │
136
+ │ └──────────┘ └──────────┘ └──────────┘ └──────────┘ │
137
+ │ │ │ │ │ │
138
+ │ ↓ ↓ ↓ ↓ │
139
+ │ [Parallel] [Parallel] [Parallel] [Parallel] │
140
+ │ [Implement] [Implement] [Implement] [Implement] │
141
+ │ [Test] [Test] [Test] [Test] │
142
+ │ │ │ │ │ │
143
+ │ └───────────────┴───────────────┴───────────────┘ │
144
+ │ │ │
145
+ │ ↓ │
146
+ │ ┌──────────────┐ │
147
+ │ │ ALL DONE? │ │
148
+ │ └──────────────┘ │
149
+ │ │ │ │
150
+ │ NO YES │
151
+ │ │ │ │
152
+ │ ↓ ↓ │
153
+ │ [Continue] [🎉 Complete!] │
154
+ │ │
155
+ │ NO STOPPING until acceptance criteria met or error limit hit │
156
+ └─────────────────────────────────────────────────────────────────┘
157
+ ```
158
+
159
+ ### ULTRAWORK Example
160
+
161
+ ```
162
+ User: /vibe.run "brick-game" ultrawork
163
+
164
+ Claude:
165
+ 🚀 ULTRAWORK MODE ACTIVATED
166
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
167
+
168
+ 📄 SPEC: .claude/vibe/specs/brick-game.md
169
+ 🎯 4 Phases detected
170
+ ⚡ Boulder Loop: ENABLED (will continue until all phases complete)
171
+ 🔄 Auto-retry: ON (max 3 per phase)
172
+ 💾 Context compression: AGGRESSIVE
173
+
174
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
175
+ 🏔️ BOULDER ROLLING... Phase 1/4
176
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
177
+
178
+ ⚡ [PARALLEL] Launching 3 exploration agents...
179
+ ✅ Exploration complete (7.2s)
180
+ 🔨 Implementing...
181
+ ✅ Phase 1 complete
182
+
183
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
184
+ 🏔️ BOULDER ROLLING... Phase 2/4
185
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
186
+
187
+ ⚡ [PARALLEL] Launching 3 exploration agents...
188
+ ✅ Exploration complete (6.8s)
189
+ 🔨 Implementing...
190
+ ❌ Test failed: collision detection
191
+ 🔄 Auto-retry 1/3...
192
+ 🔨 Fixing...
193
+ ✅ Phase 2 complete
194
+
195
+ [...continues automatically...]
196
+
197
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
198
+ 🎉 BOULDER REACHED THE TOP!
199
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
200
+
201
+ ✅ All 4 phases complete
202
+ ✅ All acceptance criteria passed
203
+ ✅ Build succeeded
204
+ ✅ Tests passed
205
+
206
+ ⏱️ Total: 8m 24s
207
+ 📊 Retries: 2
208
+ 💾 Context saved: 3 checkpoints
209
+ ```
210
+
211
+ ### Normal vs ULTRAWORK Comparison
212
+
213
+ | Aspect | Normal | ULTRAWORK |
214
+ |--------|--------|-----------|
215
+ | Phase transition | May pause | Auto-continues |
216
+ | On error | Reports and stops | Auto-retries (3x) |
217
+ | Context 70%+ | Warning only | Auto-compress + save |
218
+ | Exploration | Sequential possible | FORCED parallel |
219
+ | Completion | Phase-by-phase | Until ALL done |
220
+
221
+ ---
222
+
223
+ ## Rules Reference
224
+
225
+ **Must follow `~/.claude/vibe/rules/` (global):**
226
+
227
+ - `core/development-philosophy.md` - Surgical precision, modify only requested scope
228
+ - `core/quick-start.md` - Korean, DRY, SRP, YAGNI
229
+ - `standards/complexity-metrics.md` - Functions ≤20 lines, nesting ≤3 levels
230
+ - `quality/checklist.md` - Code quality checklist
231
+
232
+ **Language guide:** `~/.claude/vibe/languages/{stack}.md` (global reference)
233
+
234
+ ## Description
235
+
236
+ Read PTCF structured SPEC document and execute implementation immediately.
237
+
238
+ > **PLAN, TASKS documents unnecessary** - SPEC is the executable prompt
239
+
240
+ ## Model Orchestration (Intelligent Routing)
241
+
242
+ Automatically select optimal model based on **task complexity analysis**.
243
+
244
+ ### Complexity-Based Model Selection
245
+
246
+ | Complexity Score | Model | When to Use |
247
+ |------------------|-------|-------------|
248
+ | 0-7 (Low) | **Haiku** | Simple fixes, searches, single file changes |
249
+ | 8-19 (Medium) | **Sonnet** | Standard features, 3-5 files, integrations |
250
+ | 20+ (High) | **Opus** | Architecture, security, multi-service, 6+ files |
251
+
252
+ ### Complexity Signals
253
+
254
+ The following signals increase complexity score:
255
+
256
+ | Signal | Score |
257
+ |--------|-------|
258
+ | Architecture change | +15 |
259
+ | Security implication | +12 |
260
+ | Multi-service | +8 |
261
+ | Refactoring | +12 |
262
+ | 6+ files | +15 |
263
+ | 3-5 files | +8 |
264
+ | New feature | +5 |
265
+ | Bug fix | -3 |
266
+ | Documentation | -5 |
267
+
268
+ ### Agent Tier System
269
+
270
+ Each agent has tier variants for cost optimization:
271
+
272
+ | Agent | Low (Haiku) | Medium (Sonnet) | High (Opus) |
273
+ |-------|-------------|-----------------|-------------|
274
+ | explorer | explorer-low | explorer-medium | explorer |
275
+ | implementer | implementer-low | implementer-medium | implementer |
276
+ | architect | architect-low | architect-medium | architect |
277
+
278
+ ### Task Calls by Role
279
+
280
+ | Task Type | Model | Task Parameter |
281
+ |-----------|-------|----------------|
282
+ | Simple search | Haiku | `model: "haiku"` |
283
+ | Codebase exploration | Haiku/Sonnet | Auto-selected |
284
+ | Core implementation | Sonnet | `model: "sonnet"` |
285
+ | Test writing | Haiku | `model: "haiku"` |
286
+ | Architecture decisions | Opus | Main session |
287
+ | Final review | Opus | Main session |
288
+
289
+ ### External LLM Usage (When Enabled)
290
+
291
+ When external LLMs are enabled in `.claude/vibe/config.json`:
292
+
293
+ | Role | Method | Condition |
294
+ |------|--------|-----------|
295
+ | User direct query | `gpt.question`, `gemini.question` | Hook auto-handles |
296
+ | Internal orchestration | Call global script via Bash | Claude calls directly |
297
+
298
+ **User questions (Hook auto-handles):**
299
+ - `gpt.question` - GPT architecture consultation
300
+ - `gemini.question` - Gemini Q&A/consultation
301
+
302
+ **Claude internal calls (directly via Bash):**
303
+ ```bash
304
+ # Usage: node llm-orchestrate.js <provider> <mode> [systemPrompt] [prompt]
305
+ # - If systemPrompt omitted, uses default
306
+ # - If systemPrompt is "-", uses default and treats next argument as prompt
307
+
308
+ # Cross-platform path (works on Windows/macOS/Linux)
309
+ VIBE_SCRIPTS="$(node -p "process.env.APPDATA || require('os').homedir() + '/.config'")/vibe/hooks/scripts"
310
+
311
+ # GPT call
312
+ node "$VIBE_SCRIPTS/llm-orchestrate.js" gpt orchestrate-json "[question content]"
313
+
314
+ # Gemini call
315
+ node "$VIBE_SCRIPTS/llm-orchestrate.js" gemini orchestrate-json "[question content]"
316
+
317
+ # Custom system prompt usage
318
+ node "$VIBE_SCRIPTS/llm-orchestrate.js" gpt orchestrate-json "You are a code reviewer" "[question content]"
319
+ ```
320
+
321
+ ### External LLM Fallback
322
+
323
+ **IMPORTANT**: When GPT/Gemini hook fails, Claude MUST handle the task directly:
324
+
325
+ **Fallback behavior**:
326
+ - Do NOT retry the external LLM call
327
+ - Claude handles the task using its own capabilities
328
+ - Continue with the implementation without interruption
329
+ - Log the fallback but don't block progress
330
+
331
+ ## Vibe Tools (Semantic Analysis & Memory)
332
+
333
+ Use vibe tools for accurate codebase understanding and session continuity.
334
+
335
+ ### Tool Invocation
336
+
337
+ All tools are called via:
338
+ ```bash
339
+ node -e "import('@su-record/vibe/tools').then(t => t.TOOL_NAME({...args}).then(r => console.log(r.content[0].text)))"
340
+ ```
341
+
342
+ ### Semantic Analysis Tools
343
+
344
+ | Tool | Purpose | Usage |
345
+ |------|---------|-------|
346
+ | `findSymbol` | Find symbol definitions | `{symbolName: 'functionName', searchPath: '.'}` |
347
+ | `findReferences` | Find all references | `{symbolName: 'functionName', searchPath: '.'}` |
348
+ | `analyzeComplexity` | Analyze code complexity | `{filePath: 'src/file.ts'}` |
349
+ | `validateCodeQuality` | Validate code quality | `{filePath: 'src/file.ts'}` |
350
+
351
+ **Example - Find symbol:**
352
+ ```bash
353
+ node -e "import('@su-record/vibe/tools').then(t => t.findSymbol({symbolName: 'login', searchPath: '.'}).then(r => console.log(r.content[0].text)))"
354
+ ```
355
+
356
+ ### Memory Tools
357
+
358
+ | Tool | Purpose | Usage |
359
+ |------|---------|-------|
360
+ | `saveMemory` | Save important decisions | `{key: 'decision-name', value: 'content', category: 'project'}` |
361
+ | `recallMemory` | Recall saved memory | `{key: 'decision-name'}` |
362
+ | `listMemories` | List all memories | `{category: 'project'}` |
363
+
364
+ **Example - Save important decision:**
365
+ ```bash
366
+ 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)))"
367
+ ```
368
+
369
+ ### Session Management (Auto via Hooks)
370
+
371
+ - **Session start**: Hook auto-calls `startSession` to restore previous context
372
+ - **Context 80%+**: Hook auto-calls `autoSaveContext` to preserve state
373
+
374
+ ## Process
375
+
376
+ ### 1. Load SPEC + Feature
377
+
378
+ ```
379
+ 📄 .claude/vibe/specs/{feature-name}.md → SPEC (structure, constraints, context)
380
+ 📄 .claude/vibe/features/{feature-name}.feature Feature (scenario = implementation unit)
381
+ ```
382
+
383
+ **Error if Feature file missing**:
384
+ ```
385
+ ❌ Feature file not found.
386
+ Run /vibe.spec "{feature-name}" first.
387
+ ```
388
+
389
+ ### 2. Extract Scenario List
390
+
391
+ Extract all Scenarios from Feature file:
392
+
393
+ ```markdown
394
+ ## Scenarios to Implement
395
+
396
+ | # | Scenario | Status |
397
+ |---|----------|--------|
398
+ | 1 | Valid login success | ⬜ |
399
+ | 2 | Invalid password error | ⬜ |
400
+ | 3 | Email format validation | ⬜ |
401
+ | 4 | Password reset link | ⬜ |
402
+
403
+ Total: 4 scenarios
404
+ ```
405
+
406
+ ### 3. Scenario-by-Scenario Implementation (Core)
407
+
408
+ **For each scenario**:
409
+
410
+ ```
411
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
412
+ 🎯 Scenario 1/4: Valid login success
413
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
414
+
415
+ Given: User is registered
416
+ When: Login with valid email and password
417
+ Then: Login success + JWT token returned
418
+
419
+ [Step 1] Analyzing implementation...
420
+ - Required files: auth.service.ts, login.controller.ts
421
+ - Exploring related code...
422
+
423
+ [Step 2] Implementing...
424
+ auth.service.ts - Added login() method
425
+ login.controller.ts - POST /login endpoint
426
+
427
+ [Step 3] Verifying...
428
+ ✅ Given: Test user creation possible
429
+ When: Login API call succeeded
430
+ ✅ Then: JWT token return confirmed
431
+
432
+ ✅ Scenario 1 passed!
433
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
434
+ ```
435
+
436
+ **On failure**:
437
+
438
+ ```
439
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
440
+ 🎯 Scenario 2/4: Invalid password error
441
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
442
+
443
+ [Step 3] Verifying...
444
+ Given: Test user exists
445
+ When: Login attempt with wrong password
446
+ ❌ Then: "Invalid credentials" error message
447
+ Actual: "Error occurred" returned
448
+
449
+ [Auto-fix 1/3]
450
+ Cause: Error message not properly set
451
+ Fix: auth.service.ts line 42
452
+
453
+ [Re-verify]
454
+ ✅ Then: "Invalid credentials" error message
455
+
456
+ ✅ Scenario 2 passed! (1 fix)
457
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
458
+ ```
459
+
460
+ ---
461
+
462
+ ## **CRITICAL: Parallel Sub-Agent Execution**
463
+
464
+ > **MUST USE PARALLEL TASK CALLS** - This is REQUIRED, not optional.
465
+ > Sequential execution when parallel is possible = VIOLATION of this workflow.
466
+
467
+ ### Mandatory Parallel Exploration (Phase Start)
468
+
469
+ **BEFORE any implementation, you MUST launch these Task calls IN PARALLEL (single message, multiple tool calls):**
470
+
471
+ ```
472
+ ┌─────────────────────────────────────────────────────────────────┐
473
+ │ STEP 1: PARALLEL EXPLORATION (REQUIRED) │
474
+
475
+ │ Launch ALL of these in ONE message: │
476
+ │ │
477
+ Task(haiku) ─┬─→ "Analyze related files in <context>"
478
+
479
+ Task(haiku) ─┼─→ "Check dependencies and imports"
480
+
481
+ Task(haiku) ─┴─→ "Find existing patterns and conventions"
482
+
483
+ [If GPT enabled] Bash: node {{VIBE_PATH}}/hooks/scripts/llm-orchestrate.js gpt orchestrate-json "[question]"
484
+ [If Gemini enabled] Bash: node {{VIBE_PATH}}/hooks/scripts/llm-orchestrate.js gemini orchestrate-json "[question]"
485
+ └─────────────────────────────────────────────────────────────────┘
486
+
487
+ (wait for all to complete)
488
+ ┌─────────────────────────────────────────────────────────────────┐
489
+ STEP 2: SYNTHESIZE (Opus) │
490
+ │ - Review all exploration results │
491
+ │ - Decide implementation approach │
492
+ - Identify files to modify/create
493
+ └─────────────────────────────────────────────────────────────────┘
494
+
495
+
496
+ ┌─────────────────────────────────────────────────────────────────┐
497
+ STEP 3: IMPLEMENT + BACKGROUND AGENTS (PARALLEL)
498
+
499
+ │ Main Agent (sonnet): │
500
+ │ └─→ Execute current phase implementation │
501
+ │ │
502
+ │ Background Agents (haiku, run_in_background=true): │
503
+ │ ├─→ Task: "Prepare Phase N+1 - analyze required files" │
504
+ │ ├─→ Task: "Pre-generate test cases for current implementation"
505
+ │ └─→ Task: "Search for related types/interfaces needed" │
506
+ │ │
507
+ [ULTRAWORK] All 4 agents run simultaneously! │
508
+ └─────────────────────────────────────────────────────────────────┘
509
+
510
+ ↓ (main completes, check backgrounds)
511
+ ┌─────────────────────────────────────────────────────────────────┐
512
+ │ STEP 4: TEST + PHASE PIPELINING │
513
+ │ │
514
+ │ Current Phase: │
515
+ │ └─→ Task(haiku): Write tests using pre-generated cases │
516
+ │ │
517
+ │ Next Phase Prep (from background results): │
518
+ │ └─→ Already have file analysis, ready to start immediately │
519
+ └─────────────────────────────────────────────────────────────────┘
520
+ ```
521
+
522
+ ### Parallel Task Call Pattern (MUST FOLLOW)
523
+
524
+ **Correct - Single message with multiple parallel Tasks:**
525
+ ```
526
+ <message>
527
+ Task(haiku, "Analyze src/components/ for existing patterns")
528
+ Task(haiku, "Check package.json dependencies")
529
+ Task(haiku, "Find usage of similar features in codebase")
530
+ </message>
531
+ All 3 run simultaneously, ~3x faster
532
+ ```
533
+
534
+ **WRONG - Sequential calls (DO NOT DO THIS):**
535
+ ```
536
+ <message>Task(haiku, "Analyze...")</message>
537
+ <message>Task(haiku, "Check...")</message>
538
+ <message>Task(haiku, "Find...")</message>
539
+ → 3x slower, wastes time
540
+ ```
541
+
542
+ ### Background Agent Pattern (ULTRAWORK) via Orchestrator
543
+
544
+ **Launch background agents for next phase via Orchestrator:**
545
+ ```bash
546
+ # Start background agent (doesn't block)
547
+ 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)))"
548
+
549
+ # Multiple backgrounds in parallel
550
+ node -e "import('@su-record/vibe/orchestrator').then(async o => {
551
+ await Promise.all([
552
+ o.runAgent('Phase 2 prep: Analyze auth API endpoints', 'phase2-prep'),
553
+ o.runAgent('Pre-generate test cases for login form', 'test-prep'),
554
+ o.runAgent('Find existing validation patterns', 'pattern-finder')
555
+ ]);
556
+ console.log('All background agents started');
557
+ })"
558
+ ```
559
+
560
+ **Check background agent status:**
561
+ ```bash
562
+ node -e "import('@su-record/vibe/orchestrator').then(o => console.log(o.status().content[0].text))"
563
+ ```
564
+
565
+ **Get result when ready:**
566
+ ```bash
567
+ node -e "import('@su-record/vibe/orchestrator').then(o => o.getResult('SESSION_ID').then(r => console.log(r.content[0].text)))"
568
+ ```
569
+
570
+ **Why Background Agents Matter:**
571
+
572
+ | Without Background | With Background |
573
+ |--------------------|-----------------|
574
+ | Phase 1: 60s | Phase 1: 60s (+ backgrounds running) |
575
+ | Phase 2 prep: 20s | Phase 2 prep: 0s (already done!) |
576
+ | Phase 2: 60s | Phase 2: 60s |
577
+ | **Total: 140s** | **Total: 120s** |
578
+
579
+ For 5 phases: 4 × 20s saved = **80s faster**
580
+
581
+ ### Why Parallel Matters
582
+
583
+ | Approach | Time | Cache Benefit |
584
+ |----------|------|---------------|
585
+ | Sequential (3 Tasks) | ~30s | Cache cold on each |
586
+ | **Parallel (3 Tasks)** | **~10s** | **Cache warmed once, shared** |
587
+
588
+ vibe ProjectCache (LRU) caches ts-morph parsing results. Parallel calls share the warmed cache.
589
+
590
+ ### Phase Execution Flow (ULTRAWORK Pipeline)
591
+
592
+ ```
593
+ Phase N Start
594
+
595
+ ├─→ [PARALLEL] Task(haiku) × 3: Exploration
596
+ - Related code analysis
597
+ │ - Dependency check
598
+ │ - Pattern discovery
599
+
600
+ ↓ (all complete)
601
+
602
+ ├─→ Opus: Synthesize and decide
603
+
604
+ ├─→ [PARALLEL PIPELINE] ←── KEY SPEED OPTIMIZATION
605
+ │ │
606
+ │ ├─→ Main: Task(sonnet) Implementation
607
+ │ │
608
+ │ └─→ Background (run_in_background=true):
609
+ │ ├─→ Task(haiku): Phase N+1 file analysis
610
+ │ ├─→ Task(haiku): Test case preparation
611
+ │ └─→ Task(haiku): Type/interface lookup
612
+
613
+ (main completes)
614
+
615
+ ├─→ Task(haiku): Tests (uses pre-generated cases)
616
+
617
+
618
+ Phase N Complete
619
+
620
+ ↓ (Background results ready - NO WAIT for Phase N+1 exploration!)
621
+
622
+ Phase N+1 Start (IMMEDIATE - exploration already done!)
623
+ ```
624
+
625
+ **Speed Comparison:**
626
+
627
+ | Mode | Phase Time | 5 Phases Total |
628
+ |------|------------|----------------|
629
+ | Sequential | ~2min/phase | ~10min |
630
+ | Parallel Exploration | ~1.5min/phase | ~7.5min |
631
+ | **ULTRAWORK Pipeline** | **~1min/phase** | **~5min** |
632
+
633
+ **Why Pipeline is Faster:**
634
+ - Background agents prepare next phase WHILE current phase implements
635
+ - No idle time between phases
636
+ - Test cases pre-generated during implementation
637
+ - Cache stays warm across parallel tasks
638
+
639
+ ---
640
+
641
+ 1. **Related code analysis**: Task(haiku) explores `<context>` related code
642
+ 2. **File creation/modification**: Task(sonnet) implements per `<output_format>`
643
+ 3. **Constraint compliance**: Check `<constraints>`
644
+ 4. **Run verification**: Execute verification commands
645
+
646
+ ### 4. Gemini Code Review + Auto-Fix (NEW)
647
+
648
+ After all scenarios are implemented, **Gemini reviews the code and auto-fixes based on feedback**:
649
+
650
+ ```
651
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
652
+ 🔍 GEMINI CODE REVIEW
653
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
654
+
655
+ [Step 1] Sending implementation code to Gemini...
656
+ - Changed files: auth.service.ts, auth.controller.ts, ...
657
+
658
+ [Step 2] Gemini review results:
659
+ ┌─────────────────────────────────────────────────────┐
660
+ 📝 Gemini Feedback │
661
+ │ │
662
+ 1. [Improvement] auth.service.ts:24 │
663
+ │ Need timing attack prevention for password compare│
664
+ │ → Recommend using crypto.timingSafeEqual() │
665
+ │ │
666
+ │ 2. [Improvement] auth.controller.ts:15 │
667
+ │ Rate limiting not applied │
668
+ │ → Recommend adding login attempt limit │
669
+ │ │
670
+ │ 3. [Style] auth.service.ts:42 │
671
+ │ Magic number usage │
672
+ │ → Recommend extracting to constant │
673
+ └─────────────────────────────────────────────────────┘
674
+
675
+ [Step 3] Auto-fixing based on feedback...
676
+ ✅ auth.service.ts:24 - Applied timingSafeEqual
677
+ auth.controller.ts:15 - Added rate limiter
678
+ ✅ auth.service.ts:42 - Extracted constant
679
+
680
+ [Step 4] Re-verifying...
681
+ Build succeeded
682
+ Tests passed
683
+
684
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
685
+ Gemini review complete! 3 improvements applied
686
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
687
+ ```
688
+
689
+ **MUST: Gemini Code Review (Required)**
690
+
691
+ When Gemini is enabled, **must** use global hook script for code review:
692
+
693
+ ```bash
694
+ # Cross-platform path (works on Windows/macOS/Linux)
695
+ VIBE_SCRIPTS="$(node -p "process.env.APPDATA || require('os').homedir() + '/.config'")/vibe/hooks/scripts"
696
+
697
+ node "$VIBE_SCRIPTS/llm-orchestrate.js" gemini orchestrate-json "Review this code for security, performance, best-practices: [code summary]. SPEC: [summary]. Scenarios: [list]"
698
+ ```
699
+
700
+ **Call sequence:**
701
+ 1. Summarize key content of changed files
702
+ 2. Add SPEC requirements summary
703
+ 3. Execute global script call
704
+ 4. Fix code for each feedback item in response
705
+ 5. Re-run build/tests
706
+
707
+ **Fallback handling:**
708
+ - On `"status": "fallback"` response → Skip and proceed to next step
709
+ - On network error → Retry once, then skip
710
+
711
+ **Review application rules:**
712
+
713
+ | Feedback Type | Action |
714
+ |---------------|--------|
715
+ | Security vulnerability | Auto-fix immediately |
716
+ | Performance improvement | Auto-fix immediately |
717
+ | Best practices | Auto-fix |
718
+ | Style/preference | Apply selectively (project convention takes priority) |
719
+
720
+ **Conditions:**
721
+ - Only runs when Gemini MCP is enabled (`vibe gemini auth`)
722
+ - Skip and proceed on fallback response
723
+ - Must re-verify build/tests after fixes
724
+
725
+ ### 5. Quality Report (Auto-generated)
726
+
727
+ After all scenarios complete + Gemini review, **quality report is auto-generated**:
728
+
729
+ ```
730
+ ┌─────────────────────────────────────────────────────────────────┐
731
+ 📊 QUALITY REPORT: login
732
+ ├─────────────────────────────────────────────────────────────────┤
733
+
734
+ Scenarios: 4/4 passed
735
+
736
+ ┌───────────────────────────────────────────────────────────┐
737
+ # │ Scenario │ Status │ Retries │ │ │
738
+ │───│───────────────────────────│────────│─────────│
739
+ 1 │ Valid login success │ ✅ │ 0 │ │ │
740
+ │ │ 2 │ Invalid password error │ ✅ │ 1 │ │ │
741
+ │ │ 3 │ Email format validation │ ✅ │ 0 │ │ │
742
+ │ │ 4 │ Password reset link │ ✅ │ 0 │ │ │
743
+ │ └───────────────────────────────────────────────────────────┘ │
744
+ │ │
745
+ │ 📈 Quality score: 94/100
746
+ │ │
747
+ │ ┌─────────────────────────────────────────────────────────┐ │
748
+ │ │ Item │ Result Notes │ │
749
+ │ │───────────────────│────────│─────────────────────────────│ │
750
+ │ │ Build │ ✅ │ npm run build succeeded │ │
751
+ │ │ Tests │ ✅ │ 12/12 passed │ │
752
+ │ │ Type check │ ✅ │ 0 errors │ │
753
+ │ │ Complexity │ ✅ │ All functions ≤30 lines │ │
754
+ │ │ Security │ ✅ │ 0 vulnerabilities │ │
755
+ │ │ Gemini review │ ✅ │ 3 improvements applied │ │
756
+ │ └─────────────────────────────────────────────────────────┘ │
757
+ │ │
758
+ │ ⏱️ Total time: 3m 42s │
759
+ │ │
760
+ └─────────────────────────────────────────────────────────────────┘
761
+ ```
762
+
763
+ **What users should check**:
764
+ - Scenario pass rate (4/4 = 100%)
765
+ - Quality score (94/100)
766
+ - Build/test status
767
+
768
+ **This alone is enough to trust quality.**
769
+
770
+ ### 6. Update Feature File
771
+
772
+ Auto-update scenario status:
773
+
774
+ ```markdown
775
+ ## Coverage
776
+
777
+ | Scenario | SPEC AC | Status |
778
+ |----------|---------|--------|
779
+ | Valid login success | AC-1 | ✅ |
780
+ | Invalid password error | AC-2 | ✅ |
781
+ | Email format validation | AC-3 | ✅ |
782
+ | Password reset link | AC-4 | ✅ |
783
+
784
+ **Last verified**: 2024-01-15 14:32
785
+ **Quality score**: 94/100
786
+ ```
787
+
788
+ ## TRUST 5 Principles
789
+
790
+ Follow during implementation:
791
+
792
+ | Principle | Description |
793
+ |-----------|-------------|
794
+ | **T**est-first | Write tests first |
795
+ | **R**eadable | Clear code |
796
+ | **U**nified | Consistent style |
797
+ | **S**ecured | Consider security |
798
+ | **T**rackable | Logging, monitoring |
799
+
800
+ ## Input
801
+
802
+ - `.claude/vibe/specs/{feature-name}.md` (PTCF SPEC)
803
+ - `.claude/vibe/features/{feature-name}.feature` (BDD)
804
+ - `CLAUDE.md` (project context)
805
+
806
+ ## Output
807
+
808
+ - Implemented code files
809
+ - Test files
810
+ - Updated SPEC document (checkmarks)
811
+
812
+ ## Example
813
+
814
+ ```
815
+ User: /vibe.run "login"
816
+
817
+ Claude:
818
+ 📄 Loading SPEC: .claude/vibe/specs/login.md
819
+ 📄 Loading Feature: .claude/vibe/features/login.feature
820
+
821
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
822
+ 📋 Scenarios to Implement
823
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
824
+
825
+ | # | Scenario | Status |
826
+ |---|----------|--------|
827
+ | 1 | Valid login success | ⬜ |
828
+ | 2 | Invalid password error | ⬜ |
829
+ | 3 | Email format validation | ⬜ |
830
+ | 4 | Password reset link | ⬜ |
831
+
832
+ Total: 4 scenarios
833
+
834
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
835
+ 🎯 Scenario 1/4: Valid login success
836
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
837
+
838
+ Given: User is registered
839
+ When: Login with valid email and password
840
+ Then: Login success + JWT token returned
841
+
842
+ ⚡ [PARALLEL] Exploring...
843
+ Exploration complete (2.1s)
844
+
845
+ 🔨 Implementing...
846
+ auth.service.ts - Added login()
847
+ auth.controller.ts - POST /login
848
+
849
+ 🔍 Verifying...
850
+ ✅ Given: OK
851
+ ✅ When: OK
852
+ Then: OK
853
+
854
+ ✅ Scenario 1 passed!
855
+
856
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
857
+ 🎯 Scenario 2/4: Invalid password error
858
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
859
+
860
+ 🔨 Implementing...
861
+ auth.service.ts - Password validation logic
862
+
863
+ 🔍 Verifying...
864
+ ✅ Given: OK
865
+ ✅ When: OK
866
+ Then: "Invalid credentials" error message
867
+ Actual: "Error" returned
868
+
869
+ 🔄 Auto-fix 1/3...
870
+ Fix: auth.service.ts line 42
871
+
872
+ 🔍 Re-verifying...
873
+ ✅ Then: OK
874
+
875
+ ✅ Scenario 2 passed! (1 fix)
876
+
877
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
878
+ 🎯 Scenario 3/4: Email format validation
879
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
880
+
881
+ 🔨 Implementing...
882
+ 🔍 Verifying...
883
+ Scenario 3 passed!
884
+
885
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
886
+ 🎯 Scenario 4/4: Password reset link
887
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
888
+
889
+ 🔨 Implementing...
890
+ 🔍 Verifying...
891
+ Scenario 4 passed!
892
+
893
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
894
+ 🔍 GEMINI CODE REVIEW
895
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
896
+
897
+ 📤 Sending code to Gemini...
898
+ 📝 Gemini feedback:
899
+ 1. [Security] Need timing attack prevention Fixing...
900
+ 2. [Performance] Unnecessary DB call → Fixing...
901
+
902
+ ✅ 2 improvements auto-applied
903
+ 🔍 Re-verifying... ✅ Passed
904
+
905
+ ┌─────────────────────────────────────────────────────────────────┐
906
+ │ 📊 QUALITY REPORT: login │
907
+ ├─────────────────────────────────────────────────────────────────┤
908
+ │ │
909
+ │ ✅ Scenarios: 4/4 passed │
910
+ │ │
911
+ | # | Scenario | Status | Retries | │
912
+ |---|───────────────────────|───────|─────────| │
913
+ | 1 | Valid login success | | 0 | │
914
+ | 2 | Invalid password error| ✅ | 1 | │
915
+ │ | 3 | Email format validation| ✅ | 0 | │
916
+ │ | 4 | Password reset link | ✅ | 0 | │
917
+ │ │
918
+ 📈 Quality score: 94/100 │
919
+ Build: | Tests: ✅ | Types: ✅ | Gemini: ✅ (2 applied) │
920
+ │ │
921
+ │ ⏱️ Total time: 3m 42s │
922
+ └─────────────────────────────────────────────────────────────────┘
923
+
924
+ 🎉 Implementation complete! All scenarios passed + Gemini review applied.
925
+
926
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
927
+ 🔍 AUTO REVIEW (13+ Agents)
928
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
929
+
930
+ ⚡ [PARALLEL] 13 expert agents reviewing...
931
+ - security-reviewer
932
+ - performance-reviewer ✅
933
+ - architecture-reviewer ✅
934
+ - ...
935
+
936
+ 📋 Review results:
937
+ - P1 Critical: 0
938
+ - P2 Important: 2
939
+ - P3 Nice-to-have: 1
940
+
941
+ 🔧 Auto-fixing P2 issues...
942
+ 1. [PERF] N+1 query → Fixed
943
+ 2. [ARCH] Circular dependency → Fixed
944
+
945
+ Auto Review complete! 2 issues auto-resolved.
946
+ ```
947
+
948
+ ### Phase-specific Execution
949
+
950
+ ```
951
+ User: /vibe.run "brick-game" --phase 2
952
+
953
+ Claude:
954
+ 📄 Reading SPEC: .claude/vibe/specs/brick-game.md
955
+ 🎯 Executing Phase 2 only.
956
+
957
+ Phase 2: Game Logic
958
+ 1. [ ] Paddle movement implementation
959
+ 2. [ ] Ball physics engine
960
+ 3. [ ] Brick collision handling
961
+ 4. [ ] Score system
962
+ 5. [ ] Game over conditions
963
+
964
+ Launching parallel exploration...
965
+ [Task(haiku) × 3 launched in parallel]
966
+
967
+ 🚀 Starting implementation...
968
+ ```
969
+
970
+ ## Error Handling
971
+
972
+ On failure:
973
+ 1. Check error message
974
+ 2. Review `<constraints>`
975
+ 3. Fix code and retry
976
+ 4. If continues to fail, report to user
977
+
978
+ ---
979
+
980
+ ## Quality Gate (Mandatory)
981
+
982
+ ### Implementation Quality Checklist
983
+
984
+ Before marking any scenario as complete, ALL items must pass:
985
+
986
+ | Category | Check Item | Weight |
987
+ |----------|------------|--------|
988
+ | **Functionality** | All Given/When/Then conditions verified | 20% |
989
+ | **Functionality** | Edge cases handled per scenario | 10% |
990
+ | **Code Quality** | No `any` types in TypeScript | 10% |
991
+ | **Code Quality** | Functions ≤30 lines, nesting ≤3 levels | 10% |
992
+ | **Code Quality** | No hardcoded values (use constants) | 5% |
993
+ | **Security** | Input validation implemented | 10% |
994
+ | **Security** | Authentication/authorization checked | 5% |
995
+ | **Error Handling** | Try-catch or error states present | 10% |
996
+ | **Error Handling** | User-friendly error messages | 5% |
997
+ | **Testing** | Unit tests exist for core logic | 10% |
998
+ | **Performance** | No N+1 queries or unnecessary loops | 5% |
999
+
1000
+ ### Quality Score Calculation
1001
+
1002
+ ```
1003
+ Score = Σ(checked items × weight) / 100
1004
+
1005
+ Grades:
1006
+ - 95-100: EXCELLENT - Ready to merge
1007
+ - 85-94: ✅ GOOD - Minor improvements recommended
1008
+ - 70-84: ⚠️ FAIR - Improvements required before merge
1009
+ - 0-69: ❌ POOR - Major fixes needed
1010
+ ```
1011
+
1012
+ ### Quality Gate Thresholds
1013
+
1014
+ | Gate | Minimum Score | Condition |
1015
+ |------|---------------|-----------|
1016
+ | **Scenario Complete** | 85 | Each scenario must score ≥85 |
1017
+ | **Phase Complete** | 90 | Average of all scenarios ≥90 |
1018
+ | **Feature Complete** | 90 | All phases complete + Gemini review |
1019
+
1020
+ ### Auto-Fix Triggers
1021
+
1022
+ | Issue Type | Auto-Fix Action |
1023
+ |------------|-----------------|
1024
+ | Missing error handling | Add try-catch wrapper |
1025
+ | Hardcoded values | Extract to constants file |
1026
+ | Missing input validation | Add validation schema |
1027
+ | Function too long | Suggest split points |
1028
+ | N+1 query detected | Add eager loading |
1029
+
1030
+ ### Forbidden Patterns (Block Merge)
1031
+
1032
+ | Pattern | Why Forbidden | Detection |
1033
+ |---------|---------------|-----------|
1034
+ | `console.log` | Debug code in production | Regex scan |
1035
+ | `// TODO` without issue | Untracked work | Comment scan |
1036
+ | `any` type | Type safety bypass | TypeScript check |
1037
+ | `@ts-ignore` | Type error suppression | TypeScript check |
1038
+ | Empty catch blocks | Silent error swallowing | AST analysis |
1039
+ | Commented-out code | Dead code | Comment scan |
1040
+
1041
+ ---
1042
+
1043
+ ## Next Step
1044
+
1045
+ ```
1046
+ /vibe.verify "brick-game"
1047
+ ```
1048
+
1049
+ ---
1050
+
1051
+ ARGUMENTS: $ARGUMENTS