@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,555 +1,555 @@
1
- ---
2
- description: Multi-agent parallel code review with priority-based findings
3
- argument-hint: "PR number, branch name, or file path"
4
- ---
5
-
6
- # /vibe.review
7
-
8
- **Parallel Agent Code Review** - 13+ specialists review simultaneously
9
-
10
- ## Usage
11
-
12
- ```
13
- /vibe.review # Review current branch
14
- /vibe.review PR#123 # Review specific PR
15
- /vibe.review feature/login # Review specific branch
16
- /vibe.review src/api/ # Review specific path
17
- /vibe.review --race # Multi-LLM race mode (GPT + Gemini)
18
- /vibe.review --race security # Race mode for specific review type
19
- ```
20
-
21
- > **⏱️ Timer**: Call `getCurrentTime` tool at the START. Record the result as `{start_time}`.
22
-
23
- ## Race Mode (v2.6.9)
24
-
25
- **Multi-LLM competitive review** - Same review task runs on GPT + Gemini in parallel, results are cross-validated.
26
-
27
- ### How It Works
28
-
29
- ```
30
- /vibe.review --race
31
-
32
- security-review:
33
- ├─ GPT-5.2-Codex → [SQL injection, XSS]
34
- └─ Gemini-3-Flash → [SQL injection, CSRF]
35
-
36
- Cross-validation:
37
- - SQL injection (2/2) → 🔴 P1 (100% confidence)
38
- - XSS (1/2) → 🟡 P2 (50% confidence)
39
- - CSRF (1/2) → 🟡 P2 (50% confidence)
40
- ```
41
-
42
- ### Confidence-Based Priority
43
-
44
- | Confidence | Priority | Meaning |
45
- |------------|----------|---------|
46
- | 100% (2/2) | P1 | Both models agree - high confidence |
47
- | 50% (1/2) | P2 | One model found - needs verification |
48
-
49
- ### Race Mode Options
50
-
51
- ```
52
- /vibe.review --race # All review types
53
- /vibe.review --race security # Security only
54
- /vibe.review --race performance # Performance only
55
- /vibe.review --race architecture # Architecture only
56
- ```
57
-
58
- ### Race Mode Output
59
-
60
- ```
61
- ## SECURITY Review (Race Mode)
62
-
63
- **Duration**: 3420ms
64
- **Models**: GPT-5.2-Codex, Gemini-3-Flash
65
-
66
- ### Model Results
67
-
68
- | Model | Issues Found | Duration | Status |
69
- |-------|--------------|----------|--------|
70
- | gpt | 3 | 1823ms | OK |
71
- | gemini | 2 | 2156ms | OK |
72
-
73
- ### Cross-Validated Issues
74
-
75
- **Summary**: 3 issues (P1: 1, P2: 2)
76
- **Consensus Rate**: 67%
77
-
78
- #### 🔴 P1 - SQL Injection in user query
79
-
80
- - **Confidence**: 100% (gpt, gemini)
81
- - **Severity**: critical
82
- - **Location**: `src/api/users.ts:42`
83
- - **Suggestion**: Use parameterized queries
84
-
85
- #### 🟡 P2 - XSS vulnerability in render
86
-
87
- - **Confidence**: 50% (gpt)
88
- - **Severity**: high
89
- - **Location**: `src/components/Comment.tsx:15`
90
- ```
91
-
92
- ### When to Use Race Mode
93
-
94
- | Scenario | Recommended |
95
- |----------|-------------|
96
- | Critical security review | ✅ `--race security` |
97
- | Pre-production audit | ✅ `--race` |
98
- | Quick iteration | ❌ Standard review |
99
- | API cost concerns | ❌ Standard review |
100
-
101
- ### Tool Invocation (Race Mode - GPT + Gemini in parallel via Bash)
102
-
103
- **🚨 Use --input file to avoid CLI argument length limits and Windows pipe issues.**
104
-
105
- 1. Save code to review into `[SCRATCHPAD]/review-code.txt` (using Write tool)
106
- 2. Write JSON input file `[SCRATCHPAD]/review-input.json` (using Write tool):
107
- - `{"prompt": "Review this code for [REVIEW_TYPE]. Return JSON: {issues: [{id, title, description, severity, suggestion}]}. Code: [CODE_CONTENT]"}`
108
- - Where `[CODE_CONTENT]` is the code text (properly JSON-escaped inside the prompt string)
109
- 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'))"`
110
- - Save output as `[LLM_SCRIPT]`
111
- 4. Run GPT + Gemini in PARALLEL (two Bash tool calls at once):
112
-
113
- ```bash
114
- # GPT review (Bash tool call 1)
115
- node "[LLM_SCRIPT]" gpt orchestrate-json --input "[SCRATCHPAD]/review-input.json"
116
- ```
117
-
118
- ```bash
119
- # Gemini review (Bash tool call 2 - run in parallel)
120
- node "[LLM_SCRIPT]" gemini orchestrate-json --input "[SCRATCHPAD]/review-input.json"
121
- ```
122
-
123
- ## Priority System
124
-
125
- | Priority | Criteria | Action |
126
- |----------|----------|--------|
127
- | P1 | Security vulnerabilities, data loss, crashes | Block merge, fix immediately |
128
- | P2 | Performance issues, architecture violations, missing tests | Fix before merge |
129
- | P3 | Style, refactoring suggestions, documentation | Add to backlog |
130
-
131
- ## Process
132
-
133
- ### Phase 1: Tech Stack Detection
134
-
135
- Detect project tech stack FIRST before launching reviewers:
136
-
137
- ```
138
- Read package.json -> TypeScript, React, Node.js
139
- Read pyproject.toml -> Python, FastAPI, Django
140
- Read Gemfile -> Ruby, Rails
141
- Read pubspec.yaml -> Flutter, Dart
142
- Read go.mod -> Go
143
- Read CLAUDE.md -> Explicit tech stack declaration
144
- ```
145
-
146
- ### Phase 2: Parallel Agent Review (STACK-AWARE) via Orchestrator
147
-
148
- **Execution via Orchestrator (12+ agents in parallel):**
149
- ```bash
150
- node -e "import('@su-record/vibe/orchestrator').then(o => o.review(['FILE_PATHS'], ['DETECTED_STACKS']).then(r => console.log(r.content[0].text)))"
151
- ```
152
-
153
- **Example:**
154
- ```bash
155
- # Review changed files with TypeScript + React stack
156
- node -e "import('@su-record/vibe/orchestrator').then(o => o.review(['src/api/users.ts', 'src/components/Login.tsx'], ['TypeScript', 'React']).then(r => console.log(r.content[0].text)))"
157
- ```
158
-
159
- **Core Reviewers (Always Run):**
160
- | Agent | Focus |
161
- |-------|-------|
162
- | security-reviewer | OWASP Top 10, vulnerabilities |
163
- | data-integrity-reviewer | Data validation, constraints |
164
- | performance-reviewer | N+1 queries, memory leaks |
165
- | architecture-reviewer | Layer violations, cycles |
166
- | complexity-reviewer | Cyclomatic complexity, length |
167
- | simplicity-reviewer | Over-abstraction, dead code |
168
- | git-history-reviewer | Churn files, risk patterns |
169
- | test-coverage-reviewer | Missing tests, edge cases |
170
-
171
- **Stack-Specific Reviewers (Conditional):**
172
- | Agent | Condition |
173
- |-------|-----------|
174
- | python-reviewer | .py files in diff |
175
- | typescript-reviewer | .ts/.tsx files OR tsconfig |
176
- | rails-reviewer | Gemfile has rails |
177
- | react-reviewer | package.json has react |
178
-
179
- ### Phase 2.5: UI/UX Review Agents (Auto-triggered)
180
-
181
- > **활성화 조건**: 변경된 파일 중 UI 파일 존재 (`.tsx`, `.jsx`, `.vue`, `.svelte`, `.html`, `.css`, `.scss`)
182
- > **비활성화**: `.claude/vibe/config.json`에 `"uiUxAnalysis": false` 설정
183
-
184
- **기존 12+ 리뷰 에이전트와 병렬 실행:**
185
-
186
- | Agent | Role | Output |
187
- |-------|------|--------|
188
- | ⑥ ux-compliance-reviewer | UX 가이드라인 준수 검증 | P1/P2/P3 findings |
189
- | ⑦ ui-a11y-auditor | WCAG 2.1 AA 접근성 감사 | P1/P2/P3 findings |
190
- | ⑧ ui-antipattern-detector | UI 안티패턴 + 디자인 시스템 일관성 | P1/P2/P3 findings |
191
-
192
- **실행 방법 — 기존 Phase 2 에이전트와 병렬 실행:**
193
-
194
- ```text
195
- # ⑥ UX 준수 검증 (Haiku)
196
- Task(subagent_type="ux-compliance-reviewer",
197
- prompt="Review UI files for UX guideline compliance: {changed_ui_files}. Use core_ui_search against ux-guidelines and web-interface domains.")
198
-
199
- # ⑦ 접근성 감사 (Haiku)
200
- Task(subagent_type="ui-a11y-auditor",
201
- prompt="Audit UI files for WCAG 2.1 AA compliance: {changed_ui_files}.")
202
-
203
- # ⑧ 안티패턴 검출 (Haiku)
204
- Task(subagent_type="ui-antipattern-detector",
205
- prompt="Detect UI anti-patterns in: {changed_ui_files}. Check against MASTER.md if exists at .claude/vibe/design-system/{project}/MASTER.md.")
206
- ```
207
-
208
- **findings 통합**: ⑥⑦⑧ findings를 기존 findings[]와 병합 → P1/P2/P3 통합 정렬
209
-
210
- **⑦ Critical finding 에스컬레이션**: ui-a11y-auditor의 P1 finding은 Review Debate Team(Phase 4.5)에 자동 포함
211
-
212
- ### Phase 3: Deep Analysis
213
-
214
- After agent results:
215
-
216
- 1. **System Context**: Component interactions, data flow, external dependencies
217
- 2. **Stakeholder Perspectives**: Developers, Ops, Security, Business
218
- 3. **Edge Cases**: Race conditions, resource exhaustion, network failures
219
- 4. **Multiple Angles**: Technical excellence, business value, risk management
220
-
221
- ### Phase 4: Findings Synthesis
222
-
223
- ```
224
- REVIEW FINDINGS
225
-
226
- P1 CRITICAL (Blocks Merge) - N issues
227
- 1. [SECURITY] SQL Injection in user query
228
- Location: src/api/users.py:42
229
- Fix: Use parameterized queries
230
-
231
- P2 IMPORTANT (Should Fix) - N issues
232
- 2. [PERF] N+1 query in user list
233
- 3. [ARCH] Circular dependency detected
234
-
235
- P3 NICE-TO-HAVE (Enhancement) - N issues
236
- 4. [STYLE] Consider extracting helper function
237
- ```
238
-
239
- ### Phase 4.5: Agent Teams — Review Debate
240
-
241
- > **Agent Teams**: 개별 리뷰어의 발견을 팀으로 토론하여 우선순위를 검증하고 오탐을 제거합니다.
242
- > 설정: `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1` + `teammateMode: in-process` (`~/.claude/settings.json` 전역 — postinstall 자동 설정)
243
-
244
- **팀 구성:**
245
-
246
- | 팀원 | 역할 |
247
- |------|------|
248
- | security-reviewer (리더) | P1/P2 이슈 종합, 보안 이슈 최종 판정, 합의 주도 |
249
- | architecture-reviewer | 구조적 영향 평가, 숨겨진 결합도 식별 |
250
- | performance-reviewer | 성능 영향 평가, 부하 시나리오 검증 |
251
- | simplicity-reviewer | 과잉 설계 지적, 더 단순한 대안 제시 |
252
-
253
- **실행 순서:**
254
-
255
- 1. `TeamCreate(team_name="review-debate-{feature}")` — 팀 + 공유 태스크 리스트 생성
256
- 2. 4개 팀원 병렬 생성 — 각각 `Task(team_name=..., name=..., subagent_type=...)` 으로 spawn
257
- 3. 팀원들이 공유 TaskList에서 이슈를 claim하고, SendMessage로 교차 검증
258
- 4. 리더(security-reviewer)가 팀 합의 결과 종합 → 검증된 P1/P2 목록 출력
259
- 5. 모든 팀원 shutdown_request → TeamDelete로 정리
260
-
261
- **팀원 spawn 패턴:**
262
-
263
- ```text
264
- TeamCreate(team_name="review-debate-{feature}", description="Review debate for {feature}")
265
-
266
- # 4개 병렬 spawn
267
- Task(team_name="review-debate-{feature}", name="security-reviewer", subagent_type="security-reviewer",
268
- prompt="리뷰 토론 팀 리더. Phase 2에서 발견된 P1/P2 이슈를 팀과 함께 검증하세요.
269
- Phase 2 결과: {phase2_findings}
270
- 역할: 보안 이슈 최종 판정, 팀원 간 우선순위 충돌 해결, 최종 합의 요약 작성.
271
- TaskList를 확인하고 이슈를 claim하세요. 각 이슈에 대해 팀원에게 SendMessage로 검증을 요청하세요.
272
- 모든 이슈 검증 완료 후 최종 합의 결과를 작성하세요.")
273
-
274
- Task(team_name="review-debate-{feature}", name="architecture-reviewer", subagent_type="architecture-reviewer",
275
- prompt="리뷰 토론 팀 아키텍처 담당. Phase 2 결과: {phase2_findings}
276
- 역할: 각 이슈의 구조적 영향 평가, 숨겨진 결합도/의존성 식별.
277
- 아키텍처 관점에서 우선순위 변경이 필요하면 security-reviewer에게 SendMessage로 알리세요.
278
- TaskList에서 아키텍처 관련 이슈를 claim하세요.")
279
-
280
- Task(team_name="review-debate-{feature}", name="performance-reviewer", subagent_type="performance-reviewer",
281
- prompt="리뷰 토론 팀 성능 담당. Phase 2 결과: {phase2_findings}
282
- 역할: 성능 영향 평가, 부하 시 cascading failure 가능성 검증.
283
- 성능 관점에서 P2→P1 승격이 필요하면 security-reviewer에게 SendMessage로 알리세요.
284
- TaskList에서 성능 관련 이슈를 claim하세요.")
285
-
286
- Task(team_name="review-debate-{feature}", name="simplicity-reviewer", subagent_type="simplicity-reviewer",
287
- prompt="리뷰 토론 팀 복잡도 담당. Phase 2 결과: {phase2_findings}
288
- 역할: 과잉 진단(오탐) 식별, 더 단순한 수정 방안 제시.
289
- 오탐이나 P1→P2 강등이 필요하면 security-reviewer에게 SendMessage로 알리세요.
290
- TaskList에서 복잡도/단순화 관련 이슈를 claim하세요.")
291
- ```
292
-
293
- **팀원 간 통신 예시:**
294
-
295
- ```text
296
- architecture-reviewer → security-reviewer: "Unbounded query는 부하 시 cascading failure 가능. P2→P1 승격 제안"
297
- simplicity-reviewer → security-reviewer: "CSRF on read-only endpoint는 side effect 없음. P1→P2 강등 제안"
298
- performance-reviewer → architecture-reviewer: "N+1 query가 현재 데이터 규모에서는 영향 없으나 확장 시 문제. 의견?"
299
- security-reviewer → broadcast: "최종 합의: SQL Injection P1 유지, Unbounded query P1 승격, CSRF P2 강등, Circular dep 오탐 제거"
300
- ```
301
-
302
- **토론 결과 예시:**
303
-
304
- ```
305
- 🤝 REVIEW DEBATE RESULTS
306
-
307
- Team Consensus (4 reviewers):
308
-
309
- ✅ Validated P1 (unanimous):
310
- 1. [SECURITY] SQL Injection — 4/4 agree critical
311
-
312
- ⬆️ Upgraded P2→P1 (debate result):
313
- 2. [PERF] Unbounded query — architecture-reviewer pointed out
314
- cascading failure risk under load → team agreed P1
315
-
316
- ⬇️ Downgraded P1→P2 (debate result):
317
- 3. [SECURITY] CSRF on read-only endpoint — simplicity-reviewer
318
- noted endpoint has no side effects → team agreed P2
319
-
320
- ❌ Removed (false positive):
321
- 4. [ARCH] "Circular dependency" — architecture-reviewer confirmed
322
- this is intentional bi-directional reference, not a cycle
323
-
324
- 🆕 New findings (team discussion):
325
- 5. [DATA] Race condition in concurrent updates — emerged from
326
- security + performance discussion
327
- ```
328
-
329
- ### Phase 5: Auto-Fix (P1/P2)
330
-
331
- **Auto-fixable issues are resolved immediately:**
332
-
333
- ```
334
- 🔧 AUTO-FIX Starting...
335
-
336
- P1 Critical:
337
- 1. [SECURITY] SQL Injection → Fixed with parameterized query ✅
338
- 2. [DATA] Missing transaction rollback → Added try-finally ✅
339
-
340
- P2 Important:
341
- 3. [PERF] N+1 query → Added select_related ✅
342
- 4. [ARCH] Circular dependency → Separated dependencies ✅
343
- 5. [TEST] Missing edge case → Added test ✅
344
-
345
- 🔍 Re-validating...
346
- ✅ Build successful
347
- ✅ Tests passed
348
-
349
- ✅ 5 issues auto-fixed!
350
- ```
351
-
352
- **Cases that cannot be auto-fixed:**
353
- - Requires large-scale architecture changes
354
- - Requires business logic decisions
355
- - Requires user confirmation
356
-
357
- → Manual handling instructions in Phase 6
358
-
359
- ### Phase 6: Todo File Creation (Items Requiring Manual Handling)
360
-
361
- Save **remaining** findings to `.claude/vibe/todos/`:
362
-
363
- ```
364
- {priority}-{category}-{short-desc}.md
365
-
366
- Examples:
367
- - P2-arch-large-refactor.md (Cannot be auto-fixed)
368
- - P3-style-extract-helper.md (Backlog)
369
- ```
370
-
371
- ## Output
372
-
373
- ```
374
- CODE REVIEW SUMMARY
375
- PR #123: Add user authentication
376
-
377
- Reviewers: 13 agents
378
- ⏱️ Started: {start_time}
379
- ⏱️ Completed: {getCurrentTime 결과}
380
-
381
- Score: 92/100 (Good) ← Score after auto-fix
382
-
383
- Issues Found:
384
- - P1 Critical: 2 → 0 (✅ Auto-fixed)
385
- - P2 Important: 5 → 1 (✅ 4 auto-fixed)
386
- - P3 Nice-to-have: 3 (Backlog)
387
-
388
- Auto-Fixed: 6 issues
389
- - [SECURITY] SQL Injection ✅
390
- - [DATA] Transaction rollback ✅
391
- - [PERF] N+1 query ✅
392
- - [ARCH] Circular dependency ✅
393
- - [PERF] Unnecessary loop ✅
394
- - [TEST] Missing edge case ✅
395
-
396
- Remaining (Manual handling required):
397
- - P2-arch-large-refactor.md (Architecture decision required)
398
- - P3-style-extract-helper.md (Backlog)
399
- - P3-docs-add-readme.md (Backlog)
400
-
401
- ✅ MERGE READY (P1/P2 resolved)
402
- ```
403
-
404
- ### Phase 7: Guide to Fix Workflow (Manual Handling Items)
405
-
406
- **Choose workflow when handling remaining issues:**
407
-
408
- ```
409
- ## Fix Workflow
410
-
411
- Choose a workflow to fix the discovered issues:
412
-
413
- | Task Scale | Recommended Approach |
414
- |------------|---------------------|
415
- | Simple fix (1-2 files) | Plan Mode |
416
- | Complex fix (3+ files, validation needed) | /vibe.spec |
417
-
418
- 1. `/vibe.spec "fix: issue-name"` - VIBE workflow (SPEC validation + re-review)
419
- 2. Plan Mode - Quick fix (for simple tasks)
420
-
421
- Which approach would you like to proceed with?
422
- ```
423
-
424
- - Wait for user's choice before proceeding
425
- - If user chooses VIBE → wait for `/vibe.spec` command
426
- - If user chooses Plan Mode → proceed with EnterPlanMode
427
-
428
- ## Core Tools (Code Analysis)
429
-
430
- ### Tool Invocation
431
-
432
- All tools are called via:
433
-
434
- ```bash
435
- node -e "import('@su-record/vibe/tools').then(t => t.TOOL_NAME({...args}).then(r => console.log(r.content[0].text)))"
436
- ```
437
-
438
- ### Recommended Tools for Review
439
-
440
- | Tool | Purpose | When to Use |
441
- |------|---------|-------------|
442
- | `validateCodeQuality` | Code quality check | Overall code quality scan |
443
- | `analyzeComplexity` | Complexity metrics | Check function complexity |
444
- | `findSymbol` | Find definitions | Locate implementations |
445
- | `findReferences` | Find all usages | Track symbol usage |
446
- | `saveMemory` | Save findings | Store important review findings |
447
-
448
- ### Example Tool Usage in Review
449
-
450
- **1. Validate code quality before review:**
451
-
452
- ```bash
453
- node -e "import('@su-record/vibe/tools').then(t => t.validateCodeQuality({targetPath: 'src/', projectPath: process.cwd()}).then(r => console.log(r.content[0].text)))"
454
- ```
455
-
456
- **2. Analyze complexity of changed files:**
457
-
458
- ```bash
459
- node -e "import('@su-record/vibe/tools').then(t => t.analyzeComplexity({targetPath: 'src/api/users.ts', projectPath: process.cwd()}).then(r => console.log(r.content[0].text)))"
460
- ```
461
-
462
- **3. Save critical finding for reference:**
463
-
464
- ```bash
465
- node -e "import('@su-record/vibe/tools').then(t => t.saveMemory({key: 'review-pr123-critical', value: 'SQL injection in users.py:42', category: 'review', projectPath: process.cwd()}).then(r => console.log(r.content[0].text)))"
466
- ```
467
-
468
- ---
469
-
470
- ## Quality Gate (Mandatory)
471
-
472
- ### Review Quality Checklist
473
-
474
- Before completing review, ALL items must be verified:
475
-
476
- | Category | Check Item | Weight |
477
- |----------|------------|--------|
478
- | **Security** | OWASP Top 10 vulnerabilities scanned | 20% |
479
- | **Security** | Authentication/authorization verified | 10% |
480
- | **Security** | Sensitive data exposure checked | 10% |
481
- | **Performance** | N+1 queries detected and flagged | 10% |
482
- | **Performance** | Memory leaks checked | 5% |
483
- | **Architecture** | Layer violations detected | 10% |
484
- | **Architecture** | Circular dependencies checked | 5% |
485
- | **Code Quality** | Complexity limits enforced | 10% |
486
- | **Code Quality** | Forbidden patterns detected | 10% |
487
- | **Testing** | Test coverage gaps identified | 5% |
488
- | **Documentation** | Public API documentation checked | 5% |
489
-
490
- ### Review Score Calculation
491
-
492
- ```
493
- Score = 100 - (P1 × 20) - (P2 × 5) - (P3 × 1)
494
-
495
- Grades:
496
- - 95-100: ✅ EXCELLENT - Merge ready
497
- - 90-94: ⚠️ GOOD - Minor fixes required before merge
498
- - 80-89: ⚠️ FAIR - Must fix P2 issues
499
- - 0-79: ❌ POOR - Block merge, fix P1/P2
500
- ```
501
-
502
- ### Merge Decision Matrix
503
-
504
- | P1 Count | P2 Count | Decision |
505
- |----------|----------|----------|
506
- | 0 | 0-2 | ✅ MERGE READY |
507
- | 0 | 3+ | ⚠️ FIX P2 FIRST |
508
- | 1+ | Any | ❌ BLOCKED |
509
-
510
- ### Auto-Fix Capability Matrix
511
-
512
- | Issue Type | Auto-Fixable | Method |
513
- |------------|--------------|--------|
514
- | SQL Injection | ✅ Yes | Parameterized query |
515
- | Missing transaction | ✅ Yes | Add try-finally |
516
- | N+1 query | ✅ Yes | Add eager loading |
517
- | Circular dependency | ⚠️ Partial | Suggest restructure |
518
- | Missing tests | ✅ Yes | Generate test skeleton |
519
- | Hardcoded secrets | ❌ No | Flag for manual review |
520
- | Architecture violation | ❌ No | Suggest refactoring plan |
521
-
522
- ### Forbidden Patterns (P1 Critical)
523
-
524
- | Pattern | Risk Level | Detection Method |
525
- |---------|------------|------------------|
526
- | Hardcoded credentials | Critical | Regex + entropy scan |
527
- | SQL string concatenation | Critical | AST analysis |
528
- | `eval()` or `exec()` | Critical | AST analysis |
529
- | Disabled CSRF protection | Critical | Config scan |
530
- | Debug mode in production | Critical | Config scan |
531
- | Unvalidated redirects | High | URL pattern scan |
532
-
533
- ### Review Output Requirements
534
-
535
- Every review MUST produce:
536
-
537
- 1. **Summary Statistics**
538
- - Total issues by priority (P1/P2/P3)
539
- - Auto-fixed count
540
- - Remaining manual fixes
541
-
542
- 2. **Detailed Findings**
543
- - File path and line number
544
- - Issue description
545
- - Recommended fix
546
- - Auto-fix status (applied/pending/manual)
547
-
548
- 3. **Quality Score**
549
- - Numerical score (0-100)
550
- - Grade (EXCELLENT/GOOD/FAIR/POOR)
551
- - Merge recommendation
552
-
553
- ---
554
-
555
- ARGUMENTS: $ARGUMENTS
1
+ ---
2
+ description: Multi-agent parallel code review with priority-based findings
3
+ argument-hint: "PR number, branch name, or file path"
4
+ ---
5
+
6
+ # /vibe.review
7
+
8
+ **Parallel Agent Code Review** - 13+ specialists review simultaneously
9
+
10
+ ## Usage
11
+
12
+ ```
13
+ /vibe.review # Review current branch
14
+ /vibe.review PR#123 # Review specific PR
15
+ /vibe.review feature/login # Review specific branch
16
+ /vibe.review src/api/ # Review specific path
17
+ /vibe.review --race # Multi-LLM race mode (GPT + Gemini)
18
+ /vibe.review --race security # Race mode for specific review type
19
+ ```
20
+
21
+ > **⏱️ Timer**: Call `getCurrentTime` tool at the START. Record the result as `{start_time}`.
22
+
23
+ ## Race Mode (v2.6.9)
24
+
25
+ **Multi-LLM competitive review** - Same review task runs on GPT + Gemini in parallel, results are cross-validated.
26
+
27
+ ### How It Works
28
+
29
+ ```
30
+ /vibe.review --race
31
+
32
+ security-review:
33
+ ├─ GPT-5.2-Codex → [SQL injection, XSS]
34
+ └─ Gemini-3-Flash → [SQL injection, CSRF]
35
+
36
+ Cross-validation:
37
+ - SQL injection (2/2) → 🔴 P1 (100% confidence)
38
+ - XSS (1/2) → 🟡 P2 (50% confidence)
39
+ - CSRF (1/2) → 🟡 P2 (50% confidence)
40
+ ```
41
+
42
+ ### Confidence-Based Priority
43
+
44
+ | Confidence | Priority | Meaning |
45
+ |------------|----------|---------|
46
+ | 100% (2/2) | P1 | Both models agree - high confidence |
47
+ | 50% (1/2) | P2 | One model found - needs verification |
48
+
49
+ ### Race Mode Options
50
+
51
+ ```
52
+ /vibe.review --race # All review types
53
+ /vibe.review --race security # Security only
54
+ /vibe.review --race performance # Performance only
55
+ /vibe.review --race architecture # Architecture only
56
+ ```
57
+
58
+ ### Race Mode Output
59
+
60
+ ```
61
+ ## SECURITY Review (Race Mode)
62
+
63
+ **Duration**: 3420ms
64
+ **Models**: GPT-5.2-Codex, Gemini-3-Flash
65
+
66
+ ### Model Results
67
+
68
+ | Model | Issues Found | Duration | Status |
69
+ |-------|--------------|----------|--------|
70
+ | gpt | 3 | 1823ms | OK |
71
+ | gemini | 2 | 2156ms | OK |
72
+
73
+ ### Cross-Validated Issues
74
+
75
+ **Summary**: 3 issues (P1: 1, P2: 2)
76
+ **Consensus Rate**: 67%
77
+
78
+ #### 🔴 P1 - SQL Injection in user query
79
+
80
+ - **Confidence**: 100% (gpt, gemini)
81
+ - **Severity**: critical
82
+ - **Location**: `src/api/users.ts:42`
83
+ - **Suggestion**: Use parameterized queries
84
+
85
+ #### 🟡 P2 - XSS vulnerability in render
86
+
87
+ - **Confidence**: 50% (gpt)
88
+ - **Severity**: high
89
+ - **Location**: `src/components/Comment.tsx:15`
90
+ ```
91
+
92
+ ### When to Use Race Mode
93
+
94
+ | Scenario | Recommended |
95
+ |----------|-------------|
96
+ | Critical security review | ✅ `--race security` |
97
+ | Pre-production audit | ✅ `--race` |
98
+ | Quick iteration | ❌ Standard review |
99
+ | API cost concerns | ❌ Standard review |
100
+
101
+ ### Tool Invocation (Race Mode - GPT + Gemini in parallel via Bash)
102
+
103
+ **🚨 Use --input file to avoid CLI argument length limits and Windows pipe issues.**
104
+
105
+ 1. Save code to review into `[SCRATCHPAD]/review-code.txt` (using Write tool)
106
+ 2. Write JSON input file `[SCRATCHPAD]/review-input.json` (using Write tool):
107
+ - `{"prompt": "Review this code for [REVIEW_TYPE]. Return JSON: {issues: [{id, title, description, severity, suggestion}]}. Code: [CODE_CONTENT]"}`
108
+ - Where `[CODE_CONTENT]` is the code text (properly JSON-escaped inside the prompt string)
109
+ 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'))"`
110
+ - Save output as `[LLM_SCRIPT]`
111
+ 4. Run GPT + Gemini in PARALLEL (two Bash tool calls at once):
112
+
113
+ ```bash
114
+ # GPT review (Bash tool call 1)
115
+ node "[LLM_SCRIPT]" gpt orchestrate-json --input "[SCRATCHPAD]/review-input.json"
116
+ ```
117
+
118
+ ```bash
119
+ # Gemini review (Bash tool call 2 - run in parallel)
120
+ node "[LLM_SCRIPT]" gemini orchestrate-json --input "[SCRATCHPAD]/review-input.json"
121
+ ```
122
+
123
+ ## Priority System
124
+
125
+ | Priority | Criteria | Action |
126
+ |----------|----------|--------|
127
+ | P1 | Security vulnerabilities, data loss, crashes | Block merge, fix immediately |
128
+ | P2 | Performance issues, architecture violations, missing tests | Fix before merge |
129
+ | P3 | Style, refactoring suggestions, documentation | Add to backlog |
130
+
131
+ ## Process
132
+
133
+ ### Phase 1: Tech Stack Detection
134
+
135
+ Detect project tech stack FIRST before launching reviewers:
136
+
137
+ ```
138
+ Read package.json -> TypeScript, React, Node.js
139
+ Read pyproject.toml -> Python, FastAPI, Django
140
+ Read Gemfile -> Ruby, Rails
141
+ Read pubspec.yaml -> Flutter, Dart
142
+ Read go.mod -> Go
143
+ Read CLAUDE.md -> Explicit tech stack declaration
144
+ ```
145
+
146
+ ### Phase 2: Parallel Agent Review (STACK-AWARE) via Orchestrator
147
+
148
+ **Execution via Orchestrator (12+ agents in parallel):**
149
+ ```bash
150
+ node -e "import('{{CORE_PATH_URL}}/node_modules/@su-record/vibe/dist/infra/orchestrator/index.js').then(o => o.review(['FILE_PATHS'], ['DETECTED_STACKS']).then(r => console.log(r.content[0].text)))"
151
+ ```
152
+
153
+ **Example:**
154
+ ```bash
155
+ # Review changed files with TypeScript + React stack
156
+ node -e "import('{{CORE_PATH_URL}}/node_modules/@su-record/vibe/dist/infra/orchestrator/index.js').then(o => o.review(['src/api/users.ts', 'src/components/Login.tsx'], ['TypeScript', 'React']).then(r => console.log(r.content[0].text)))"
157
+ ```
158
+
159
+ **Core Reviewers (Always Run):**
160
+ | Agent | Focus |
161
+ |-------|-------|
162
+ | security-reviewer | OWASP Top 10, vulnerabilities |
163
+ | data-integrity-reviewer | Data validation, constraints |
164
+ | performance-reviewer | N+1 queries, memory leaks |
165
+ | architecture-reviewer | Layer violations, cycles |
166
+ | complexity-reviewer | Cyclomatic complexity, length |
167
+ | simplicity-reviewer | Over-abstraction, dead code |
168
+ | git-history-reviewer | Churn files, risk patterns |
169
+ | test-coverage-reviewer | Missing tests, edge cases |
170
+
171
+ **Stack-Specific Reviewers (Conditional):**
172
+ | Agent | Condition |
173
+ |-------|-----------|
174
+ | python-reviewer | .py files in diff |
175
+ | typescript-reviewer | .ts/.tsx files OR tsconfig |
176
+ | rails-reviewer | Gemfile has rails |
177
+ | react-reviewer | package.json has react |
178
+
179
+ ### Phase 2.5: UI/UX Review Agents (Auto-triggered)
180
+
181
+ > **활성화 조건**: 변경된 파일 중 UI 파일 존재 (`.tsx`, `.jsx`, `.vue`, `.svelte`, `.html`, `.css`, `.scss`)
182
+ > **비활성화**: `.claude/vibe/config.json`에 `"uiUxAnalysis": false` 설정
183
+
184
+ **기존 12+ 리뷰 에이전트와 병렬 실행:**
185
+
186
+ | Agent | Role | Output |
187
+ |-------|------|--------|
188
+ | ⑥ ux-compliance-reviewer | UX 가이드라인 준수 검증 | P1/P2/P3 findings |
189
+ | ⑦ ui-a11y-auditor | WCAG 2.1 AA 접근성 감사 | P1/P2/P3 findings |
190
+ | ⑧ ui-antipattern-detector | UI 안티패턴 + 디자인 시스템 일관성 | P1/P2/P3 findings |
191
+
192
+ **실행 방법 — 기존 Phase 2 에이전트와 병렬 실행:**
193
+
194
+ ```text
195
+ # ⑥ UX 준수 검증 (Haiku)
196
+ Task(subagent_type="ux-compliance-reviewer",
197
+ prompt="Review UI files for UX guideline compliance: {changed_ui_files}. Use core_ui_search against ux-guidelines and web-interface domains.")
198
+
199
+ # ⑦ 접근성 감사 (Haiku)
200
+ Task(subagent_type="ui-a11y-auditor",
201
+ prompt="Audit UI files for WCAG 2.1 AA compliance: {changed_ui_files}.")
202
+
203
+ # ⑧ 안티패턴 검출 (Haiku)
204
+ Task(subagent_type="ui-antipattern-detector",
205
+ prompt="Detect UI anti-patterns in: {changed_ui_files}. Check against MASTER.md if exists at .claude/vibe/design-system/{project}/MASTER.md.")
206
+ ```
207
+
208
+ **findings 통합**: ⑥⑦⑧ findings를 기존 findings[]와 병합 → P1/P2/P3 통합 정렬
209
+
210
+ **⑦ Critical finding 에스컬레이션**: ui-a11y-auditor의 P1 finding은 Review Debate Team(Phase 4.5)에 자동 포함
211
+
212
+ ### Phase 3: Deep Analysis
213
+
214
+ After agent results:
215
+
216
+ 1. **System Context**: Component interactions, data flow, external dependencies
217
+ 2. **Stakeholder Perspectives**: Developers, Ops, Security, Business
218
+ 3. **Edge Cases**: Race conditions, resource exhaustion, network failures
219
+ 4. **Multiple Angles**: Technical excellence, business value, risk management
220
+
221
+ ### Phase 4: Findings Synthesis
222
+
223
+ ```
224
+ REVIEW FINDINGS
225
+
226
+ P1 CRITICAL (Blocks Merge) - N issues
227
+ 1. [SECURITY] SQL Injection in user query
228
+ Location: src/api/users.py:42
229
+ Fix: Use parameterized queries
230
+
231
+ P2 IMPORTANT (Should Fix) - N issues
232
+ 2. [PERF] N+1 query in user list
233
+ 3. [ARCH] Circular dependency detected
234
+
235
+ P3 NICE-TO-HAVE (Enhancement) - N issues
236
+ 4. [STYLE] Consider extracting helper function
237
+ ```
238
+
239
+ ### Phase 4.5: Agent Teams — Review Debate
240
+
241
+ > **Agent Teams**: 개별 리뷰어의 발견을 팀으로 토론하여 우선순위를 검증하고 오탐을 제거합니다.
242
+ > 설정: `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1` + `teammateMode: in-process` (`~/.claude/settings.json` 전역 — postinstall 자동 설정)
243
+
244
+ **팀 구성:**
245
+
246
+ | 팀원 | 역할 |
247
+ |------|------|
248
+ | security-reviewer (리더) | P1/P2 이슈 종합, 보안 이슈 최종 판정, 합의 주도 |
249
+ | architecture-reviewer | 구조적 영향 평가, 숨겨진 결합도 식별 |
250
+ | performance-reviewer | 성능 영향 평가, 부하 시나리오 검증 |
251
+ | simplicity-reviewer | 과잉 설계 지적, 더 단순한 대안 제시 |
252
+
253
+ **실행 순서:**
254
+
255
+ 1. `TeamCreate(team_name="review-debate-{feature}")` — 팀 + 공유 태스크 리스트 생성
256
+ 2. 4개 팀원 병렬 생성 — 각각 `Task(team_name=..., name=..., subagent_type=...)` 으로 spawn
257
+ 3. 팀원들이 공유 TaskList에서 이슈를 claim하고, SendMessage로 교차 검증
258
+ 4. 리더(security-reviewer)가 팀 합의 결과 종합 → 검증된 P1/P2 목록 출력
259
+ 5. 모든 팀원 shutdown_request → TeamDelete로 정리
260
+
261
+ **팀원 spawn 패턴:**
262
+
263
+ ```text
264
+ TeamCreate(team_name="review-debate-{feature}", description="Review debate for {feature}")
265
+
266
+ # 4개 병렬 spawn
267
+ Task(team_name="review-debate-{feature}", name="security-reviewer", subagent_type="security-reviewer",
268
+ prompt="리뷰 토론 팀 리더. Phase 2에서 발견된 P1/P2 이슈를 팀과 함께 검증하세요.
269
+ Phase 2 결과: {phase2_findings}
270
+ 역할: 보안 이슈 최종 판정, 팀원 간 우선순위 충돌 해결, 최종 합의 요약 작성.
271
+ TaskList를 확인하고 이슈를 claim하세요. 각 이슈에 대해 팀원에게 SendMessage로 검증을 요청하세요.
272
+ 모든 이슈 검증 완료 후 최종 합의 결과를 작성하세요.")
273
+
274
+ Task(team_name="review-debate-{feature}", name="architecture-reviewer", subagent_type="architecture-reviewer",
275
+ prompt="리뷰 토론 팀 아키텍처 담당. Phase 2 결과: {phase2_findings}
276
+ 역할: 각 이슈의 구조적 영향 평가, 숨겨진 결합도/의존성 식별.
277
+ 아키텍처 관점에서 우선순위 변경이 필요하면 security-reviewer에게 SendMessage로 알리세요.
278
+ TaskList에서 아키텍처 관련 이슈를 claim하세요.")
279
+
280
+ Task(team_name="review-debate-{feature}", name="performance-reviewer", subagent_type="performance-reviewer",
281
+ prompt="리뷰 토론 팀 성능 담당. Phase 2 결과: {phase2_findings}
282
+ 역할: 성능 영향 평가, 부하 시 cascading failure 가능성 검증.
283
+ 성능 관점에서 P2→P1 승격이 필요하면 security-reviewer에게 SendMessage로 알리세요.
284
+ TaskList에서 성능 관련 이슈를 claim하세요.")
285
+
286
+ Task(team_name="review-debate-{feature}", name="simplicity-reviewer", subagent_type="simplicity-reviewer",
287
+ prompt="리뷰 토론 팀 복잡도 담당. Phase 2 결과: {phase2_findings}
288
+ 역할: 과잉 진단(오탐) 식별, 더 단순한 수정 방안 제시.
289
+ 오탐이나 P1→P2 강등이 필요하면 security-reviewer에게 SendMessage로 알리세요.
290
+ TaskList에서 복잡도/단순화 관련 이슈를 claim하세요.")
291
+ ```
292
+
293
+ **팀원 간 통신 예시:**
294
+
295
+ ```text
296
+ architecture-reviewer → security-reviewer: "Unbounded query는 부하 시 cascading failure 가능. P2→P1 승격 제안"
297
+ simplicity-reviewer → security-reviewer: "CSRF on read-only endpoint는 side effect 없음. P1→P2 강등 제안"
298
+ performance-reviewer → architecture-reviewer: "N+1 query가 현재 데이터 규모에서는 영향 없으나 확장 시 문제. 의견?"
299
+ security-reviewer → broadcast: "최종 합의: SQL Injection P1 유지, Unbounded query P1 승격, CSRF P2 강등, Circular dep 오탐 제거"
300
+ ```
301
+
302
+ **토론 결과 예시:**
303
+
304
+ ```
305
+ 🤝 REVIEW DEBATE RESULTS
306
+
307
+ Team Consensus (4 reviewers):
308
+
309
+ ✅ Validated P1 (unanimous):
310
+ 1. [SECURITY] SQL Injection — 4/4 agree critical
311
+
312
+ ⬆️ Upgraded P2→P1 (debate result):
313
+ 2. [PERF] Unbounded query — architecture-reviewer pointed out
314
+ cascading failure risk under load → team agreed P1
315
+
316
+ ⬇️ Downgraded P1→P2 (debate result):
317
+ 3. [SECURITY] CSRF on read-only endpoint — simplicity-reviewer
318
+ noted endpoint has no side effects → team agreed P2
319
+
320
+ ❌ Removed (false positive):
321
+ 4. [ARCH] "Circular dependency" — architecture-reviewer confirmed
322
+ this is intentional bi-directional reference, not a cycle
323
+
324
+ 🆕 New findings (team discussion):
325
+ 5. [DATA] Race condition in concurrent updates — emerged from
326
+ security + performance discussion
327
+ ```
328
+
329
+ ### Phase 5: Auto-Fix (P1/P2)
330
+
331
+ **Auto-fixable issues are resolved immediately:**
332
+
333
+ ```
334
+ 🔧 AUTO-FIX Starting...
335
+
336
+ P1 Critical:
337
+ 1. [SECURITY] SQL Injection → Fixed with parameterized query ✅
338
+ 2. [DATA] Missing transaction rollback → Added try-finally ✅
339
+
340
+ P2 Important:
341
+ 3. [PERF] N+1 query → Added select_related ✅
342
+ 4. [ARCH] Circular dependency → Separated dependencies ✅
343
+ 5. [TEST] Missing edge case → Added test ✅
344
+
345
+ 🔍 Re-validating...
346
+ ✅ Build successful
347
+ ✅ Tests passed
348
+
349
+ ✅ 5 issues auto-fixed!
350
+ ```
351
+
352
+ **Cases that cannot be auto-fixed:**
353
+ - Requires large-scale architecture changes
354
+ - Requires business logic decisions
355
+ - Requires user confirmation
356
+
357
+ → Manual handling instructions in Phase 6
358
+
359
+ ### Phase 6: Todo File Creation (Items Requiring Manual Handling)
360
+
361
+ Save **remaining** findings to `.claude/vibe/todos/`:
362
+
363
+ ```
364
+ {priority}-{category}-{short-desc}.md
365
+
366
+ Examples:
367
+ - P2-arch-large-refactor.md (Cannot be auto-fixed)
368
+ - P3-style-extract-helper.md (Backlog)
369
+ ```
370
+
371
+ ## Output
372
+
373
+ ```
374
+ CODE REVIEW SUMMARY
375
+ PR #123: Add user authentication
376
+
377
+ Reviewers: 13 agents
378
+ ⏱️ Started: {start_time}
379
+ ⏱️ Completed: {getCurrentTime 결과}
380
+
381
+ Score: 92/100 (Good) ← Score after auto-fix
382
+
383
+ Issues Found:
384
+ - P1 Critical: 2 → 0 (✅ Auto-fixed)
385
+ - P2 Important: 5 → 1 (✅ 4 auto-fixed)
386
+ - P3 Nice-to-have: 3 (Backlog)
387
+
388
+ Auto-Fixed: 6 issues
389
+ - [SECURITY] SQL Injection ✅
390
+ - [DATA] Transaction rollback ✅
391
+ - [PERF] N+1 query ✅
392
+ - [ARCH] Circular dependency ✅
393
+ - [PERF] Unnecessary loop ✅
394
+ - [TEST] Missing edge case ✅
395
+
396
+ Remaining (Manual handling required):
397
+ - P2-arch-large-refactor.md (Architecture decision required)
398
+ - P3-style-extract-helper.md (Backlog)
399
+ - P3-docs-add-readme.md (Backlog)
400
+
401
+ ✅ MERGE READY (P1/P2 resolved)
402
+ ```
403
+
404
+ ### Phase 7: Guide to Fix Workflow (Manual Handling Items)
405
+
406
+ **Choose workflow when handling remaining issues:**
407
+
408
+ ```
409
+ ## Fix Workflow
410
+
411
+ Choose a workflow to fix the discovered issues:
412
+
413
+ | Task Scale | Recommended Approach |
414
+ |------------|---------------------|
415
+ | Simple fix (1-2 files) | Plan Mode |
416
+ | Complex fix (3+ files, validation needed) | /vibe.spec |
417
+
418
+ 1. `/vibe.spec "fix: issue-name"` - VIBE workflow (SPEC validation + re-review)
419
+ 2. Plan Mode - Quick fix (for simple tasks)
420
+
421
+ Which approach would you like to proceed with?
422
+ ```
423
+
424
+ - Wait for user's choice before proceeding
425
+ - If user chooses VIBE → wait for `/vibe.spec` command
426
+ - If user chooses Plan Mode → proceed with EnterPlanMode
427
+
428
+ ## Core Tools (Code Analysis)
429
+
430
+ ### Tool Invocation
431
+
432
+ All tools are called via:
433
+
434
+ ```bash
435
+ 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)))"
436
+ ```
437
+
438
+ ### Recommended Tools for Review
439
+
440
+ | Tool | Purpose | When to Use |
441
+ |------|---------|-------------|
442
+ | `validateCodeQuality` | Code quality check | Overall code quality scan |
443
+ | `analyzeComplexity` | Complexity metrics | Check function complexity |
444
+ | `findSymbol` | Find definitions | Locate implementations |
445
+ | `findReferences` | Find all usages | Track symbol usage |
446
+ | `saveMemory` | Save findings | Store important review findings |
447
+
448
+ ### Example Tool Usage in Review
449
+
450
+ **1. Validate code quality before review:**
451
+
452
+ ```bash
453
+ node -e "import('{{CORE_PATH_URL}}/node_modules/@su-record/vibe/dist/tools/index.js').then(t => t.validateCodeQuality({targetPath: 'src/', projectPath: process.cwd()}).then(r => console.log(r.content[0].text)))"
454
+ ```
455
+
456
+ **2. Analyze complexity of changed files:**
457
+
458
+ ```bash
459
+ node -e "import('{{CORE_PATH_URL}}/node_modules/@su-record/vibe/dist/tools/index.js').then(t => t.analyzeComplexity({targetPath: 'src/api/users.ts', projectPath: process.cwd()}).then(r => console.log(r.content[0].text)))"
460
+ ```
461
+
462
+ **3. Save critical finding for reference:**
463
+
464
+ ```bash
465
+ node -e "import('{{CORE_PATH_URL}}/node_modules/@su-record/vibe/dist/tools/index.js').then(t => t.saveMemory({key: 'review-pr123-critical', value: 'SQL injection in users.py:42', category: 'review', projectPath: process.cwd()}).then(r => console.log(r.content[0].text)))"
466
+ ```
467
+
468
+ ---
469
+
470
+ ## Quality Gate (Mandatory)
471
+
472
+ ### Review Quality Checklist
473
+
474
+ Before completing review, ALL items must be verified:
475
+
476
+ | Category | Check Item | Weight |
477
+ |----------|------------|--------|
478
+ | **Security** | OWASP Top 10 vulnerabilities scanned | 20% |
479
+ | **Security** | Authentication/authorization verified | 10% |
480
+ | **Security** | Sensitive data exposure checked | 10% |
481
+ | **Performance** | N+1 queries detected and flagged | 10% |
482
+ | **Performance** | Memory leaks checked | 5% |
483
+ | **Architecture** | Layer violations detected | 10% |
484
+ | **Architecture** | Circular dependencies checked | 5% |
485
+ | **Code Quality** | Complexity limits enforced | 10% |
486
+ | **Code Quality** | Forbidden patterns detected | 10% |
487
+ | **Testing** | Test coverage gaps identified | 5% |
488
+ | **Documentation** | Public API documentation checked | 5% |
489
+
490
+ ### Review Score Calculation
491
+
492
+ ```
493
+ Score = 100 - (P1 × 20) - (P2 × 5) - (P3 × 1)
494
+
495
+ Grades:
496
+ - 95-100: ✅ EXCELLENT - Merge ready
497
+ - 90-94: ⚠️ GOOD - Minor fixes required before merge
498
+ - 80-89: ⚠️ FAIR - Must fix P2 issues
499
+ - 0-79: ❌ POOR - Block merge, fix P1/P2
500
+ ```
501
+
502
+ ### Merge Decision Matrix
503
+
504
+ | P1 Count | P2 Count | Decision |
505
+ |----------|----------|----------|
506
+ | 0 | 0-2 | ✅ MERGE READY |
507
+ | 0 | 3+ | ⚠️ FIX P2 FIRST |
508
+ | 1+ | Any | ❌ BLOCKED |
509
+
510
+ ### Auto-Fix Capability Matrix
511
+
512
+ | Issue Type | Auto-Fixable | Method |
513
+ |------------|--------------|--------|
514
+ | SQL Injection | ✅ Yes | Parameterized query |
515
+ | Missing transaction | ✅ Yes | Add try-finally |
516
+ | N+1 query | ✅ Yes | Add eager loading |
517
+ | Circular dependency | ⚠️ Partial | Suggest restructure |
518
+ | Missing tests | ✅ Yes | Generate test skeleton |
519
+ | Hardcoded secrets | ❌ No | Flag for manual review |
520
+ | Architecture violation | ❌ No | Suggest refactoring plan |
521
+
522
+ ### Forbidden Patterns (P1 Critical)
523
+
524
+ | Pattern | Risk Level | Detection Method |
525
+ |---------|------------|------------------|
526
+ | Hardcoded credentials | Critical | Regex + entropy scan |
527
+ | SQL string concatenation | Critical | AST analysis |
528
+ | `eval()` or `exec()` | Critical | AST analysis |
529
+ | Disabled CSRF protection | Critical | Config scan |
530
+ | Debug mode in production | Critical | Config scan |
531
+ | Unvalidated redirects | High | URL pattern scan |
532
+
533
+ ### Review Output Requirements
534
+
535
+ Every review MUST produce:
536
+
537
+ 1. **Summary Statistics**
538
+ - Total issues by priority (P1/P2/P3)
539
+ - Auto-fixed count
540
+ - Remaining manual fixes
541
+
542
+ 2. **Detailed Findings**
543
+ - File path and line number
544
+ - Issue description
545
+ - Recommended fix
546
+ - Auto-fix status (applied/pending/manual)
547
+
548
+ 3. **Quality Score**
549
+ - Numerical score (0-100)
550
+ - Grade (EXCELLENT/GOOD/FAIR/POOR)
551
+ - Merge recommendation
552
+
553
+ ---
554
+
555
+ ARGUMENTS: $ARGUMENTS