@su-record/vibe 2.5.11 → 2.5.13

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 (341) hide show
  1. package/CLAUDE.md +243 -0
  2. package/LICENSE +21 -21
  3. package/README.md +262 -262
  4. package/agents/architect-low.md +41 -41
  5. package/agents/architect-medium.md +59 -59
  6. package/agents/architect.md +80 -80
  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 -42
  12. package/agents/explorer-medium.md +59 -59
  13. package/agents/explorer.md +48 -48
  14. package/agents/implementer-low.md +43 -43
  15. package/agents/implementer-medium.md +52 -52
  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 +1117 -1051
  42. package/commands/vibe.spec.md +1058 -1058
  43. package/commands/vibe.utils.md +353 -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/cli/mcp.d.ts +49 -0
  50. package/dist/cli/mcp.d.ts.map +1 -0
  51. package/dist/cli/mcp.js +169 -0
  52. package/dist/cli/mcp.js.map +1 -0
  53. package/dist/cli/postinstall.js +180 -2
  54. package/dist/cli/postinstall.js.map +1 -1
  55. package/dist/cli/setup/GlobalInstaller.d.ts +24 -0
  56. package/dist/cli/setup/GlobalInstaller.d.ts.map +1 -0
  57. package/dist/cli/setup/GlobalInstaller.js +130 -0
  58. package/dist/cli/setup/GlobalInstaller.js.map +1 -0
  59. package/dist/cli/setup/LanguageDetector.d.ts +16 -0
  60. package/dist/cli/setup/LanguageDetector.d.ts.map +1 -0
  61. package/dist/cli/setup/LanguageDetector.js +49 -0
  62. package/dist/cli/setup/LanguageDetector.js.map +1 -0
  63. package/dist/cli/setup/LegacyMigration.d.ts +25 -0
  64. package/dist/cli/setup/LegacyMigration.d.ts.map +1 -0
  65. package/dist/cli/setup/LegacyMigration.js +162 -0
  66. package/dist/cli/setup/LegacyMigration.js.map +1 -0
  67. package/dist/cli/setup/ProjectSetup.d.ts +30 -0
  68. package/dist/cli/setup/ProjectSetup.d.ts.map +1 -0
  69. package/dist/cli/setup/ProjectSetup.js +238 -0
  70. package/dist/cli/setup/ProjectSetup.js.map +1 -0
  71. package/dist/cli/setup/index.d.ts +14 -0
  72. package/dist/cli/setup/index.d.ts.map +1 -0
  73. package/dist/cli/setup/index.js +18 -0
  74. package/dist/cli/setup/index.js.map +1 -0
  75. package/dist/cli/setup.d.ts +10 -77
  76. package/dist/cli/setup.d.ts.map +1 -1
  77. package/dist/cli/setup.js +15 -592
  78. package/dist/cli/setup.js.map +1 -1
  79. package/dist/lib/DeepInit.d.ts +0 -2
  80. package/dist/lib/DeepInit.d.ts.map +1 -1
  81. package/dist/lib/DeepInit.js +24 -26
  82. package/dist/lib/DeepInit.js.map +1 -1
  83. package/dist/lib/IterationTracker.d.ts +0 -2
  84. package/dist/lib/IterationTracker.d.ts.map +1 -1
  85. package/dist/lib/IterationTracker.js +11 -13
  86. package/dist/lib/IterationTracker.js.map +1 -1
  87. package/dist/lib/ModelRouter.d.ts +0 -2
  88. package/dist/lib/ModelRouter.d.ts.map +1 -1
  89. package/dist/lib/ModelRouter.js +0 -2
  90. package/dist/lib/ModelRouter.js.map +1 -1
  91. package/dist/lib/OrchestrateWorkflow.d.ts +1 -3
  92. package/dist/lib/OrchestrateWorkflow.d.ts.map +1 -1
  93. package/dist/lib/OrchestrateWorkflow.js +1 -3
  94. package/dist/lib/OrchestrateWorkflow.js.map +1 -1
  95. package/dist/lib/PythonParser.js +108 -108
  96. package/dist/lib/SkillFrontmatter.d.ts +0 -2
  97. package/dist/lib/SkillFrontmatter.d.ts.map +1 -1
  98. package/dist/lib/SkillFrontmatter.js +28 -30
  99. package/dist/lib/SkillFrontmatter.js.map +1 -1
  100. package/dist/lib/SkillQualityGate.d.ts +0 -2
  101. package/dist/lib/SkillQualityGate.d.ts.map +1 -1
  102. package/dist/lib/SkillQualityGate.js +9 -11
  103. package/dist/lib/SkillQualityGate.js.map +1 -1
  104. package/dist/lib/SkillRepository.d.ts +117 -0
  105. package/dist/lib/SkillRepository.d.ts.map +1 -0
  106. package/dist/lib/SkillRepository.js +477 -0
  107. package/dist/lib/SkillRepository.js.map +1 -0
  108. package/dist/lib/UltraQA.d.ts +0 -2
  109. package/dist/lib/UltraQA.d.ts.map +1 -1
  110. package/dist/lib/UltraQA.js +77 -79
  111. package/dist/lib/UltraQA.js.map +1 -1
  112. package/dist/lib/gemini-mcp.d.ts +10 -0
  113. package/dist/lib/gemini-mcp.d.ts.map +1 -0
  114. package/dist/lib/gemini-mcp.js +353 -0
  115. package/dist/lib/gemini-mcp.js.map +1 -0
  116. package/dist/lib/gpt-api.js +4 -4
  117. package/dist/lib/gpt-mcp.d.ts +10 -0
  118. package/dist/lib/gpt-mcp.d.ts.map +1 -0
  119. package/dist/lib/gpt-mcp.js +352 -0
  120. package/dist/lib/gpt-mcp.js.map +1 -0
  121. package/dist/lib/llm/auth/ApiKeyManager.d.ts +21 -0
  122. package/dist/lib/llm/auth/ApiKeyManager.d.ts.map +1 -0
  123. package/dist/lib/llm/auth/ApiKeyManager.js +43 -0
  124. package/dist/lib/llm/auth/ApiKeyManager.js.map +1 -0
  125. package/dist/lib/llm/auth/ConfigManager.d.ts +29 -0
  126. package/dist/lib/llm/auth/ConfigManager.d.ts.map +1 -0
  127. package/dist/lib/llm/auth/ConfigManager.js +67 -0
  128. package/dist/lib/llm/auth/ConfigManager.js.map +1 -0
  129. package/dist/lib/llm/auth/index.d.ts +25 -0
  130. package/dist/lib/llm/auth/index.d.ts.map +1 -0
  131. package/dist/lib/llm/auth/index.js +83 -0
  132. package/dist/lib/llm/auth/index.js.map +1 -0
  133. package/dist/lib/llm/index.d.ts +10 -0
  134. package/dist/lib/llm/index.d.ts.map +1 -0
  135. package/dist/lib/llm/index.js +12 -0
  136. package/dist/lib/llm/index.js.map +1 -0
  137. package/dist/lib/llm/types.d.ts +96 -0
  138. package/dist/lib/llm/types.d.ts.map +1 -0
  139. package/dist/lib/llm/types.js +17 -0
  140. package/dist/lib/llm/types.js.map +1 -0
  141. package/dist/lib/llm/utils/index.d.ts +6 -0
  142. package/dist/lib/llm/utils/index.d.ts.map +1 -0
  143. package/dist/lib/llm/utils/index.js +6 -0
  144. package/dist/lib/llm/utils/index.js.map +1 -0
  145. package/dist/lib/llm/utils/retry.d.ts +25 -0
  146. package/dist/lib/llm/utils/retry.d.ts.map +1 -0
  147. package/dist/lib/llm/utils/retry.js +72 -0
  148. package/dist/lib/llm/utils/retry.js.map +1 -0
  149. package/dist/lib/llm/utils/stream.d.ts +13 -0
  150. package/dist/lib/llm/utils/stream.d.ts.map +1 -0
  151. package/dist/lib/llm/utils/stream.js +110 -0
  152. package/dist/lib/llm/utils/stream.js.map +1 -0
  153. package/dist/lib/memory/KnowledgeGraph.js +4 -4
  154. package/dist/lib/memory/MemorySearch.js +20 -20
  155. package/dist/lib/memory/MemoryStorage.js +64 -64
  156. package/dist/orchestrator/AgentExecutor.d.ts +23 -0
  157. package/dist/orchestrator/AgentExecutor.d.ts.map +1 -0
  158. package/dist/orchestrator/AgentExecutor.js +231 -0
  159. package/dist/orchestrator/AgentExecutor.js.map +1 -0
  160. package/dist/orchestrator/AgentManager.d.ts +73 -0
  161. package/dist/orchestrator/AgentManager.d.ts.map +1 -0
  162. package/dist/orchestrator/AgentManager.js +184 -0
  163. package/dist/orchestrator/AgentManager.js.map +1 -0
  164. package/dist/orchestrator/LLMCluster.d.ts +70 -0
  165. package/dist/orchestrator/LLMCluster.d.ts.map +1 -0
  166. package/dist/orchestrator/LLMCluster.js +91 -0
  167. package/dist/orchestrator/LLMCluster.js.map +1 -0
  168. package/dist/orchestrator/MultiLlmResearch.d.ts +27 -0
  169. package/dist/orchestrator/MultiLlmResearch.d.ts.map +1 -0
  170. package/dist/orchestrator/MultiLlmResearch.js +145 -0
  171. package/dist/orchestrator/MultiLlmResearch.js.map +1 -0
  172. package/dist/orchestrator/SessionStore.d.ts +41 -0
  173. package/dist/orchestrator/SessionStore.d.ts.map +1 -0
  174. package/dist/orchestrator/SessionStore.js +117 -0
  175. package/dist/orchestrator/SessionStore.js.map +1 -0
  176. package/dist/orchestrator/SmartRouter.d.ts +68 -0
  177. package/dist/orchestrator/SmartRouter.d.ts.map +1 -0
  178. package/dist/orchestrator/SmartRouter.js +256 -0
  179. package/dist/orchestrator/SmartRouter.js.map +1 -0
  180. package/dist/orchestrator/backgroundAgent.d.ts +10 -28
  181. package/dist/orchestrator/backgroundAgent.d.ts.map +1 -1
  182. package/dist/orchestrator/backgroundAgent.js +11 -346
  183. package/dist/orchestrator/backgroundAgent.js.map +1 -1
  184. package/dist/orchestrator/index.d.ts +3 -0
  185. package/dist/orchestrator/index.d.ts.map +1 -1
  186. package/dist/orchestrator/index.js +4 -0
  187. package/dist/orchestrator/index.js.map +1 -1
  188. package/dist/orchestrator/orchestrator.d.ts +19 -154
  189. package/dist/orchestrator/orchestrator.d.ts.map +1 -1
  190. package/dist/orchestrator/orchestrator.js +90 -514
  191. package/dist/orchestrator/orchestrator.js.map +1 -1
  192. package/dist/orchestrator/parallelResearch.d.ts +5 -12
  193. package/dist/orchestrator/parallelResearch.d.ts.map +1 -1
  194. package/dist/orchestrator/parallelResearch.js +10 -193
  195. package/dist/orchestrator/parallelResearch.js.map +1 -1
  196. package/dist/tools/analytics/getUsageAnalytics.d.ts +10 -0
  197. package/dist/tools/analytics/getUsageAnalytics.d.ts.map +1 -0
  198. package/dist/tools/analytics/getUsageAnalytics.js +246 -0
  199. package/dist/tools/analytics/getUsageAnalytics.js.map +1 -0
  200. package/dist/tools/analytics/index.d.ts +5 -0
  201. package/dist/tools/analytics/index.d.ts.map +1 -0
  202. package/dist/tools/analytics/index.js +5 -0
  203. package/dist/tools/analytics/index.js.map +1 -0
  204. package/dist/tools/convention/analyzeComplexity.test.js +115 -115
  205. package/dist/tools/convention/getCodingGuide.d.ts +7 -0
  206. package/dist/tools/convention/getCodingGuide.d.ts.map +1 -0
  207. package/dist/tools/convention/getCodingGuide.js +69 -0
  208. package/dist/tools/convention/getCodingGuide.js.map +1 -0
  209. package/dist/tools/convention/validateCodeQuality.test.js +104 -104
  210. package/dist/tools/index.d.ts +2 -0
  211. package/dist/tools/index.d.ts.map +1 -1
  212. package/dist/tools/index.js +2 -0
  213. package/dist/tools/index.js.map +1 -1
  214. package/dist/tools/planning/analyzeRequirements.d.ts +9 -0
  215. package/dist/tools/planning/analyzeRequirements.d.ts.map +1 -0
  216. package/dist/tools/planning/analyzeRequirements.js +171 -0
  217. package/dist/tools/planning/analyzeRequirements.js.map +1 -0
  218. package/dist/tools/planning/createUserStories.d.ts +9 -0
  219. package/dist/tools/planning/createUserStories.d.ts.map +1 -0
  220. package/dist/tools/planning/createUserStories.js +124 -0
  221. package/dist/tools/planning/createUserStories.js.map +1 -0
  222. package/dist/tools/planning/featureRoadmap.d.ts +10 -0
  223. package/dist/tools/planning/featureRoadmap.d.ts.map +1 -0
  224. package/dist/tools/planning/featureRoadmap.js +207 -0
  225. package/dist/tools/planning/featureRoadmap.js.map +1 -0
  226. package/dist/tools/planning/generatePrd.d.ts +11 -0
  227. package/dist/tools/planning/generatePrd.d.ts.map +1 -0
  228. package/dist/tools/planning/generatePrd.js +161 -0
  229. package/dist/tools/planning/generatePrd.js.map +1 -0
  230. package/dist/tools/planning/index.d.ts +8 -0
  231. package/dist/tools/planning/index.d.ts.map +1 -0
  232. package/dist/tools/planning/index.js +8 -0
  233. package/dist/tools/planning/index.js.map +1 -0
  234. package/dist/tools/prompt/analyzePrompt.d.ts +7 -0
  235. package/dist/tools/prompt/analyzePrompt.d.ts.map +1 -0
  236. package/dist/tools/prompt/analyzePrompt.js +150 -0
  237. package/dist/tools/prompt/analyzePrompt.js.map +1 -0
  238. package/dist/tools/prompt/enhancePrompt.d.ts +8 -0
  239. package/dist/tools/prompt/enhancePrompt.d.ts.map +1 -0
  240. package/dist/tools/prompt/enhancePrompt.js +110 -0
  241. package/dist/tools/prompt/enhancePrompt.js.map +1 -0
  242. package/dist/tools/prompt/enhancePromptGemini.d.ts +8 -0
  243. package/dist/tools/prompt/enhancePromptGemini.d.ts.map +1 -0
  244. package/dist/tools/prompt/enhancePromptGemini.js +332 -0
  245. package/dist/tools/prompt/enhancePromptGemini.js.map +1 -0
  246. package/dist/tools/prompt/index.d.ts +7 -0
  247. package/dist/tools/prompt/index.d.ts.map +1 -0
  248. package/dist/tools/prompt/index.js +7 -0
  249. package/dist/tools/prompt/index.js.map +1 -0
  250. package/dist/tools/reasoning/applyReasoningFramework.d.ts +8 -0
  251. package/dist/tools/reasoning/applyReasoningFramework.d.ts.map +1 -0
  252. package/dist/tools/reasoning/applyReasoningFramework.js +266 -0
  253. package/dist/tools/reasoning/applyReasoningFramework.js.map +1 -0
  254. package/dist/tools/reasoning/index.d.ts +5 -0
  255. package/dist/tools/reasoning/index.d.ts.map +1 -0
  256. package/dist/tools/reasoning/index.js +5 -0
  257. package/dist/tools/reasoning/index.js.map +1 -0
  258. package/dist/tools/thinking/analyzeProblem.d.ts +7 -0
  259. package/dist/tools/thinking/analyzeProblem.d.ts.map +1 -0
  260. package/dist/tools/thinking/analyzeProblem.js +55 -0
  261. package/dist/tools/thinking/analyzeProblem.js.map +1 -0
  262. package/dist/tools/thinking/breakDownProblem.d.ts +8 -0
  263. package/dist/tools/thinking/breakDownProblem.d.ts.map +1 -0
  264. package/dist/tools/thinking/breakDownProblem.js +145 -0
  265. package/dist/tools/thinking/breakDownProblem.js.map +1 -0
  266. package/dist/tools/thinking/createThinkingChain.d.ts +7 -0
  267. package/dist/tools/thinking/createThinkingChain.d.ts.map +1 -0
  268. package/dist/tools/thinking/createThinkingChain.js +44 -0
  269. package/dist/tools/thinking/createThinkingChain.js.map +1 -0
  270. package/dist/tools/thinking/formatAsPlan.d.ts +9 -0
  271. package/dist/tools/thinking/formatAsPlan.d.ts.map +1 -0
  272. package/dist/tools/thinking/formatAsPlan.js +78 -0
  273. package/dist/tools/thinking/formatAsPlan.js.map +1 -0
  274. package/dist/tools/thinking/index.d.ts +10 -0
  275. package/dist/tools/thinking/index.d.ts.map +1 -0
  276. package/dist/tools/thinking/index.js +10 -0
  277. package/dist/tools/thinking/index.js.map +1 -0
  278. package/dist/tools/thinking/stepByStepAnalysis.d.ts +8 -0
  279. package/dist/tools/thinking/stepByStepAnalysis.d.ts.map +1 -0
  280. package/dist/tools/thinking/stepByStepAnalysis.js +63 -0
  281. package/dist/tools/thinking/stepByStepAnalysis.js.map +1 -0
  282. package/dist/tools/thinking/thinkAloudProcess.d.ts +8 -0
  283. package/dist/tools/thinking/thinkAloudProcess.d.ts.map +1 -0
  284. package/dist/tools/thinking/thinkAloudProcess.js +80 -0
  285. package/dist/tools/thinking/thinkAloudProcess.js.map +1 -0
  286. package/hooks/hooks.json +222 -222
  287. package/hooks/scripts/code-check.js +22 -22
  288. package/hooks/scripts/code-review.js +22 -22
  289. package/hooks/scripts/complexity.js +22 -22
  290. package/hooks/scripts/compound.js +23 -23
  291. package/hooks/scripts/context-save.js +33 -33
  292. package/hooks/scripts/generate-brand-assets.js +472 -0
  293. package/hooks/scripts/hud-multiline.js +262 -264
  294. package/hooks/scripts/hud-status.js +291 -293
  295. package/hooks/scripts/keyword-detector.js +214 -216
  296. package/hooks/scripts/llm-orchestrate.js +171 -171
  297. package/hooks/scripts/post-edit.js +97 -97
  298. package/hooks/scripts/post-tool-verify.js +210 -212
  299. package/hooks/scripts/pre-tool-guard.js +125 -127
  300. package/hooks/scripts/recall.js +22 -22
  301. package/hooks/scripts/session-start.js +30 -30
  302. package/hooks/scripts/skill-injector.js +191 -193
  303. package/hooks/scripts/utils.js +97 -97
  304. package/languages/csharp-unity.md +515 -515
  305. package/languages/gdscript-godot.md +470 -470
  306. package/languages/ruby-rails.md +489 -489
  307. package/languages/typescript-angular.md +433 -433
  308. package/languages/typescript-astro.md +416 -416
  309. package/languages/typescript-electron.md +406 -406
  310. package/languages/typescript-nestjs.md +524 -524
  311. package/languages/typescript-svelte.md +407 -407
  312. package/languages/typescript-tauri.md +365 -365
  313. package/package.json +83 -83
  314. package/skills/brand-assets.md +141 -0
  315. package/skills/commerce-patterns.md +361 -0
  316. package/skills/context7-usage.md +102 -102
  317. package/skills/e2e-commerce.md +304 -0
  318. package/skills/frontend-design.md +92 -0
  319. package/skills/git-worktree.md +181 -181
  320. package/skills/parallel-research.md +77 -77
  321. package/skills/priority-todos.md +239 -239
  322. package/skills/seo-checklist.md +244 -0
  323. package/skills/tool-fallback.md +190 -190
  324. package/skills/vibe-capabilities.md +161 -161
  325. package/vibe/constitution.md +227 -227
  326. package/vibe/rules/core/communication-guide.md +98 -98
  327. package/vibe/rules/core/development-philosophy.md +52 -52
  328. package/vibe/rules/core/quick-start.md +102 -102
  329. package/vibe/rules/quality/bdd-contract-testing.md +393 -393
  330. package/vibe/rules/quality/checklist.md +276 -276
  331. package/vibe/rules/quality/testing-strategy.md +440 -440
  332. package/vibe/rules/standards/anti-patterns.md +541 -541
  333. package/vibe/rules/standards/code-structure.md +291 -291
  334. package/vibe/rules/standards/complexity-metrics.md +313 -313
  335. package/vibe/rules/standards/naming-conventions.md +198 -198
  336. package/vibe/setup.sh +31 -31
  337. package/vibe/templates/constitution-template.md +252 -252
  338. package/vibe/templates/contract-backend-template.md +526 -526
  339. package/vibe/templates/contract-frontend-template.md +599 -599
  340. package/vibe/templates/feature-template.md +96 -96
  341. package/vibe/templates/spec-template.md +221 -221
@@ -1,1051 +1,1117 @@
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
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. Brand Assets Generation (Optional)
647
+
648
+ When starting a **new project** with brand context in SPEC, auto-generate app icons and favicons:
649
+
650
+ ```
651
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
652
+ 🎨 BRAND ASSETS GENERATION
653
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
654
+
655
+ [Check] Brand assets exist? Skip if favicon.ico exists
656
+ [Check] Gemini API configured? Required for image generation
657
+ [Check] SPEC has brand context? → Extract app name, colors, style
658
+
659
+ [Generate] Creating app icon with Gemini Image API...
660
+ - Prompt: "App icon for [AppName], [style], [color]..."
661
+ - Generated: 512x512 master icon
662
+
663
+ [Resize] Creating platform variants...
664
+ favicon.ico (16/32/48)
665
+ ✅ favicon-16x16.png
666
+ favicon-32x32.png
667
+ apple-touch-icon.png (180x180)
668
+ android-chrome-192x192.png
669
+ ✅ android-chrome-512x512.png
670
+ site.webmanifest
671
+
672
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
673
+ ✅ Brand assets generated in public/
674
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
675
+ ```
676
+
677
+ **SPEC Brand Context Example:**
678
+
679
+ ```xml
680
+ <context>
681
+ Brand:
682
+ - App Name: MyApp
683
+ - Primary Color: #2F6BFF
684
+ - Style: Modern, minimalist, flat design
685
+ - Icon Concept: Abstract geometric shape
686
+ </context>
687
+ ```
688
+
689
+ **Trigger Conditions:**
690
+ - First `/vibe.run` execution (no existing icons)
691
+ - SPEC contains brand/design context
692
+ - Gemini API key configured (`vibe gemini auth`)
693
+
694
+ **Manual Generation:**
695
+ ```bash
696
+ node hooks/scripts/generate-brand-assets.js \
697
+ --spec ".claude/vibe/specs/my-feature.md" \
698
+ --output "./public"
699
+
700
+ # Or with explicit values
701
+ node hooks/scripts/generate-brand-assets.js \
702
+ --name "MyApp" \
703
+ --color "#2F6BFF" \
704
+ --style "modern minimal" \
705
+ --output "./public"
706
+ ```
707
+
708
+ **Fallback:** If Gemini Image fails, generates text monogram icon (first letter + primary color).
709
+
710
+ ---
711
+
712
+ ### 5. Gemini Code Review + Auto-Fix
713
+
714
+ After all scenarios are implemented, **Gemini reviews the code and auto-fixes based on feedback**:
715
+
716
+ ```
717
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
718
+ 🔍 GEMINI CODE REVIEW
719
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
720
+
721
+ [Step 1] Sending implementation code to Gemini...
722
+ - Changed files: auth.service.ts, auth.controller.ts, ...
723
+
724
+ [Step 2] Gemini review results:
725
+ ┌─────────────────────────────────────────────────────┐
726
+ │ 📝 Gemini Feedback │
727
+ │ │
728
+ │ 1. [Improvement] auth.service.ts:24 │
729
+ │ Need timing attack prevention for password compare│
730
+ │ → Recommend using crypto.timingSafeEqual() │
731
+
732
+ │ 2. [Improvement] auth.controller.ts:15 │
733
+ Rate limiting not applied
734
+ Recommend adding login attempt limit
735
+
736
+ 3. [Style] auth.service.ts:42 │
737
+ Magic number usage
738
+ → Recommend extracting to constant
739
+ └─────────────────────────────────────────────────────┘
740
+
741
+ [Step 3] Auto-fixing based on feedback...
742
+ auth.service.ts:24 - Applied timingSafeEqual
743
+ ✅ auth.controller.ts:15 - Added rate limiter
744
+ ✅ auth.service.ts:42 - Extracted constant
745
+
746
+ [Step 4] Re-verifying...
747
+ ✅ Build succeeded
748
+ Tests passed
749
+
750
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
751
+ Gemini review complete! 3 improvements applied
752
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
753
+ ```
754
+
755
+ **MUST: Gemini Code Review (Required)**
756
+
757
+ When Gemini is enabled, **must** use global hook script for code review:
758
+
759
+ ```bash
760
+ # Cross-platform path (works on Windows/macOS/Linux)
761
+ VIBE_SCRIPTS="$(node -p "process.env.APPDATA || require('os').homedir() + '/.config'")/vibe/hooks/scripts"
762
+
763
+ node "$VIBE_SCRIPTS/llm-orchestrate.js" gemini orchestrate-json "Review this code for security, performance, best-practices: [code summary]. SPEC: [summary]. Scenarios: [list]"
764
+ ```
765
+
766
+ **Call sequence:**
767
+ 1. Summarize key content of changed files
768
+ 2. Add SPEC requirements summary
769
+ 3. Execute global script call
770
+ 4. Fix code for each feedback item in response
771
+ 5. Re-run build/tests
772
+
773
+ **Fallback handling:**
774
+ - On `"status": "fallback"` response → Skip and proceed to next step
775
+ - On network error → Retry once, then skip
776
+
777
+ **Review application rules:**
778
+
779
+ | Feedback Type | Action |
780
+ |---------------|--------|
781
+ | Security vulnerability | Auto-fix immediately |
782
+ | Performance improvement | Auto-fix immediately |
783
+ | Best practices | Auto-fix |
784
+ | Style/preference | Apply selectively (project convention takes priority) |
785
+
786
+ **Conditions:**
787
+ - Only runs when Gemini MCP is enabled (`vibe gemini auth`)
788
+ - Skip and proceed on fallback response
789
+ - Must re-verify build/tests after fixes
790
+
791
+ ### 6. Quality Report (Auto-generated)
792
+
793
+ After all scenarios complete + Gemini review, **quality report is auto-generated**:
794
+
795
+ ```
796
+ ┌─────────────────────────────────────────────────────────────────┐
797
+ │ 📊 QUALITY REPORT: login │
798
+ ├─────────────────────────────────────────────────────────────────┤
799
+ │ │
800
+ │ ✅ Scenarios: 4/4 passed │
801
+ │ │
802
+ │ ┌───────────────────────────────────────────────────────────┐ │
803
+ │ │ # │ Scenario │ Status │ Retries │ │ │
804
+ │ │───│───────────────────────────│────────│─────────│ │ │
805
+ │ │ 1 │ Valid login success │ ✅ │ 0 │ │ │
806
+ │ │ 2 │ Invalid password error │ ✅ │ 1 │ │ │
807
+ │ │ 3 │ Email format validation │ ✅ │ 0 │ │ │
808
+ │ │ 4 Password reset link │ ✅ │ 0 │ │ │
809
+ │ └───────────────────────────────────────────────────────────┘ │
810
+ │ │
811
+ │ 📈 Quality score: 94/100 │
812
+ │ │
813
+ │ ┌─────────────────────────────────────────────────────────┐ │
814
+ │ │ Item │ Result │ Notes │ │
815
+ │ │───────────────────│────────│─────────────────────────────│ │
816
+ │ │ Build │ ✅ │ npm run build succeeded │ │
817
+ │ │ Tests │ ✅ │ 12/12 passed │ │
818
+ │ │ Type check │ ✅ │ 0 errors │ │
819
+ │ │ Complexity │ ✅ │ All functions ≤30 lines │ │
820
+ │ │ Security │ ✅ │ 0 vulnerabilities │ │
821
+ │ │ Gemini review │ ✅ │ 3 improvements applied │ │
822
+ │ └─────────────────────────────────────────────────────────┘ │
823
+ │ │
824
+ │ ⏱️ Total time: 3m 42s │
825
+ │ │
826
+ └─────────────────────────────────────────────────────────────────┘
827
+ ```
828
+
829
+ **What users should check**:
830
+ - Scenario pass rate (4/4 = 100%)
831
+ - Quality score (94/100)
832
+ - Build/test status
833
+
834
+ **This alone is enough to trust quality.**
835
+
836
+ ### 7. Update Feature File
837
+
838
+ Auto-update scenario status:
839
+
840
+ ```markdown
841
+ ## Coverage
842
+
843
+ | Scenario | SPEC AC | Status |
844
+ |----------|---------|--------|
845
+ | Valid login success | AC-1 | ✅ |
846
+ | Invalid password error | AC-2 | ✅ |
847
+ | Email format validation | AC-3 | ✅ |
848
+ | Password reset link | AC-4 | ✅ |
849
+
850
+ **Last verified**: 2024-01-15 14:32
851
+ **Quality score**: 94/100
852
+ ```
853
+
854
+ ## TRUST 5 Principles
855
+
856
+ Follow during implementation:
857
+
858
+ | Principle | Description |
859
+ |-----------|-------------|
860
+ | **T**est-first | Write tests first |
861
+ | **R**eadable | Clear code |
862
+ | **U**nified | Consistent style |
863
+ | **S**ecured | Consider security |
864
+ | **T**rackable | Logging, monitoring |
865
+
866
+ ## Input
867
+
868
+ - `.claude/vibe/specs/{feature-name}.md` (PTCF SPEC)
869
+ - `.claude/vibe/features/{feature-name}.feature` (BDD)
870
+ - `CLAUDE.md` (project context)
871
+
872
+ ## Output
873
+
874
+ - Implemented code files
875
+ - Test files
876
+ - Updated SPEC document (checkmarks)
877
+
878
+ ## Example
879
+
880
+ ```
881
+ User: /vibe.run "login"
882
+
883
+ Claude:
884
+ 📄 Loading SPEC: .claude/vibe/specs/login.md
885
+ 📄 Loading Feature: .claude/vibe/features/login.feature
886
+
887
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
888
+ 📋 Scenarios to Implement
889
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
890
+
891
+ | # | Scenario | Status |
892
+ |---|----------|--------|
893
+ | 1 | Valid login success | ⬜ |
894
+ | 2 | Invalid password error | ⬜ |
895
+ | 3 | Email format validation | ⬜ |
896
+ | 4 | Password reset link | ⬜ |
897
+
898
+ Total: 4 scenarios
899
+
900
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
901
+ 🎯 Scenario 1/4: Valid login success
902
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
903
+
904
+ Given: User is registered
905
+ When: Login with valid email and password
906
+ Then: Login success + JWT token returned
907
+
908
+ ⚡ [PARALLEL] Exploring...
909
+ Exploration complete (2.1s)
910
+
911
+ 🔨 Implementing...
912
+ ✅ auth.service.ts - Added login()
913
+ auth.controller.ts - POST /login
914
+
915
+ 🔍 Verifying...
916
+ Given: OK
917
+ ✅ When: OK
918
+ Then: OK
919
+
920
+ ✅ Scenario 1 passed!
921
+
922
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
923
+ 🎯 Scenario 2/4: Invalid password error
924
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
925
+
926
+ 🔨 Implementing...
927
+ auth.service.ts - Password validation logic
928
+
929
+ 🔍 Verifying...
930
+ Given: OK
931
+ When: OK
932
+ Then: "Invalid credentials" error message
933
+ Actual: "Error" returned
934
+
935
+ 🔄 Auto-fix 1/3...
936
+ Fix: auth.service.ts line 42
937
+
938
+ 🔍 Re-verifying...
939
+ Then: OK
940
+
941
+ Scenario 2 passed! (1 fix)
942
+
943
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
944
+ 🎯 Scenario 3/4: Email format validation
945
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
946
+
947
+ 🔨 Implementing...
948
+ 🔍 Verifying...
949
+ ✅ Scenario 3 passed!
950
+
951
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
952
+ 🎯 Scenario 4/4: Password reset link
953
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
954
+
955
+ 🔨 Implementing...
956
+ 🔍 Verifying...
957
+ Scenario 4 passed!
958
+
959
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
960
+ 🔍 GEMINI CODE REVIEW
961
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
962
+
963
+ 📤 Sending code to Gemini...
964
+ 📝 Gemini feedback:
965
+ 1. [Security] Need timing attack prevention → Fixing...
966
+ 2. [Performance] Unnecessary DB call → Fixing...
967
+
968
+ ✅ 2 improvements auto-applied
969
+ 🔍 Re-verifying... ✅ Passed
970
+
971
+ ┌─────────────────────────────────────────────────────────────────┐
972
+ │ 📊 QUALITY REPORT: login │
973
+ ├─────────────────────────────────────────────────────────────────┤
974
+ │ │
975
+ │ ✅ Scenarios: 4/4 passed │
976
+ │ │
977
+ │ | # | Scenario | Status | Retries | │
978
+ │ |---|───────────────────────|───────|─────────| │
979
+ │ | 1 | Valid login success | ✅ | 0 | │
980
+ │ | 2 | Invalid password error| ✅ | 1 | │
981
+ │ | 3 | Email format validation| ✅ | 0 | │
982
+ │ | 4 | Password reset link | ✅ | 0 | │
983
+ │ │
984
+ │ 📈 Quality score: 94/100 │
985
+ │ Build: ✅ | Tests: ✅ | Types: ✅ | Gemini: ✅ (2 applied) │
986
+ │ │
987
+ │ ⏱️ Total time: 3m 42s │
988
+ └─────────────────────────────────────────────────────────────────┘
989
+
990
+ 🎉 Implementation complete! All scenarios passed + Gemini review applied.
991
+
992
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
993
+ 🔍 AUTO REVIEW (13+ Agents)
994
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
995
+
996
+ [PARALLEL] 13 expert agents reviewing...
997
+ - security-reviewer
998
+ - performance-reviewer
999
+ - architecture-reviewer ✅
1000
+ - ...
1001
+
1002
+ 📋 Review results:
1003
+ - P1 Critical: 0
1004
+ - P2 Important: 2
1005
+ - P3 Nice-to-have: 1
1006
+
1007
+ 🔧 Auto-fixing P2 issues...
1008
+ 1. [PERF] N+1 query Fixed
1009
+ 2. [ARCH] Circular dependency Fixed
1010
+
1011
+ ✅ Auto Review complete! 2 issues auto-resolved.
1012
+ ```
1013
+
1014
+ ### Phase-specific Execution
1015
+
1016
+ ```
1017
+ User: /vibe.run "brick-game" --phase 2
1018
+
1019
+ Claude:
1020
+ 📄 Reading SPEC: .claude/vibe/specs/brick-game.md
1021
+ 🎯 Executing Phase 2 only.
1022
+
1023
+ Phase 2: Game Logic
1024
+ 1. [ ] Paddle movement implementation
1025
+ 2. [ ] Ball physics engine
1026
+ 3. [ ] Brick collision handling
1027
+ 4. [ ] Score system
1028
+ 5. [ ] Game over conditions
1029
+
1030
+ Launching parallel exploration...
1031
+ [Task(haiku) × 3 launched in parallel]
1032
+
1033
+ 🚀 Starting implementation...
1034
+ ```
1035
+
1036
+ ## Error Handling
1037
+
1038
+ On failure:
1039
+ 1. Check error message
1040
+ 2. Review `<constraints>`
1041
+ 3. Fix code and retry
1042
+ 4. If continues to fail, report to user
1043
+
1044
+ ---
1045
+
1046
+ ## Quality Gate (Mandatory)
1047
+
1048
+ ### Implementation Quality Checklist
1049
+
1050
+ Before marking any scenario as complete, ALL items must pass:
1051
+
1052
+ | Category | Check Item | Weight |
1053
+ |----------|------------|--------|
1054
+ | **Functionality** | All Given/When/Then conditions verified | 20% |
1055
+ | **Functionality** | Edge cases handled per scenario | 10% |
1056
+ | **Code Quality** | No `any` types in TypeScript | 10% |
1057
+ | **Code Quality** | Functions ≤30 lines, nesting ≤3 levels | 10% |
1058
+ | **Code Quality** | No hardcoded values (use constants) | 5% |
1059
+ | **Security** | Input validation implemented | 10% |
1060
+ | **Security** | Authentication/authorization checked | 5% |
1061
+ | **Error Handling** | Try-catch or error states present | 10% |
1062
+ | **Error Handling** | User-friendly error messages | 5% |
1063
+ | **Testing** | Unit tests exist for core logic | 10% |
1064
+ | **Performance** | No N+1 queries or unnecessary loops | 5% |
1065
+
1066
+ ### Quality Score Calculation
1067
+
1068
+ ```
1069
+ Score = Σ(checked items × weight) / 100
1070
+
1071
+ Grades:
1072
+ - 95-100: ✅ EXCELLENT - Ready to merge
1073
+ - 90-94: ⚠️ GOOD - Minor improvements required before merge
1074
+ - 80-89: ⚠️ FAIR - Significant improvements required
1075
+ - 0-79: ❌ POOR - Major fixes needed
1076
+ ```
1077
+
1078
+ ### Quality Gate Thresholds
1079
+
1080
+ | Gate | Minimum Score | Condition |
1081
+ |------|---------------|-----------|
1082
+ | **Scenario Complete** | 95 | Each scenario must score ≥95 |
1083
+ | **Phase Complete** | 95 | Average of all scenarios ≥95 |
1084
+ | **Feature Complete** | 95 | All phases complete + Gemini review |
1085
+
1086
+ ### Auto-Fix Triggers
1087
+
1088
+ | Issue Type | Auto-Fix Action |
1089
+ |------------|-----------------|
1090
+ | Missing error handling | Add try-catch wrapper |
1091
+ | Hardcoded values | Extract to constants file |
1092
+ | Missing input validation | Add validation schema |
1093
+ | Function too long | Suggest split points |
1094
+ | N+1 query detected | Add eager loading |
1095
+
1096
+ ### Forbidden Patterns (Block Merge)
1097
+
1098
+ | Pattern | Why Forbidden | Detection |
1099
+ |---------|---------------|-----------|
1100
+ | `console.log` | Debug code in production | Regex scan |
1101
+ | `// TODO` without issue | Untracked work | Comment scan |
1102
+ | `any` type | Type safety bypass | TypeScript check |
1103
+ | `@ts-ignore` | Type error suppression | TypeScript check |
1104
+ | Empty catch blocks | Silent error swallowing | AST analysis |
1105
+ | Commented-out code | Dead code | Comment scan |
1106
+
1107
+ ---
1108
+
1109
+ ## Next Step
1110
+
1111
+ ```
1112
+ /vibe.verify "brick-game"
1113
+ ```
1114
+
1115
+ ---
1116
+
1117
+ ARGUMENTS: $ARGUMENTS