@su-record/vibe 2.7.12 → 2.7.14

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 (331) hide show
  1. package/.env.example +37 -37
  2. package/CLAUDE.md +126 -126
  3. package/LICENSE +21 -21
  4. package/README.md +449 -580
  5. package/agents/architect-low.md +41 -41
  6. package/agents/architect-medium.md +59 -59
  7. package/agents/architect.md +80 -80
  8. package/agents/build-error-resolver.md +115 -115
  9. package/agents/compounder.md +261 -261
  10. package/agents/diagrammer.md +178 -178
  11. package/agents/docs/api-documenter.md +99 -99
  12. package/agents/docs/changelog-writer.md +93 -93
  13. package/agents/e2e-tester.md +294 -266
  14. package/agents/explorer-low.md +42 -42
  15. package/agents/explorer-medium.md +59 -59
  16. package/agents/explorer.md +48 -48
  17. package/agents/implementer-low.md +43 -43
  18. package/agents/implementer-medium.md +52 -52
  19. package/agents/implementer.md +54 -54
  20. package/agents/junior-mentor.md +141 -141
  21. package/agents/planning/requirements-analyst.md +84 -84
  22. package/agents/planning/ux-advisor.md +83 -83
  23. package/agents/qa/acceptance-tester.md +86 -86
  24. package/agents/qa/edge-case-finder.md +93 -93
  25. package/agents/refactor-cleaner.md +143 -143
  26. package/agents/research/best-practices-agent.md +199 -199
  27. package/agents/research/codebase-patterns-agent.md +157 -157
  28. package/agents/research/framework-docs-agent.md +188 -188
  29. package/agents/research/security-advisory-agent.md +213 -213
  30. package/agents/review/architecture-reviewer.md +107 -107
  31. package/agents/review/complexity-reviewer.md +116 -116
  32. package/agents/review/data-integrity-reviewer.md +88 -88
  33. package/agents/review/git-history-reviewer.md +103 -103
  34. package/agents/review/performance-reviewer.md +86 -86
  35. package/agents/review/python-reviewer.md +150 -150
  36. package/agents/review/rails-reviewer.md +139 -139
  37. package/agents/review/react-reviewer.md +144 -144
  38. package/agents/review/security-reviewer.md +80 -80
  39. package/agents/review/simplicity-reviewer.md +140 -140
  40. package/agents/review/test-coverage-reviewer.md +116 -116
  41. package/agents/review/typescript-reviewer.md +127 -127
  42. package/agents/searcher.md +54 -54
  43. package/agents/simplifier.md +120 -120
  44. package/agents/tester.md +49 -49
  45. package/agents/ui/ui-a11y-auditor.md +93 -93
  46. package/agents/ui/ui-antipattern-detector.md +94 -94
  47. package/agents/ui/ui-dataviz-advisor.md +69 -69
  48. package/agents/ui/ui-design-system-gen.md +57 -57
  49. package/agents/ui/ui-industry-analyzer.md +49 -49
  50. package/agents/ui/ui-layout-architect.md +65 -65
  51. package/agents/ui/ui-stack-implementer.md +68 -68
  52. package/agents/ui/ux-compliance-reviewer.md +81 -81
  53. package/agents/ui-previewer.md +258 -260
  54. package/commands/vibe.analyze.md +8 -0
  55. package/commands/vibe.review.md +10 -3
  56. package/commands/vibe.run.md +2078 -2022
  57. package/commands/vibe.spec.md +10 -10
  58. package/commands/vibe.spec.review.md +565 -558
  59. package/commands/vibe.utils.md +413 -413
  60. package/commands/vibe.verify.md +45 -0
  61. package/dist/cli/auth.d.ts.map +1 -1
  62. package/dist/cli/auth.js +1 -7
  63. package/dist/cli/auth.js.map +1 -1
  64. package/dist/cli/collaborator.js +52 -52
  65. package/dist/cli/commands/evolution.js +12 -12
  66. package/dist/cli/commands/info.d.ts.map +1 -1
  67. package/dist/cli/commands/info.js +55 -70
  68. package/dist/cli/commands/info.js.map +1 -1
  69. package/dist/cli/commands/init.d.ts.map +1 -1
  70. package/dist/cli/commands/init.js +6 -7
  71. package/dist/cli/commands/init.js.map +1 -1
  72. package/dist/cli/commands/remove.js +14 -14
  73. package/dist/cli/commands/sentinel.js +27 -27
  74. package/dist/cli/commands/setup.js +1 -1
  75. package/dist/cli/commands/setup.js.map +1 -1
  76. package/dist/cli/commands/skills.js +5 -5
  77. package/dist/cli/commands/slack.js +10 -10
  78. package/dist/cli/commands/telegram.js +12 -12
  79. package/dist/cli/commands/update.d.ts.map +1 -1
  80. package/dist/cli/commands/update.js +3 -4
  81. package/dist/cli/commands/update.js.map +1 -1
  82. package/dist/cli/detect.js +32 -32
  83. package/dist/cli/index.js +51 -55
  84. package/dist/cli/index.js.map +1 -1
  85. package/dist/cli/llm/claude-commands.js +16 -16
  86. package/dist/cli/llm/config.js +20 -20
  87. package/dist/cli/llm/config.js.map +1 -1
  88. package/dist/cli/llm/gemini-commands.d.ts +4 -6
  89. package/dist/cli/llm/gemini-commands.d.ts.map +1 -1
  90. package/dist/cli/llm/gemini-commands.js +52 -322
  91. package/dist/cli/llm/gemini-commands.js.map +1 -1
  92. package/dist/cli/llm/gpt-commands.js +21 -21
  93. package/dist/cli/llm/gpt-commands.js.map +1 -1
  94. package/dist/cli/llm/help.js +21 -21
  95. package/dist/cli/postinstall/constants.js +1 -1
  96. package/dist/cli/postinstall/constants.js.map +1 -1
  97. package/dist/cli/postinstall/cursor-agents.js +32 -32
  98. package/dist/cli/postinstall/cursor-rules.js +83 -83
  99. package/dist/cli/postinstall/cursor-skills.js +743 -743
  100. package/dist/cli/postinstall/inline-skills.js +1 -1
  101. package/dist/cli/postinstall/inline-skills.js.map +1 -1
  102. package/dist/cli/setup/Provisioner.js +42 -42
  103. package/dist/cli/types.d.ts +2 -18
  104. package/dist/cli/types.d.ts.map +1 -1
  105. package/dist/cli/utils.d.ts +0 -9
  106. package/dist/cli/utils.d.ts.map +1 -1
  107. package/dist/cli/utils.js +0 -28
  108. package/dist/cli/utils.js.map +1 -1
  109. package/dist/infra/lib/DeepInit.js +24 -24
  110. package/dist/infra/lib/IterationTracker.js +11 -11
  111. package/dist/infra/lib/PythonParser.js +108 -108
  112. package/dist/infra/lib/ReviewRace.js +96 -96
  113. package/dist/infra/lib/SkillFrontmatter.js +28 -28
  114. package/dist/infra/lib/SkillQualityGate.js +9 -9
  115. package/dist/infra/lib/SkillRepository.js +159 -159
  116. package/dist/infra/lib/UltraQA.js +99 -99
  117. package/dist/infra/lib/autonomy/AuditStore.js +41 -41
  118. package/dist/infra/lib/autonomy/ConfirmationStore.js +30 -30
  119. package/dist/infra/lib/autonomy/EventOutbox.js +38 -38
  120. package/dist/infra/lib/autonomy/PolicyEngine.js +18 -18
  121. package/dist/infra/lib/autonomy/SecuritySentinel.js +1 -1
  122. package/dist/infra/lib/autonomy/SuggestionStore.js +33 -33
  123. package/dist/infra/lib/config/GlobalConfigManager.d.ts +0 -2
  124. package/dist/infra/lib/config/GlobalConfigManager.d.ts.map +1 -1
  125. package/dist/infra/lib/config/GlobalConfigManager.js +0 -27
  126. package/dist/infra/lib/config/GlobalConfigManager.js.map +1 -1
  127. package/dist/infra/lib/embedding/VectorStore.js +22 -22
  128. package/dist/infra/lib/evolution/AgentAnalyzer.js +10 -10
  129. package/dist/infra/lib/evolution/DescriptionOptimizer.js +21 -21
  130. package/dist/infra/lib/evolution/GenerationRegistry.js +36 -36
  131. package/dist/infra/lib/evolution/InsightStore.js +90 -90
  132. package/dist/infra/lib/evolution/RollbackManager.js +5 -5
  133. package/dist/infra/lib/evolution/SkillBenchmark.js +23 -23
  134. package/dist/infra/lib/evolution/SkillEvalRunner.js +50 -50
  135. package/dist/infra/lib/evolution/SkillGapDetector.js +10 -10
  136. package/dist/infra/lib/evolution/UsageTracker.js +28 -28
  137. package/dist/infra/lib/gemini/auth.d.ts +4 -16
  138. package/dist/infra/lib/gemini/auth.d.ts.map +1 -1
  139. package/dist/infra/lib/gemini/auth.js +10 -405
  140. package/dist/infra/lib/gemini/auth.js.map +1 -1
  141. package/dist/infra/lib/gemini/capabilities.d.ts +4 -8
  142. package/dist/infra/lib/gemini/capabilities.d.ts.map +1 -1
  143. package/dist/infra/lib/gemini/capabilities.js +8 -166
  144. package/dist/infra/lib/gemini/capabilities.js.map +1 -1
  145. package/dist/infra/lib/gemini/chat.d.ts +4 -13
  146. package/dist/infra/lib/gemini/chat.d.ts.map +1 -1
  147. package/dist/infra/lib/gemini/chat.js +10 -323
  148. package/dist/infra/lib/gemini/chat.js.map +1 -1
  149. package/dist/infra/lib/gemini/completion.d.ts +5 -15
  150. package/dist/infra/lib/gemini/completion.d.ts.map +1 -1
  151. package/dist/infra/lib/gemini/completion.js +6 -97
  152. package/dist/infra/lib/gemini/completion.js.map +1 -1
  153. package/dist/infra/lib/gemini/constants.d.ts +2 -31
  154. package/dist/infra/lib/gemini/constants.d.ts.map +1 -1
  155. package/dist/infra/lib/gemini/constants.js +2 -77
  156. package/dist/infra/lib/gemini/constants.js.map +1 -1
  157. package/dist/infra/lib/gemini/index.d.ts +5 -8
  158. package/dist/infra/lib/gemini/index.d.ts.map +1 -1
  159. package/dist/infra/lib/gemini/index.js +4 -7
  160. package/dist/infra/lib/gemini/index.js.map +1 -1
  161. package/dist/infra/lib/gemini/models.d.ts +3 -4
  162. package/dist/infra/lib/gemini/models.d.ts.map +1 -1
  163. package/dist/infra/lib/gemini/models.js +8 -84
  164. package/dist/infra/lib/gemini/models.js.map +1 -1
  165. package/dist/infra/lib/gemini/orchestration.js +5 -5
  166. package/dist/infra/lib/gemini/types.d.ts +16 -44
  167. package/dist/infra/lib/gemini/types.d.ts.map +1 -1
  168. package/dist/infra/lib/gemini/types.js +1 -1
  169. package/dist/infra/lib/gpt/auth.d.ts +2 -5
  170. package/dist/infra/lib/gpt/auth.d.ts.map +1 -1
  171. package/dist/infra/lib/gpt/auth.js +8 -38
  172. package/dist/infra/lib/gpt/auth.js.map +1 -1
  173. package/dist/infra/lib/gpt/chat.d.ts +3 -3
  174. package/dist/infra/lib/gpt/chat.d.ts.map +1 -1
  175. package/dist/infra/lib/gpt/chat.js +37 -53
  176. package/dist/infra/lib/gpt/chat.js.map +1 -1
  177. package/dist/infra/lib/gpt/constants.d.ts +2 -5
  178. package/dist/infra/lib/gpt/constants.d.ts.map +1 -1
  179. package/dist/infra/lib/gpt/constants.js +4 -9
  180. package/dist/infra/lib/gpt/constants.js.map +1 -1
  181. package/dist/infra/lib/gpt/embedding.d.ts +1 -1
  182. package/dist/infra/lib/gpt/embedding.js +3 -3
  183. package/dist/infra/lib/gpt/embedding.js.map +1 -1
  184. package/dist/infra/lib/gpt/oauth.d.ts +6 -39
  185. package/dist/infra/lib/gpt/oauth.d.ts.map +1 -1
  186. package/dist/infra/lib/gpt/oauth.js +8 -340
  187. package/dist/infra/lib/gpt/oauth.js.map +1 -1
  188. package/dist/infra/lib/gpt/orchestration.js +5 -5
  189. package/dist/infra/lib/gpt/orchestration.js.map +1 -1
  190. package/dist/infra/lib/gpt/specializations.d.ts +2 -2
  191. package/dist/infra/lib/gpt/specializations.js +3 -3
  192. package/dist/infra/lib/gpt/specializations.js.map +1 -1
  193. package/dist/infra/lib/gpt/types.d.ts +1 -1
  194. package/dist/infra/lib/gpt/types.d.ts.map +1 -1
  195. package/dist/infra/lib/llm/auth/AuthProfileManager.d.ts +2 -2
  196. package/dist/infra/lib/llm/auth/AuthProfileManager.d.ts.map +1 -1
  197. package/dist/infra/lib/llm/auth/AuthProfileManager.js.map +1 -1
  198. package/dist/infra/lib/llm/auth/AuthProfileManager.test.js +1 -1
  199. package/dist/infra/lib/llm/auth/AuthProfileManager.test.js.map +1 -1
  200. package/dist/infra/lib/llm/auth/TokenRefresher.d.ts +1 -1
  201. package/dist/infra/lib/llm/auth/TokenRefresher.js +1 -1
  202. package/dist/infra/lib/llm/auth/index.d.ts +2 -12
  203. package/dist/infra/lib/llm/auth/index.d.ts.map +1 -1
  204. package/dist/infra/lib/llm/auth/index.js +5 -63
  205. package/dist/infra/lib/llm/auth/index.js.map +1 -1
  206. package/dist/infra/lib/llm/types.d.ts +1 -1
  207. package/dist/infra/lib/llm/types.d.ts.map +1 -1
  208. package/dist/infra/lib/memory/KnowledgeGraph.js +4 -4
  209. package/dist/infra/lib/memory/MemorySearch.js +57 -57
  210. package/dist/infra/lib/memory/MemoryStorage.js +181 -181
  211. package/dist/infra/lib/memory/ObservationStore.js +28 -28
  212. package/dist/infra/lib/memory/ReflectionStore.js +30 -30
  213. package/dist/infra/lib/memory/SessionRAGRetriever.js +7 -7
  214. package/dist/infra/lib/memory/SessionRAGStore.js +225 -225
  215. package/dist/infra/lib/memory/SessionSummarizer.js +9 -9
  216. package/dist/infra/orchestrator/AgentManager.js +12 -12
  217. package/dist/infra/orchestrator/AgentRegistry.js +65 -65
  218. package/dist/infra/orchestrator/MultiLlmResearch.js +8 -8
  219. package/dist/infra/orchestrator/SwarmOrchestrator.test.js +16 -16
  220. package/dist/infra/orchestrator/parallelResearch.js +24 -24
  221. package/dist/tools/convention/analyzeComplexity.test.js +115 -115
  222. package/dist/tools/convention/validateCodeQuality.test.js +104 -104
  223. package/dist/tools/memory/createMemoryTimeline.js +10 -10
  224. package/dist/tools/memory/getMemoryGraph.js +12 -12
  225. package/dist/tools/memory/getSessionContext.js +9 -9
  226. package/dist/tools/memory/linkMemories.js +14 -14
  227. package/dist/tools/memory/listMemories.js +4 -4
  228. package/dist/tools/memory/recallMemory.js +4 -4
  229. package/dist/tools/memory/saveMemory.js +4 -4
  230. package/dist/tools/memory/searchMemoriesAdvanced.js +23 -23
  231. package/dist/tools/semantic/analyzeDependencyGraph.js +12 -12
  232. package/dist/tools/semantic/astGrep.test.js +6 -6
  233. package/dist/tools/spec/prdParser.test.js +171 -171
  234. package/dist/tools/spec/specGenerator.js +169 -169
  235. package/dist/tools/spec/traceabilityMatrix.js +64 -64
  236. package/dist/tools/spec/traceabilityMatrix.test.js +28 -28
  237. package/hooks/gemini-hooks.json +73 -73
  238. package/hooks/hooks.json +137 -137
  239. package/hooks/scripts/code-check.js +70 -70
  240. package/hooks/scripts/context-save.js +212 -212
  241. package/hooks/scripts/hud-status.js +291 -291
  242. package/hooks/scripts/keyword-detector.js +214 -214
  243. package/hooks/scripts/llm-orchestrate.js +475 -646
  244. package/hooks/scripts/post-edit.js +32 -32
  245. package/hooks/scripts/pre-tool-guard.js +125 -125
  246. package/hooks/scripts/prompt-dispatcher.js +185 -185
  247. package/hooks/scripts/sentinel-guard.js +104 -104
  248. package/hooks/scripts/session-start.js +106 -106
  249. package/hooks/scripts/stop-notify.js +209 -209
  250. package/hooks/scripts/utils.js +100 -100
  251. package/languages/csharp-unity.md +515 -515
  252. package/languages/gdscript-godot.md +470 -470
  253. package/languages/ruby-rails.md +489 -489
  254. package/languages/typescript-angular.md +433 -433
  255. package/languages/typescript-astro.md +416 -416
  256. package/languages/typescript-electron.md +406 -406
  257. package/languages/typescript-nestjs.md +524 -524
  258. package/languages/typescript-svelte.md +407 -407
  259. package/languages/typescript-tauri.md +365 -365
  260. package/package.json +121 -121
  261. package/skills/agents-md/SKILL.md +120 -120
  262. package/skills/arch-guard/SKILL.md +180 -180
  263. package/skills/brand-assets/SKILL.md +146 -146
  264. package/skills/capability-loop/SKILL.md +167 -167
  265. package/skills/characterization-test/SKILL.md +206 -206
  266. package/skills/commerce-patterns/SKILL.md +59 -59
  267. package/skills/commit-push-pr/SKILL.md +75 -75
  268. package/skills/context7-usage/SKILL.md +105 -105
  269. package/skills/core-capabilities/SKILL.md +48 -48
  270. package/skills/e2e-commerce/SKILL.md +57 -57
  271. package/skills/exec-plan/SKILL.md +147 -147
  272. package/skills/frontend-design/SKILL.md +73 -73
  273. package/skills/git-worktree/SKILL.md +72 -72
  274. package/skills/handoff/SKILL.md +109 -109
  275. package/skills/parallel-research/SKILL.md +87 -87
  276. package/skills/priority-todos/SKILL.md +63 -63
  277. package/skills/seo-checklist/SKILL.md +57 -57
  278. package/skills/techdebt/SKILL.md +122 -122
  279. package/skills/tool-fallback/SKILL.md +103 -103
  280. package/skills/typescript-advanced-types/SKILL.md +66 -65
  281. package/skills/ui-ux-pro-max/SKILL.md +206 -206
  282. package/skills/vercel-react-best-practices/SKILL.md +59 -59
  283. package/skills/video-production/SKILL.md +51 -51
  284. package/vibe/config.json +29 -29
  285. package/vibe/constitution.md +227 -227
  286. package/vibe/rules/principles/communication-guide.md +98 -98
  287. package/vibe/rules/principles/development-philosophy.md +52 -52
  288. package/vibe/rules/principles/quick-start.md +102 -102
  289. package/vibe/rules/quality/bdd-contract-testing.md +393 -393
  290. package/vibe/rules/quality/checklist.md +276 -276
  291. package/vibe/rules/quality/performance.md +236 -236
  292. package/vibe/rules/quality/testing-strategy.md +440 -440
  293. package/vibe/rules/standards/anti-patterns.md +541 -541
  294. package/vibe/rules/standards/code-structure.md +291 -291
  295. package/vibe/rules/standards/complexity-metrics.md +313 -313
  296. package/vibe/rules/standards/git-workflow.md +237 -237
  297. package/vibe/rules/standards/naming-conventions.md +198 -198
  298. package/vibe/rules/standards/security.md +305 -305
  299. package/vibe/rules/writing/document-style.md +74 -74
  300. package/vibe/setup.sh +31 -31
  301. package/vibe/templates/constitution-template.md +252 -252
  302. package/vibe/templates/contract-backend-template.md +526 -526
  303. package/vibe/templates/contract-frontend-template.md +599 -599
  304. package/vibe/templates/feature-template.md +96 -96
  305. package/vibe/templates/spec-template.md +221 -221
  306. package/vibe/ui-ux-data/charts.csv +26 -26
  307. package/vibe/ui-ux-data/colors.csv +97 -97
  308. package/vibe/ui-ux-data/icons.csv +101 -101
  309. package/vibe/ui-ux-data/landing.csv +31 -31
  310. package/vibe/ui-ux-data/products.csv +96 -96
  311. package/vibe/ui-ux-data/react-performance.csv +45 -45
  312. package/vibe/ui-ux-data/stacks/astro.csv +54 -54
  313. package/vibe/ui-ux-data/stacks/flutter.csv +53 -53
  314. package/vibe/ui-ux-data/stacks/html-tailwind.csv +56 -56
  315. package/vibe/ui-ux-data/stacks/jetpack-compose.csv +53 -53
  316. package/vibe/ui-ux-data/stacks/nextjs.csv +53 -53
  317. package/vibe/ui-ux-data/stacks/nuxt-ui.csv +51 -51
  318. package/vibe/ui-ux-data/stacks/nuxtjs.csv +59 -59
  319. package/vibe/ui-ux-data/stacks/react-native.csv +52 -52
  320. package/vibe/ui-ux-data/stacks/react.csv +54 -54
  321. package/vibe/ui-ux-data/stacks/shadcn.csv +61 -61
  322. package/vibe/ui-ux-data/stacks/svelte.csv +54 -54
  323. package/vibe/ui-ux-data/stacks/swiftui.csv +51 -51
  324. package/vibe/ui-ux-data/stacks/vue.csv +50 -50
  325. package/vibe/ui-ux-data/styles.csv +68 -68
  326. package/vibe/ui-ux-data/typography.csv +57 -57
  327. package/vibe/ui-ux-data/ui-reasoning.csv +101 -101
  328. package/vibe/ui-ux-data/ux-guidelines.csv +99 -99
  329. package/vibe/ui-ux-data/version.json +31 -31
  330. package/vibe/ui-ux-data/web-interface.csv +31 -31
  331. package/commands/vibe.voice.md +0 -79
@@ -1,2022 +1,2078 @@
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
- > **⏱️ Timer**: Call `getCurrentTime` tool at the START. Record the result as `{start_time}`.
24
-
25
- ## **Scenario-Driven Development (SDD)**
26
-
27
- > Automate **Scenario = Implementation = Verification** so even non-developers can trust quality
28
-
29
- ### Core Flow
30
-
31
- ```
32
- ┌─────────────────────────────────────────────────────────────────┐
33
- │ SCENARIO-DRIVEN IMPLEMENTATION │
34
- │ │
35
- │ Load Feature file │
36
- │ ↓ │
37
- │ ┌──────────────────────────────────────────────────────────┐ │
38
- │ │ Scenario 1: Happy Path │ │
39
- │ │ Given → When → Then │ │
40
- │ │ ↓ │ │
41
- │ [Implement] → [Verify immediately] → ✅ Pass
42
- └──────────────────────────────────────────────────────────┘
43
-
44
- ┌──────────────────────────────────────────────────────────┐
45
- │ Scenario 2: Edge Case │
46
- │ │ Given When Then │ │
47
- │ ││ │
48
- │ │ [Implement] → [Verify] → ❌ Fail → [Fix] → ✅ Pass │ │
49
- └──────────────────────────────────────────────────────────┘
50
-
51
- ┌──────────────────────────────────────────────────────────┐
52
- │ Scenario N: ... │
53
- │ │ [Implement] [Verify immediately] → ✅ Pass │ │
54
- └──────────────────────────────────────────────────────────┘
55
- │ ↓
56
- ┌──────────────────────────────────────────────────────────┐
57
- 📊 QUALITY REPORT
58
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ │ │
59
- Scenarios: 5/5 passed ✅
60
- │ │ Quality score: 94/100 │ │
61
- │ │ Build: | Tests: │ │
62
- │ └──────────────────────────────────────────────────────────┘ │
63
- └─────────────────────────────────────────────────────────────────┘
64
- ```
65
-
66
- ### Scenario = Implementation Unit
67
-
68
- **Traditional approach (Phase-based)**:
69
- ```
70
- Phase 1 → Phase 2 → Phase 3 → ... → Verify at the end
71
-
72
- "Where did it go wrong?"
73
- ```
74
-
75
- **SDD approach (Scenario-based)**:
76
- ```
77
- Scenario 1 → Implement → Verify ✅
78
- Scenario 2 → Implement → Verify
79
- Scenario 3 → Implement → Verify ❌ → Fix → ✅
80
- ...
81
- All pass = Quality guaranteed
82
- ```
83
-
84
- ### Automated Verification
85
-
86
- After implementing each scenario, **automatic verification**:
87
-
88
- | Verification Item | Auto Check |
89
- |-------------------|------------|
90
- | Given (precondition) | State/data preparation confirmed |
91
- | When (action) | Feature execution possible |
92
- | Then (result) | Expected result matches |
93
- | Code quality | Complexity, style, security |
94
-
95
- ### Auto-Fix on Failure
96
-
97
- ```
98
- Scenario verification failed
99
-
100
- [Root cause analysis] - Which Then condition failed?
101
-
102
- [Implement fix] - Fix only that part
103
-
104
- [Re-verify] - Check again
105
-
106
- Repeat until pass (max 3 times)
107
- ```
108
-
109
- ---
110
-
111
- ## **ULTRAWORK Mode** (ulw)
112
-
113
- > Include `ultrawork` or `ulw` in your command to activate **maximum performance mode**.
114
-
115
- ### What ULTRAWORK Enables
116
-
117
- When you include `ultrawork` (or `ulw`), ALL of these activate automatically:
118
-
119
- | Feature | Description |
120
- |---------|-------------|
121
- | **Parallel Exploration** | 3+ Task(haiku) agents run simultaneously |
122
- | **Boulder Loop** | Auto-continues until ALL phases complete |
123
- | **Context Compression** | Aggressive auto-save at 70%+ context |
124
- | **No Pause** | Doesn't wait for confirmation between phases |
125
- | **External LLMs** | Auto-consults GPT/Gemini if enabled |
126
- | **Error Recovery** | Auto-retries on failure (up to 3 times) |
127
- | **Race Review (v2.6.9)** | Multi-LLM review (GPT+Gemini) with cross-validation |
128
-
129
- ### Boulder Loop (Inspired by Sisyphus)
130
-
131
- Like Sisyphus rolling the boulder, ULTRAWORK **keeps going until done**:
132
-
133
- ```
134
- ┌─────────────────────────────────────────────────────────────────┐
135
- │ BOULDER LOOP (ultrawork) │
136
- │ │
137
- │ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐ │
138
- │ │ Phase 1 │───→│ Phase 2 │───→│ Phase 3 │───→│ Phase N │ │
139
- │ └──────────┘ └──────────┘ └──────────┘ └──────────┘ │
140
- │ │ │ │ │ │
141
- │ ↓ ↓ ↓ ↓ │
142
- │ [Parallel] [Parallel] [Parallel] [Parallel] │
143
- │ [Implement] [Implement] [Implement] [Implement] │
144
- │ [Test] [Test] [Test] [Test] │
145
- │ │ │ │ │ │
146
- │ └───────────────┴───────────────┴───────────────┘ │
147
- │ │ │
148
- │ ↓ │
149
- │ ┌──────────────┐ │
150
- │ │ ALL DONE? │ │
151
- │ └──────────────┘ │
152
- │ │ │ │
153
- │ NO YES │
154
- │ │ │ │
155
- ↓ │
156
- [Continue] [🎉 Complete!] │
157
- │ │
158
- │ NO STOPPING until acceptance criteria met or error limit hit │
159
- └─────────────────────────────────────────────────────────────────┘
160
- ```
161
-
162
- ### Ralph Loop (Completion Verification) - CRITICAL
163
-
164
- > **Inspired by [ghuntley.com/ralph](https://ghuntley.com/ralph)**: "Deterministically bad in an undeterministic world" - Keep iterating until TRULY complete.
165
-
166
- **Problem**: AI often claims "complete" when implementation is partial.
167
-
168
- **Solution**: RTM-based automated coverage verification with iteration tracking.
169
-
170
- ```
171
- ┌─────────────────────────────────────────────────────────────────┐
172
- │ RALPH LOOP (Mandatory) │
173
- │ │
174
- │ After ALL phases complete: │
175
- │ │
176
- │ ┌──────────────────────────────────────────────────────────┐ │
177
- │ │ RTM COVERAGE VERIFICATION [Iteration {{ITER}}/{{MAX}}] │ │
178
- │ │ │ │
179
- │ │ Generate RTM via core tools: │ │
180
- │ │ → generateTraceabilityMatrix("{feature-name}") │ │
181
- │ │ │ │
182
- │ │ Coverage Metrics (automated): │ │
183
- │ │ □ Requirements coverage: {coveragePercent}% │ │
184
- │ │ □ SPEC → Feature mapping: {featureCovered}/{total} │ │
185
- │ │ □ Feature Test mapping: {testCovered}/{total} │ │
186
- │ │ □ Build successful? │ │
187
- │ │ □ Tests passing? │ │
188
- │ │ │ │
189
- │ │ UNCOVERED: {uncoveredRequirements[]} │ │
190
- │ └──────────────────────────────────────────────────────────┘ │
191
-
192
- ┌──────────┴──────────┐
193
- Coverage ≥ 95%?
194
- └──────────┬──────────┘
195
- │ │
196
- NO YES
197
- │ │
198
- ↓ ↓
199
- ┌────────────────┐ ┌────────────────┐
200
- IMPLEMENT │ │ ✅ TRULY DONE │ │
201
- UNCOVERED
202
- REQUIREMENTS │ │ Report final │ │
203
- (auto-extract) │ RTM coverage │ │
204
- └───────┬────────┘ └────────────────┘
205
-
206
- └──────────→ [Re-generate RTM]
207
-
208
- MAX_ITERATIONS: 5 (prevent infinite loops)
209
- COVERAGE_THRESHOLD: 95% (quality gate)
210
- ZERO TOLERANCE for scope reduction
211
- └─────────────────────────────────────────────────────────────────┘
212
- ```
213
-
214
- **Ralph Loop with RTM:**
215
-
216
- ```bash
217
- # Generate RTM for coverage verification
218
- node -e "import('{{VIBE_PATH_URL}}/node_modules/@su-record/vibe/dist/tools/index.js').then(t => t.generateTraceabilityMatrix('{feature-name}', {projectPath: process.cwd()}).then(r => console.log(JSON.stringify(r, null, 2))))"
219
- ```
220
-
221
- **RTM provides automated metrics:**
222
-
223
- | Metric | Description |
224
- |--------|-------------|
225
- | `totalRequirements` | Total REQ-* items in SPEC |
226
- | `specCovered` | Requirements with SPEC mapping |
227
- | `featureCovered` | Requirements with Feature scenarios |
228
- | `testCovered` | Requirements with test files |
229
- | `coveragePercent` | Overall coverage percentage |
230
- | `uncoveredRequirements` | List of missing REQ-* IDs |
231
-
232
- **Ralph Loop Rules:**
233
-
234
- | Rule | Description |
235
- |------|-------------|
236
- | **No Scope Reduction** | Never say "simplified" or "basic version" - implement FULL request |
237
- | **Iteration Tracking** | Display `[{{ITER}}/{{MAX}}]` to show progress |
238
- | **RTM-Based Gap List** | Use `uncoveredRequirements` array - no manual comparison |
239
- | **Coverage Threshold** | Must reach 95% coverage to complete |
240
- | **Max Iterations** | Stop at 5 iterations (report remaining gaps) |
241
-
242
- **Ralph Loop Output Format:**
243
-
244
- ```
245
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
246
- 🔄 RALPH VERIFICATION [Iteration 1/5]
247
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
248
-
249
- 📊 RTM Coverage Report: login
250
-
251
- Requirements Traceability:
252
- Total Requirements: 9
253
- SPEC Covered: 9/9 (100%)
254
- Feature Covered: 5/9 (55%)
255
- Test Covered: 4/9 (44%)
256
-
257
- ✅ REQ-login-001: Login form UI → Scenario 1 → login.test.ts
258
- REQ-login-002: Email validation → Scenario 2 → validation.test.ts
259
- REQ-login-003: Password validation → Scenario 2 → validation.test.ts
260
- ❌ REQ-login-004: Remember me checkbox → NOT IMPLEMENTED
261
- ❌ REQ-login-005: Forgot password link → NOT IMPLEMENTED
262
- REQ-login-006: API integration → Scenario 3 → api.test.ts
263
- ❌ REQ-login-007: Loading state → NOT IMPLEMENTED
264
- ❌ REQ-login-008: Error toast NOT IMPLEMENTED
265
- ✅ REQ-login-009: Session storage → Scenario 4 → (no test)
266
-
267
- Overall Coverage: 55% ⚠️ BELOW 95% THRESHOLD
268
-
269
- UNCOVERED REQUIREMENTS (auto-extracted from RTM):
270
- 1. REQ-login-004: Remember me checkbox
271
- 2. REQ-login-005: Forgot password link
272
- 3. REQ-login-007: Loading state
273
- 4. REQ-login-008: Error toast notifications
274
-
275
- ⚠️ NOT COMPLETE - Implementing uncovered requirements...
276
-
277
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
278
- 🔄 RALPH VERIFICATION [Iteration 2/5]
279
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
280
-
281
- 📊 RTM Coverage Report: login
282
-
283
- Requirements Traceability:
284
- Total Requirements: 9
285
- SPEC Covered: 9/9 (100%)
286
- Feature Covered: 9/9 (100%)
287
- Test Covered: 9/9 (100%)
288
-
289
- Overall Coverage: 100% ✅ ABOVE 95% THRESHOLD
290
-
291
- Build: ✅ Passed
292
- Tests: 12/12 Passed
293
- Type Check: No errors
294
-
295
- RALPH VERIFIED COMPLETE!
296
-
297
- 📄 RTM saved: .claude/vibe/rtm/login-rtm.md
298
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
299
- ```
300
-
301
- **When to Trigger Ralph Loop:**
302
-
303
- 1. After all phases complete
304
- 2. Before final quality report
305
- 3. Whenever user says "ultrawork" or "ralph"
306
-
307
- **Forbidden Responses (VIOLATIONS):**
308
-
309
- | NEVER Say | ✅ Instead |
310
- |-------------|-----------|
311
- | "I've implemented a basic version" | Implement the FULL version |
312
- | "This is a simplified approach" | Implement as specified |
313
- | "You can add X later" | Add X now |
314
- | "For demonstration purposes" | Implement production-ready |
315
- | "The core functionality is done" | ALL functionality must be done |
316
-
317
- ### ULTRAWORK Example
318
-
319
- ```
320
- User: /vibe.run "brick-game" ultrawork
321
-
322
- Claude:
323
- 🚀 ULTRAWORK MODE ACTIVATED
324
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
325
-
326
- 📄 SPEC: .claude/vibe/specs/brick-game.md
327
- 🎯 4 Phases detected
328
- Boulder Loop: ENABLED (will continue until all phases complete)
329
- 🔄 Auto-retry: ON (max 3 per phase)
330
- 💾 Context compression: AGGRESSIVE
331
-
332
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
333
- 🏔️ BOULDER ROLLING... Phase 1/4
334
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
335
-
336
- ⚡ [PARALLEL] Launching 3 exploration agents...
337
- Exploration complete (7.2s)
338
- 🔨 Implementing...
339
- Phase 1 complete
340
-
341
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
342
- 🏔️ BOULDER ROLLING... Phase 2/4
343
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
344
-
345
- [PARALLEL] Launching 3 exploration agents...
346
- ✅ Exploration complete (6.8s)
347
- 🔨 Implementing...
348
- Test failed: collision detection
349
- 🔄 Auto-retry 1/3...
350
- 🔨 Fixing...
351
- Phase 2 complete
352
-
353
- [...continues automatically...]
354
-
355
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
356
- 🎉 BOULDER REACHED THE TOP!
357
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
358
-
359
- All 4 phases complete
360
- All acceptance criteria passed
361
- Build succeeded
362
- ✅ Tests passed
363
-
364
- ⏱️ Total: 8m 24s
365
- 📊 Retries: 2
366
- 💾 Context saved: 3 checkpoints
367
- ```
368
-
369
- ### Normal vs ULTRAWORK Comparison
370
-
371
- | Aspect | Normal | ULTRAWORK |
372
- |--------|--------|-----------|
373
- | Phase transition | May pause | Auto-continues |
374
- | On error | Reports and stops | Auto-retries (3x) |
375
- | Context 70%+ | Warning only | Auto-compress + save |
376
- | Exploration | Sequential possible | FORCED parallel |
377
- | Completion | Phase-by-phase | Until ALL done |
378
-
379
- ---
380
-
381
- ## Rules Reference
382
-
383
- **Must follow `~/.claude/vibe/rules/` (global):**
384
-
385
- - `core/development-philosophy.md` - Surgical precision, modify only requested scope
386
- - `core/quick-start.md` - Korean, DRY, SRP, YAGNI
387
- - `standards/complexity-metrics.md` - Functions ≤20 lines, nesting ≤3 levels
388
- - `quality/checklist.md` - Code quality checklist
389
-
390
- **Language guide:** `~/.claude/vibe/languages/{stack}.md` (global reference)
391
-
392
- ---
393
-
394
- ## Coding Guidelines (Mandatory)
395
-
396
- ### Type Safety: Use Types Explicitly
397
-
398
- > **Core Principle**: Use types explicitly in every language that has a type system!
399
-
400
- Type definitions are not just language syntax — they are a **core engineering philosophy for simplifying and controlling complex software**.
401
-
402
- ### Applies to ALL Typed Languages
403
-
404
- | Category | Languages | Key Principle |
405
- |----------|-----------|---------------|
406
- | **Static Typed** | Java, C#, C++, Go, Rust, Swift, Kotlin, Scala | Types = compile-time contracts |
407
- | **Gradual Typed** | TypeScript, Python (typing), PHP (typed), Ruby (RBS) | Types = optional safety nets |
408
- | **Functional** | Haskell, OCaml, F#, Elm | Types = logical proofs |
409
-
410
- ### Universal Anti-Patterns (All Languages)
411
-
412
- | Forbidden Pattern | Why | ✅ Instead |
413
- |---------------------|-----|-----------|
414
- | Type escape hatches (`any`, `Any`, `Object`, `void*`, `interface{}`) | Loses type info, runtime errors | Concrete types or `unknown` + guards |
415
- | Type suppression (`@ts-ignore`, `# type: ignore`, `@SuppressWarnings`) | Hides errors | Fix actual type issues |
416
- | Raw generic types (`List`, `Map` without params) | Loses type safety | `List<User>`, `Map<String, Order>` |
417
- | Excessive casting (`as`, `(Type)`, `unsafe`) | Bypasses compiler | Type guards or pattern matching |
418
-
419
- ### Language-Specific Guidelines
420
-
421
- **TypeScript/JavaScript:**
422
- ```typescript
423
- // ❌ BAD
424
- function process(data: any): any { return data.foo; }
425
-
426
- // ✅ GOOD
427
- function process(data: unknown): Result {
428
- if (isValidData(data)) return data.foo;
429
- throw new Error('Invalid');
430
- }
431
- ```
432
-
433
- **Python:**
434
- ```python
435
- # ❌ BAD
436
- def process(data: Any) -> Any: return data["key"]
437
-
438
- # ✅ GOOD
439
- def process(data: UserData) -> str: return data["name"]
440
- ```
441
-
442
- **Java/Kotlin:**
443
- ```java
444
- // BAD
445
- List items = new ArrayList(); // Raw type
446
- Object data = getData(); // Lost type info
447
-
448
- // ✅ GOOD
449
- List<User> users = new ArrayList<>();
450
- User user = getUser();
451
- ```
452
-
453
- **Go:**
454
- ```go
455
- // ❌ BAD
456
- func process(data interface{}) interface{} { ... }
457
-
458
- // GOOD
459
- func process(data UserRequest) (UserResponse, error) { ... }
460
- ```
461
-
462
- **Rust:**
463
- ```rust
464
- // BAD (unnecessary unsafe or Box<dyn Any>)
465
- let data: Box<dyn Any> = get_data();
466
-
467
- // ✅ GOOD
468
- let data: UserData = get_data()?;
469
- ```
470
-
471
- **C#:**
472
- ```csharp
473
- // BAD
474
- object data = GetData();
475
- dynamic result = Process(data);
476
-
477
- // ✅ GOOD
478
- UserData data = GetData();
479
- Result result = Process(data);
480
- ```
481
-
482
- ### Type Safety Rules (Universal)
483
-
484
- | Rule | Description |
485
- |------|-------------|
486
- | **Boundary Validation** | Validate only at system boundaries (API, JSON, user input) |
487
- | **Internal Trust** | After validation, pass only precise types internally |
488
- | **No Type Escape** | Never use escape hatches to "fix" type errors |
489
- | **Explicit Signatures** | Specify types in function/method signatures |
490
- | **Generics with Params** | Always use generics with type parameters |
491
-
492
- ### Quality Gate: Type Violations Block Merge
493
-
494
- | Violation | Action |
495
- |-----------|--------|
496
- | Type escape hatches (`any`, `Any`, `Object`, `interface{}`, etc.) | ❌ Block |
497
- | Type suppression comments | ❌ Block |
498
- | Raw generic types | ❌ Block |
499
- | Missing function return types | ⚠️ Warning |
500
- | Excessive type casting | ⚠️ Warning |
501
-
502
- ## Description
503
-
504
- Read PTCF structured SPEC document and execute implementation immediately.
505
-
506
- > **PLAN, TASKS documents unnecessary** - SPEC is the executable prompt
507
-
508
- ## Model Orchestration (Intelligent Routing)
509
-
510
- Automatically select optimal model based on **task complexity analysis**.
511
-
512
- ### Complexity-Based Model Selection
513
-
514
- | Complexity Score | Model | When to Use |
515
- |------------------|-------|-------------|
516
- | 0-7 (Low) | **Haiku** | Simple fixes, searches, single file changes |
517
- | 8-19 (Medium) | **Sonnet** | Standard features, 3-5 files, integrations |
518
- | 20+ (High) | **Opus** | Architecture, security, multi-service, 6+ files |
519
-
520
- ### Complexity Signals
521
-
522
- The following signals increase complexity score:
523
-
524
- | Signal | Score |
525
- |--------|-------|
526
- | Architecture change | +15 |
527
- | Security implication | +12 |
528
- | Multi-service | +8 |
529
- | Refactoring | +12 |
530
- | 6+ files | +15 |
531
- | 3-5 files | +8 |
532
- | New feature | +5 |
533
- | Bug fix | -3 |
534
- | Documentation | -5 |
535
-
536
- ### Agent Tier System
537
-
538
- Each agent has tier variants for cost optimization:
539
-
540
- | Agent | Low (Haiku) | Medium (Sonnet) | High (Opus) |
541
- |-------|-------------|-----------------|-------------|
542
- | explorer | explorer-low | explorer-medium | explorer |
543
- | implementer | implementer-low | implementer-medium | implementer |
544
- | architect | architect-low | architect-medium | architect |
545
-
546
- ### Task Calls by Role
547
-
548
- | Task Type | Model | Task Parameter |
549
- |-----------|-------|----------------|
550
- | Simple search | Haiku | `model: "haiku"` |
551
- | Codebase exploration | Haiku/Sonnet | Auto-selected |
552
- | Core implementation | Sonnet | `model: "sonnet"` |
553
- | Test writing | Haiku | `model: "haiku"` |
554
- | Architecture decisions | Opus | Main session |
555
- | Final review | Opus | Main session |
556
-
557
- ### External LLM Usage (When Enabled)
558
-
559
- When external LLMs are enabled in `.claude/vibe/config.json`:
560
-
561
- | Role | Method | Condition |
562
- |------|--------|-----------|
563
- | User direct query | `gpt.question`, `gemini.question` | Hook auto-handles |
564
- | Internal orchestration | Call global script via Bash | Claude calls directly |
565
-
566
- **User questions (Hook auto-handles):**
567
- - `gpt.question` - GPT architecture consultation
568
- - `gemini.question` - Gemini Q&A/consultation
569
-
570
- **Claude internal calls (directly via Bash):**
571
- ```bash
572
- # Usage: node llm-orchestrate.js <provider> <mode> [systemPrompt] [prompt]
573
- # - If systemPrompt omitted, uses default
574
- # - If systemPrompt is "-", uses default and treats next argument as prompt
575
-
576
- # [LLM_SCRIPT] = {{VIBE_PATH}}/hooks/scripts/llm-orchestrate.js
577
-
578
- # GPT call (short prompt - CLI arg)
579
- node "[LLM_SCRIPT]" gpt orchestrate-json "[question content]"
580
-
581
- # Gemini call
582
- node "[LLM_SCRIPT]" gemini orchestrate-json "[question content]"
583
-
584
- # Custom system prompt usage
585
- node "[LLM_SCRIPT]" gpt orchestrate-json "You are a code reviewer" "[question content]"
586
-
587
- # Long prompt - use --input file (write JSON file first with Write tool)
588
- # JSON format: {"prompt": "your prompt here"}
589
- node "[LLM_SCRIPT]" gpt orchestrate-json --input "[SCRATCHPAD]/input.json"
590
- ```
591
-
592
- ### External LLM Fallback
593
-
594
- **IMPORTANT**: When GPT/Gemini hook fails, Claude MUST handle the task directly:
595
-
596
- **Fallback behavior**:
597
- - Do NOT retry the external LLM call
598
- - Claude handles the task using its own capabilities
599
- - Continue with the implementation without interruption
600
- - Log the fallback but don't block progress
601
-
602
- ## Core Tools (Semantic Analysis & Memory)
603
-
604
- Use core tools for accurate codebase understanding and session continuity.
605
-
606
- ### Tool Invocation
607
-
608
- All tools are called via:
609
- ```bash
610
- node -e "import('{{VIBE_PATH_URL}}/node_modules/@su-record/vibe/dist/tools/index.js').then(t => t.TOOL_NAME({...args}).then(r => console.log(r.content[0].text)))"
611
- ```
612
-
613
- ### Semantic Analysis Tools
614
-
615
- | Tool | Purpose | Usage |
616
- |------|---------|-------|
617
- | `findSymbol` | Find symbol definitions | `{symbolName: 'functionName', searchPath: '.'}` |
618
- | `findReferences` | Find all references | `{symbolName: 'functionName', searchPath: '.'}` |
619
- | `analyzeComplexity` | Analyze code complexity | `{filePath: 'src/file.ts'}` |
620
- | `validateCodeQuality` | Validate code quality | `{filePath: 'src/file.ts'}` |
621
-
622
- **Example - Find symbol:**
623
- ```bash
624
- node -e "import('{{VIBE_PATH_URL}}/node_modules/@su-record/vibe/dist/tools/index.js').then(t => t.findSymbol({symbolName: 'login', searchPath: '.'}).then(r => console.log(r.content[0].text)))"
625
- ```
626
-
627
- ### Memory Tools
628
-
629
- | Tool | Purpose | Usage |
630
- |------|---------|-------|
631
- | `saveMemory` | Save important decisions | `{key: 'decision-name', value: 'content', category: 'project'}` |
632
- | `recallMemory` | Recall saved memory | `{key: 'decision-name'}` |
633
- | `listMemories` | List all memories | `{category: 'project'}` |
634
-
635
- **Example - Save important decision:**
636
- ```bash
637
- node -e "import('{{VIBE_PATH_URL}}/node_modules/@su-record/vibe/dist/tools/index.js').then(t => t.saveMemory({key: 'auth-pattern', value: 'Using JWT with refresh tokens', category: 'project'}).then(r => console.log(r.content[0].text)))"
638
- ```
639
-
640
- ### Session Management (Auto via Hooks)
641
-
642
- - **Session start**: Hook auto-calls `startSession` to restore previous context
643
- - **Context 80%+**: Hook auto-calls `autoSaveContext` to preserve state
644
-
645
- ## Process
646
-
647
- ### 1. Load SPEC + Feature
648
-
649
- **Search order (check BOTH file AND folder):**
650
-
651
- ```
652
- Step 1: Check if SPLIT structure exists (folder)
653
- 📁 .claude/vibe/specs/{feature-name}/ → Folder with _index.md + phase files
654
- 📁 .claude/vibe/features/{feature-name}/ → Folder with _index.feature + phase files
655
-
656
- Step 2: If no folder, check single file
657
- 📄 .claude/vibe/specs/{feature-name}.md → Single SPEC file
658
- 📄 .claude/vibe/features/{feature-name}.feature Single Feature file
659
-
660
- Step 3: If neither exists Error
661
- ```
662
-
663
- **Split structure (folder) detected:**
664
- ```
665
- 📁 .claude/vibe/specs/{feature-name}/
666
- ├── _index.md → Master SPEC (read first for overview)
667
- ├── phase-1-{name}.md → Phase 1 SPEC
668
- ├── phase-2-{name}.md → Phase 2 SPEC
669
- └── ...
670
-
671
- 📁 .claude/vibe/features/{feature-name}/
672
- ├── _index.feature → Master Feature (read first for scenario overview)
673
- ├── phase-1-{name}.feature Phase 1 scenarios
674
- ├── phase-2-{name}.feature Phase 2 scenarios
675
- └── ...
676
-
677
- → Load _index.md first, then load phase files in order
678
- Execute phases sequentially (or per --phase flag)
679
- ```
680
-
681
- **Single file detected:**
682
- ```
683
- 📄 .claude/vibe/specs/{feature-name}.md → SPEC (structure, constraints, context)
684
- 📄 .claude/vibe/features/{feature-name}.feature → Feature (scenario = implementation unit)
685
- ```
686
-
687
- **Error if NEITHER file NOR folder found:**
688
- ```
689
- SPEC not found. Searched:
690
- - .claude/vibe/specs/{feature-name}/ (folder)
691
- - .claude/vibe/specs/{feature-name}.md (file)
692
-
693
- Run /vibe.spec "{feature-name}" first.
694
- ```
695
-
696
- ### 1-1. Phase Isolation Protocol (Large SPEC Guard)
697
-
698
- > **Problem**: Large SPECs (3+ phases, 5+ scenarios) overflow context — agent drifts from SPEC by Phase 3.
699
- > **Solution**: Load only the current phase's SPEC section. Re-anchor before each scenario.
700
-
701
- **Phase Isolation Rules (MANDATORY for 3+ phases):**
702
-
703
- ```
704
- ┌─────────────────────────────────────────────────────────────────┐
705
- │ PHASE ISOLATION PROTOCOL │
706
- │ │
707
- │ ❌ WRONG: Load entire SPEC → implement all phases │
708
- │ ✅ RIGHT: Load _index overview per-phase load → implement │
709
- │ │
710
- Step A: Read _index.md (overview only — phase list, REQ IDs) │
711
- │ Step B: For each Phase N: │
712
- │ 1. RE-READ Phase N SPEC section (every time, no memory) │
713
- │ 2. RE-READ Phase N Feature scenarios │
714
- │ 3. Extract Phase N scope: files, scenarios, requirements │
715
- │ 4. Implement Phase N scenarios │
716
- │ 5. Verify Phase N │
717
- │ 6. Write Phase Checkpoint → .claude/vibe/checkpoints/ │
718
- │ 7. DISCARD Phase N details from working memory │
719
- │ Step C: Next Phase — go to Step B │
720
- └─────────────────────────────────────────────────────────────────┘
721
- ```
722
-
723
- **Phase Checkpoint Format** (`.claude/vibe/checkpoints/{feature}-phase-{N}.md`):
724
-
725
- ```markdown
726
- # Checkpoint: {feature} Phase {N}
727
-
728
- ## Completed
729
- - Scenario 1: {name}
730
- - Scenario 2: {name}
731
-
732
- ## Files Changed
733
- - src/auth.service.ts (added login(), validateToken())
734
- - src/auth.controller.ts (POST /login, POST /refresh)
735
-
736
- ## State for Next Phase
737
- - Auth service exports: login(), logout(), validateToken(), refreshToken()
738
- - JWT secret configured in .env (JWT_SECRET)
739
- - Test baseline: 12 tests passing
740
-
741
- ## Remaining Phases
742
- - Phase {N+1}: {name} — {scenario count} scenarios
743
- - Phase {N+2}: {name} {scenario count} scenarios
744
- ```
745
-
746
- **SPEC Re-anchoring (Before EVERY scenario):**
747
-
748
- ```
749
- Before implementing Scenario X:
750
- 1. Re-read the EXACT Given/When/Then from Feature file (not from memory!)
751
- 2. Compare: "Am I about to implement what the SPEC says, or what I think it says?"
752
- 3. If single-file SPEC: re-read only the current phase section (use line offsets)
753
- 4. If split SPEC: re-read only phase-N-{name}.md
754
- ```
755
-
756
- **Scope Lock (Per Phase):**
757
-
758
- ```
759
- At Phase start, declare:
760
- MODIFY: [list of files this phase will touch]
761
- CREATE: [list of files this phase will create]
762
- DO NOT TOUCH: everything else
763
-
764
- If implementation requires files outside scope:
765
- → STOP. Re-read SPEC. Is this actually needed?
766
- If yes: add to scope with explicit justification
767
- If no: you're drifting. Return to SPEC.
768
- ```
769
-
770
- **Context Pressure Handling:**
771
-
772
- | Context Level | Action |
773
- |---------------|--------|
774
- | < 50% | Normal execution |
775
- | 50-70% | Save checkpoint, trim exploration results |
776
- | 70%+ | Save checkpoint → `/new` → resume from checkpoint |
777
- | Phase boundary | Always save checkpoint regardless of context level |
778
-
779
- ### 2. Extract Scenario List
780
-
781
- Extract all Scenarios from Feature file:
782
-
783
- ```markdown
784
- ## Scenarios to Implement
785
-
786
- | # | Scenario | Status |
787
- |---|----------|--------|
788
- | 1 | Valid login success | ⬜ |
789
- | 2 | Invalid password error | ⬜ |
790
- | 3 | Email format validation | ⬜ |
791
- | 4 | Password reset link | ⬜ |
792
-
793
- Total: 4 scenarios
794
- ```
795
-
796
- ### 3. Scenario-by-Scenario Implementation (Core)
797
-
798
- **For each scenario**:
799
-
800
- ```
801
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
802
- 🎯 Scenario 1/4: Valid login success
803
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
804
-
805
- Given: User is registered
806
- When: Login with valid email and password
807
- Then: Login success + JWT token returned
808
-
809
- [Step 1] Analyzing implementation...
810
- - Required files: auth.service.ts, login.controller.ts
811
- - Exploring related code...
812
-
813
- [Step 2] Implementing...
814
- ✅ auth.service.ts - Added login() method
815
- login.controller.ts - POST /login endpoint
816
-
817
- [Step 3] Verifying...
818
- Given: Test user creation possible
819
- ✅ When: Login API call succeeded
820
- Then: JWT token return confirmed
821
-
822
- Scenario 1 passed!
823
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
824
- ```
825
-
826
- **On failure**:
827
-
828
- ```
829
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
830
- 🎯 Scenario 2/4: Invalid password error
831
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
832
-
833
- [Step 3] Verifying...
834
- ✅ Given: Test user exists
835
- When: Login attempt with wrong password
836
- ❌ Then: "Invalid credentials" error message
837
- Actual: "Error occurred" returned
838
-
839
- [Auto-fix 1/3]
840
- Cause: Error message not properly set
841
- Fix: auth.service.ts line 42
842
-
843
- [Re-verify]
844
- Then: "Invalid credentials" error message
845
-
846
- Scenario 2 passed! (1 fix)
847
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
848
- ```
849
-
850
- ---
851
-
852
- ## **CRITICAL: Parallel Sub-Agent Execution**
853
-
854
- > **MUST USE PARALLEL TASK CALLS** - This is REQUIRED, not optional.
855
- > Sequential execution when parallel is possible = VIOLATION of this workflow.
856
-
857
- ### Mandatory Parallel Exploration (Phase Start)
858
-
859
- **BEFORE any implementation, you MUST launch these Task calls IN PARALLEL (single message, multiple tool calls):**
860
-
861
- ```
862
- ┌─────────────────────────────────────────────────────────────────┐
863
- │ STEP 1: PARALLEL EXPLORATION (REQUIRED) │
864
- │ │
865
- │ Launch ALL of these in ONE message: │
866
- │ │
867
- Task(haiku) ─┬─→ "Analyze related files in <context>" │
868
- │ │ │
869
- │ Task(haiku) ─┼─→ "Check dependencies and imports" │
870
- │ │ │
871
- Task(haiku) ─┴─→ "Find existing patterns and conventions" │
872
- │ │
873
- [If GPT enabled] Bash: node "[LLM_SCRIPT]" gpt-spark orchestrate-json "[question]"
874
- [If Gemini enabled] Bash: node "[LLM_SCRIPT]" gemini orchestrate-json "[question]"
875
- └─────────────────────────────────────────────────────────────────┘
876
-
877
- ↓ (wait for all to complete)
878
- ┌─────────────────────────────────────────────────────────────────┐
879
- │ STEP 2: SYNTHESIZE (Opus) │
880
- │ - Review all exploration results │
881
- │ - Decide implementation approach │
882
- │ - Identify files to modify/create │
883
- └─────────────────────────────────────────────────────────────────┘
884
-
885
-
886
- ┌─────────────────────────────────────────────────────────────────┐
887
- │ STEP 3: IMPLEMENT + BACKGROUND AGENTS (PARALLEL) │
888
- │ │
889
- │ Main Agent (sonnet): │
890
- └─→ Execute current phase implementation │
891
- │ │
892
- Background Agents (haiku, run_in_background=true): │
893
- │ ├─→ Task: "Prepare Phase N+1 - analyze required files" │
894
- │ ├─→ Task: "Pre-generate test cases for current implementation" │
895
- │ └─→ Task: "Search for related types/interfaces needed" │
896
- │ │
897
- [ULTRAWORK] All 4 agents run simultaneously! │
898
- └─────────────────────────────────────────────────────────────────┘
899
-
900
- (main completes, check backgrounds)
901
- ┌─────────────────────────────────────────────────────────────────┐
902
- │ STEP 4: TEST + PHASE PIPELINING │
903
- │ │
904
- │ Current Phase: │
905
- │ └─→ Task(haiku): Write tests using pre-generated cases │
906
- │ │
907
- │ Next Phase Prep (from background results): │
908
- │ └─→ Already have file analysis, ready to start immediately │
909
- └─────────────────────────────────────────────────────────────────┘
910
- ```
911
-
912
- ### Parallel Task Call Pattern (MUST FOLLOW)
913
-
914
- **Correct - Single message with multiple parallel Tasks:**
915
- ```
916
- <message>
917
- Task(haiku, "Analyze src/components/ for existing patterns")
918
- Task(haiku, "Check package.json dependencies")
919
- Task(haiku, "Find usage of similar features in codebase")
920
- </message>
921
- All 3 run simultaneously, ~3x faster
922
- ```
923
-
924
- **WRONG - Sequential calls (DO NOT DO THIS):**
925
- ```
926
- <message>Task(haiku, "Analyze...")</message>
927
- <message>Task(haiku, "Check...")</message>
928
- <message>Task(haiku, "Find...")</message>
929
- 3x slower, wastes time
930
- ```
931
-
932
- ### Background Agent Pattern (ULTRAWORK) via Orchestrator
933
-
934
- **Launch background agents for next phase via Orchestrator:**
935
- ```bash
936
- # Start background agent (doesn't block)
937
- node -e "import('{{VIBE_PATH_URL}}/node_modules/@su-record/vibe/dist/infra/orchestrator/index.js').then(o => o.runAgent('Phase 2 prep: Analyze auth API endpoints', 'phase2-prep').then(r => console.log(r.content[0].text)))"
938
-
939
- # Multiple backgrounds in parallel
940
- node -e "import('{{VIBE_PATH_URL}}/node_modules/@su-record/vibe/dist/infra/orchestrator/index.js').then(async o => {
941
- await Promise.all([
942
- o.runAgent('Phase 2 prep: Analyze auth API endpoints', 'phase2-prep'),
943
- o.runAgent('Pre-generate test cases for login form', 'test-prep'),
944
- o.runAgent('Find existing validation patterns', 'pattern-finder')
945
- ]);
946
- console.log('All background agents started');
947
- })"
948
- ```
949
-
950
- **Check background agent status:**
951
- ```bash
952
- node -e "import('{{VIBE_PATH_URL}}/node_modules/@su-record/vibe/dist/infra/orchestrator/index.js').then(o => console.log(o.status().content[0].text))"
953
- ```
954
-
955
- **Get result when ready:**
956
- ```bash
957
- node -e "import('{{VIBE_PATH_URL}}/node_modules/@su-record/vibe/dist/infra/orchestrator/index.js').then(o => o.getResult('SESSION_ID').then(r => console.log(r.content[0].text)))"
958
- ```
959
-
960
- **Why Background Agents Matter:**
961
-
962
- | Without Background | With Background |
963
- |--------------------|-----------------|
964
- | Phase 1: 60s | Phase 1: 60s (+ backgrounds running) |
965
- | Phase 2 prep: 20s | Phase 2 prep: 0s (already done!) |
966
- | Phase 2: 60s | Phase 2: 60s |
967
- | **Total: 140s** | **Total: 120s** |
968
-
969
- For 5 phases: 4 × 20s saved = **80s faster**
970
-
971
- ### Why Parallel Matters
972
-
973
- | Approach | Time | Cache Benefit |
974
- |----------|------|---------------|
975
- | Sequential (3 Tasks) | ~30s | Cache cold on each |
976
- | **Parallel (3 Tasks)** | **~10s** | **Cache warmed once, shared** |
977
-
978
- core ProjectCache (LRU) caches ts-morph parsing results. Parallel calls share the warmed cache.
979
-
980
- ### UI/UX Design Intelligence (Auto-triggered before Phase 1)
981
-
982
- > **조건**: SPEC 또는 Feature에 UI/UX 키워드 포함 시 자동 실행
983
- > **비활성화**: `.claude/vibe/config.json`에 `"uiUxAnalysis": false` 설정
984
-
985
- **Phase 1 시작 전, 2개 에이전트 자동 실행:**
986
-
987
- | Agent | Condition | Role |
988
- |-------|-----------|------|
989
- | ④ ui-stack-implementer | **항상 실행** | 프레임워크별 컴포넌트 가이드라인 제공 |
990
- | ui-dataviz-advisor | **조건부** (chart/dashboard/visualization 키워드) | 차트/시각화 라이브러리 추천 |
991
-
992
- **실행 방법:**
993
-
994
- ```text
995
- # 항상 실행 (Haiku)
996
- Task(subagent_type="ui-stack-implementer",
997
- prompt="Provide implementation guidelines for project '{project}' using {detected_stack}. Use core_ui_stack_search for framework-specific patterns.")
998
-
999
- # ⑤ 조건부 실행 (Haiku) SPEC에 차트/대시보드/시각화 키워드 포함
1000
- Task(subagent_type="ui-dataviz-advisor",
1001
- prompt="Recommend data visualization approach for project '{project}'. Use core_ui_search for chart types and react-performance patterns.")
1002
- ```
1003
-
1004
- **디자인 시스템 자동 참조:**
1005
- - `.claude/vibe/design-system/{project}/MASTER.md` 존재 시 자동 로드
1006
- - 구현 에이전트가 CSS 변수, 폰트, 색상 팔레트를 직접 참조
1007
- - 페이지별 오버라이드 `pages/{page}.md` 존재 시 우선 적용
1008
-
1009
- ### Phase Execution Flow (ULTRAWORK Pipeline)
1010
-
1011
- ```
1012
- Phase N Start
1013
-
1014
- ├─→ [PARALLEL] Task(haiku) × 3: Exploration
1015
- │ - Related code analysis
1016
- │ - Dependency check
1017
- │ - Pattern discovery
1018
-
1019
- ↓ (all complete)
1020
-
1021
- ├─→ Opus: Synthesize and decide
1022
-
1023
- ├─→ [PARALLEL PIPELINE] ←── KEY SPEED OPTIMIZATION
1024
- │ │
1025
- │ ├─→ Main: Task(sonnet) Implementation
1026
- │ │
1027
- │ └─→ Background (run_in_background=true):
1028
- │ ├─→ Task(haiku): Phase N+1 file analysis
1029
- │ ├─→ Task(haiku): Test case preparation
1030
- │ └─→ Task(haiku): Type/interface lookup
1031
-
1032
- (main completes)
1033
-
1034
- ├─→ Task(haiku): Tests (uses pre-generated cases)
1035
-
1036
-
1037
- Phase N Complete
1038
-
1039
- (Background results ready - NO WAIT for Phase N+1 exploration!)
1040
-
1041
- Phase N+1 Start (IMMEDIATE - exploration already done!)
1042
- ```
1043
-
1044
- **Speed Comparison:**
1045
-
1046
- | Mode | Phase Time | 5 Phases Total |
1047
- |------|------------|----------------|
1048
- | Sequential | ~2min/phase | ~10min |
1049
- | Parallel Exploration | ~1.5min/phase | ~7.5min |
1050
- | **ULTRAWORK Pipeline** | **~1min/phase** | **~5min** |
1051
-
1052
- **Why Pipeline is Faster:**
1053
- - Background agents prepare next phase WHILE current phase implements
1054
- - No idle time between phases
1055
- - Test cases pre-generated during implementation
1056
- - Cache stays warm across parallel tasks
1057
-
1058
- ---
1059
-
1060
- ### Agent Teams — Dev Team
1061
-
1062
- > **Agent Teams**: 에이전트들이 팀을 이루어 서로 소통하며 구현합니다.
1063
- > 설정: `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1` + `teammateMode: in-process` (`~/.claude/settings.json` 전역 postinstall 자동 설정)
1064
-
1065
- **팀 구성:**
1066
-
1067
- | 팀원 | 역할 |
1068
- |------|------|
1069
- | architect (리더) | 설계 결정, 구현 방향 조율, SPEC 준수 검증, 팀 합의 주도 |
1070
- | implementer | 핵심 비즈니스 로직 구현, architect 설계를 따라 코드 작성 |
1071
- | tester | 구현 완료 즉시 테스트 작성, 실패 시 implementer에 피드백 |
1072
- | security-reviewer | 실시간 보안 취약점 검증, 블로킹 이슈 식별 |
1073
-
1074
- **실행 순서:**
1075
-
1076
- 1. `TeamCreate(team_name="dev-{feature}")` — 팀 + 공유 태스크 리스트 생성
1077
- 2. 4개 팀원 병렬 생성 — 각각 `Task(team_name=..., name=..., subagent_type=...)` 으로 spawn
1078
- 3. architect가 SPEC Phase를 분석하여 구현 계획 수립 → TaskList에 작업 등록
1079
- 4. 팀원들이 TaskList에서 작업을 claim하고, SendMessage로 실시간 협업
1080
- 5. 모든 시나리오 검증 완료 → 팀원 shutdown_request → TeamDelete로 정리
1081
-
1082
- **팀원 spawn 패턴:**
1083
-
1084
- ```text
1085
- TeamCreate(team_name="dev-{feature}", description="Implementation team for {feature} Phase {N}")
1086
-
1087
- # 4개 병렬 spawn
1088
- Task(team_name="dev-{feature}", name="architect", subagent_type="architect",
1089
- prompt="구현 팀 리더. Phase {N}의 SPEC을 분석하고 구현 계획을 수립하세요.
1090
- SPEC: {spec_content}
1091
- Feature Scenarios: {scenarios}
1092
- 역할: 설계 결정, 구현 방향 조율, 팀원 간 충돌 해결, SPEC 준수 검증.
1093
- TaskList에 구현 작업을 등록하세요. implementer에게 설계를 SendMessage로 전달하세요.
1094
- 모든 시나리오가 통과할 때까지 팀을 조율하세요.")
1095
-
1096
- Task(team_name="dev-{feature}", name="implementer", subagent_type="implementer",
1097
- mode="bypassPermissions",
1098
- prompt="구현 팀 코드 담당. SPEC: {spec_content}
1099
- 역할: architect의 설계를 따라 프로덕션 코드 작성.
1100
- architect에게서 설계를 받으면 구현을 시작하세요.
1101
- 컴포넌트 구현 완료 시 tester에게 SendMessage로 테스트 요청하세요.
1102
- security-reviewer의 블로킹 이슈는 즉시 수정하세요.
1103
- TaskList에서 구현 작업을 claim하세요.")
1104
-
1105
- Task(team_name="dev-{feature}", name="tester", subagent_type="tester",
1106
- mode="bypassPermissions",
1107
- prompt="구현 팀 테스트 담당. SPEC: {spec_content}
1108
- 역할: implementer가 완료한 컴포넌트부터 즉시 테스트 작성.
1109
- 구현 전체를 기다리지 말고 컴포넌트 단위로 점진적 테스트하세요.
1110
- 테스트 실패 implementer에게 SendMessage로 피드백하세요.
1111
- edge case 발견 architect에게 설계 검토를 요청하세요.
1112
- TaskList에서 테스트 작업을 claim하세요.")
1113
-
1114
- Task(team_name="dev-{feature}", name="security-reviewer", subagent_type="security-reviewer",
1115
- mode="bypassPermissions",
1116
- prompt="구현 보안 담당. SPEC: {spec_content}
1117
- 역할: 구현 코드의 보안 취약점 실시간 검증.
1118
- 보안 이슈는 BLOCKING implementer에게 SendMessage로 즉시 수정 요청하세요.
1119
- 심각한 설계 결함 발견 architect에게 SendMessage로 알리세요.
1120
- TaskList에서 보안 검증 작업을 claim하세요.")
1121
- ```
1122
-
1123
- **팀원 통신 예시:**
1124
-
1125
- ```text
1126
- architect implementer: "Repository 패턴으로 데이터 접근 계층 분리해서 구현해주세요. 인터페이스는 TaskList에 등록했습니다"
1127
- implementer tester: "LoginService 구현 완료. 정상/실패/잠금 시나리오 테스트 요청합니다"
1128
- security-reviewer implementer: "SQL injection 위험: raw query 사용 감지. parameterized query로 즉시 수정 필요"
1129
- tester → architect: "edge case 3건 실패 (빈 입력, 특수문자, 동시 요청). 설계 검토 요청합니다"
1130
- architect → broadcast: "Phase {N} 모든 시나리오 통과 확인. 구현 완료합니다"
1131
- ```
1132
-
1133
- **팀 모드 vs 기존 병렬 모드 비교:**
1134
-
1135
- | 측면 | 기존 병렬 모드 | Agent Teams |
1136
- |------|---------------|-------------|
1137
- | 통신 | 결과만 수집 | 실시간 상호 피드백 |
1138
- | 테스트 | 구현 후 별도 단계 | 구현과 동시 진행 |
1139
- | 보안 | 사후 리뷰 | 실시간 검증 |
1140
- | 설계 변경 | 메인 에이전트만 결정 | architect 주도 팀 합의 |
1141
- | 오류 복구 | 재시도 루프 | 팀 내 즉시 피드백 |
1142
-
1143
- **활성화 조건 (Dev Team Full — 4명):**
1144
- - ULTRAWORK 모드 + 3개 이상 시나리오
1145
- - 또는 복잡도 점수 20+ (High)
1146
-
1147
- ### Agent Teams — Lite Team (Normal Mode)
1148
-
1149
- > **일반 모드에서도 협업**. Dev Team의 축소 버전으로, 3개 이상 시나리오 시 자동 활성화.
1150
- > security-reviewer를 제외한 architect + implementer + tester 3명 구성.
1151
-
1152
- **팀 구성:**
1153
-
1154
- | 팀원 | 역할 |
1155
- |------|------|
1156
- | architect (리더) | 설계 결정, 시나리오 분석, 구현 방향 조율 |
1157
- | implementer | 핵심 비즈니스 로직 구현 |
1158
- | tester | 구현 완료 즉시 테스트 작성, 실패 시 피드백 |
1159
-
1160
- **spawn 패턴:**
1161
-
1162
- ```text
1163
- TeamCreate(team_name="lite-{feature}", description="Lite implementation team for {feature} Phase {N}")
1164
-
1165
- Task(team_name="lite-{feature}", name="architect", subagent_type="architect",
1166
- prompt="Lite 리더. Phase {N}의 SPEC을 분석하고 구현 계획을 수립하세요.
1167
- SPEC: {spec_content}
1168
- Feature Scenarios: {scenarios}
1169
- 역할: 설계 결정, 구현 방향 조율. TaskList에 작업을 등록하세요.
1170
- implementer에게 설계를 SendMessage로 전달하세요.")
1171
-
1172
- Task(team_name="lite-{feature}", name="implementer", subagent_type="implementer",
1173
- mode="bypassPermissions",
1174
- prompt="Lite 코드 담당. SPEC: {spec_content}
1175
- 역할: architect의 설계를 따라 프로덕션 코드 작성.
1176
- 완료 tester에게 SendMessage로 테스트 요청하세요.")
1177
-
1178
- Task(team_name="lite-{feature}", name="tester", subagent_type="tester",
1179
- mode="bypassPermissions",
1180
- prompt="Lite 팀 테스트 담당. SPEC: {spec_content}
1181
- 역할: implementer가 완료한 컴포넌트부터 즉시 테스트 작성.
1182
- 테스트 실패 implementer에게 SendMessage로 피드백하세요.")
1183
- ```
1184
-
1185
- **활성화 조건 (Lite Team 3명):**
1186
- - 일반 모드 + 3개 이상 시나리오
1187
- - 복잡도 점수 8-19 (Medium)
1188
- - 단순 구현(1-2 파일, 시나리오 2개 이하)에서는 기존 병렬 모드 유지
1189
-
1190
- **팀 선택 기준:**
1191
-
1192
- | 조건 | 팀 |
1193
- |------|-----|
1194
- | 시나리오 1-2개, 파일 1-2개 | 기존 병렬 모드 (팀 없음) |
1195
- | 시나리오 3개+, 일반 모드 | **Lite Team (3명)** |
1196
- | ULTRAWORK 또는 복잡도 20+ | Dev Team Full (4명) |
1197
-
1198
- ### Agent Teams — Review Team
1199
-
1200
- > P1/P2 이슈 교차 검증을 위한 보안+아키텍처+성능+단순성 전문 리뷰 팀.
1201
- > `/vibe.review` P1/P2 이슈가 발견되면 자동 활성화.
1202
-
1203
- **팀 구성:**
1204
-
1205
- | 팀원 | 역할 |
1206
- |------|------|
1207
- | security-reviewer (리더) | 보안 이슈 우선순위 결정, 교차 검증 주도, 오탐 제거 |
1208
- | architecture-reviewer | 아키텍처 위반 검증, 설계 패턴 평가 |
1209
- | performance-reviewer | 성능 병목 검증, N+1 쿼리/메모리 누수 확인 |
1210
- | simplicity-reviewer | 과도한 복잡성 검증, 불필요한 추상화 식별 |
1211
-
1212
- **spawn 패턴:**
1213
-
1214
- ```text
1215
- TeamCreate(team_name="review-{feature}", description="Cross-validation review team for {feature}")
1216
-
1217
- Task(team_name="review-{feature}", name="security-reviewer", subagent_type="security-reviewer",
1218
- mode="bypassPermissions",
1219
- prompt="Review team leader. Cross-validate P1/P2 issues found in parallel review.
1220
- Files: {changed_files}
1221
- Found issues: {p1_p2_issues}
1222
- Role: Verify each P1/P2 issue is genuine (not false positive). Prioritize by actual impact.
1223
- Send disputed findings to relevant reviewer for confirmation via SendMessage.")
1224
-
1225
- Task(team_name="review-{feature}", name="architecture-reviewer", subagent_type="architecture-reviewer",
1226
- mode="bypassPermissions",
1227
- prompt="Review team architecture expert. Validate architecture-related findings.
1228
- Files: {changed_files}
1229
- Role: Confirm or dispute architecture violations. Check SOLID principles and layer boundaries.")
1230
-
1231
- Task(team_name="review-{feature}", name="performance-reviewer", subagent_type="performance-reviewer",
1232
- mode="bypassPermissions",
1233
- prompt="Review team performance expert. Validate performance-related findings.
1234
- Files: {changed_files}
1235
- Role: Confirm or dispute performance issues. Run complexity analysis on flagged code.")
1236
-
1237
- Task(team_name="review-{feature}", name="simplicity-reviewer", subagent_type="simplicity-reviewer",
1238
- mode="bypassPermissions",
1239
- prompt="Review team simplicity advocate. Challenge over-engineering findings.
1240
- Files: {changed_files}
1241
- Role: Verify YAGNI violations. Confirm or dispute unnecessary abstraction flags.")
1242
- ```
1243
-
1244
- **팀원 통신 예시:**
1245
-
1246
- ```text
1247
- security-reviewer → architecture-reviewer: "SQL injection finding in users.py:42 — is this pattern used elsewhere?"
1248
- architecture-reviewer security-reviewer: "Confirmed. Same pattern in orders.py:78. Elevate to P1."
1249
- performance-reviewer → security-reviewer: "N+1 query finding is false positive — already uses prefetch_related."
1250
- security-reviewer broadcast: "Review complete. 2 P1 confirmed, 1 P2 downgraded to P3."
1251
- ```
1252
-
1253
- **활성화 조건:**
1254
-
1255
- - `/vibe.review` 실행 후 P1 또는 P2 이슈 2개 이상 발견 시
1256
- - Agent Teams 환경변수 활성화 상태
1257
-
1258
- ### Agent Teams — Debug Team
1259
-
1260
- > 빌드/테스트 실패 시 아키텍트 진단 → 구현자 수정 → 테스터 검증 사이클.
1261
- > UltraQA 3회 실패 진입 시 또는 빌드 실패 3회+ 시 자동 활성화.
1262
-
1263
- **팀 구성:**
1264
-
1265
- | 팀원 | 역할 |
1266
- |------|------|
1267
- | architect (리더) | 근본 원인 진단, 수정 방향 설계, 아키텍처 레벨 문제 식별 |
1268
- | implementer | architect 진단에 따라 최소 diff 수정 적용 |
1269
- | tester | 수정 후 즉시 테스트 실행, 회귀 검증 |
1270
-
1271
- **spawn 패턴:**
1272
-
1273
- ```text
1274
- TeamCreate(team_name="debug-{feature}", description="Debug team for {feature} build/test failure")
1275
-
1276
- Task(team_name="debug-{feature}", name="architect", subagent_type="architect",
1277
- prompt="Debug team leader. Diagnose root cause of build/test failure.
1278
- Error: {error_output}
1279
- Failed files: {failed_files}
1280
- Previous attempts: {attempt_history}
1281
- Role: Analyze error, identify root cause (not symptoms). Design minimal fix.
1282
- Send diagnosis to implementer via SendMessage. If same failure 3x, escalate to user.")
1283
-
1284
- Task(team_name="debug-{feature}", name="implementer", subagent_type="implementer",
1285
- mode="bypassPermissions",
1286
- prompt="Debug team fixer. Apply minimal-diff fixes based on architect diagnosis.
1287
- Role: Wait for architect diagnosis. Apply ONLY the specific fix recommended.
1288
- Do NOT refactor surrounding code. Notify tester when fix is applied.")
1289
-
1290
- Task(team_name="debug-{feature}", name="tester", subagent_type="tester",
1291
- mode="bypassPermissions",
1292
- prompt="Debug team verifier. Run tests after each fix to verify resolution.
1293
- Role: Wait for implementer fix notification. Run failing tests.
1294
- Report results to architect. If still failing, provide detailed error output.")
1295
- ```
1296
-
1297
- **활성화 조건:**
1298
-
1299
- - 동일 빌드/테스트 실패 3회 이상
1300
- - UltraQA `architecture_question` 상태 진입 시
1301
-
1302
- ### Agent Teams — Research Team
1303
-
1304
- > `/vibe.spec` Step 3 리서치 단계에서 4개 전문 리서치 에이전트가 팀으로 협업.
1305
- > 리서치 결과 교차 검증 충돌 해결.
1306
-
1307
- **팀 구성:**
1308
-
1309
- | 팀원 | 역할 |
1310
- |------|------|
1311
- | best-practices-agent (리더) | 베스트 프랙티스 수집, 리서치 통합, 충돌 해결 |
1312
- | security-advisory-agent | 보안 취약점 조사, CVE 확인, 보안 권장사항 |
1313
- | codebase-patterns-agent | 기존 코드베이스 패턴 분석, 유사 구현 참조 |
1314
- | framework-docs-agent | 프레임워크 최신 문서 확인, API 변경사항 추적 |
1315
-
1316
- **spawn 패턴:**
1317
-
1318
- ```text
1319
- TeamCreate(team_name="research-{feature}", description="Research team for {feature} SPEC")
1320
-
1321
- Task(team_name="research-{feature}", name="best-practices-agent", subagent_type="best-practices-agent",
1322
- prompt="Research team leader. Coordinate research for {feature} SPEC.
1323
- Tech stack: {tech_stack}
1324
- Requirements: {requirements}
1325
- Role: Collect best practices. Integrate findings from all researchers.
1326
- Resolve conflicting recommendations. Produce unified research summary.")
1327
-
1328
- Task(team_name="research-{feature}", name="security-advisory-agent", subagent_type="security-advisory-agent",
1329
- prompt="Research team security specialist. Check security advisories for {feature}.
1330
- Tech stack: {tech_stack}
1331
- Role: Check CVEs for dependencies. Identify security patterns to follow.
1332
- Share findings with best-practices-agent for integration.")
1333
-
1334
- Task(team_name="research-{feature}", name="codebase-patterns-agent", subagent_type="codebase-patterns-agent",
1335
- prompt="Research team codebase analyst. Analyze existing patterns for {feature}.
1336
- Project path: {project_path}
1337
- Role: Find similar implementations in codebase. Extract conventions and patterns.
1338
- Share findings with best-practices-agent.")
1339
-
1340
- Task(team_name="research-{feature}", name="framework-docs-agent", subagent_type="framework-docs-agent",
1341
- prompt="Research team docs specialist. Check latest framework docs for {feature}.
1342
- Tech stack: {tech_stack}
1343
- Role: Verify API usage against latest docs. Check for breaking changes.
1344
- Share findings with best-practices-agent.")
1345
- ```
1346
-
1347
- **활성화 조건:**
1348
-
1349
- - `/vibe.spec` Step 3 리서치 단계
1350
- - Agent Teams 환경변수 활성화 상태
1351
-
1352
- ### Agent Teams — Security Team
1353
-
1354
- > 보안 민감 코드 변경 시 전문 보안 검증 팀.
1355
- > 인증, 권한, 결제, 개인정보 관련 코드 변경 감지 시 자동 활성화.
1356
-
1357
- **팀 구성:**
1358
-
1359
- | 팀원 | 역할 |
1360
- |------|------|
1361
- | security-reviewer (리더) | OWASP Top 10 검증, 보안 이슈 우선순위 결정 |
1362
- | data-integrity-reviewer | 데이터 무결성, 트랜잭션 관리, 입력 검증 |
1363
- | security-advisory-agent | 사용 라이브러리 CVE 확인, 보안 패치 확인 |
1364
- | tester | 보안 테스트 케이스 작성, 침투 테스트 시나리오 검증 |
1365
-
1366
- **spawn 패턴:**
1367
-
1368
- ```text
1369
- TeamCreate(team_name="security-{feature}", description="Security audit team for {feature}")
1370
-
1371
- Task(team_name="security-{feature}", name="security-reviewer", subagent_type="security-reviewer",
1372
- mode="bypassPermissions",
1373
- prompt="Security team leader. Comprehensive security audit for {feature}.
1374
- Files: {changed_files}
1375
- Role: OWASP Top 10 check. XSS, CSRF, SQL injection, auth bypass.
1376
- Coordinate with data-integrity-reviewer for data flow analysis.
1377
- Any P1 finding blocks merge — notify team immediately.")
1378
-
1379
- Task(team_name="security-{feature}", name="data-integrity-reviewer", subagent_type="data-integrity-reviewer",
1380
- mode="bypassPermissions",
1381
- prompt="Security team data specialist. Verify data integrity for {feature}.
1382
- Files: {changed_files}
1383
- Role: Check transaction management, input validation, data sanitization.
1384
- Report findings to security-reviewer.")
1385
-
1386
- Task(team_name="security-{feature}", name="security-advisory-agent", subagent_type="security-advisory-agent",
1387
- prompt="Security team advisory specialist. Check dependencies for {feature}.
1388
- Role: Scan for known CVEs in project dependencies. Check security advisories.
1389
- Report critical findings to security-reviewer.")
1390
-
1391
- Task(team_name="security-{feature}", name="tester", subagent_type="tester",
1392
- mode="bypassPermissions",
1393
- prompt="Security team test specialist. Write security-focused tests for {feature}.
1394
- Files: {changed_files}
1395
- Role: Write tests for auth bypass, injection, permission escalation.
1396
- Report test results to security-reviewer.")
1397
- ```
1398
-
1399
- **활성화 조건:**
1400
-
1401
- - auth, payment, user-data, crypto 관련 파일 변경 감지 시
1402
- - 또는 수동으로 `security` 키워드 지정 시
1403
-
1404
- ### Agent Teams — Migration Team
1405
-
1406
- > 프레임워크/라이브러리 마이그레이션 전문 팀.
1407
- > 대규모 의존성 업그레이드, 프레임워크 전환 시 활성화.
1408
-
1409
- **팀 구성:**
1410
-
1411
- | 팀원 | 역할 |
1412
- |------|------|
1413
- | architect (리더) | 마이그레이션 전략 설계, 호환성 분석, 단계별 계획 |
1414
- | implementer | 코드 변환 실행, API 변경 적용 |
1415
- | tester | 마이그레이션 후 회귀 테스트, 호환성 검증 |
1416
- | build-error-resolver | 빌드 에러 즉시 해결, 타입 에러 수정 |
1417
-
1418
- **spawn 패턴:**
1419
-
1420
- ```text
1421
- TeamCreate(team_name="migration-{feature}", description="Migration team for {feature}")
1422
-
1423
- Task(team_name="migration-{feature}", name="architect", subagent_type="architect",
1424
- prompt="Migration team leader. Plan migration strategy for {feature}.
1425
- From: {current_version}
1426
- To: {target_version}
1427
- Role: Analyze breaking changes. Create step-by-step migration plan.
1428
- Assign file groups to implementer. Monitor build-error-resolver for blockers.")
1429
-
1430
- Task(team_name="migration-{feature}", name="implementer", subagent_type="implementer",
1431
- mode="bypassPermissions",
1432
- prompt="Migration team implementer. Execute code migration for {feature}.
1433
- Role: Apply migration changes per architect plan. Work file-by-file.
1434
- Notify tester after each file group. Report blockers to architect.")
1435
-
1436
- Task(team_name="migration-{feature}", name="tester", subagent_type="tester",
1437
- mode="bypassPermissions",
1438
- prompt="Migration team tester. Verify migration correctness for {feature}.
1439
- Role: Run existing tests after each migration step. Add new tests for changed APIs.
1440
- Report regressions to implementer and architect.")
1441
-
1442
- Task(team_name="migration-{feature}", name="build-error-resolver", subagent_type="build-error-resolver",
1443
- mode="bypassPermissions",
1444
- prompt="Migration team build fixer. Resolve build errors during {feature} migration.
1445
- Role: Monitor build output. Apply minimal-diff type fixes for migration errors.
1446
- Notify implementer of patterns requiring broader changes.")
1447
- ```
1448
-
1449
- **활성화 조건:**
1450
-
1451
- - package.json 주요 의존성 버전 변경 감지
1452
- - 또는 수동으로 `migration` 키워드 지정 시
1453
-
1454
- ### Agent Teams — Fullstack Team
1455
-
1456
- > Frontend + Backend 동시 변경이 필요한 풀스택 기능 구현 팀.
1457
- > API 엔드포인트 + UI 컴포넌트를 동시에 개발.
1458
-
1459
- **팀 구성:**
1460
-
1461
- | 팀원 | 역할 |
1462
- |------|------|
1463
- | architect (리더) | API 인터페이스 설계, frontend/backend 분업 조율 |
1464
- | implementer-backend | Backend API, 데이터베이스, 서비스 로직 구현 |
1465
- | implementer-frontend | Frontend UI, 상태 관리, API 연동 구현 |
1466
- | tester | E2E 테스트, API 테스트, 통합 테스트 |
1467
-
1468
- **spawn 패턴:**
1469
-
1470
- ```text
1471
- TeamCreate(team_name="fullstack-{feature}", description="Fullstack team for {feature}")
1472
-
1473
- Task(team_name="fullstack-{feature}", name="architect", subagent_type="architect",
1474
- prompt="Fullstack team leader. Design API contract for {feature}.
1475
- SPEC: {spec_content}
1476
- Role: Define API endpoints (request/response schemas). Design data models.
1477
- Share API contract with both implementers. Coordinate integration timing.")
1478
-
1479
- Task(team_name="fullstack-{feature}", name="implementer-backend", subagent_type="implementer",
1480
- mode="bypassPermissions",
1481
- prompt="Fullstack team backend developer. Implement API for {feature}.
1482
- SPEC: {spec_content}
1483
- Role: Implement API endpoints per architect's contract. Create data models and services.
1484
- Notify implementer-frontend when endpoints are ready for integration.
1485
- Share API response samples with tester.")
1486
-
1487
- Task(team_name="fullstack-{feature}", name="implementer-frontend", subagent_type="implementer",
1488
- mode="bypassPermissions",
1489
- prompt="Fullstack team frontend developer. Implement UI for {feature}.
1490
- SPEC: {spec_content}
1491
- Role: Build UI components and pages per SPEC. Use architect's API contract for types.
1492
- Start with mock data, switch to real API when backend notifies readiness.
1493
- Notify tester when UI is ready for E2E testing.")
1494
-
1495
- Task(team_name="fullstack-{feature}", name="tester", subagent_type="tester",
1496
- mode="bypassPermissions",
1497
- prompt="Fullstack team tester. Write comprehensive tests for {feature}.
1498
- SPEC: {spec_content}
1499
- Role: Write API tests (after backend ready). Write E2E tests (after frontend ready).
1500
- Test API contract conformance. Report integration issues to architect.")
1501
- ```
1502
-
1503
- **활성화 조건:**
1504
-
1505
- - SPEC에 frontend + backend 파일이 모두 포함된 경우
1506
- - 또는 수동으로 `fullstack` 키워드 지정 시
1507
-
1508
- ---
1509
-
1510
- 1. **Related code analysis**: Task(haiku) explores `<context>` related code
1511
- 2. **File creation/modification**: Task(sonnet) implements per `<output_format>`
1512
- 3. **Constraint compliance**: Check `<constraints>`
1513
- 4. **Run verification**: Execute verification commands
1514
-
1515
- ### 4. Brand Assets Generation (Optional)
1516
-
1517
- When starting a **new project** with brand context in SPEC, auto-generate app icons and favicons:
1518
-
1519
- ```
1520
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1521
- 🎨 BRAND ASSETS GENERATION
1522
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1523
-
1524
- [Check] Brand assets exist? → Skip if favicon.ico exists
1525
- [Check] Gemini API configured? → Required for image generation
1526
- [Check] SPEC has brand context? → Extract app name, colors, style
1527
-
1528
- [Generate] Creating app icon with Gemini Image API...
1529
- - Prompt: "App icon for [AppName], [style], [color]..."
1530
- - Generated: 512x512 master icon
1531
-
1532
- [Resize] Creating platform variants...
1533
- favicon.ico (16/32/48)
1534
- ✅ favicon-16x16.png
1535
- favicon-32x32.png
1536
- ✅ apple-touch-icon.png (180x180)
1537
- android-chrome-192x192.png
1538
- android-chrome-512x512.png
1539
- site.webmanifest
1540
-
1541
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1542
- ✅ Brand assets generated in public/
1543
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1544
- ```
1545
-
1546
- **SPEC Brand Context Example:**
1547
-
1548
- ```xml
1549
- <context>
1550
- Brand:
1551
- - App Name: MyApp
1552
- - Primary Color: #2F6BFF
1553
- - Style: Modern, minimalist, flat design
1554
- - Icon Concept: Abstract geometric shape
1555
- </context>
1556
- ```
1557
-
1558
- **Trigger Conditions:**
1559
- - First `/vibe.run` execution (no existing icons)
1560
- - SPEC contains brand/design context
1561
- - Gemini API key configured (`vibe gemini auth`)
1562
-
1563
- **Manual Generation:**
1564
- ```bash
1565
- # [LLM_SCRIPT] = {{VIBE_PATH}}/hooks/scripts/llm-orchestrate.js
1566
- node "[LLM_SCRIPT]" gemini image "App icon for MyApp, primary color #2F6BFF, square format 1:1, simple recognizable design, works well at small sizes, no text or letters, solid or gradient background, modern minimalist" --output "./public/app-icon.png"
1567
- ```
1568
-
1569
- ---
1570
-
1571
- ### 5. Race Code Review (GPT + Gemini) + Auto-Fix (v2.6.9)
1572
-
1573
- After all scenarios are implemented, **GPT and Gemini review in parallel with cross-validation**:
1574
-
1575
- > **ULTRAWORK Default**: In ULTRAWORK mode, race review is automatically enabled.
1576
-
1577
- ```
1578
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1579
- 🏁 RACE CODE REVIEW (GPT + Gemini)
1580
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1581
-
1582
- [Step 1] Parallel review execution...
1583
- ├─ GPT-5.2-Codex: Reviewing...
1584
- └─ Gemini-3-Flash: Reviewing...
1585
-
1586
- [Step 2] Cross-validation results:
1587
- ┌───────────────────────────────────────────────────────────┐
1588
- Issue │ GPT │ Gemini │ Confidence│
1589
- │────────────────────────────────│─────│────────│───────────│
1590
- │ Timing attack in password │ ✅ │ 100% → P1 │
1591
- │ Rate limiting missing │ ✅ │ 100% → P1 │
1592
- │ Magic number usage │ ❌ │ 50% → P2 │
1593
- └───────────────────────────────────────────────────────────┘
1594
-
1595
- Summary: 3 issues (P1: 2, P2: 1)
1596
-
1597
- [Step 3] Auto-fixing P1/P2 issues...
1598
- auth.service.ts:24 - Applied timingSafeEqual (P1)
1599
- ✅ auth.controller.ts:15 - Added rate limiter (P1)
1600
- ✅ auth.service.ts:42 - Extracted constant (P2)
1601
-
1602
- [Step 4] Re-verifying...
1603
- ✅ Build succeeded
1604
- ✅ Tests passed
1605
-
1606
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1607
- Race review complete! 3 improvements (2 P1, 1 P2)
1608
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1609
- ```
1610
-
1611
- **Race Review Invocation (GPT + Gemini in parallel via Bash):**
1612
-
1613
- **🚨 Use --input file to avoid CLI argument length limits and Windows pipe issues.**
1614
-
1615
- 1. Save code to review into `[SCRATCHPAD]/review-code.txt` (using Write tool)
1616
- 2. Write JSON input file `[SCRATCHPAD]/review-input.json` (using Write tool):
1617
- - `{"prompt": "Review this code for security, performance, and best practices. Return JSON: {issues: [{id, title, description, severity, suggestion}]}. Code: [CODE_CONTENT]"}`
1618
- - Where `[CODE_CONTENT]` is the code text (properly JSON-escaped inside the prompt string)
1619
- 3. Script path: `[LLM_SCRIPT]` = `{{VIBE_PATH}}/hooks/scripts/llm-orchestrate.js`
1620
- 4. Run GPT + Gemini in PARALLEL (two Bash tool calls at once):
1621
-
1622
- ```bash
1623
- # GPT review (Bash tool call 1)
1624
- node "[LLM_SCRIPT]" gpt orchestrate-json --input "[SCRATCHPAD]/review-input.json"
1625
- ```
1626
-
1627
- ```bash
1628
- # Gemini review (Bash tool call 2 - run in parallel)
1629
- node "[LLM_SCRIPT]" gemini orchestrate-json --input "[SCRATCHPAD]/review-input.json"
1630
- ```
1631
-
1632
- **Confidence-based Priority:**
1633
-
1634
- | Confidence | Priority | Action |
1635
- |------------|----------|--------|
1636
- | 100% (2/2) | P1 | Auto-fix immediately |
1637
- | 50% (1/2) | P2 | Auto-fix with review |
1638
-
1639
- **Fallback handling:**
1640
- - If one LLM fails → Use remaining LLM results (reduced confidence)
1641
- - If all fail → Skip and proceed (log warning)
1642
-
1643
- **Review application rules:**
1644
-
1645
- | Feedback Type | Action |
1646
- |---------------|--------|
1647
- | Security vulnerability (P1) | Auto-fix immediately |
1648
- | Performance improvement (P1/P2) | Auto-fix immediately |
1649
- | Best practices (P2) | Auto-fix |
1650
- | Style/preference (P3) | Apply selectively |
1651
-
1652
- **Conditions:**
1653
- - **ULTRAWORK**: Race review enabled by default
1654
- - **Normal mode**: Use `--race` flag to enable
1655
- - Must re-verify build/tests after fixes
1656
-
1657
- ### 6. Quality Report (Auto-generated)
1658
-
1659
- After all scenarios complete + Gemini review, **quality report is auto-generated**:
1660
-
1661
- ```
1662
- ┌─────────────────────────────────────────────────────────────────┐
1663
- │ 📊 QUALITY REPORT: login │
1664
- ├─────────────────────────────────────────────────────────────────┤
1665
- │ │
1666
- │ ✅ Scenarios: 4/4 passed │
1667
- │ │
1668
- │ ┌───────────────────────────────────────────────────────────┐ │
1669
- │ │ # Scenario │ Status Retries │ │ │
1670
- │ │───│───────────────────────────│────────│─────────│ │ │
1671
- │ │ 1 Valid login success │ ✅ │ 0 │ │ │
1672
- │ │ 2 Invalid password error │ ✅ │ 1 │ │ │
1673
- │ │ 3 Email format validation │ ✅ │ 0 │ │ │
1674
- │ │ 4 Password reset link │ ✅ │ 0 │ │ │
1675
- │ └───────────────────────────────────────────────────────────┘ │
1676
- │ │
1677
- │ 📈 Quality score: 94/100 │
1678
- │ │
1679
- │ ┌─────────────────────────────────────────────────────────┐ │
1680
- │ │ Item │ Result Notes │ │
1681
- │ │───────────────────│────────│─────────────────────────────│ │
1682
- │ │ Build │ ✅ │ npm run build succeeded │ │
1683
- │ │ Tests │ ✅ │ 12/12 passed │ │
1684
- │ │ Type check │ ✅ │ 0 errors │ │
1685
- │ │ Complexity │ ✅ │ All functions ≤30 lines │ │
1686
- │ │ Security │ ✅ │ 0 vulnerabilities │ │
1687
- │ │ Race review │ ✅ │ 3 improvements applied │ │
1688
- │ └─────────────────────────────────────────────────────────┘ │
1689
- │ │
1690
- │ ⏱️ Started: {start_time} │
1691
- │ ⏱️ Completed: {getCurrentTime 결과} │
1692
- │ │
1693
- └─────────────────────────────────────────────────────────────────┘
1694
- ```
1695
-
1696
- **What users should check**:
1697
- - Scenario pass rate (4/4 = 100%)
1698
- - Quality score (94/100)
1699
- - Build/test status
1700
-
1701
- **This alone is enough to trust quality.**
1702
-
1703
- ### 7. Update Feature File
1704
-
1705
- Auto-update scenario status:
1706
-
1707
- ```markdown
1708
- ## Coverage
1709
-
1710
- | Scenario | SPEC AC | Status |
1711
- |----------|---------|--------|
1712
- | Valid login success | AC-1 | ✅ |
1713
- | Invalid password error | AC-2 | ✅ |
1714
- | Email format validation | AC-3 | ✅ |
1715
- | Password reset link | AC-4 | |
1716
-
1717
- **Last verified**: 2024-01-15 14:32
1718
- **Quality score**: 94/100
1719
- ```
1720
-
1721
- ## TRUST 5 Principles
1722
-
1723
- Follow during implementation:
1724
-
1725
- | Principle | Description |
1726
- |-----------|-------------|
1727
- | **T**est-first | Write tests first |
1728
- | **R**eadable | Clear code |
1729
- | **U**nified | Consistent style |
1730
- | **S**ecured | Consider security |
1731
- | **T**rackable | Logging, monitoring |
1732
-
1733
- ## Input
1734
-
1735
- - `.claude/vibe/specs/{feature-name}.md` (PTCF SPEC)
1736
- - `.claude/vibe/features/{feature-name}.feature` (BDD)
1737
- - `CLAUDE.md` (project context)
1738
-
1739
- ## Output
1740
-
1741
- - Implemented code files
1742
- - Test files
1743
- - Updated SPEC document (checkmarks)
1744
-
1745
- ## Example
1746
-
1747
- ```
1748
- User: /vibe.run "login"
1749
-
1750
- Claude:
1751
- 📄 Loading SPEC: .claude/vibe/specs/login.md
1752
- 📄 Loading Feature: .claude/vibe/features/login.feature
1753
-
1754
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1755
- 📋 Scenarios to Implement
1756
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1757
-
1758
- | # | Scenario | Status |
1759
- |---|----------|--------|
1760
- | 1 | Valid login success | ⬜ |
1761
- | 2 | Invalid password error | ⬜ |
1762
- | 3 | Email format validation | ⬜ |
1763
- | 4 | Password reset link | ⬜ |
1764
-
1765
- Total: 4 scenarios
1766
-
1767
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1768
- 🎯 Scenario 1/4: Valid login success
1769
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1770
-
1771
- Given: User is registered
1772
- When: Login with valid email and password
1773
- Then: Login success + JWT token returned
1774
-
1775
- ⚡ [PARALLEL] Exploring...
1776
- ✅ Exploration complete (2.1s)
1777
-
1778
- 🔨 Implementing...
1779
- auth.service.ts - Added login()
1780
- ✅ auth.controller.ts - POST /login
1781
-
1782
- 🔍 Verifying...
1783
- Given: OK
1784
- When: OK
1785
- Then: OK
1786
-
1787
- Scenario 1 passed!
1788
-
1789
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1790
- 🎯 Scenario 2/4: Invalid password error
1791
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1792
-
1793
- 🔨 Implementing...
1794
- ✅ auth.service.ts - Password validation logic
1795
-
1796
- 🔍 Verifying...
1797
- Given: OK
1798
- When: OK
1799
- Then: "Invalid credentials" error message
1800
- Actual: "Error" returned
1801
-
1802
- 🔄 Auto-fix 1/3...
1803
- Fix: auth.service.ts line 42
1804
-
1805
- 🔍 Re-verifying...
1806
- ✅ Then: OK
1807
-
1808
- Scenario 2 passed! (1 fix)
1809
-
1810
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1811
- 🎯 Scenario 3/4: Email format validation
1812
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1813
-
1814
- 🔨 Implementing...
1815
- 🔍 Verifying...
1816
- Scenario 3 passed!
1817
-
1818
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1819
- 🎯 Scenario 4/4: Password reset link
1820
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1821
-
1822
- 🔨 Implementing...
1823
- 🔍 Verifying...
1824
- Scenario 4 passed!
1825
-
1826
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1827
- 🔍 GEMINI CODE REVIEW
1828
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1829
-
1830
- 📤 Sending code to Gemini...
1831
- 📝 Gemini feedback:
1832
- 1. [Security] Need timing attack prevention → Fixing...
1833
- 2. [Performance] Unnecessary DB call → Fixing...
1834
-
1835
- 2 improvements auto-applied
1836
- 🔍 Re-verifying... Passed
1837
-
1838
- ┌─────────────────────────────────────────────────────────────────┐
1839
- 📊 QUALITY REPORT: login │
1840
- ├─────────────────────────────────────────────────────────────────┤
1841
- │ │
1842
- │ ✅ Scenarios: 4/4 passed │
1843
- │ │
1844
- │ | # | Scenario | Status | Retries | │
1845
- │ |---|───────────────────────|───────|─────────| │
1846
- │ | 1 | Valid login success | ✅ | 0 | │
1847
- │ | 2 | Invalid password error| ✅ | 1 | │
1848
- │ | 3 | Email format validation| ✅ | 0 | │
1849
- │ | 4 | Password reset link | ✅ | 0 | │
1850
- │ │
1851
- │ 📈 Quality score: 94/100 │
1852
- │ Build: ✅ | Tests: ✅ | Types: ✅ | Gemini: ✅ (2 applied) │
1853
- │ │
1854
- ⏱️ Started: {start_time} │
1855
- ⏱️ Completed: {getCurrentTime 결과} │
1856
- └─────────────────────────────────────────────────────────────────┘
1857
-
1858
- 🎉 Implementation complete! All scenarios passed + Gemini review applied.
1859
-
1860
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1861
- 🔍 AUTO REVIEW (13+ Agents)
1862
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1863
-
1864
- [PARALLEL] 13 expert agents reviewing...
1865
- - security-reviewer ✅
1866
- - performance-reviewer ✅
1867
- - architecture-reviewer
1868
- - ...
1869
-
1870
- 📋 Review results:
1871
- - P1 Critical: 0
1872
- - P2 Important: 2
1873
- - P3 Nice-to-have: 1
1874
-
1875
- 🔧 Auto-fixing P2 issues...
1876
- 1. [PERF] N+1 query → Fixed
1877
- 2. [ARCH] Circular dependency → Fixed
1878
-
1879
- Auto Review complete! 2 issues auto-resolved.
1880
- ```
1881
-
1882
- ### Phase-specific Execution
1883
-
1884
- ```
1885
- User: /vibe.run "brick-game" --phase 2
1886
-
1887
- Claude:
1888
- 📄 Reading SPEC: .claude/vibe/specs/brick-game.md
1889
- 🎯 Executing Phase 2 only.
1890
-
1891
- Phase 2: Game Logic
1892
- 1. [ ] Paddle movement implementation
1893
- 2. [ ] Ball physics engine
1894
- 3. [ ] Brick collision handling
1895
- 4. [ ] Score system
1896
- 5. [ ] Game over conditions
1897
-
1898
- Launching parallel exploration...
1899
- [Task(haiku) × 3 launched in parallel]
1900
-
1901
- 🚀 Starting implementation...
1902
- ```
1903
-
1904
- ## Error Handling
1905
-
1906
- On failure:
1907
- 1. Check error message
1908
- 2. Review `<constraints>`
1909
- 3. Fix code and retry
1910
- 4. If continues to fail, report to user
1911
-
1912
- ---
1913
-
1914
- ## Quality Gate (Mandatory)
1915
-
1916
- ### Implementation Quality Checklist
1917
-
1918
- Before marking any scenario as complete, ALL items must pass:
1919
-
1920
- | Category | Check Item | Weight |
1921
- |----------|------------|--------|
1922
- | **Functionality** | All Given/When/Then conditions verified | 20% |
1923
- | **Functionality** | Edge cases handled per scenario | 10% |
1924
- | **Code Quality** | No `any` types in TypeScript | 10% |
1925
- | **Code Quality** | Functions ≤30 lines, nesting ≤3 levels | 10% |
1926
- | **Code Quality** | No hardcoded values (use constants) | 5% |
1927
- | **Security** | Input validation implemented | 10% |
1928
- | **Security** | Authentication/authorization checked | 5% |
1929
- | **Error Handling** | Try-catch or error states present | 10% |
1930
- | **Error Handling** | User-friendly error messages | 5% |
1931
- | **Testing** | Unit tests exist for core logic | 10% |
1932
- | **Performance** | No N+1 queries or unnecessary loops | 5% |
1933
-
1934
- ### Quality Score Calculation
1935
-
1936
- ```
1937
- Score = Σ(checked items × weight) / 100
1938
-
1939
- Grades:
1940
- - 95-100: ✅ EXCELLENT - Ready to merge
1941
- - 90-94: ⚠️ GOOD - Minor improvements required before merge
1942
- - 80-89: ⚠️ FAIR - Significant improvements required
1943
- - 0-79: ❌ POOR - Major fixes needed
1944
- ```
1945
-
1946
- ### Quality Gate Thresholds
1947
-
1948
- | Gate | Minimum Score | Condition |
1949
- |------|---------------|-----------|
1950
- | **Scenario Complete** | 95 | Each scenario must score ≥95 |
1951
- | **Phase Complete** | 95 | Average of all scenarios ≥95 |
1952
- | **Feature Complete** | 95 | All phases complete + Gemini review |
1953
-
1954
- ### Auto-Fix Triggers
1955
-
1956
- | Issue Type | Auto-Fix Action |
1957
- |------------|-----------------|
1958
- | Missing error handling | Add try-catch wrapper |
1959
- | Hardcoded values | Extract to constants file |
1960
- | Missing input validation | Add validation schema |
1961
- | Function too long | Suggest split points |
1962
- | N+1 query detected | Add eager loading |
1963
-
1964
- ### Forbidden Patterns (Block Merge)
1965
-
1966
- | Pattern | Why Forbidden | Detection |
1967
- |---------|---------------|-----------|
1968
- | `console.log` | Debug code in production | Regex scan |
1969
- | `// TODO` without issue | Untracked work | Comment scan |
1970
- | `any` type | Type safety bypass | TypeScript check |
1971
- | `@ts-ignore` | Type error suppression | TypeScript check |
1972
- | Empty catch blocks | Silent error swallowing | AST analysis |
1973
- | Commented-out code | Dead code | Comment scan |
1974
-
1975
- ---
1976
-
1977
- ## Auto-Retrospective (Post-Implementation)
1978
-
1979
- After ALL phases complete successfully, **automatically** perform a brief retrospective:
1980
-
1981
- ### Retrospective Template
1982
-
1983
- ```
1984
- ## Retrospective: {feature-name}
1985
-
1986
- ### What Worked
1987
- - [List effective patterns, tools, approaches used]
1988
-
1989
- ### What Didn't
1990
- - [List issues, failures, unexpected blockers]
1991
-
1992
- ### Key Decisions
1993
- - [Important architectural or implementation decisions made during this run]
1994
-
1995
- ### Lessons Learned
1996
- - [Principle format: "When X, do Y because Z"]
1997
- ```
1998
-
1999
- ### Execution Steps
2000
-
2001
- 1. Generate retrospective based on the implementation session
2002
- 2. Save to `.claude/vibe/retros/{feature-name}.md`
2003
- 3. Save key lessons via `core_save_memory` (for cross-session recall)
2004
- 4. Update `claude-progress.txt` with final status
2005
-
2006
- **Important:**
2007
-
2008
- - Keep it concise (under 20 lines)
2009
- - Focus on **project-specific** insights, not generic knowledge
2010
- - Only save to memory if the lesson is actionable and non-obvious
2011
-
2012
- ---
2013
-
2014
- ## Next Step
2015
-
2016
- ```
2017
- /vibe.verify "brick-game"
2018
- ```
2019
-
2020
- ---
2021
-
2022
- 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
+ > **⏱️ Timer**: Call `getCurrentTime` tool at the START. Record the result as `{start_time}`.
24
+
25
+ ## File Reading Policy (Mandatory)
26
+
27
+ - **SPEC/Feature 파일**: 반드시 `Read` 도구로 전체 파일을 읽을 (Grep 금지)
28
+ - **소스코드 파일**: 구현/수정 대상 파일은 반드시 `Read` 도구로 전체 읽은 후 작업할 것
29
+ - **Grep 사용 제한**: 파일 위치 탐색(어떤 파일에 있는지 찾기)에만 사용. 파일 내용 파악에는 반드시 Read 사용
30
+ - **에이전트 spawn 시**: 프롬프트에 "대상 파일을 Read 도구로 전체 읽은 후 구현하라"를 반드시 포함할 것
31
+ - **부분 읽기 금지**: Grep 결과의 주변 몇 줄만 보고 수정하지 말 것. 전체 맥락을 파악해야 기존 코드와 일관된 구현 가능
32
+
33
+ ## **Scenario-Driven Development (SDD)**
34
+
35
+ > Automate **Scenario = Implementation = Verification** so even non-developers can trust quality
36
+
37
+ ### Core Flow
38
+
39
+ ```
40
+ ┌─────────────────────────────────────────────────────────────────┐
41
+ SCENARIO-DRIVEN IMPLEMENTATION
42
+
43
+ Load Feature file
44
+
45
+ ┌──────────────────────────────────────────────────────────┐
46
+ │ │ Scenario 1: Happy Path │ │
47
+ │ │ Given → When → Then │ │
48
+ │ ││ │
49
+ │ [Implement] → [Verify immediately] → ✅ Pass │
50
+ └──────────────────────────────────────────────────────────┘
51
+
52
+ ┌──────────────────────────────────────────────────────────┐
53
+ │ │ Scenario 2: Edge Case │ │
54
+ │ Given → When → Then │
55
+
56
+ │ [Implement] → [Verify] → ❌ Fail → [Fix] → ✅ Pass │
57
+ └──────────────────────────────────────────────────────────┘
58
+
59
+ ┌──────────────────────────────────────────────────────────┐
60
+ │ │ Scenario N: ... │ │
61
+ │ │ [Implement] [Verify immediately] Pass │ │
62
+ │ └──────────────────────────────────────────────────────────┘ │
63
+ │ ↓ │
64
+ │ ┌──────────────────────────────────────────────────────────┐ │
65
+ │ │ 📊 QUALITY REPORT │ │
66
+ │ │ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ │ │
67
+ │ │ Scenarios: 5/5 passed ✅ │ │
68
+ │ │ Quality score: 94/100 │ │
69
+ │ │ Build: ✅ | Tests: ✅ │ │
70
+ │ └──────────────────────────────────────────────────────────┘ │
71
+ └─────────────────────────────────────────────────────────────────┘
72
+ ```
73
+
74
+ ### Scenario = Implementation Unit
75
+
76
+ **Traditional approach (Phase-based)**:
77
+ ```
78
+ Phase 1 → Phase 2 → Phase 3 ... → Verify at the end
79
+
80
+ "Where did it go wrong?"
81
+ ```
82
+
83
+ **SDD approach (Scenario-based)**:
84
+ ```
85
+ Scenario 1 → Implement → Verify ✅
86
+ Scenario 2 Implement Verify ✅
87
+ Scenario 3 → Implement → Verify ❌ → Fix → ✅
88
+ ...
89
+ All pass = Quality guaranteed
90
+ ```
91
+
92
+ ### Automated Verification (Closed Loop)
93
+
94
+ **자율적 AI 코딩 = 구현 + 검증 + 반복. 검증을 AI에게 맡기는 순간 루프가 닫힌다.**
95
+
96
+ After implementing each scenario, **automatic verification**:
97
+
98
+ | Verification Item | Auto Check | Method |
99
+ |-------------------|------------|--------|
100
+ | Given (precondition) | State/data preparation confirmed | Code analysis |
101
+ | When (action) | Feature execution possible | Code analysis + Build |
102
+ | Then (result) | Expected result matches | Code analysis + Test |
103
+ | Code quality | Complexity, style, security | Static analysis |
104
+ | **UI behavior** | **실제 브라우저에서 동작 확인** | **E2E Closed Loop** |
105
+
106
+ ### E2E Closed Loop (UI Scenarios)
107
+
108
+ **UI 시나리오가 포함된 Feature일 때 자동 활성화.**
109
+
110
+ ```
111
+ ┌─────────────────────────────────────────────────────────────────┐
112
+ │ CLOSED LOOP = 구현 + 검증 + 반복 │
113
+ │ │
114
+ │ Scenario 구현 완료 │
115
+ │ ↓ │
116
+ │ [E2E 검증] AI가 직접 브라우저 조작 │
117
+ │ │ (접근성 트리 기반 토큰 효율적)
118
+ │ ├─ PASS → Next scenario │
119
+ │ └─ FAIL Root cause analysis │
120
+ │ → Fix code (Read full file first) │
121
+ │ → Re-run failed scenario only │
122
+ │ → PASS? Next scenario │
123
+ │ → FAIL? Retry (max 3) │
124
+ │ │
125
+ │ 핵심: 검증이 가벼울수록 루프는 많이 돈다 │
126
+ │ - 접근성 트리: button "Sign In" = 15 chars │
127
+ │ - DOM 트리: div class="nav-wrapper mx-4..." = 200+ chars │
128
+ │ - 전자를 써야 한 세션에서 수십 개 시나리오 검증 가능 │
129
+ └─────────────────────────────────────────────────────────────────┘
130
+ ```
131
+
132
+ **Browser Tool Priority:**
133
+
134
+ | Priority | Tool | 용도 |
135
+ |----------|------|------|
136
+ | 1st | Agent Browser (접근성 트리) | AI 직접 조작, 최소 토큰 |
137
+ | 2nd | Playwright Test Runner | 테스트 코드 실행, pass/fail 반환 |
138
+ | 3rd | Playwright MCP (DOM) | 최후 수단, 토큰 비효율 |
139
+
140
+ **활성화 조건:**
141
+ - Feature 파일에 UI 관련 시나리오 존재 (form, button, page, navigate 등)
142
+ - `.claude/vibe/e2e/config.json`의 `closedLoop.enabled: true` (기본값)
143
+ - dev server가 실행 중 (`baseURL` 접근 가능)
144
+
145
+ ### Auto-Fix on Failure
146
+
147
+ ```
148
+ Scenario verification failed (코드 분석 또는 E2E)
149
+
150
+ [Collect evidence]
151
+ - E2E: screenshot, console errors, accessibility tree snapshot
152
+ - Code: build errors, test failures, type errors
153
+
154
+ [Root cause analysis] - Which Then condition failed?
155
+
156
+ [Read target file FULLY] - Grep으로 훑지 말 것
157
+
158
+ [Implement fix] - Fix only that part
159
+
160
+ [Re-verify] - Re-run ONLY failed scenario (save tokens)
161
+
162
+ Repeat until pass (max 3 times)
163
+ ```
164
+
165
+ ---
166
+
167
+ ## **ULTRAWORK Mode** (ulw)
168
+
169
+ > Include `ultrawork` or `ulw` in your command to activate **maximum performance mode**.
170
+
171
+ ### What ULTRAWORK Enables
172
+
173
+ When you include `ultrawork` (or `ulw`), ALL of these activate automatically:
174
+
175
+ | Feature | Description |
176
+ |---------|-------------|
177
+ | **Parallel Exploration** | 3+ Task(haiku) agents run simultaneously |
178
+ | **Boulder Loop** | Auto-continues until ALL phases complete |
179
+ | **Context Compression** | Aggressive auto-save at 70%+ context |
180
+ | **No Pause** | Doesn't wait for confirmation between phases |
181
+ | **External LLMs** | Auto-consults GPT/Gemini if enabled |
182
+ | **Error Recovery** | Auto-retries on failure (up to 3 times) |
183
+ | **Race Review (v2.6.9)** | Multi-LLM review (GPT+Gemini) with cross-validation |
184
+
185
+ ### Boulder Loop (Inspired by Sisyphus)
186
+
187
+ Like Sisyphus rolling the boulder, ULTRAWORK **keeps going until done**:
188
+
189
+ ```
190
+ ┌─────────────────────────────────────────────────────────────────┐
191
+ BOULDER LOOP (ultrawork)
192
+
193
+ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐
194
+ Phase 1 │───→│ Phase 2 │───→│ Phase 3 │───→│ Phase N │ │
195
+ └──────────┘ └──────────┘ └──────────┘ └──────────┘
196
+ │ │ │ │
197
+ ↓ ↓ ↓ ↓
198
+ [Parallel] [Parallel] [Parallel] [Parallel]
199
+ [Implement] [Implement] [Implement] [Implement]
200
+ [Test] [Test] [Test] [Test]
201
+
202
+ └───────────────┴───────────────┴───────────────┘
203
+
204
+
205
+ ┌──────────────┐
206
+ │ ALL DONE?
207
+ └──────────────┘
208
+ │ │
209
+ NO YES
210
+ │ │
211
+ │ ↓ ↓ │
212
+ │ [Continue] [🎉 Complete!] │
213
+ │ │
214
+ │ NO STOPPING until acceptance criteria met or error limit hit │
215
+ └─────────────────────────────────────────────────────────────────┘
216
+ ```
217
+
218
+ ### Ralph Loop (Completion Verification) - CRITICAL
219
+
220
+ > **Inspired by [ghuntley.com/ralph](https://ghuntley.com/ralph)**: "Deterministically bad in an undeterministic world" - Keep iterating until TRULY complete.
221
+
222
+ **Problem**: AI often claims "complete" when implementation is partial.
223
+
224
+ **Solution**: RTM-based automated coverage verification with iteration tracking.
225
+
226
+ ```
227
+ ┌─────────────────────────────────────────────────────────────────┐
228
+ │ RALPH LOOP (Mandatory) │
229
+ │ │
230
+ │ After ALL phases complete: │
231
+ │ │
232
+ │ ┌──────────────────────────────────────────────────────────┐ │
233
+ │ │ RTM COVERAGE VERIFICATION [Iteration {{ITER}}/{{MAX}}] │ │
234
+ │ │ │ │
235
+ │ │ Generate RTM via core tools: │ │
236
+ │ │ → generateTraceabilityMatrix("{feature-name}") │ │
237
+ │ │ │ │
238
+ │ │ Coverage Metrics (automated): │ │
239
+ │ │ □ Requirements coverage: {coveragePercent}% │ │
240
+ │ │ □ SPEC Feature mapping: {featureCovered}/{total} │ │
241
+ │ │ □ Feature → Test mapping: {testCovered}/{total} │ │
242
+ │ │ □ Build successful? │ │
243
+ │ │ □ Tests passing? │ │
244
+ │ │ │ │
245
+ │ │ UNCOVERED: {uncoveredRequirements[]} │ │
246
+ │ └──────────────────────────────────────────────────────────┘ │
247
+ │ │ │
248
+ │ ┌──────────┴──────────┐ │
249
+ │ │ Coverage 95%? │ │
250
+ │ └──────────┬──────────┘ │
251
+ │ │ │ │
252
+ │ NO YES │
253
+ │ │ │ │
254
+ │ ↓ ↓ │
255
+ │ ┌────────────────┐ ┌────────────────┐ │
256
+ │ │ IMPLEMENT │ │ ✅ TRULY DONE │ │
257
+ │ │ UNCOVERED │ │ │ │
258
+ │ │ REQUIREMENTS │ Report final │ │
259
+ │ │ (auto-extract) │ │ RTM coverage │ │
260
+ │ └───────┬────────┘ └────────────────┘ │
261
+ │ │ │
262
+ │ └──────────→ [Re-generate RTM] │
263
+ │ │
264
+ │ MAX_ITERATIONS: 5 (prevent infinite loops) │
265
+ │ COVERAGE_THRESHOLD: 95% (quality gate)
266
+ │ ZERO TOLERANCE for scope reduction │
267
+ └─────────────────────────────────────────────────────────────────┘
268
+ ```
269
+
270
+ **Ralph Loop with RTM:**
271
+
272
+ ```bash
273
+ # Generate RTM for coverage verification
274
+ node -e "import('{{VIBE_PATH_URL}}/node_modules/@su-record/vibe/dist/tools/index.js').then(t => t.generateTraceabilityMatrix('{feature-name}', {projectPath: process.cwd()}).then(r => console.log(JSON.stringify(r, null, 2))))"
275
+ ```
276
+
277
+ **RTM provides automated metrics:**
278
+
279
+ | Metric | Description |
280
+ |--------|-------------|
281
+ | `totalRequirements` | Total REQ-* items in SPEC |
282
+ | `specCovered` | Requirements with SPEC mapping |
283
+ | `featureCovered` | Requirements with Feature scenarios |
284
+ | `testCovered` | Requirements with test files |
285
+ | `coveragePercent` | Overall coverage percentage |
286
+ | `uncoveredRequirements` | List of missing REQ-* IDs |
287
+
288
+ **Ralph Loop Rules:**
289
+
290
+ | Rule | Description |
291
+ |------|-------------|
292
+ | **No Scope Reduction** | Never say "simplified" or "basic version" - implement FULL request |
293
+ | **Iteration Tracking** | Display `[{{ITER}}/{{MAX}}]` to show progress |
294
+ | **RTM-Based Gap List** | Use `uncoveredRequirements` array - no manual comparison |
295
+ | **Coverage Threshold** | Must reach 95% coverage to complete |
296
+ | **Max Iterations** | Stop at 5 iterations (report remaining gaps) |
297
+
298
+ **Ralph Loop Output Format:**
299
+
300
+ ```
301
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
302
+ 🔄 RALPH VERIFICATION [Iteration 1/5]
303
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
304
+
305
+ 📊 RTM Coverage Report: login
306
+
307
+ Requirements Traceability:
308
+ Total Requirements: 9
309
+ SPEC Covered: 9/9 (100%)
310
+ Feature Covered: 5/9 (55%)
311
+ Test Covered: 4/9 (44%)
312
+
313
+ REQ-login-001: Login form UI Scenario 1 login.test.ts
314
+ REQ-login-002: Email validation Scenario 2 → validation.test.ts
315
+ REQ-login-003: Password validation Scenario 2 validation.test.ts
316
+ ❌ REQ-login-004: Remember me checkbox → NOT IMPLEMENTED
317
+ REQ-login-005: Forgot password link → NOT IMPLEMENTED
318
+ ✅ REQ-login-006: API integration → Scenario 3 → api.test.ts
319
+ ❌ REQ-login-007: Loading state → NOT IMPLEMENTED
320
+ ❌ REQ-login-008: Error toast → NOT IMPLEMENTED
321
+ ✅ REQ-login-009: Session storage → Scenario 4 → (no test)
322
+
323
+ Overall Coverage: 55% ⚠️ BELOW 95% THRESHOLD
324
+
325
+ UNCOVERED REQUIREMENTS (auto-extracted from RTM):
326
+ 1. REQ-login-004: Remember me checkbox
327
+ 2. REQ-login-005: Forgot password link
328
+ 3. REQ-login-007: Loading state
329
+ 4. REQ-login-008: Error toast notifications
330
+
331
+ ⚠️ NOT COMPLETE - Implementing uncovered requirements...
332
+
333
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
334
+ 🔄 RALPH VERIFICATION [Iteration 2/5]
335
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
336
+
337
+ 📊 RTM Coverage Report: login
338
+
339
+ Requirements Traceability:
340
+ Total Requirements: 9
341
+ SPEC Covered: 9/9 (100%)
342
+ Feature Covered: 9/9 (100%)
343
+ Test Covered: 9/9 (100%)
344
+
345
+ Overall Coverage: 100% ABOVE 95% THRESHOLD
346
+
347
+ Build: ✅ Passed
348
+ Tests: 12/12 Passed
349
+ Type Check: ✅ No errors
350
+
351
+ RALPH VERIFIED COMPLETE!
352
+
353
+ 📄 RTM saved: .claude/vibe/rtm/login-rtm.md
354
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
355
+ ```
356
+
357
+ **When to Trigger Ralph Loop:**
358
+
359
+ 1. After all phases complete
360
+ 2. Before final quality report
361
+ 3. Whenever user says "ultrawork" or "ralph"
362
+
363
+ **Forbidden Responses (VIOLATIONS):**
364
+
365
+ | NEVER Say | ✅ Instead |
366
+ |-------------|-----------|
367
+ | "I've implemented a basic version" | Implement the FULL version |
368
+ | "This is a simplified approach" | Implement as specified |
369
+ | "You can add X later" | Add X now |
370
+ | "For demonstration purposes" | Implement production-ready |
371
+ | "The core functionality is done" | ALL functionality must be done |
372
+
373
+ ### ULTRAWORK Example
374
+
375
+ ```
376
+ User: /vibe.run "brick-game" ultrawork
377
+
378
+ Claude:
379
+ 🚀 ULTRAWORK MODE ACTIVATED
380
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
381
+
382
+ 📄 SPEC: .claude/vibe/specs/brick-game.md
383
+ 🎯 4 Phases detected
384
+ ⚡ Boulder Loop: ENABLED (will continue until all phases complete)
385
+ 🔄 Auto-retry: ON (max 3 per phase)
386
+ 💾 Context compression: AGGRESSIVE
387
+
388
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
389
+ 🏔️ BOULDER ROLLING... Phase 1/4
390
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
391
+
392
+ ⚡ [PARALLEL] Launching 3 exploration agents...
393
+ ✅ Exploration complete (7.2s)
394
+ 🔨 Implementing...
395
+ ✅ Phase 1 complete
396
+
397
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
398
+ 🏔️ BOULDER ROLLING... Phase 2/4
399
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
400
+
401
+ ⚡ [PARALLEL] Launching 3 exploration agents...
402
+ Exploration complete (6.8s)
403
+ 🔨 Implementing...
404
+ Test failed: collision detection
405
+ 🔄 Auto-retry 1/3...
406
+ 🔨 Fixing...
407
+ Phase 2 complete
408
+
409
+ [...continues automatically...]
410
+
411
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
412
+ 🎉 BOULDER REACHED THE TOP!
413
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
414
+
415
+ All 4 phases complete
416
+ All acceptance criteria passed
417
+ Build succeeded
418
+ ✅ Tests passed
419
+
420
+ ⏱️ Total: 8m 24s
421
+ 📊 Retries: 2
422
+ 💾 Context saved: 3 checkpoints
423
+ ```
424
+
425
+ ### Normal vs ULTRAWORK Comparison
426
+
427
+ | Aspect | Normal | ULTRAWORK |
428
+ |--------|--------|-----------|
429
+ | Phase transition | May pause | Auto-continues |
430
+ | On error | Reports and stops | Auto-retries (3x) |
431
+ | Context 70%+ | Warning only | Auto-compress + save |
432
+ | Exploration | Sequential possible | FORCED parallel |
433
+ | Completion | Phase-by-phase | Until ALL done |
434
+
435
+ ---
436
+
437
+ ## Rules Reference
438
+
439
+ **Must follow `~/.claude/vibe/rules/` (global):**
440
+
441
+ - `core/development-philosophy.md` - Surgical precision, modify only requested scope
442
+ - `core/quick-start.md` - Korean, DRY, SRP, YAGNI
443
+ - `standards/complexity-metrics.md` - Functions ≤20 lines, nesting ≤3 levels
444
+ - `quality/checklist.md` - Code quality checklist
445
+
446
+ **Language guide:** `~/.claude/vibe/languages/{stack}.md` (global reference)
447
+
448
+ ---
449
+
450
+ ## Coding Guidelines (Mandatory)
451
+
452
+ ### Type Safety: Use Types Explicitly
453
+
454
+ > **Core Principle**: Use types explicitly in every language that has a type system!
455
+
456
+ Type definitions are not just language syntax — they are a **core engineering philosophy for simplifying and controlling complex software**.
457
+
458
+ ### Applies to ALL Typed Languages
459
+
460
+ | Category | Languages | Key Principle |
461
+ |----------|-----------|---------------|
462
+ | **Static Typed** | Java, C#, C++, Go, Rust, Swift, Kotlin, Scala | Types = compile-time contracts |
463
+ | **Gradual Typed** | TypeScript, Python (typing), PHP (typed), Ruby (RBS) | Types = optional safety nets |
464
+ | **Functional** | Haskell, OCaml, F#, Elm | Types = logical proofs |
465
+
466
+ ### Universal Anti-Patterns (All Languages)
467
+
468
+ | Forbidden Pattern | Why | ✅ Instead |
469
+ |---------------------|-----|-----------|
470
+ | Type escape hatches (`any`, `Any`, `Object`, `void*`, `interface{}`) | Loses type info, runtime errors | Concrete types or `unknown` + guards |
471
+ | Type suppression (`@ts-ignore`, `# type: ignore`, `@SuppressWarnings`) | Hides errors | Fix actual type issues |
472
+ | Raw generic types (`List`, `Map` without params) | Loses type safety | `List<User>`, `Map<String, Order>` |
473
+ | Excessive casting (`as`, `(Type)`, `unsafe`) | Bypasses compiler | Type guards or pattern matching |
474
+
475
+ ### Language-Specific Guidelines
476
+
477
+ **TypeScript/JavaScript:**
478
+ ```typescript
479
+ // BAD
480
+ function process(data: any): any { return data.foo; }
481
+
482
+ // GOOD
483
+ function process(data: unknown): Result {
484
+ if (isValidData(data)) return data.foo;
485
+ throw new Error('Invalid');
486
+ }
487
+ ```
488
+
489
+ **Python:**
490
+ ```python
491
+ # ❌ BAD
492
+ def process(data: Any) -> Any: return data["key"]
493
+
494
+ # GOOD
495
+ def process(data: UserData) -> str: return data["name"]
496
+ ```
497
+
498
+ **Java/Kotlin:**
499
+ ```java
500
+ // BAD
501
+ List items = new ArrayList(); // Raw type
502
+ Object data = getData(); // Lost type info
503
+
504
+ // GOOD
505
+ List<User> users = new ArrayList<>();
506
+ User user = getUser();
507
+ ```
508
+
509
+ **Go:**
510
+ ```go
511
+ // ❌ BAD
512
+ func process(data interface{}) interface{} { ... }
513
+
514
+ // GOOD
515
+ func process(data UserRequest) (UserResponse, error) { ... }
516
+ ```
517
+
518
+ **Rust:**
519
+ ```rust
520
+ // BAD (unnecessary unsafe or Box<dyn Any>)
521
+ let data: Box<dyn Any> = get_data();
522
+
523
+ // ✅ GOOD
524
+ let data: UserData = get_data()?;
525
+ ```
526
+
527
+ **C#:**
528
+ ```csharp
529
+ // BAD
530
+ object data = GetData();
531
+ dynamic result = Process(data);
532
+
533
+ // GOOD
534
+ UserData data = GetData();
535
+ Result result = Process(data);
536
+ ```
537
+
538
+ ### Type Safety Rules (Universal)
539
+
540
+ | Rule | Description |
541
+ |------|-------------|
542
+ | **Boundary Validation** | Validate only at system boundaries (API, JSON, user input) |
543
+ | **Internal Trust** | After validation, pass only precise types internally |
544
+ | **No Type Escape** | Never use escape hatches to "fix" type errors |
545
+ | **Explicit Signatures** | Specify types in function/method signatures |
546
+ | **Generics with Params** | Always use generics with type parameters |
547
+
548
+ ### Quality Gate: Type Violations Block Merge
549
+
550
+ | Violation | Action |
551
+ |-----------|--------|
552
+ | Type escape hatches (`any`, `Any`, `Object`, `interface{}`, etc.) | ❌ Block |
553
+ | Type suppression comments | Block |
554
+ | Raw generic types | Block |
555
+ | Missing function return types | ⚠️ Warning |
556
+ | Excessive type casting | ⚠️ Warning |
557
+
558
+ ## Description
559
+
560
+ Read PTCF structured SPEC document and execute implementation immediately.
561
+
562
+ > **PLAN, TASKS documents unnecessary** - SPEC is the executable prompt
563
+
564
+ ## Model Orchestration (Intelligent Routing)
565
+
566
+ Automatically select optimal model based on **task complexity analysis**.
567
+
568
+ ### Complexity-Based Model Selection
569
+
570
+ | Complexity Score | Model | When to Use |
571
+ |------------------|-------|-------------|
572
+ | 0-7 (Low) | **Haiku** | Simple fixes, searches, single file changes |
573
+ | 8-19 (Medium) | **Sonnet** | Standard features, 3-5 files, integrations |
574
+ | 20+ (High) | **Opus** | Architecture, security, multi-service, 6+ files |
575
+
576
+ ### Complexity Signals
577
+
578
+ The following signals increase complexity score:
579
+
580
+ | Signal | Score |
581
+ |--------|-------|
582
+ | Architecture change | +15 |
583
+ | Security implication | +12 |
584
+ | Multi-service | +8 |
585
+ | Refactoring | +12 |
586
+ | 6+ files | +15 |
587
+ | 3-5 files | +8 |
588
+ | New feature | +5 |
589
+ | Bug fix | -3 |
590
+ | Documentation | -5 |
591
+
592
+ ### Agent Tier System
593
+
594
+ Each agent has tier variants for cost optimization:
595
+
596
+ | Agent | Low (Haiku) | Medium (Sonnet) | High (Opus) |
597
+ |-------|-------------|-----------------|-------------|
598
+ | explorer | explorer-low | explorer-medium | explorer |
599
+ | implementer | implementer-low | implementer-medium | implementer |
600
+ | architect | architect-low | architect-medium | architect |
601
+
602
+ ### Task Calls by Role
603
+
604
+ | Task Type | Model | Task Parameter |
605
+ |-----------|-------|----------------|
606
+ | Simple search | Haiku | `model: "haiku"` |
607
+ | Codebase exploration | Haiku/Sonnet | Auto-selected |
608
+ | Core implementation | Sonnet | `model: "sonnet"` |
609
+ | Test writing | Haiku | `model: "haiku"` |
610
+ | Architecture decisions | Opus | Main session |
611
+ | Final review | Opus | Main session |
612
+
613
+ ### External LLM Usage (When Enabled)
614
+
615
+ When external LLMs are enabled in `.claude/vibe/config.json`:
616
+
617
+ | Role | Method | Condition |
618
+ |------|--------|-----------|
619
+ | User direct query | `gpt.question`, `gemini.question` | Hook auto-handles |
620
+ | Internal orchestration | Call global script via Bash | Claude calls directly |
621
+
622
+ **User questions (Hook auto-handles):**
623
+ - `gpt.question` - GPT architecture consultation
624
+ - `gemini.question` - Gemini Q&A/consultation
625
+
626
+ **Claude internal calls (directly via Bash):**
627
+ ```bash
628
+ # Usage: node llm-orchestrate.js <provider> <mode> [systemPrompt] [prompt]
629
+ # - If systemPrompt omitted, uses default
630
+ # - If systemPrompt is "-", uses default and treats next argument as prompt
631
+
632
+ # [LLM_SCRIPT] = {{VIBE_PATH}}/hooks/scripts/llm-orchestrate.js
633
+
634
+ # GPT call (short prompt - CLI arg)
635
+ node "[LLM_SCRIPT]" gpt orchestrate-json "[question content]"
636
+
637
+ # Gemini call
638
+ node "[LLM_SCRIPT]" gemini orchestrate-json "[question content]"
639
+
640
+ # Custom system prompt usage
641
+ node "[LLM_SCRIPT]" gpt orchestrate-json "You are a code reviewer" "[question content]"
642
+
643
+ # Long prompt - use --input file (write JSON file first with Write tool)
644
+ # JSON format: {"prompt": "your prompt here"}
645
+ node "[LLM_SCRIPT]" gpt orchestrate-json --input "[SCRATCHPAD]/input.json"
646
+ ```
647
+
648
+ ### External LLM Fallback
649
+
650
+ **IMPORTANT**: When GPT/Gemini hook fails, Claude MUST handle the task directly:
651
+
652
+ **Fallback behavior**:
653
+ - Do NOT retry the external LLM call
654
+ - Claude handles the task using its own capabilities
655
+ - Continue with the implementation without interruption
656
+ - Log the fallback but don't block progress
657
+
658
+ ## Core Tools (Semantic Analysis & Memory)
659
+
660
+ Use core tools for accurate codebase understanding and session continuity.
661
+
662
+ ### Tool Invocation
663
+
664
+ All tools are called via:
665
+ ```bash
666
+ node -e "import('{{VIBE_PATH_URL}}/node_modules/@su-record/vibe/dist/tools/index.js').then(t => t.TOOL_NAME({...args}).then(r => console.log(r.content[0].text)))"
667
+ ```
668
+
669
+ ### Semantic Analysis Tools
670
+
671
+ | Tool | Purpose | Usage |
672
+ |------|---------|-------|
673
+ | `findSymbol` | Find symbol definitions | `{symbolName: 'functionName', searchPath: '.'}` |
674
+ | `findReferences` | Find all references | `{symbolName: 'functionName', searchPath: '.'}` |
675
+ | `analyzeComplexity` | Analyze code complexity | `{filePath: 'src/file.ts'}` |
676
+ | `validateCodeQuality` | Validate code quality | `{filePath: 'src/file.ts'}` |
677
+
678
+ **Example - Find symbol:**
679
+ ```bash
680
+ node -e "import('{{VIBE_PATH_URL}}/node_modules/@su-record/vibe/dist/tools/index.js').then(t => t.findSymbol({symbolName: 'login', searchPath: '.'}).then(r => console.log(r.content[0].text)))"
681
+ ```
682
+
683
+ ### Memory Tools
684
+
685
+ | Tool | Purpose | Usage |
686
+ |------|---------|-------|
687
+ | `saveMemory` | Save important decisions | `{key: 'decision-name', value: 'content', category: 'project'}` |
688
+ | `recallMemory` | Recall saved memory | `{key: 'decision-name'}` |
689
+ | `listMemories` | List all memories | `{category: 'project'}` |
690
+
691
+ **Example - Save important decision:**
692
+ ```bash
693
+ node -e "import('{{VIBE_PATH_URL}}/node_modules/@su-record/vibe/dist/tools/index.js').then(t => t.saveMemory({key: 'auth-pattern', value: 'Using JWT with refresh tokens', category: 'project'}).then(r => console.log(r.content[0].text)))"
694
+ ```
695
+
696
+ ### Session Management (Auto via Hooks)
697
+
698
+ - **Session start**: Hook auto-calls `startSession` to restore previous context
699
+ - **Context 80%+**: Hook auto-calls `autoSaveContext` to preserve state
700
+
701
+ ## Process
702
+
703
+ ### 1. Load SPEC + Feature
704
+
705
+ **Search order (check BOTH file AND folder):**
706
+
707
+ ```
708
+ Step 1: Check if SPLIT structure exists (folder)
709
+ 📁 .claude/vibe/specs/{feature-name}/ → Folder with _index.md + phase files
710
+ 📁 .claude/vibe/features/{feature-name}/ → Folder with _index.feature + phase files
711
+
712
+ Step 2: If no folder, check single file
713
+ 📄 .claude/vibe/specs/{feature-name}.md → Single SPEC file
714
+ 📄 .claude/vibe/features/{feature-name}.feature Single Feature file
715
+
716
+ Step 3: If neither exists → Error
717
+ ```
718
+
719
+ **Split structure (folder) detected:**
720
+ ```
721
+ 📁 .claude/vibe/specs/{feature-name}/
722
+ ├── _index.md → Master SPEC (read first for overview)
723
+ ├── phase-1-{name}.md → Phase 1 SPEC
724
+ ├── phase-2-{name}.md → Phase 2 SPEC
725
+ └── ...
726
+
727
+ 📁 .claude/vibe/features/{feature-name}/
728
+ ├── _index.feature → Master Feature (read first for scenario overview)
729
+ ├── phase-1-{name}.feature → Phase 1 scenarios
730
+ ├── phase-2-{name}.feature → Phase 2 scenarios
731
+ └── ...
732
+
733
+ Load _index.md first, then load phase files in order
734
+ Execute phases sequentially (or per --phase flag)
735
+ ```
736
+
737
+ **Single file detected:**
738
+ ```
739
+ 📄 .claude/vibe/specs/{feature-name}.md → SPEC (structure, constraints, context)
740
+ 📄 .claude/vibe/features/{feature-name}.feature → Feature (scenario = implementation unit)
741
+ ```
742
+
743
+ **Error if NEITHER file NOR folder found:**
744
+ ```
745
+ ❌ SPEC not found. Searched:
746
+ - .claude/vibe/specs/{feature-name}/ (folder)
747
+ - .claude/vibe/specs/{feature-name}.md (file)
748
+
749
+ Run /vibe.spec "{feature-name}" first.
750
+ ```
751
+
752
+ ### 1-1. Phase Isolation Protocol (Large SPEC Guard)
753
+
754
+ > **Problem**: Large SPECs (3+ phases, 5+ scenarios) overflow context — agent drifts from SPEC by Phase 3.
755
+ > **Solution**: Load only the current phase's SPEC section. Re-anchor before each scenario.
756
+
757
+ **Phase Isolation Rules (MANDATORY for 3+ phases):**
758
+
759
+ ```
760
+ ┌─────────────────────────────────────────────────────────────────┐
761
+ PHASE ISOLATION PROTOCOL │
762
+ │ │
763
+ │ ❌ WRONG: Load entire SPEC → implement all phases │
764
+ │ ✅ RIGHT: Load _index overview → per-phase load → implement │
765
+ │ │
766
+ Step A: Read _index.md (overview only phase list, REQ IDs) │
767
+ Step B: For each Phase N: │
768
+ │ 1. RE-READ Phase N SPEC section (every time, no memory) │
769
+ │ 2. RE-READ Phase N Feature scenarios │
770
+ │ 3. Extract Phase N scope: files, scenarios, requirements │
771
+ │ 4. Implement Phase N scenarios │
772
+ │ 5. Verify Phase N │
773
+ │ 6. Write Phase Checkpoint → .claude/vibe/checkpoints/ │
774
+ │ 7. DISCARD Phase N details from working memory │
775
+ │ Step C: Next Phase go to Step B │
776
+ └─────────────────────────────────────────────────────────────────┘
777
+ ```
778
+
779
+ **Phase Checkpoint Format** (`.claude/vibe/checkpoints/{feature}-phase-{N}.md`):
780
+
781
+ ```markdown
782
+ # Checkpoint: {feature} Phase {N}
783
+
784
+ ## Completed
785
+ - Scenario 1: {name} ✅
786
+ - Scenario 2: {name}
787
+
788
+ ## Files Changed
789
+ - src/auth.service.ts (added login(), validateToken())
790
+ - src/auth.controller.ts (POST /login, POST /refresh)
791
+
792
+ ## State for Next Phase
793
+ - Auth service exports: login(), logout(), validateToken(), refreshToken()
794
+ - JWT secret configured in .env (JWT_SECRET)
795
+ - Test baseline: 12 tests passing
796
+
797
+ ## Remaining Phases
798
+ - Phase {N+1}: {name} — {scenario count} scenarios
799
+ - Phase {N+2}: {name} — {scenario count} scenarios
800
+ ```
801
+
802
+ **SPEC Re-anchoring (Before EVERY scenario):**
803
+
804
+ ```
805
+ Before implementing Scenario X:
806
+ 1. Re-read the EXACT Given/When/Then from Feature file (not from memory!)
807
+ 2. Compare: "Am I about to implement what the SPEC says, or what I think it says?"
808
+ 3. If single-file SPEC: re-read only the current phase section (use line offsets)
809
+ 4. If split SPEC: re-read only phase-N-{name}.md
810
+ ```
811
+
812
+ **Scope Lock (Per Phase):**
813
+
814
+ ```
815
+ At Phase start, declare:
816
+ MODIFY: [list of files this phase will touch]
817
+ CREATE: [list of files this phase will create]
818
+ DO NOT TOUCH: everything else
819
+
820
+ If implementation requires files outside scope:
821
+ → STOP. Re-read SPEC. Is this actually needed?
822
+ If yes: add to scope with explicit justification
823
+ → If no: you're drifting. Return to SPEC.
824
+ ```
825
+
826
+ **Context Pressure Handling:**
827
+
828
+ | Context Level | Action |
829
+ |---------------|--------|
830
+ | < 50% | Normal execution |
831
+ | 50-70% | Save checkpoint, trim exploration results |
832
+ | 70%+ | Save checkpoint → `/new` → resume from checkpoint |
833
+ | Phase boundary | Always save checkpoint regardless of context level |
834
+
835
+ ### 2. Extract Scenario List
836
+
837
+ Extract all Scenarios from Feature file:
838
+
839
+ ```markdown
840
+ ## Scenarios to Implement
841
+
842
+ | # | Scenario | Status |
843
+ |---|----------|--------|
844
+ | 1 | Valid login success | ⬜ |
845
+ | 2 | Invalid password error | ⬜ |
846
+ | 3 | Email format validation | ⬜ |
847
+ | 4 | Password reset link | ⬜ |
848
+
849
+ Total: 4 scenarios
850
+ ```
851
+
852
+ ### 3. Scenario-by-Scenario Implementation (Core)
853
+
854
+ **For each scenario**:
855
+
856
+ ```
857
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
858
+ 🎯 Scenario 1/4: Valid login success
859
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
860
+
861
+ Given: User is registered
862
+ When: Login with valid email and password
863
+ Then: Login success + JWT token returned
864
+
865
+ [Step 1] Analyzing implementation...
866
+ - Required files: auth.service.ts, login.controller.ts
867
+ - Exploring related code...
868
+
869
+ [Step 2] Implementing...
870
+ ✅ auth.service.ts - Added login() method
871
+ login.controller.ts - POST /login endpoint
872
+
873
+ [Step 3] Verifying...
874
+ Given: Test user creation possible
875
+ ✅ When: Login API call succeeded
876
+ ✅ Then: JWT token return confirmed
877
+
878
+ ✅ Scenario 1 passed!
879
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
880
+ ```
881
+
882
+ **On failure**:
883
+
884
+ ```
885
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
886
+ 🎯 Scenario 2/4: Invalid password error
887
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
888
+
889
+ [Step 3] Verifying...
890
+ Given: Test user exists
891
+ ✅ When: Login attempt with wrong password
892
+ Then: "Invalid credentials" error message
893
+ Actual: "Error occurred" returned
894
+
895
+ [Auto-fix 1/3]
896
+ Cause: Error message not properly set
897
+ Fix: auth.service.ts line 42
898
+
899
+ [Re-verify]
900
+ Then: "Invalid credentials" error message
901
+
902
+ Scenario 2 passed! (1 fix)
903
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
904
+ ```
905
+
906
+ ---
907
+
908
+ ## **CRITICAL: Parallel Sub-Agent Execution**
909
+
910
+ > **MUST USE PARALLEL TASK CALLS** - This is REQUIRED, not optional.
911
+ > Sequential execution when parallel is possible = VIOLATION of this workflow.
912
+
913
+ ### Mandatory Parallel Exploration (Phase Start)
914
+
915
+ **BEFORE any implementation, you MUST launch these Task calls IN PARALLEL (single message, multiple tool calls):**
916
+
917
+ ```
918
+ ┌─────────────────────────────────────────────────────────────────┐
919
+ STEP 1: PARALLEL EXPLORATION (REQUIRED)
920
+ │ │
921
+ │ Launch ALL of these in ONE message: │
922
+ │ │
923
+ │ Task(haiku) ─┬─→ "Analyze related files in <context>" │
924
+ │ │ │
925
+ │ Task(haiku) ─┼─→ "Check dependencies and imports" │
926
+ │ │ │
927
+ Task(haiku) ─┴─→ "Find existing patterns and conventions"
928
+ │ │
929
+ │ [If GPT enabled] Bash: node "[LLM_SCRIPT]" gpt-codex orchestrate-json "[question]"
930
+ │ [If Gemini enabled] Bash: node "[LLM_SCRIPT]" gemini orchestrate-json "[question]"
931
+ └─────────────────────────────────────────────────────────────────┘
932
+
933
+ ↓ (wait for all to complete)
934
+ ┌─────────────────────────────────────────────────────────────────┐
935
+ │ STEP 2: SYNTHESIZE (Opus) │
936
+ │ - Review all exploration results │
937
+ - Decide implementation approach │
938
+ │ - Identify files to modify/create │
939
+ └─────────────────────────────────────────────────────────────────┘
940
+
941
+
942
+ ┌─────────────────────────────────────────────────────────────────┐
943
+ │ STEP 3: IMPLEMENT + BACKGROUND AGENTS (PARALLEL)
944
+ │ │
945
+ Main Agent (sonnet): │
946
+ └─→ Execute current phase implementation │
947
+ │ │
948
+ │ Background Agents (haiku, run_in_background=true): │
949
+ │ ├─→ Task: "Prepare Phase N+1 - analyze required files" │
950
+ │ ├─→ Task: "Pre-generate test cases for current implementation" │
951
+ │ └─→ Task: "Search for related types/interfaces needed" │
952
+ │ │
953
+ │ [ULTRAWORK] All 4 agents run simultaneously! │
954
+ └─────────────────────────────────────────────────────────────────┘
955
+
956
+ ↓ (main completes, check backgrounds)
957
+ ┌─────────────────────────────────────────────────────────────────┐
958
+ │ STEP 4: TEST + PHASE PIPELINING │
959
+ │ │
960
+ │ Current Phase: │
961
+ │ └─→ Task(haiku): Write tests using pre-generated cases │
962
+ │ │
963
+ │ Next Phase Prep (from background results): │
964
+ │ └─→ Already have file analysis, ready to start immediately │
965
+ └─────────────────────────────────────────────────────────────────┘
966
+ ```
967
+
968
+ ### Parallel Task Call Pattern (MUST FOLLOW)
969
+
970
+ **Correct - Single message with multiple parallel Tasks:**
971
+ ```
972
+ <message>
973
+ Task(haiku, "Analyze src/components/ for existing patterns")
974
+ Task(haiku, "Check package.json dependencies")
975
+ Task(haiku, "Find usage of similar features in codebase")
976
+ </message>
977
+ → All 3 run simultaneously, ~3x faster
978
+ ```
979
+
980
+ **WRONG - Sequential calls (DO NOT DO THIS):**
981
+ ```
982
+ <message>Task(haiku, "Analyze...")</message>
983
+ <message>Task(haiku, "Check...")</message>
984
+ <message>Task(haiku, "Find...")</message>
985
+ 3x slower, wastes time
986
+ ```
987
+
988
+ ### Background Agent Pattern (ULTRAWORK) via Orchestrator
989
+
990
+ **Launch background agents for next phase via Orchestrator:**
991
+ ```bash
992
+ # Start background agent (doesn't block)
993
+ node -e "import('{{VIBE_PATH_URL}}/node_modules/@su-record/vibe/dist/infra/orchestrator/index.js').then(o => o.runAgent('Phase 2 prep: Analyze auth API endpoints', 'phase2-prep').then(r => console.log(r.content[0].text)))"
994
+
995
+ # Multiple backgrounds in parallel
996
+ node -e "import('{{VIBE_PATH_URL}}/node_modules/@su-record/vibe/dist/infra/orchestrator/index.js').then(async o => {
997
+ await Promise.all([
998
+ o.runAgent('Phase 2 prep: Analyze auth API endpoints', 'phase2-prep'),
999
+ o.runAgent('Pre-generate test cases for login form', 'test-prep'),
1000
+ o.runAgent('Find existing validation patterns', 'pattern-finder')
1001
+ ]);
1002
+ console.log('All background agents started');
1003
+ })"
1004
+ ```
1005
+
1006
+ **Check background agent status:**
1007
+ ```bash
1008
+ node -e "import('{{VIBE_PATH_URL}}/node_modules/@su-record/vibe/dist/infra/orchestrator/index.js').then(o => console.log(o.status().content[0].text))"
1009
+ ```
1010
+
1011
+ **Get result when ready:**
1012
+ ```bash
1013
+ node -e "import('{{VIBE_PATH_URL}}/node_modules/@su-record/vibe/dist/infra/orchestrator/index.js').then(o => o.getResult('SESSION_ID').then(r => console.log(r.content[0].text)))"
1014
+ ```
1015
+
1016
+ **Why Background Agents Matter:**
1017
+
1018
+ | Without Background | With Background |
1019
+ |--------------------|-----------------|
1020
+ | Phase 1: 60s | Phase 1: 60s (+ backgrounds running) |
1021
+ | Phase 2 prep: 20s | Phase 2 prep: 0s (already done!) |
1022
+ | Phase 2: 60s | Phase 2: 60s |
1023
+ | **Total: 140s** | **Total: 120s** |
1024
+
1025
+ For 5 phases: 4 × 20s saved = **80s faster**
1026
+
1027
+ ### Why Parallel Matters
1028
+
1029
+ | Approach | Time | Cache Benefit |
1030
+ |----------|------|---------------|
1031
+ | Sequential (3 Tasks) | ~30s | Cache cold on each |
1032
+ | **Parallel (3 Tasks)** | **~10s** | **Cache warmed once, shared** |
1033
+
1034
+ core ProjectCache (LRU) caches ts-morph parsing results. Parallel calls share the warmed cache.
1035
+
1036
+ ### UI/UX Design Intelligence (Auto-triggered before Phase 1)
1037
+
1038
+ > **조건**: SPEC 또는 Feature에 UI/UX 키워드 포함 시 자동 실행
1039
+ > **비활성화**: `.claude/vibe/config.json`에 `"uiUxAnalysis": false` 설정
1040
+
1041
+ **Phase 1 시작 전, 2개 에이전트 자동 실행:**
1042
+
1043
+ | Agent | Condition | Role |
1044
+ |-------|-----------|------|
1045
+ | ④ ui-stack-implementer | **항상 실행** | 프레임워크별 컴포넌트 가이드라인 제공 |
1046
+ | ui-dataviz-advisor | **조건부** (chart/dashboard/visualization 키워드) | 차트/시각화 라이브러리 추천 |
1047
+
1048
+ **실행 방법:**
1049
+
1050
+ ```text
1051
+ # ④ 항상 실행 (Haiku)
1052
+ Task(subagent_type="ui-stack-implementer",
1053
+ prompt="Provide implementation guidelines for project '{project}' using {detected_stack}. Use core_ui_stack_search for framework-specific patterns.")
1054
+
1055
+ # 조건부 실행 (Haiku) — SPEC에 차트/대시보드/시각화 키워드 포함 시
1056
+ Task(subagent_type="ui-dataviz-advisor",
1057
+ prompt="Recommend data visualization approach for project '{project}'. Use core_ui_search for chart types and react-performance patterns.")
1058
+ ```
1059
+
1060
+ **디자인 시스템 자동 참조:**
1061
+ - `.claude/vibe/design-system/{project}/MASTER.md` 존재 시 자동 로드
1062
+ - 구현 에이전트가 CSS 변수, 폰트, 색상 팔레트를 직접 참조
1063
+ - 페이지별 오버라이드 `pages/{page}.md` 존재 우선 적용
1064
+
1065
+ ### Phase Execution Flow (ULTRAWORK Pipeline)
1066
+
1067
+ ```
1068
+ Phase N Start
1069
+
1070
+ ├─→ [PARALLEL] Task(haiku) × 3: Exploration
1071
+ │ - Related code analysis
1072
+ - Dependency check
1073
+ │ - Pattern discovery
1074
+
1075
+ ↓ (all complete)
1076
+
1077
+ ├─→ Opus: Synthesize and decide
1078
+
1079
+ ├─→ [PARALLEL PIPELINE] ←── KEY SPEED OPTIMIZATION
1080
+ │ │
1081
+ │ ├─→ Main: Task(sonnet) Implementation
1082
+ │ │
1083
+ │ └─→ Background (run_in_background=true):
1084
+ │ ├─→ Task(haiku): Phase N+1 file analysis
1085
+ │ ├─→ Task(haiku): Test case preparation
1086
+ │ └─→ Task(haiku): Type/interface lookup
1087
+
1088
+ (main completes)
1089
+
1090
+ ├─→ Task(haiku): Tests (uses pre-generated cases)
1091
+
1092
+
1093
+ Phase N Complete
1094
+
1095
+ ↓ (Background results ready - NO WAIT for Phase N+1 exploration!)
1096
+
1097
+ Phase N+1 Start (IMMEDIATE - exploration already done!)
1098
+ ```
1099
+
1100
+ **Speed Comparison:**
1101
+
1102
+ | Mode | Phase Time | 5 Phases Total |
1103
+ |------|------------|----------------|
1104
+ | Sequential | ~2min/phase | ~10min |
1105
+ | Parallel Exploration | ~1.5min/phase | ~7.5min |
1106
+ | **ULTRAWORK Pipeline** | **~1min/phase** | **~5min** |
1107
+
1108
+ **Why Pipeline is Faster:**
1109
+ - Background agents prepare next phase WHILE current phase implements
1110
+ - No idle time between phases
1111
+ - Test cases pre-generated during implementation
1112
+ - Cache stays warm across parallel tasks
1113
+
1114
+ ---
1115
+
1116
+ ### Agent Teams Dev Team
1117
+
1118
+ > **Agent Teams**: 에이전트들이 팀을 이루어 서로 소통하며 구현합니다.
1119
+ > 설정: `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1` + `teammateMode: in-process` (`~/.claude/settings.json` 전역 — postinstall 자동 설정)
1120
+
1121
+ **팀 구성:**
1122
+
1123
+ | 팀원 | 역할 |
1124
+ |------|------|
1125
+ | architect (리더) | 설계 결정, 구현 방향 조율, SPEC 준수 검증, 팀 합의 주도 |
1126
+ | implementer | 핵심 비즈니스 로직 구현, architect 설계를 따라 코드 작성 |
1127
+ | tester | 구현 완료 즉시 테스트 작성, 실패 시 implementer에 피드백 |
1128
+ | security-reviewer | 실시간 보안 취약점 검증, 블로킹 이슈 식별 |
1129
+
1130
+ **실행 순서:**
1131
+
1132
+ 1. `TeamCreate(team_name="dev-{feature}")` — 팀 + 공유 태스크 리스트 생성
1133
+ 2. 4개 팀원 병렬 생성 — 각각 `Task(team_name=..., name=..., subagent_type=...)` 으로 spawn
1134
+ 3. architect가 SPEC Phase를 분석하여 구현 계획 수립 → TaskList에 작업 등록
1135
+ 4. 팀원들이 TaskList에서 작업을 claim하고, SendMessage로 실시간 협업
1136
+ 5. 모든 시나리오 검증 완료 → 팀원 shutdown_request → TeamDelete로 정리
1137
+
1138
+ **팀원 spawn 패턴:**
1139
+
1140
+ ```text
1141
+ TeamCreate(team_name="dev-{feature}", description="Implementation team for {feature} Phase {N}")
1142
+
1143
+ # 4개 병렬 spawn
1144
+ Task(team_name="dev-{feature}", name="architect", subagent_type="architect",
1145
+ prompt="구현 리더. Phase {N}의 SPEC을 분석하고 구현 계획을 수립하세요.
1146
+ SPEC: {spec_content}
1147
+ Feature Scenarios: {scenarios}
1148
+ 역할: 설계 결정, 구현 방향 조율, 팀원 간 충돌 해결, SPEC 준수 검증.
1149
+ TaskList에 구현 작업을 등록하세요. implementer에게 설계를 SendMessage로 전달하세요.
1150
+ 모든 시나리오가 통과할 때까지 팀을 조율하세요.")
1151
+
1152
+ Task(team_name="dev-{feature}", name="implementer", subagent_type="implementer",
1153
+ mode="bypassPermissions",
1154
+ prompt="구현 코드 담당. SPEC: {spec_content}
1155
+ 역할: architect의 설계를 따라 프로덕션 코드 작성.
1156
+ architect에게서 설계를 받으면 구현을 시작하세요.
1157
+ 컴포넌트 구현 완료 tester에게 SendMessage로 테스트 요청하세요.
1158
+ security-reviewer의 블로킹 이슈는 즉시 수정하세요.
1159
+ TaskList에서 구현 작업을 claim하세요.")
1160
+
1161
+ Task(team_name="dev-{feature}", name="tester", subagent_type="tester",
1162
+ mode="bypassPermissions",
1163
+ prompt="구현 테스트 담당. SPEC: {spec_content}
1164
+ 역할: implementer가 완료한 컴포넌트부터 즉시 테스트 작성.
1165
+ 구현 전체를 기다리지 말고 컴포넌트 단위로 점진적 테스트하세요.
1166
+ 테스트 실패 implementer에게 SendMessage로 피드백하세요.
1167
+ edge case 발견 시 architect에게 설계 검토를 요청하세요.
1168
+ TaskList에서 테스트 작업을 claim하세요.")
1169
+
1170
+ Task(team_name="dev-{feature}", name="security-reviewer", subagent_type="security-reviewer",
1171
+ mode="bypassPermissions",
1172
+ prompt="구현 팀 보안 담당. SPEC: {spec_content}
1173
+ 역할: 구현 코드의 보안 취약점 실시간 검증.
1174
+ 보안 이슈는 BLOCKING implementer에게 SendMessage로 즉시 수정 요청하세요.
1175
+ 심각한 설계 결함 발견 architect에게 SendMessage로 알리세요.
1176
+ TaskList에서 보안 검증 작업을 claim하세요.")
1177
+ ```
1178
+
1179
+ **팀원 간 통신 예시:**
1180
+
1181
+ ```text
1182
+ architect implementer: "Repository 패턴으로 데이터 접근 계층 분리해서 구현해주세요. 인터페이스는 TaskList에 등록했습니다"
1183
+ implementer → tester: "LoginService 구현 완료. 정상/실패/잠금 시나리오 테스트 요청합니다"
1184
+ security-reviewer → implementer: "SQL injection 위험: raw query 사용 감지. parameterized query로 즉시 수정 필요"
1185
+ tester architect: "edge case 3건 실패 ( 입력, 특수문자, 동시 요청). 설계 검토 요청합니다"
1186
+ architect broadcast: "Phase {N} 모든 시나리오 통과 확인. 구현 완료합니다"
1187
+ ```
1188
+
1189
+ **팀 모드 vs 기존 병렬 모드 비교:**
1190
+
1191
+ | 측면 | 기존 병렬 모드 | Agent Teams |
1192
+ |------|---------------|-------------|
1193
+ | 통신 | 결과만 수집 | 실시간 상호 피드백 |
1194
+ | 테스트 | 구현 별도 단계 | 구현과 동시 진행 |
1195
+ | 보안 | 사후 리뷰 | 실시간 검증 |
1196
+ | 설계 변경 | 메인 에이전트만 결정 | architect 주도 합의 |
1197
+ | 오류 복구 | 재시도 루프 | 팀 내 즉시 피드백 |
1198
+
1199
+ **활성화 조건 (Dev Team Full — 4명):**
1200
+ - ULTRAWORK 모드 + 3개 이상 시나리오
1201
+ - 또는 복잡도 점수 20+ (High)
1202
+
1203
+ ### Agent Teams — Lite Team (Normal Mode)
1204
+
1205
+ > **일반 모드에서도 협업**. Dev Team의 축소 버전으로, 3개 이상 시나리오 시 자동 활성화.
1206
+ > security-reviewer를 제외한 architect + implementer + tester 3명 구성.
1207
+
1208
+ **팀 구성:**
1209
+
1210
+ | 팀원 | 역할 |
1211
+ |------|------|
1212
+ | architect (리더) | 설계 결정, 시나리오 분석, 구현 방향 조율 |
1213
+ | implementer | 핵심 비즈니스 로직 구현 |
1214
+ | tester | 구현 완료 즉시 테스트 작성, 실패 시 피드백 |
1215
+
1216
+ **spawn 패턴:**
1217
+
1218
+ ```text
1219
+ TeamCreate(team_name="lite-{feature}", description="Lite implementation team for {feature} Phase {N}")
1220
+
1221
+ Task(team_name="lite-{feature}", name="architect", subagent_type="architect",
1222
+ prompt="Lite 리더. Phase {N}의 SPEC을 분석하고 구현 계획을 수립하세요.
1223
+ SPEC: {spec_content}
1224
+ Feature Scenarios: {scenarios}
1225
+ 역할: 설계 결정, 구현 방향 조율. TaskList에 작업을 등록하세요.
1226
+ implementer에게 설계를 SendMessage로 전달하세요.")
1227
+
1228
+ Task(team_name="lite-{feature}", name="implementer", subagent_type="implementer",
1229
+ mode="bypassPermissions",
1230
+ prompt="Lite 팀 코드 담당. SPEC: {spec_content}
1231
+ 역할: architect의 설계를 따라 프로덕션 코드 작성.
1232
+ 완료 시 tester에게 SendMessage로 테스트 요청하세요.")
1233
+
1234
+ Task(team_name="lite-{feature}", name="tester", subagent_type="tester",
1235
+ mode="bypassPermissions",
1236
+ prompt="Lite 팀 테스트 담당. SPEC: {spec_content}
1237
+ 역할: implementer가 완료한 컴포넌트부터 즉시 테스트 작성.
1238
+ 테스트 실패 시 implementer에게 SendMessage로 피드백하세요.")
1239
+ ```
1240
+
1241
+ **활성화 조건 (Lite Team 3명):**
1242
+ - 일반 모드 + 3개 이상 시나리오
1243
+ - 복잡도 점수 8-19 (Medium)
1244
+ - 단순 구현(1-2 파일, 시나리오 2개 이하)에서는 기존 병렬 모드 유지
1245
+
1246
+ **팀 선택 기준:**
1247
+
1248
+ | 조건 | |
1249
+ |------|-----|
1250
+ | 시나리오 1-2개, 파일 1-2 | 기존 병렬 모드 (팀 없음) |
1251
+ | 시나리오 3개+, 일반 모드 | **Lite Team (3명)** |
1252
+ | ULTRAWORK 또는 복잡도 20+ | Dev Team Full (4명) |
1253
+
1254
+ ### Agent Teams — Review Team
1255
+
1256
+ > P1/P2 이슈 교차 검증을 위한 보안+아키텍처+성능+단순성 전문 리뷰 팀.
1257
+ > `/vibe.review` 시 P1/P2 이슈가 발견되면 자동 활성화.
1258
+
1259
+ **팀 구성:**
1260
+
1261
+ | 팀원 | 역할 |
1262
+ |------|------|
1263
+ | security-reviewer (리더) | 보안 이슈 우선순위 결정, 교차 검증 주도, 오탐 제거 |
1264
+ | architecture-reviewer | 아키텍처 위반 검증, 설계 패턴 평가 |
1265
+ | performance-reviewer | 성능 병목 검증, N+1 쿼리/메모리 누수 확인 |
1266
+ | simplicity-reviewer | 과도한 복잡성 검증, 불필요한 추상화 식별 |
1267
+
1268
+ **spawn 패턴:**
1269
+
1270
+ ```text
1271
+ TeamCreate(team_name="review-{feature}", description="Cross-validation review team for {feature}")
1272
+
1273
+ Task(team_name="review-{feature}", name="security-reviewer", subagent_type="security-reviewer",
1274
+ mode="bypassPermissions",
1275
+ prompt="Review team leader. Cross-validate P1/P2 issues found in parallel review.
1276
+ Files: {changed_files}
1277
+ Found issues: {p1_p2_issues}
1278
+ Role: Verify each P1/P2 issue is genuine (not false positive). Prioritize by actual impact.
1279
+ Send disputed findings to relevant reviewer for confirmation via SendMessage.")
1280
+
1281
+ Task(team_name="review-{feature}", name="architecture-reviewer", subagent_type="architecture-reviewer",
1282
+ mode="bypassPermissions",
1283
+ prompt="Review team architecture expert. Validate architecture-related findings.
1284
+ Files: {changed_files}
1285
+ Role: Confirm or dispute architecture violations. Check SOLID principles and layer boundaries.")
1286
+
1287
+ Task(team_name="review-{feature}", name="performance-reviewer", subagent_type="performance-reviewer",
1288
+ mode="bypassPermissions",
1289
+ prompt="Review team performance expert. Validate performance-related findings.
1290
+ Files: {changed_files}
1291
+ Role: Confirm or dispute performance issues. Run complexity analysis on flagged code.")
1292
+
1293
+ Task(team_name="review-{feature}", name="simplicity-reviewer", subagent_type="simplicity-reviewer",
1294
+ mode="bypassPermissions",
1295
+ prompt="Review team simplicity advocate. Challenge over-engineering findings.
1296
+ Files: {changed_files}
1297
+ Role: Verify YAGNI violations. Confirm or dispute unnecessary abstraction flags.")
1298
+ ```
1299
+
1300
+ **팀원 통신 예시:**
1301
+
1302
+ ```text
1303
+ security-reviewer → architecture-reviewer: "SQL injection finding in users.py:42 — is this pattern used elsewhere?"
1304
+ architecture-reviewer security-reviewer: "Confirmed. Same pattern in orders.py:78. Elevate to P1."
1305
+ performance-reviewer security-reviewer: "N+1 query finding is false positive — already uses prefetch_related."
1306
+ security-reviewer → broadcast: "Review complete. 2 P1 confirmed, 1 P2 downgraded to P3."
1307
+ ```
1308
+
1309
+ **활성화 조건:**
1310
+
1311
+ - `/vibe.review` 실행 P1 또는 P2 이슈 2개 이상 발견 시
1312
+ - Agent Teams 환경변수 활성화 상태
1313
+
1314
+ ### Agent Teams Debug Team
1315
+
1316
+ > 빌드/테스트 실패 시 아키텍트 진단 → 구현자 수정 → 테스터 검증 사이클.
1317
+ > UltraQA 3회 실패 진입 시 또는 빌드 실패 3회+ 시 자동 활성화.
1318
+
1319
+ **팀 구성:**
1320
+
1321
+ | 팀원 | 역할 |
1322
+ |------|------|
1323
+ | architect (리더) | 근본 원인 진단, 수정 방향 설계, 아키텍처 레벨 문제 식별 |
1324
+ | implementer | architect 진단에 따라 최소 diff 수정 적용 |
1325
+ | tester | 수정 즉시 테스트 실행, 회귀 검증 |
1326
+
1327
+ **spawn 패턴:**
1328
+
1329
+ ```text
1330
+ TeamCreate(team_name="debug-{feature}", description="Debug team for {feature} build/test failure")
1331
+
1332
+ Task(team_name="debug-{feature}", name="architect", subagent_type="architect",
1333
+ prompt="Debug team leader. Diagnose root cause of build/test failure.
1334
+ Error: {error_output}
1335
+ Failed files: {failed_files}
1336
+ Previous attempts: {attempt_history}
1337
+ Role: Analyze error, identify root cause (not symptoms). Design minimal fix.
1338
+ Send diagnosis to implementer via SendMessage. If same failure 3x, escalate to user.")
1339
+
1340
+ Task(team_name="debug-{feature}", name="implementer", subagent_type="implementer",
1341
+ mode="bypassPermissions",
1342
+ prompt="Debug team fixer. Apply minimal-diff fixes based on architect diagnosis.
1343
+ Role: Wait for architect diagnosis. Apply ONLY the specific fix recommended.
1344
+ Do NOT refactor surrounding code. Notify tester when fix is applied.")
1345
+
1346
+ Task(team_name="debug-{feature}", name="tester", subagent_type="tester",
1347
+ mode="bypassPermissions",
1348
+ prompt="Debug team verifier. Run tests after each fix to verify resolution.
1349
+ Role: Wait for implementer fix notification. Run failing tests.
1350
+ Report results to architect. If still failing, provide detailed error output.")
1351
+ ```
1352
+
1353
+ **활성화 조건:**
1354
+
1355
+ - 동일 빌드/테스트 실패 3회 이상
1356
+ - UltraQA `architecture_question` 상태 진입 시
1357
+
1358
+ ### Agent Teams — Research Team
1359
+
1360
+ > `/vibe.spec` Step 3 리서치 단계에서 4개 전문 리서치 에이전트가 팀으로 협업.
1361
+ > 리서치 결과 교차 검증 충돌 해결.
1362
+
1363
+ **팀 구성:**
1364
+
1365
+ | 팀원 | 역할 |
1366
+ |------|------|
1367
+ | best-practices-agent (리더) | 베스트 프랙티스 수집, 리서치 통합, 충돌 해결 |
1368
+ | security-advisory-agent | 보안 취약점 조사, CVE 확인, 보안 권장사항 |
1369
+ | codebase-patterns-agent | 기존 코드베이스 패턴 분석, 유사 구현 참조 |
1370
+ | framework-docs-agent | 프레임워크 최신 문서 확인, API 변경사항 추적 |
1371
+
1372
+ **spawn 패턴:**
1373
+
1374
+ ```text
1375
+ TeamCreate(team_name="research-{feature}", description="Research team for {feature} SPEC")
1376
+
1377
+ Task(team_name="research-{feature}", name="best-practices-agent", subagent_type="best-practices-agent",
1378
+ prompt="Research team leader. Coordinate research for {feature} SPEC.
1379
+ Tech stack: {tech_stack}
1380
+ Requirements: {requirements}
1381
+ Role: Collect best practices. Integrate findings from all researchers.
1382
+ Resolve conflicting recommendations. Produce unified research summary.")
1383
+
1384
+ Task(team_name="research-{feature}", name="security-advisory-agent", subagent_type="security-advisory-agent",
1385
+ prompt="Research team security specialist. Check security advisories for {feature}.
1386
+ Tech stack: {tech_stack}
1387
+ Role: Check CVEs for dependencies. Identify security patterns to follow.
1388
+ Share findings with best-practices-agent for integration.")
1389
+
1390
+ Task(team_name="research-{feature}", name="codebase-patterns-agent", subagent_type="codebase-patterns-agent",
1391
+ prompt="Research team codebase analyst. Analyze existing patterns for {feature}.
1392
+ Project path: {project_path}
1393
+ Role: Find similar implementations in codebase. Extract conventions and patterns.
1394
+ Share findings with best-practices-agent.")
1395
+
1396
+ Task(team_name="research-{feature}", name="framework-docs-agent", subagent_type="framework-docs-agent",
1397
+ prompt="Research team docs specialist. Check latest framework docs for {feature}.
1398
+ Tech stack: {tech_stack}
1399
+ Role: Verify API usage against latest docs. Check for breaking changes.
1400
+ Share findings with best-practices-agent.")
1401
+ ```
1402
+
1403
+ **활성화 조건:**
1404
+
1405
+ - `/vibe.spec` Step 3 리서치 단계
1406
+ - Agent Teams 환경변수 활성화 상태
1407
+
1408
+ ### Agent Teams — Security Team
1409
+
1410
+ > 보안 민감 코드 변경 시 전문 보안 검증 팀.
1411
+ > 인증, 권한, 결제, 개인정보 관련 코드 변경 감지 시 자동 활성화.
1412
+
1413
+ **팀 구성:**
1414
+
1415
+ | 팀원 | 역할 |
1416
+ |------|------|
1417
+ | security-reviewer (리더) | OWASP Top 10 검증, 보안 이슈 우선순위 결정 |
1418
+ | data-integrity-reviewer | 데이터 무결성, 트랜잭션 관리, 입력 검증 |
1419
+ | security-advisory-agent | 사용 라이브러리 CVE 확인, 보안 패치 확인 |
1420
+ | tester | 보안 테스트 케이스 작성, 침투 테스트 시나리오 검증 |
1421
+
1422
+ **spawn 패턴:**
1423
+
1424
+ ```text
1425
+ TeamCreate(team_name="security-{feature}", description="Security audit team for {feature}")
1426
+
1427
+ Task(team_name="security-{feature}", name="security-reviewer", subagent_type="security-reviewer",
1428
+ mode="bypassPermissions",
1429
+ prompt="Security team leader. Comprehensive security audit for {feature}.
1430
+ Files: {changed_files}
1431
+ Role: OWASP Top 10 check. XSS, CSRF, SQL injection, auth bypass.
1432
+ Coordinate with data-integrity-reviewer for data flow analysis.
1433
+ Any P1 finding blocks merge notify team immediately.")
1434
+
1435
+ Task(team_name="security-{feature}", name="data-integrity-reviewer", subagent_type="data-integrity-reviewer",
1436
+ mode="bypassPermissions",
1437
+ prompt="Security team data specialist. Verify data integrity for {feature}.
1438
+ Files: {changed_files}
1439
+ Role: Check transaction management, input validation, data sanitization.
1440
+ Report findings to security-reviewer.")
1441
+
1442
+ Task(team_name="security-{feature}", name="security-advisory-agent", subagent_type="security-advisory-agent",
1443
+ prompt="Security team advisory specialist. Check dependencies for {feature}.
1444
+ Role: Scan for known CVEs in project dependencies. Check security advisories.
1445
+ Report critical findings to security-reviewer.")
1446
+
1447
+ Task(team_name="security-{feature}", name="tester", subagent_type="tester",
1448
+ mode="bypassPermissions",
1449
+ prompt="Security team test specialist. Write security-focused tests for {feature}.
1450
+ Files: {changed_files}
1451
+ Role: Write tests for auth bypass, injection, permission escalation.
1452
+ Report test results to security-reviewer.")
1453
+ ```
1454
+
1455
+ **활성화 조건:**
1456
+
1457
+ - auth, payment, user-data, crypto 관련 파일 변경 감지 시
1458
+ - 또는 수동으로 `security` 키워드 지정 시
1459
+
1460
+ ### Agent Teams — Migration Team
1461
+
1462
+ > 프레임워크/라이브러리 마이그레이션 전문 팀.
1463
+ > 대규모 의존성 업그레이드, 프레임워크 전환 활성화.
1464
+
1465
+ **팀 구성:**
1466
+
1467
+ | 팀원 | 역할 |
1468
+ |------|------|
1469
+ | architect (리더) | 마이그레이션 전략 설계, 호환성 분석, 단계별 계획 |
1470
+ | implementer | 코드 변환 실행, API 변경 적용 |
1471
+ | tester | 마이그레이션 후 회귀 테스트, 호환성 검증 |
1472
+ | build-error-resolver | 빌드 에러 즉시 해결, 타입 에러 수정 |
1473
+
1474
+ **spawn 패턴:**
1475
+
1476
+ ```text
1477
+ TeamCreate(team_name="migration-{feature}", description="Migration team for {feature}")
1478
+
1479
+ Task(team_name="migration-{feature}", name="architect", subagent_type="architect",
1480
+ prompt="Migration team leader. Plan migration strategy for {feature}.
1481
+ From: {current_version}
1482
+ To: {target_version}
1483
+ Role: Analyze breaking changes. Create step-by-step migration plan.
1484
+ Assign file groups to implementer. Monitor build-error-resolver for blockers.")
1485
+
1486
+ Task(team_name="migration-{feature}", name="implementer", subagent_type="implementer",
1487
+ mode="bypassPermissions",
1488
+ prompt="Migration team implementer. Execute code migration for {feature}.
1489
+ Role: Apply migration changes per architect plan. Work file-by-file.
1490
+ Notify tester after each file group. Report blockers to architect.")
1491
+
1492
+ Task(team_name="migration-{feature}", name="tester", subagent_type="tester",
1493
+ mode="bypassPermissions",
1494
+ prompt="Migration team tester. Verify migration correctness for {feature}.
1495
+ Role: Run existing tests after each migration step. Add new tests for changed APIs.
1496
+ Report regressions to implementer and architect.")
1497
+
1498
+ Task(team_name="migration-{feature}", name="build-error-resolver", subagent_type="build-error-resolver",
1499
+ mode="bypassPermissions",
1500
+ prompt="Migration team build fixer. Resolve build errors during {feature} migration.
1501
+ Role: Monitor build output. Apply minimal-diff type fixes for migration errors.
1502
+ Notify implementer of patterns requiring broader changes.")
1503
+ ```
1504
+
1505
+ **활성화 조건:**
1506
+
1507
+ - package.json 주요 의존성 버전 변경 감지 시
1508
+ - 또는 수동으로 `migration` 키워드 지정 시
1509
+
1510
+ ### Agent Teams Fullstack Team
1511
+
1512
+ > Frontend + Backend 동시 변경이 필요한 풀스택 기능 구현 팀.
1513
+ > API 엔드포인트 + UI 컴포넌트를 동시에 개발.
1514
+
1515
+ **팀 구성:**
1516
+
1517
+ | 팀원 | 역할 |
1518
+ |------|------|
1519
+ | architect (리더) | API 인터페이스 설계, frontend/backend 분업 조율 |
1520
+ | implementer-backend | Backend API, 데이터베이스, 서비스 로직 구현 |
1521
+ | implementer-frontend | Frontend UI, 상태 관리, API 연동 구현 |
1522
+ | tester | E2E 테스트, API 테스트, 통합 테스트 |
1523
+
1524
+ **spawn 패턴:**
1525
+
1526
+ ```text
1527
+ TeamCreate(team_name="fullstack-{feature}", description="Fullstack team for {feature}")
1528
+
1529
+ Task(team_name="fullstack-{feature}", name="architect", subagent_type="architect",
1530
+ prompt="Fullstack team leader. Design API contract for {feature}.
1531
+ SPEC: {spec_content}
1532
+ Role: Define API endpoints (request/response schemas). Design data models.
1533
+ Share API contract with both implementers. Coordinate integration timing.")
1534
+
1535
+ Task(team_name="fullstack-{feature}", name="implementer-backend", subagent_type="implementer",
1536
+ mode="bypassPermissions",
1537
+ prompt="Fullstack team backend developer. Implement API for {feature}.
1538
+ SPEC: {spec_content}
1539
+ Role: Implement API endpoints per architect's contract. Create data models and services.
1540
+ Notify implementer-frontend when endpoints are ready for integration.
1541
+ Share API response samples with tester.")
1542
+
1543
+ Task(team_name="fullstack-{feature}", name="implementer-frontend", subagent_type="implementer",
1544
+ mode="bypassPermissions",
1545
+ prompt="Fullstack team frontend developer. Implement UI for {feature}.
1546
+ SPEC: {spec_content}
1547
+ Role: Build UI components and pages per SPEC. Use architect's API contract for types.
1548
+ Start with mock data, switch to real API when backend notifies readiness.
1549
+ Notify tester when UI is ready for E2E testing.")
1550
+
1551
+ Task(team_name="fullstack-{feature}", name="tester", subagent_type="tester",
1552
+ mode="bypassPermissions",
1553
+ prompt="Fullstack team tester. Write comprehensive tests for {feature}.
1554
+ SPEC: {spec_content}
1555
+ Role: Write API tests (after backend ready). Write E2E tests (after frontend ready).
1556
+ Test API contract conformance. Report integration issues to architect.")
1557
+ ```
1558
+
1559
+ **활성화 조건:**
1560
+
1561
+ - SPEC에 frontend + backend 파일이 모두 포함된 경우
1562
+ - 또는 수동으로 `fullstack` 키워드 지정 시
1563
+
1564
+ ---
1565
+
1566
+ 1. **Related code analysis**: Task(haiku) explores `<context>` related code
1567
+ 2. **File creation/modification**: Task(sonnet) implements per `<output_format>`
1568
+ 3. **Constraint compliance**: Check `<constraints>`
1569
+ 4. **Run verification**: Execute verification commands
1570
+
1571
+ ### 4. Brand Assets Generation (Optional)
1572
+
1573
+ When starting a **new project** with brand context in SPEC, auto-generate app icons and favicons:
1574
+
1575
+ ```
1576
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1577
+ 🎨 BRAND ASSETS GENERATION
1578
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1579
+
1580
+ [Check] Brand assets exist? → Skip if favicon.ico exists
1581
+ [Check] Gemini API configured? → Required for image generation
1582
+ [Check] SPEC has brand context? → Extract app name, colors, style
1583
+
1584
+ [Generate] Creating app icon with Gemini Image API...
1585
+ - Prompt: "App icon for [AppName], [style], [color]..."
1586
+ - Generated: 512x512 master icon
1587
+
1588
+ [Resize] Creating platform variants...
1589
+ ✅ favicon.ico (16/32/48)
1590
+ favicon-16x16.png
1591
+ favicon-32x32.png
1592
+ apple-touch-icon.png (180x180)
1593
+ ✅ android-chrome-192x192.png
1594
+ ✅ android-chrome-512x512.png
1595
+ site.webmanifest
1596
+
1597
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1598
+ Brand assets generated in public/
1599
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1600
+ ```
1601
+
1602
+ **SPEC Brand Context Example:**
1603
+
1604
+ ```xml
1605
+ <context>
1606
+ Brand:
1607
+ - App Name: MyApp
1608
+ - Primary Color: #2F6BFF
1609
+ - Style: Modern, minimalist, flat design
1610
+ - Icon Concept: Abstract geometric shape
1611
+ </context>
1612
+ ```
1613
+
1614
+ **Trigger Conditions:**
1615
+ - First `/vibe.run` execution (no existing icons)
1616
+ - SPEC contains brand/design context
1617
+ - Gemini API key configured (`vibe gemini auth`)
1618
+
1619
+ **Manual Generation:**
1620
+ ```bash
1621
+ # [LLM_SCRIPT] = {{VIBE_PATH}}/hooks/scripts/llm-orchestrate.js
1622
+ node "[LLM_SCRIPT]" gemini image "App icon for MyApp, primary color #2F6BFF, square format 1:1, simple recognizable design, works well at small sizes, no text or letters, solid or gradient background, modern minimalist" --output "./public/app-icon.png"
1623
+ ```
1624
+
1625
+ ---
1626
+
1627
+ ### 5. Race Code Review (GPT + Gemini) + Auto-Fix (v2.6.9)
1628
+
1629
+ After all scenarios are implemented, **GPT and Gemini review in parallel with cross-validation**:
1630
+
1631
+ > **ULTRAWORK Default**: In ULTRAWORK mode, race review is automatically enabled.
1632
+
1633
+ ```
1634
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1635
+ 🏁 RACE CODE REVIEW (GPT + Gemini)
1636
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1637
+
1638
+ [Step 1] Parallel review execution...
1639
+ ├─ GPT Codex: Reviewing...
1640
+ └─ Gemini: Reviewing...
1641
+
1642
+ [Step 2] Cross-validation results:
1643
+ ┌───────────────────────────────────────────────────────────┐
1644
+ │ Issue │ GPT │ Gemini │ Confidence│
1645
+ │────────────────────────────────│─────│────────│───────────│
1646
+ │ Timing attack in password │ ✅ │ ✅ │ 100% → P1 │
1647
+ Rate limiting missing │ ✅ │ ✅ │ 100% → P1 │
1648
+ Magic number usage │ ✅ │ ❌ │ 50% → P2 │
1649
+ └───────────────────────────────────────────────────────────┘
1650
+
1651
+ Summary: 3 issues (P1: 2, P2: 1)
1652
+
1653
+ [Step 3] Auto-fixing P1/P2 issues...
1654
+ auth.service.ts:24 - Applied timingSafeEqual (P1)
1655
+ auth.controller.ts:15 - Added rate limiter (P1)
1656
+ ✅ auth.service.ts:42 - Extracted constant (P2)
1657
+
1658
+ [Step 4] Re-verifying...
1659
+ Build succeeded
1660
+ ✅ Tests passed
1661
+
1662
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1663
+ Race review complete! 3 improvements (2 P1, 1 P2)
1664
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1665
+ ```
1666
+
1667
+ **Race Review Invocation (GPT + Gemini in parallel via Bash):**
1668
+
1669
+ **🚨 Use --input file to avoid CLI argument length limits and Windows pipe issues.**
1670
+
1671
+ 1. Save code to review into `[SCRATCHPAD]/review-code.txt` (using Write tool)
1672
+ 2. Write JSON input file `[SCRATCHPAD]/review-input.json` (using Write tool):
1673
+ - `{"prompt": "Review this code for security, performance, and best practices. Return JSON: {issues: [{id, title, description, severity, suggestion}]}. Code: [CODE_CONTENT]"}`
1674
+ - Where `[CODE_CONTENT]` is the code text (properly JSON-escaped inside the prompt string)
1675
+ 3. Script path: `[LLM_SCRIPT]` = `{{VIBE_PATH}}/hooks/scripts/llm-orchestrate.js`
1676
+ 4. Run GPT + Gemini in PARALLEL (two Bash tool calls at once):
1677
+
1678
+ ```bash
1679
+ # GPT review (Bash tool call 1)
1680
+ node "[LLM_SCRIPT]" gpt orchestrate-json --input "[SCRATCHPAD]/review-input.json"
1681
+ ```
1682
+
1683
+ ```bash
1684
+ # Gemini review (Bash tool call 2 - run in parallel)
1685
+ node "[LLM_SCRIPT]" gemini orchestrate-json --input "[SCRATCHPAD]/review-input.json"
1686
+ ```
1687
+
1688
+ **Confidence-based Priority:**
1689
+
1690
+ | Confidence | Priority | Action |
1691
+ |------------|----------|--------|
1692
+ | 100% (2/2) | P1 | Auto-fix immediately |
1693
+ | 50% (1/2) | P2 | Auto-fix with review |
1694
+
1695
+ **Fallback handling:**
1696
+ - If one LLM fails → Use remaining LLM results (reduced confidence)
1697
+ - If all fail → Skip and proceed (log warning)
1698
+
1699
+ **Review application rules:**
1700
+
1701
+ | Feedback Type | Action |
1702
+ |---------------|--------|
1703
+ | Security vulnerability (P1) | Auto-fix immediately |
1704
+ | Performance improvement (P1/P2) | Auto-fix immediately |
1705
+ | Best practices (P2) | Auto-fix |
1706
+ | Style/preference (P3) | Apply selectively |
1707
+
1708
+ **Conditions:**
1709
+ - **ULTRAWORK**: Race review enabled by default
1710
+ - **Normal mode**: Use `--race` flag to enable
1711
+ - Must re-verify build/tests after fixes
1712
+
1713
+ ### 6. Quality Report (Auto-generated)
1714
+
1715
+ After all scenarios complete + Gemini review, **quality report is auto-generated**:
1716
+
1717
+ ```
1718
+ ┌─────────────────────────────────────────────────────────────────┐
1719
+ │ 📊 QUALITY REPORT: login │
1720
+ ├─────────────────────────────────────────────────────────────────┤
1721
+ │ │
1722
+ │ ✅ Scenarios: 4/4 passed │
1723
+ │ │
1724
+ │ ┌───────────────────────────────────────────────────────────┐ │
1725
+ │ │ # Scenario │ Status │ Retries │ │ │
1726
+ │ │───│───────────────────────────│────────│─────────│ │ │
1727
+ │ │ 1 Valid login success │ ✅ │ 0 │ │ │
1728
+ │ │ 2 Invalid password error │ ✅ │ 1 │ │ │
1729
+ │ │ 3 Email format validation │ ✅ │ 0 │ │ │
1730
+ │ │ 4 Password reset link │ ✅ │ 0 │ │ │
1731
+ │ └───────────────────────────────────────────────────────────┘ │
1732
+ │ │
1733
+ │ 📈 Quality score: 94/100 │
1734
+ │ │
1735
+ │ ┌─────────────────────────────────────────────────────────┐ │
1736
+ │ │ Item │ Result │ Notes │ │
1737
+ │ │───────────────────│────────│─────────────────────────────│ │
1738
+ │ │ Build │ ✅ │ npm run build succeeded │ │
1739
+ │ │ Tests │ ✅ │ 12/12 passed │ │
1740
+ │ │ Type check │ ✅ │ 0 errors │ │
1741
+ │ │ Complexity │ ✅ │ All functions ≤30 lines │ │
1742
+ │ │ Security │ ✅ │ 0 vulnerabilities │ │
1743
+ │ │ Race review │ ✅ │ 3 improvements applied │ │
1744
+ │ └─────────────────────────────────────────────────────────┘ │
1745
+ │ │
1746
+ │ ⏱️ Started: {start_time} │
1747
+ │ ⏱️ Completed: {getCurrentTime 결과} │
1748
+ │ │
1749
+ └─────────────────────────────────────────────────────────────────┘
1750
+ ```
1751
+
1752
+ **What users should check**:
1753
+ - Scenario pass rate (4/4 = 100%)
1754
+ - Quality score (94/100)
1755
+ - Build/test status
1756
+
1757
+ **This alone is enough to trust quality.**
1758
+
1759
+ ### 7. Update Feature File
1760
+
1761
+ Auto-update scenario status:
1762
+
1763
+ ```markdown
1764
+ ## Coverage
1765
+
1766
+ | Scenario | SPEC AC | Status |
1767
+ |----------|---------|--------|
1768
+ | Valid login success | AC-1 | |
1769
+ | Invalid password error | AC-2 | ✅ |
1770
+ | Email format validation | AC-3 | ✅ |
1771
+ | Password reset link | AC-4 | ✅ |
1772
+
1773
+ **Last verified**: 2024-01-15 14:32
1774
+ **Quality score**: 94/100
1775
+ ```
1776
+
1777
+ ## TRUST 5 Principles
1778
+
1779
+ Follow during implementation:
1780
+
1781
+ | Principle | Description |
1782
+ |-----------|-------------|
1783
+ | **T**est-first | Write tests first |
1784
+ | **R**eadable | Clear code |
1785
+ | **U**nified | Consistent style |
1786
+ | **S**ecured | Consider security |
1787
+ | **T**rackable | Logging, monitoring |
1788
+
1789
+ ## Input
1790
+
1791
+ - `.claude/vibe/specs/{feature-name}.md` (PTCF SPEC)
1792
+ - `.claude/vibe/features/{feature-name}.feature` (BDD)
1793
+ - `CLAUDE.md` (project context)
1794
+
1795
+ ## Output
1796
+
1797
+ - Implemented code files
1798
+ - Test files
1799
+ - Updated SPEC document (checkmarks)
1800
+
1801
+ ## Example
1802
+
1803
+ ```
1804
+ User: /vibe.run "login"
1805
+
1806
+ Claude:
1807
+ 📄 Loading SPEC: .claude/vibe/specs/login.md
1808
+ 📄 Loading Feature: .claude/vibe/features/login.feature
1809
+
1810
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1811
+ 📋 Scenarios to Implement
1812
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1813
+
1814
+ | # | Scenario | Status |
1815
+ |---|----------|--------|
1816
+ | 1 | Valid login success | ⬜ |
1817
+ | 2 | Invalid password error | ⬜ |
1818
+ | 3 | Email format validation | ⬜ |
1819
+ | 4 | Password reset link | ⬜ |
1820
+
1821
+ Total: 4 scenarios
1822
+
1823
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1824
+ 🎯 Scenario 1/4: Valid login success
1825
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1826
+
1827
+ Given: User is registered
1828
+ When: Login with valid email and password
1829
+ Then: Login success + JWT token returned
1830
+
1831
+ [PARALLEL] Exploring...
1832
+ Exploration complete (2.1s)
1833
+
1834
+ 🔨 Implementing...
1835
+ auth.service.ts - Added login()
1836
+ auth.controller.ts - POST /login
1837
+
1838
+ 🔍 Verifying...
1839
+ Given: OK
1840
+ ✅ When: OK
1841
+ ✅ Then: OK
1842
+
1843
+ ✅ Scenario 1 passed!
1844
+
1845
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1846
+ 🎯 Scenario 2/4: Invalid password error
1847
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1848
+
1849
+ 🔨 Implementing...
1850
+ ✅ auth.service.ts - Password validation logic
1851
+
1852
+ 🔍 Verifying...
1853
+ ✅ Given: OK
1854
+ When: OK
1855
+ Then: "Invalid credentials" error message
1856
+ Actual: "Error" returned
1857
+
1858
+ 🔄 Auto-fix 1/3...
1859
+ Fix: auth.service.ts line 42
1860
+
1861
+ 🔍 Re-verifying...
1862
+ ✅ Then: OK
1863
+
1864
+ Scenario 2 passed! (1 fix)
1865
+
1866
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1867
+ 🎯 Scenario 3/4: Email format validation
1868
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1869
+
1870
+ 🔨 Implementing...
1871
+ 🔍 Verifying...
1872
+ Scenario 3 passed!
1873
+
1874
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1875
+ 🎯 Scenario 4/4: Password reset link
1876
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1877
+
1878
+ 🔨 Implementing...
1879
+ 🔍 Verifying...
1880
+ ✅ Scenario 4 passed!
1881
+
1882
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1883
+ 🔍 GEMINI CODE REVIEW
1884
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1885
+
1886
+ 📤 Sending code to Gemini...
1887
+ 📝 Gemini feedback:
1888
+ 1. [Security] Need timing attack prevention → Fixing...
1889
+ 2. [Performance] Unnecessary DB call → Fixing...
1890
+
1891
+ 2 improvements auto-applied
1892
+ 🔍 Re-verifying... Passed
1893
+
1894
+ ┌─────────────────────────────────────────────────────────────────┐
1895
+ │ 📊 QUALITY REPORT: login │
1896
+ ├─────────────────────────────────────────────────────────────────┤
1897
+ │ │
1898
+ │ ✅ Scenarios: 4/4 passed │
1899
+ │ │
1900
+ │ | # | Scenario | Status | Retries | │
1901
+ │ |---|───────────────────────|───────|─────────| │
1902
+ │ | 1 | Valid login success | ✅ | 0 | │
1903
+ │ | 2 | Invalid password error| ✅ | 1 | │
1904
+ │ | 3 | Email format validation| ✅ | 0 | │
1905
+ │ | 4 | Password reset link | ✅ | 0 | │
1906
+ │ │
1907
+ │ 📈 Quality score: 94/100 │
1908
+ │ Build: ✅ | Tests: ✅ | Types: ✅ | Gemini: ✅ (2 applied) │
1909
+ │ │
1910
+ │ ⏱️ Started: {start_time} │
1911
+ │ ⏱️ Completed: {getCurrentTime 결과} │
1912
+ └─────────────────────────────────────────────────────────────────┘
1913
+
1914
+ 🎉 Implementation complete! All scenarios passed + Gemini review applied.
1915
+
1916
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1917
+ 🔍 AUTO REVIEW (13+ Agents)
1918
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1919
+
1920
+ [PARALLEL] 13 expert agents reviewing...
1921
+ - security-reviewer ✅
1922
+ - performance-reviewer
1923
+ - architecture-reviewer
1924
+ - ...
1925
+
1926
+ 📋 Review results:
1927
+ - P1 Critical: 0
1928
+ - P2 Important: 2
1929
+ - P3 Nice-to-have: 1
1930
+
1931
+ 🔧 Auto-fixing P2 issues...
1932
+ 1. [PERF] N+1 query Fixed
1933
+ 2. [ARCH] Circular dependency → Fixed
1934
+
1935
+ ✅ Auto Review complete! 2 issues auto-resolved.
1936
+ ```
1937
+
1938
+ ### Phase-specific Execution
1939
+
1940
+ ```
1941
+ User: /vibe.run "brick-game" --phase 2
1942
+
1943
+ Claude:
1944
+ 📄 Reading SPEC: .claude/vibe/specs/brick-game.md
1945
+ 🎯 Executing Phase 2 only.
1946
+
1947
+ Phase 2: Game Logic
1948
+ 1. [ ] Paddle movement implementation
1949
+ 2. [ ] Ball physics engine
1950
+ 3. [ ] Brick collision handling
1951
+ 4. [ ] Score system
1952
+ 5. [ ] Game over conditions
1953
+
1954
+ Launching parallel exploration...
1955
+ [Task(haiku) × 3 launched in parallel]
1956
+
1957
+ 🚀 Starting implementation...
1958
+ ```
1959
+
1960
+ ## Error Handling
1961
+
1962
+ On failure:
1963
+ 1. Check error message
1964
+ 2. Review `<constraints>`
1965
+ 3. Fix code and retry
1966
+ 4. If continues to fail, report to user
1967
+
1968
+ ---
1969
+
1970
+ ## Quality Gate (Mandatory)
1971
+
1972
+ ### Implementation Quality Checklist
1973
+
1974
+ Before marking any scenario as complete, ALL items must pass:
1975
+
1976
+ | Category | Check Item | Weight |
1977
+ |----------|------------|--------|
1978
+ | **Functionality** | All Given/When/Then conditions verified | 20% |
1979
+ | **Functionality** | Edge cases handled per scenario | 10% |
1980
+ | **Code Quality** | No `any` types in TypeScript | 10% |
1981
+ | **Code Quality** | Functions ≤30 lines, nesting ≤3 levels | 10% |
1982
+ | **Code Quality** | No hardcoded values (use constants) | 5% |
1983
+ | **Security** | Input validation implemented | 10% |
1984
+ | **Security** | Authentication/authorization checked | 5% |
1985
+ | **Error Handling** | Try-catch or error states present | 10% |
1986
+ | **Error Handling** | User-friendly error messages | 5% |
1987
+ | **Testing** | Unit tests exist for core logic | 10% |
1988
+ | **Performance** | No N+1 queries or unnecessary loops | 5% |
1989
+
1990
+ ### Quality Score Calculation
1991
+
1992
+ ```
1993
+ Score = Σ(checked items × weight) / 100
1994
+
1995
+ Grades:
1996
+ - 95-100: EXCELLENT - Ready to merge
1997
+ - 90-94: ⚠️ GOOD - Minor improvements required before merge
1998
+ - 80-89: ⚠️ FAIR - Significant improvements required
1999
+ - 0-79: ❌ POOR - Major fixes needed
2000
+ ```
2001
+
2002
+ ### Quality Gate Thresholds
2003
+
2004
+ | Gate | Minimum Score | Condition |
2005
+ |------|---------------|-----------|
2006
+ | **Scenario Complete** | 95 | Each scenario must score ≥95 |
2007
+ | **Phase Complete** | 95 | Average of all scenarios ≥95 |
2008
+ | **Feature Complete** | 95 | All phases complete + Gemini review |
2009
+
2010
+ ### Auto-Fix Triggers
2011
+
2012
+ | Issue Type | Auto-Fix Action |
2013
+ |------------|-----------------|
2014
+ | Missing error handling | Add try-catch wrapper |
2015
+ | Hardcoded values | Extract to constants file |
2016
+ | Missing input validation | Add validation schema |
2017
+ | Function too long | Suggest split points |
2018
+ | N+1 query detected | Add eager loading |
2019
+
2020
+ ### Forbidden Patterns (Block Merge)
2021
+
2022
+ | Pattern | Why Forbidden | Detection |
2023
+ |---------|---------------|-----------|
2024
+ | `console.log` | Debug code in production | Regex scan |
2025
+ | `// TODO` without issue | Untracked work | Comment scan |
2026
+ | `any` type | Type safety bypass | TypeScript check |
2027
+ | `@ts-ignore` | Type error suppression | TypeScript check |
2028
+ | Empty catch blocks | Silent error swallowing | AST analysis |
2029
+ | Commented-out code | Dead code | Comment scan |
2030
+
2031
+ ---
2032
+
2033
+ ## Auto-Retrospective (Post-Implementation)
2034
+
2035
+ After ALL phases complete successfully, **automatically** perform a brief retrospective:
2036
+
2037
+ ### Retrospective Template
2038
+
2039
+ ```
2040
+ ## Retrospective: {feature-name}
2041
+
2042
+ ### What Worked
2043
+ - [List effective patterns, tools, approaches used]
2044
+
2045
+ ### What Didn't
2046
+ - [List issues, failures, unexpected blockers]
2047
+
2048
+ ### Key Decisions
2049
+ - [Important architectural or implementation decisions made during this run]
2050
+
2051
+ ### Lessons Learned
2052
+ - [Principle format: "When X, do Y because Z"]
2053
+ ```
2054
+
2055
+ ### Execution Steps
2056
+
2057
+ 1. Generate retrospective based on the implementation session
2058
+ 2. Save to `.claude/vibe/retros/{feature-name}.md`
2059
+ 3. Save key lessons via `core_save_memory` (for cross-session recall)
2060
+ 4. Update `claude-progress.txt` with final status
2061
+
2062
+ **Important:**
2063
+
2064
+ - Keep it concise (under 20 lines)
2065
+ - Focus on **project-specific** insights, not generic knowledge
2066
+ - Only save to memory if the lesson is actionable and non-obvious
2067
+
2068
+ ---
2069
+
2070
+ ## Next Step
2071
+
2072
+ ```
2073
+ /vibe.verify "brick-game"
2074
+ ```
2075
+
2076
+ ---
2077
+
2078
+ ARGUMENTS: $ARGUMENTS