@su-record/vibe 2.7.14 → 2.7.16

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