@su-record/vibe 2.6.41 → 2.6.43

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