@kood/claude-code 0.5.1 → 0.5.3
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.
- package/dist/index.js +163 -28
- package/package.json +1 -1
- package/templates/.claude/agents/analyst.md +6 -14
- package/templates/.claude/agents/architect.md +6 -14
- package/templates/.claude/agents/code-reviewer.md +8 -14
- package/templates/.claude/agents/dependency-manager.md +8 -14
- package/templates/.claude/agents/deployment-validator.md +8 -14
- package/templates/.claude/agents/designer.md +8 -0
- package/templates/.claude/agents/document-writer.md +6 -14
- package/templates/.claude/agents/explore.md +8 -3
- package/templates/.claude/agents/git-operator.md +63 -17
- package/templates/.claude/agents/implementation-executor.md +14 -37
- package/templates/.claude/agents/ko-to-en-translator.md +8 -13
- package/templates/.claude/agents/lint-fixer.md +8 -172
- package/templates/.claude/agents/planner.md +6 -14
- package/templates/.claude/agents/refactor-advisor.md +8 -14
- package/templates/.claude/commands/git-all.md +3 -167
- package/templates/.claude/commands/git-session.md +3 -71
- package/templates/.claude/commands/lint-fix.md +119 -82
- package/templates/.claude/commands/lint-init.md +2 -54
- package/templates/.claude/commands/pre-deploy.md +143 -82
- package/templates/.claude/commands/version-update.md +171 -66
- package/templates/.claude/instructions/agent-patterns/agent-coordination.md +208 -0
- package/templates/.claude/instructions/agent-patterns/index.md +264 -0
- package/templates/.claude/instructions/agent-patterns/model-routing.md +167 -0
- package/templates/.claude/instructions/agent-patterns/parallel-execution.md +91 -0
- package/templates/.claude/instructions/agent-patterns/read-parallelization.md +106 -0
- package/templates/.claude/instructions/index.md +350 -0
- package/templates/.claude/instructions/multi-agent/agent-roster.md +811 -0
- package/templates/.claude/{PARALLEL_AGENTS.md → instructions/multi-agent/coordination-guide.md} +27 -336
- package/templates/.claude/instructions/{parallel-agent-execution.md → multi-agent/execution-patterns.md} +127 -438
- package/templates/.claude/instructions/multi-agent/index.md +282 -0
- package/templates/.claude/instructions/multi-agent/performance-optimization.md +456 -0
- package/templates/.claude/instructions/tech-stack/design-standards.md +282 -0
- package/templates/.claude/instructions/tech-stack/index.md +70 -0
- package/templates/.claude/instructions/tech-stack/prisma-patterns.md +352 -0
- package/templates/.claude/instructions/tech-stack/tanstack-patterns.md +275 -0
- package/templates/.claude/instructions/validation/forbidden-patterns.md +281 -0
- package/templates/.claude/instructions/validation/index.md +32 -0
- package/templates/.claude/instructions/validation/required-behaviors.md +331 -0
- package/templates/.claude/instructions/validation/verification-checklist.md +318 -0
- package/templates/.claude/instructions/workflow-patterns/index.md +18 -0
- package/templates/.claude/instructions/workflow-patterns/phase-based-workflow.md +250 -0
- package/templates/.claude/instructions/workflow-patterns/sequential-thinking.md +217 -0
- package/templates/.claude/instructions/workflow-patterns/todowrite-pattern.md +215 -0
- package/templates/.claude/skills/bug-fix/SKILL.md +972 -0
- package/templates/.claude/skills/docs-creator/AGENTS.md +4 -1
- package/templates/.claude/skills/docs-creator/SKILL.md +258 -0
- package/templates/.claude/skills/docs-refactor/AGENTS.md +4 -1
- package/templates/.claude/skills/docs-refactor/SKILL.md +145 -0
- package/templates/.claude/skills/execute/SKILL.md +15 -242
- package/templates/.claude/skills/figma-to-code/AGENTS.md +4 -1
- package/templates/.claude/skills/figma-to-code/SKILL.md +306 -0
- package/templates/.claude/skills/global-uiux-design/AGENTS.md +4 -1
- package/templates/.claude/skills/global-uiux-design/SKILL.md +455 -125
- package/templates/.claude/skills/korea-uiux-design/AGENTS.md +4 -1
- package/templates/.claude/skills/korea-uiux-design/SKILL.md +461 -116
- package/templates/.claude/skills/nextjs-react-best-practices/SKILL.md +177 -0
- package/templates/.claude/skills/plan/SKILL.md +1102 -98
- package/templates/.claude/skills/prd/SKILL.md +367 -66
- package/templates/.claude/skills/ralph/AGENTS.md +4 -1
- package/templates/.claude/skills/ralph/SKILL.md +83 -0
- package/templates/.claude/skills/refactor/SKILL.md +1214 -0
- package/templates/.claude/skills/tanstack-start-react-best-practices/SKILL.md +149 -0
- package/templates/.claude/commands/bug-fix.md +0 -510
- package/templates/.claude/commands/refactor.md +0 -788
|
@@ -1,22 +1,18 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Multi-Agent Execution Patterns
|
|
2
2
|
|
|
3
|
-
병렬 에이전트
|
|
3
|
+
병렬 에이전트 실행 및 조정 패턴을 통한 성능 최적화.
|
|
4
4
|
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
<
|
|
7
|
+
<overview>
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
**Core Principle:** 순차 실행 → 병렬 실행으로 5-15배 성능 향상.
|
|
12
|
-
|
|
13
|
-
</purpose>
|
|
9
|
+
## 목적 및 사용 시점
|
|
14
10
|
|
|
15
|
-
|
|
11
|
+
**Goal:** 독립적인 작업을 동시에 처리하여 대기 시간 최소화, 처리량 극대화, 비용 절감.
|
|
16
12
|
|
|
17
|
-
|
|
13
|
+
**Performance:** 순차 실행 → 병렬 실행으로 5-15배 성능 향상.
|
|
18
14
|
|
|
19
|
-
|
|
15
|
+
### 사용 시점
|
|
20
16
|
|
|
21
17
|
| 상황 | 설명 | 예상 효과 |
|
|
22
18
|
|------|------|----------|
|
|
@@ -26,21 +22,7 @@
|
|
|
26
22
|
| **다중 도메인** | API + UI + 문서 동시 작업 | 전문 에이전트 활용 |
|
|
27
23
|
| **배치 처리** | 여러 아이템 동일 작업 | 토큰 70-90% 절감 |
|
|
28
24
|
|
|
29
|
-
</
|
|
30
|
-
|
|
31
|
-
---
|
|
32
|
-
|
|
33
|
-
<core_principles>
|
|
34
|
-
|
|
35
|
-
## 3대 원칙
|
|
36
|
-
|
|
37
|
-
| 원칙 | 실행 방법 | 기대 효과 |
|
|
38
|
-
|------|----------|----------|
|
|
39
|
-
| **PARALLEL** | 단일 메시지에서 여러 Tool 동시 호출 | 5-15배 속도 향상 |
|
|
40
|
-
| **BACKGROUND** | 10개 이상 작업 시 `run_in_background=true` | 대기 시간 제거 |
|
|
41
|
-
| **DELEGATE** | 전문 에이전트에게 즉시 위임 | 컨텍스트 격리, 품질 향상 |
|
|
42
|
-
|
|
43
|
-
</core_principles>
|
|
25
|
+
</overview>
|
|
44
26
|
|
|
45
27
|
---
|
|
46
28
|
|
|
@@ -189,52 +171,11 @@ TaskOutput(task_id="...")
|
|
|
189
171
|
|
|
190
172
|
---
|
|
191
173
|
|
|
192
|
-
<
|
|
193
|
-
|
|
194
|
-
## 스마트 모델 라우팅
|
|
195
|
-
|
|
196
|
-
**원칙:** 작업 복잡도에 따라 모델 선택, 비용 최적화.
|
|
197
|
-
|
|
198
|
-
| 복잡도 | 모델 | 작업 예시 | 비용 | 속도 |
|
|
199
|
-
|--------|------|----------|------|------|
|
|
200
|
-
| **LOW** | haiku | 파일 읽기, 정의 조회, 간단한 탐색 | 💰 | ⚡⚡⚡ |
|
|
201
|
-
| **MEDIUM** | sonnet | 기능 구현, 버그 수정, 리팩토링 | 💰💰 | ⚡⚡ |
|
|
202
|
-
| **HIGH** | opus | 아키텍처 설계, 복잡한 디버깅, 보안 | 💰💰💰 | ⚡ |
|
|
203
|
-
|
|
204
|
-
**에이전트별 권장 모델:**
|
|
205
|
-
|
|
206
|
-
| 에이전트 | 권장 모델 | 용도 |
|
|
207
|
-
|---------|----------|------|
|
|
208
|
-
| planner | opus | 아키텍처 설계, 계획 검증 |
|
|
209
|
-
| implementation-executor | sonnet | 일반 구현, 버그 수정 |
|
|
210
|
-
| explore | haiku | 코드베이스 탐색 |
|
|
211
|
-
| designer | sonnet/opus | UI/UX 구현 |
|
|
212
|
-
| document-writer | haiku/sonnet | 문서 작성 |
|
|
213
|
-
| deployment-validator | sonnet | typecheck/lint/build |
|
|
214
|
-
| code-reviewer | opus | 코드 리뷰 |
|
|
215
|
-
| lint-fixer | sonnet | tsc/eslint 수정 |
|
|
216
|
-
|
|
217
|
-
**예시:**
|
|
218
|
-
|
|
219
|
-
```typescript
|
|
220
|
-
// ✅ 모델 명시
|
|
221
|
-
Task(subagent_type="explore", model="haiku",
|
|
222
|
-
prompt="프로젝트 구조 분석")
|
|
223
|
-
Task(subagent_type="implementation-executor", model="sonnet",
|
|
224
|
-
prompt="API 엔드포인트 구현")
|
|
225
|
-
Task(subagent_type="planner", model="opus",
|
|
226
|
-
prompt="아키텍처 검증")
|
|
227
|
-
```
|
|
228
|
-
|
|
229
|
-
</model_routing>
|
|
230
|
-
|
|
231
|
-
---
|
|
232
|
-
|
|
233
|
-
<agent_coordination>
|
|
174
|
+
<coordination_patterns>
|
|
234
175
|
|
|
235
|
-
##
|
|
176
|
+
## 조정 패턴
|
|
236
177
|
|
|
237
|
-
### 서브에이전트 패턴 (Subagents
|
|
178
|
+
### 패턴 1: 서브에이전트 패턴 (Subagents)
|
|
238
179
|
|
|
239
180
|
**특징:** 메인 에이전트가 컨텍스트 유지, 서브에이전트는 stateless.
|
|
240
181
|
|
|
@@ -244,11 +185,11 @@ Task(subagent_type="planner", model="opus",
|
|
|
244
185
|
Task(subagent_type="implementation-executor", model="sonnet",
|
|
245
186
|
prompt="User API 엔드포인트 구현")
|
|
246
187
|
|
|
247
|
-
// 서브에이전트 2: UI 구현
|
|
188
|
+
// 서브에이전트 2: UI 구현 (동시 실행)
|
|
248
189
|
Task(subagent_type="designer", model="sonnet",
|
|
249
190
|
prompt="User Profile UI 구현")
|
|
250
191
|
|
|
251
|
-
// 서브에이전트 3: 테스트 작성
|
|
192
|
+
// 서브에이전트 3: 테스트 작성 (동시 실행)
|
|
252
193
|
Task(subagent_type="implementation-executor", model="sonnet",
|
|
253
194
|
prompt="API 통합 테스트 작성")
|
|
254
195
|
```
|
|
@@ -260,29 +201,29 @@ Task(subagent_type="implementation-executor", model="sonnet",
|
|
|
260
201
|
|
|
261
202
|
---
|
|
262
203
|
|
|
263
|
-
### 순차 파이프라인 (Sequential Pipeline)
|
|
204
|
+
### 패턴 2: 순차 파이프라인 (Sequential Pipeline)
|
|
264
205
|
|
|
265
206
|
**용도:** 단계별 의존성 있는 작업.
|
|
266
207
|
|
|
267
208
|
```typescript
|
|
268
|
-
// Step 1: 분석
|
|
209
|
+
// Step 1: 분석 (haiku)
|
|
269
210
|
Task(subagent_type="explore", model="haiku",
|
|
270
211
|
prompt="기존 인증 로직 분석")
|
|
271
212
|
|
|
272
|
-
//
|
|
213
|
+
// Step 2: 구현 (sonnet) - Step 1 결과 필요
|
|
273
214
|
Task(subagent_type="implementation-executor", model="sonnet",
|
|
274
215
|
prompt="분석 결과 바탕으로 새 인증 로직 구현")
|
|
275
216
|
|
|
276
|
-
// Step 3: 검증
|
|
217
|
+
// Step 3: 검증 (sonnet) - Step 2 완료 필요
|
|
277
218
|
Task(subagent_type="deployment-validator", model="sonnet",
|
|
278
|
-
prompt="
|
|
219
|
+
prompt="typecheck/lint/build 검증")
|
|
279
220
|
```
|
|
280
221
|
|
|
281
|
-
**주의:** 순차
|
|
222
|
+
**주의:** 순차 실행은 의존성이 명확할 때만 사용.
|
|
282
223
|
|
|
283
224
|
---
|
|
284
225
|
|
|
285
|
-
###
|
|
226
|
+
### 패턴 3: 라우터 패턴 (Router)
|
|
286
227
|
|
|
287
228
|
**정의:** 중앙 에이전트가 작업 분석 후 전문 에이전트에게 라우팅.
|
|
288
229
|
|
|
@@ -302,344 +243,11 @@ if (taskType === "frontend") {
|
|
|
302
243
|
|
|
303
244
|
**활용:** 복잡한 요청을 도메인별로 자동 분배.
|
|
304
245
|
|
|
305
|
-
</
|
|
306
|
-
|
|
307
|
-
---
|
|
308
|
-
|
|
309
|
-
<context_preservation>
|
|
310
|
-
|
|
311
|
-
## 컨텍스트 보존 전략
|
|
312
|
-
|
|
313
|
-
### 문제: 병렬 실행 시 컨텍스트 손실
|
|
314
|
-
|
|
315
|
-
**원인:**
|
|
316
|
-
- 서브에이전트는 독립 컨텍스트
|
|
317
|
-
- 메인 에이전트 컨텍스트와 분리
|
|
318
|
-
- 결과만 전달됨
|
|
319
|
-
|
|
320
|
-
### 해결책
|
|
321
|
-
|
|
322
|
-
#### 1. 공유 상태 관리
|
|
323
|
-
|
|
324
|
-
```typescript
|
|
325
|
-
// ❌ 컨텍스트 손실
|
|
326
|
-
Task(subagent_type="implementation-executor",
|
|
327
|
-
prompt="모듈 A 구현")
|
|
328
|
-
Task(subagent_type="implementation-executor",
|
|
329
|
-
prompt="모듈 B 구현")
|
|
330
|
-
// → 서로 모듈 존재 모름
|
|
331
|
-
|
|
332
|
-
// ✅ 공유 상태 명시
|
|
333
|
-
Task(subagent_type="implementation-executor",
|
|
334
|
-
prompt=`모듈 A 구현
|
|
335
|
-
|
|
336
|
-
공유 상태:
|
|
337
|
-
- 프로젝트 구조: [설명]
|
|
338
|
-
- 공통 인터페이스: [설명]
|
|
339
|
-
- 의존성: [리스트]`)
|
|
340
|
-
|
|
341
|
-
Task(subagent_type="implementation-executor",
|
|
342
|
-
prompt=`모듈 B 구현 (모듈 A와 통합)
|
|
343
|
-
|
|
344
|
-
공유 상태:
|
|
345
|
-
- 프로젝트 구조: [설명]
|
|
346
|
-
- 공통 인터페이스: [설명]
|
|
347
|
-
- 모듈 A 위치: [경로]`)
|
|
348
|
-
```
|
|
349
|
-
|
|
350
|
-
#### 2. 문서 기반 컨텍스트
|
|
351
|
-
|
|
352
|
-
**활용:** 상태 문서 파일로 컨텍스트 공유.
|
|
353
|
-
|
|
354
|
-
```typescript
|
|
355
|
-
// Step 1: 상태 문서 생성
|
|
356
|
-
Write(".claude/context/project-state.md", `
|
|
357
|
-
# Project State
|
|
358
|
-
|
|
359
|
-
## Architecture
|
|
360
|
-
- Auth: JWT 기반
|
|
361
|
-
- Database: Prisma + PostgreSQL
|
|
362
|
-
- API: TanStack Start Server Functions
|
|
363
|
-
|
|
364
|
-
## Modules
|
|
365
|
-
- User: 완료
|
|
366
|
-
- Auth: 진행 중
|
|
367
|
-
- Post: 대기
|
|
368
|
-
`)
|
|
369
|
-
|
|
370
|
-
// Step 2: 병렬 실행 시 문서 참조
|
|
371
|
-
Task(subagent_type="implementation-executor",
|
|
372
|
-
prompt="@.claude/context/project-state.md 참조하여 Post 모듈 구현")
|
|
373
|
-
```
|
|
374
|
-
|
|
375
|
-
#### 3. 컨텍스트 컴팩션 (Context Compaction)
|
|
376
|
-
|
|
377
|
-
**문제:** 토큰 한계 도달 시 이전 작업 손실.
|
|
378
|
-
|
|
379
|
-
**해결책:**
|
|
380
|
-
|
|
381
|
-
```typescript
|
|
382
|
-
// 주기적 요약 및 저장
|
|
383
|
-
Task(subagent_type="document-writer", model="haiku",
|
|
384
|
-
prompt=`현재까지 작업 요약하여 .claude/context/summary.md에 저장
|
|
385
|
-
|
|
386
|
-
포함 내용:
|
|
387
|
-
- 완료된 작업
|
|
388
|
-
- 중요 의사결정
|
|
389
|
-
- 다음 단계`)
|
|
390
|
-
```
|
|
391
|
-
|
|
392
|
-
**컨텍스트 복구:**
|
|
393
|
-
|
|
394
|
-
```text
|
|
395
|
-
1. pwd → 작업 디렉토리 확인
|
|
396
|
-
2. Read(".claude/context/summary.md") → 진행 상태 파악
|
|
397
|
-
3. git log --oneline -10 → 최근 작업 확인
|
|
398
|
-
4. 중단 지점부터 재개
|
|
399
|
-
```
|
|
400
|
-
|
|
401
|
-
#### 4. 핸드오프 (Handoffs)
|
|
402
|
-
|
|
403
|
-
**정의:** 에이전트 간 명시적 정보 전달.
|
|
404
|
-
|
|
405
|
-
```typescript
|
|
406
|
-
// Agent A → Agent B 핸드오프
|
|
407
|
-
const resultA = Task(subagent_type="explore", model="haiku",
|
|
408
|
-
prompt="인증 로직 위치 찾기")
|
|
409
|
-
|
|
410
|
-
// 결과 명시적 전달
|
|
411
|
-
Task(subagent_type="implementation-executor", model="sonnet",
|
|
412
|
-
prompt=`인증 로직 수정
|
|
413
|
-
|
|
414
|
-
이전 에이전트 결과:
|
|
415
|
-
${resultA}
|
|
416
|
-
|
|
417
|
-
수정 내용: [...]`)
|
|
418
|
-
```
|
|
419
|
-
|
|
420
|
-
</context_preservation>
|
|
421
|
-
|
|
422
|
-
---
|
|
423
|
-
|
|
424
|
-
<error_handling>
|
|
425
|
-
|
|
426
|
-
## 에러 처리 및 복구
|
|
427
|
-
|
|
428
|
-
### 원칙
|
|
429
|
-
|
|
430
|
-
| 전략 | 설명 | 구현 |
|
|
431
|
-
|------|------|------|
|
|
432
|
-
| **Failure Isolation** | 실패 도메인 격리 | 에이전트별 독립 실행 |
|
|
433
|
-
| **Redundancy** | 중요 작업 중복 실행 | 동일 작업 여러 에이전트 |
|
|
434
|
-
| **Circuit Breaker** | 반복 실패 시 중단 | 3회 실패 시 에스컬레이션 |
|
|
435
|
-
| **Monitoring** | 상태 추적 | TaskList, 로그 파일 |
|
|
436
|
-
| **Graceful Degradation** | 부분 실패 허용 | 핵심 작업 우선 완료 |
|
|
437
|
-
|
|
438
|
-
### 패턴 1: 실패 격리
|
|
439
|
-
|
|
440
|
-
```typescript
|
|
441
|
-
// ✅ 에이전트별 격리
|
|
442
|
-
try {
|
|
443
|
-
Task(subagent_type="implementation-executor",
|
|
444
|
-
prompt="기능 A 구현")
|
|
445
|
-
} catch (error) {
|
|
446
|
-
// 기능 A 실패해도 B는 계속
|
|
447
|
-
}
|
|
448
|
-
|
|
449
|
-
Task(subagent_type="implementation-executor",
|
|
450
|
-
prompt="기능 B 구현")
|
|
451
|
-
```
|
|
452
|
-
|
|
453
|
-
### 패턴 2: 재시도 전략
|
|
454
|
-
|
|
455
|
-
```typescript
|
|
456
|
-
// ❌ 무한 재시도
|
|
457
|
-
while (true) {
|
|
458
|
-
Task(...) // 위험
|
|
459
|
-
}
|
|
460
|
-
|
|
461
|
-
// ✅ 제한적 재시도
|
|
462
|
-
const maxRetries = 3
|
|
463
|
-
let attempt = 0
|
|
464
|
-
|
|
465
|
-
while (attempt < maxRetries) {
|
|
466
|
-
try {
|
|
467
|
-
Task(subagent_type="implementation-executor", ...)
|
|
468
|
-
break // 성공 시 탈출
|
|
469
|
-
} catch (error) {
|
|
470
|
-
attempt++
|
|
471
|
-
if (attempt >= maxRetries) {
|
|
472
|
-
// 에스컬레이션: 더 강력한 모델 사용
|
|
473
|
-
Task(subagent_type="planner", model="opus",
|
|
474
|
-
prompt="문제 분석 및 대안 제시")
|
|
475
|
-
}
|
|
476
|
-
}
|
|
477
|
-
}
|
|
478
|
-
```
|
|
479
|
-
|
|
480
|
-
### 패턴 3: 서킷 브레이커
|
|
481
|
-
|
|
482
|
-
```typescript
|
|
483
|
-
// 에이전트 상태 추적
|
|
484
|
-
const agentFailures = new Map()
|
|
485
|
-
|
|
486
|
-
function executeWithCircuitBreaker(agentType, prompt) {
|
|
487
|
-
const failures = agentFailures.get(agentType) || 0
|
|
488
|
-
|
|
489
|
-
// 3회 이상 실패 시 차단
|
|
490
|
-
if (failures >= 3) {
|
|
491
|
-
console.log(`Circuit breaker: ${agentType} 차단됨`)
|
|
492
|
-
// 대안 에이전트 사용
|
|
493
|
-
return Task(subagent_type="alternative-agent", ...)
|
|
494
|
-
}
|
|
495
|
-
|
|
496
|
-
try {
|
|
497
|
-
const result = Task(subagent_type=agentType, prompt=prompt)
|
|
498
|
-
agentFailures.set(agentType, 0) // 성공 시 리셋
|
|
499
|
-
return result
|
|
500
|
-
} catch (error) {
|
|
501
|
-
agentFailures.set(agentType, failures + 1)
|
|
502
|
-
throw error
|
|
503
|
-
}
|
|
504
|
-
}
|
|
505
|
-
```
|
|
506
|
-
|
|
507
|
-
### 패턴 4: 모니터링 및 알림
|
|
508
|
-
|
|
509
|
-
```typescript
|
|
510
|
-
// 작업 상태 추적
|
|
511
|
-
TaskList() // pending/in_progress 작업 확인
|
|
512
|
-
|
|
513
|
-
// 실패 기록
|
|
514
|
-
Write(".claude/logs/failures.md", `
|
|
515
|
-
## Failure Log
|
|
516
|
-
|
|
517
|
-
- Time: ${timestamp}
|
|
518
|
-
- Agent: ${agentType}
|
|
519
|
-
- Task: ${taskDescription}
|
|
520
|
-
- Error: ${errorMessage}
|
|
521
|
-
- Retry: ${retryCount}
|
|
522
|
-
`)
|
|
523
|
-
```
|
|
524
|
-
|
|
525
|
-
### 패턴 5: 분산 복구
|
|
526
|
-
|
|
527
|
-
```typescript
|
|
528
|
-
// 여러 에이전트로 중복 실행
|
|
529
|
-
Task(subagent_type="implementation-executor", model="sonnet",
|
|
530
|
-
prompt="인증 로직 구현 (방법 1)")
|
|
531
|
-
Task(subagent_type="implementation-executor", model="sonnet",
|
|
532
|
-
prompt="인증 로직 구현 (방법 2)")
|
|
533
|
-
|
|
534
|
-
// 먼저 완료되거나 더 나은 결과 선택
|
|
535
|
-
```
|
|
536
|
-
|
|
537
|
-
</error_handling>
|
|
538
|
-
|
|
539
|
-
---
|
|
540
|
-
|
|
541
|
-
<performance_optimization>
|
|
542
|
-
|
|
543
|
-
## 성능 최적화
|
|
544
|
-
|
|
545
|
-
### 최적화 체크리스트
|
|
546
|
-
|
|
547
|
-
- [ ] 독립 작업 → 병렬 실행
|
|
548
|
-
- [ ] 10개 이상 유사 작업 → 배치 처리
|
|
549
|
-
- [ ] 10분 이상 작업 → 백그라운드 실행
|
|
550
|
-
- [ ] 복잡도별 모델 선택 (haiku/sonnet/opus)
|
|
551
|
-
- [ ] 컨텍스트 크기 모니터링 → 컴팩션
|
|
552
|
-
- [ ] 실패 시 재시도 제한 (3회)
|
|
553
|
-
- [ ] 상태 문서화 (컨텍스트 복구)
|
|
554
|
-
|
|
555
|
-
### 성능 지표
|
|
556
|
-
|
|
557
|
-
| 지표 | 목표 | 측정 방법 |
|
|
558
|
-
|------|------|----------|
|
|
559
|
-
| **대기 시간** | 순차 대비 80% 감소 | 시작~완료 시간 |
|
|
560
|
-
| **토큰 사용** | 70-90% 절감 (배치) | API 로그 |
|
|
561
|
-
| **병렬도** | 3-10개 동시 실행 | 활성 에이전트 수 |
|
|
562
|
-
| **성공률** | 95% 이상 | 완료/시도 비율 |
|
|
563
|
-
|
|
564
|
-
### 안티패턴
|
|
565
|
-
|
|
566
|
-
| 안티패턴 | 문제 | 올바른 방법 |
|
|
567
|
-
|---------|------|------------|
|
|
568
|
-
| **순차 실행** | 불필요한 대기 | 병렬 실행 |
|
|
569
|
-
| **과도한 병렬** | 컨텍스트 혼란 | 3-10개 제한 |
|
|
570
|
-
| **모델 미스매치** | 비용 낭비 | 복잡도별 선택 |
|
|
571
|
-
| **컨텍스트 미보존** | 작업 손실 | 상태 문서화 |
|
|
572
|
-
| **무한 재시도** | 리소스 낭비 | 3회 제한 |
|
|
573
|
-
|
|
574
|
-
</performance_optimization>
|
|
575
|
-
|
|
576
|
-
---
|
|
577
|
-
|
|
578
|
-
<best_practices>
|
|
579
|
-
|
|
580
|
-
## 모범 사례
|
|
581
|
-
|
|
582
|
-
### 실행 전 체크
|
|
583
|
-
|
|
584
|
-
```text
|
|
585
|
-
1. 작업 분석
|
|
586
|
-
- 독립적인가? → 병렬
|
|
587
|
-
- 의존적인가? → 순차
|
|
588
|
-
- 유사한가? → 배치
|
|
589
|
-
|
|
590
|
-
2. 모델 선택
|
|
591
|
-
- 간단 → haiku
|
|
592
|
-
- 일반 → sonnet
|
|
593
|
-
- 복잡 → opus
|
|
594
|
-
|
|
595
|
-
3. 컨텍스트 계획
|
|
596
|
-
- 공유 상태 필요? → 문서화
|
|
597
|
-
- 컨텍스트 한계? → 컴팩션
|
|
598
|
-
|
|
599
|
-
4. 에러 처리
|
|
600
|
-
- 재시도 전략
|
|
601
|
-
- 대안 계획
|
|
602
|
-
- 모니터링
|
|
603
|
-
```
|
|
604
|
-
|
|
605
|
-
### 작업 분해 원칙
|
|
606
|
-
|
|
607
|
-
| 원칙 | 설명 | 예시 |
|
|
608
|
-
|------|------|------|
|
|
609
|
-
| **Single Responsibility** | 에이전트당 하나의 책임 | explore, implement, review 분리 |
|
|
610
|
-
| **Loose Coupling** | 에이전트 간 최소 의존성 | 공유 상태만 문서로 전달 |
|
|
611
|
-
| **High Cohesion** | 관련 작업 그룹화 | UI 관련 작업 → designer |
|
|
612
|
-
|
|
613
|
-
### 효율적인 프롬프트
|
|
614
|
-
|
|
615
|
-
```typescript
|
|
616
|
-
// ❌ 모호한 지시
|
|
617
|
-
Task(subagent_type="implementation-executor",
|
|
618
|
-
prompt="뭔가 구현해줘")
|
|
619
|
-
|
|
620
|
-
// ✅ 명확한 지시
|
|
621
|
-
Task(subagent_type="implementation-executor", model="sonnet",
|
|
622
|
-
prompt=`User API 엔드포인트 구현
|
|
623
|
-
|
|
624
|
-
요구사항:
|
|
625
|
-
- GET /users: 사용자 목록
|
|
626
|
-
- POST /users: 사용자 생성
|
|
627
|
-
- 인증: JWT 미들웨어
|
|
628
|
-
- 검증: Zod 스키마
|
|
629
|
-
|
|
630
|
-
기존 패턴:
|
|
631
|
-
@functions/auth.ts 참조
|
|
632
|
-
|
|
633
|
-
예상 결과:
|
|
634
|
-
- functions/users.ts
|
|
635
|
-
- 테스트 포함`)
|
|
636
|
-
```
|
|
637
|
-
|
|
638
|
-
</best_practices>
|
|
246
|
+
</coordination_patterns>
|
|
639
247
|
|
|
640
248
|
---
|
|
641
249
|
|
|
642
|
-
<
|
|
250
|
+
<practical_examples>
|
|
643
251
|
|
|
644
252
|
## 실전 예제
|
|
645
253
|
|
|
@@ -808,45 +416,91 @@ while (attempt < maxRetries) {
|
|
|
808
416
|
}
|
|
809
417
|
```
|
|
810
418
|
|
|
811
|
-
</
|
|
419
|
+
</practical_examples>
|
|
812
420
|
|
|
813
421
|
---
|
|
814
422
|
|
|
815
|
-
<
|
|
423
|
+
<best_practices>
|
|
816
424
|
|
|
817
|
-
##
|
|
425
|
+
## 모범 사례
|
|
818
426
|
|
|
819
|
-
###
|
|
427
|
+
### 실행 전 체크리스트
|
|
820
428
|
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
429
|
+
```text
|
|
430
|
+
1. 작업 분석
|
|
431
|
+
- 독립적인가? → 병렬
|
|
432
|
+
- 의존적인가? → 순차
|
|
433
|
+
- 유사한가? → 배치
|
|
824
434
|
|
|
825
|
-
|
|
435
|
+
2. 모델 선택
|
|
436
|
+
- 간단 → haiku
|
|
437
|
+
- 일반 → sonnet
|
|
438
|
+
- 복잡 → opus
|
|
826
439
|
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
7. [Agentic AI Patterns (AWS)](https://docs.aws.amazon.com/prescriptive-guidance/latest/agentic-ai-patterns/introduction.html) - 워크플로우 패턴
|
|
440
|
+
3. 컨텍스트 계획
|
|
441
|
+
- 공유 상태 필요? → 문서화
|
|
442
|
+
- 컨텍스트 한계? → 컴팩션
|
|
831
443
|
|
|
832
|
-
|
|
444
|
+
4. 에러 처리
|
|
445
|
+
- 재시도 전략
|
|
446
|
+
- 대안 계획
|
|
447
|
+
- 모니터링
|
|
448
|
+
```
|
|
833
449
|
|
|
834
|
-
|
|
835
|
-
9. [Parallel Processing with Claude](https://codesignal.com/learn/courses/exploring-workflows-with-claude-in-typescript/lessons/parallel-processing-with-claude) - 병렬 처리 실습
|
|
836
|
-
10. [AI Agent Performance Optimization](https://www.talktoagent.com/blog/ways-to-optimize-ai-agent-performance) - 9가지 최적화 전략
|
|
450
|
+
### 작업 분해 원칙
|
|
837
451
|
|
|
838
|
-
|
|
452
|
+
| 원칙 | 설명 | 예시 |
|
|
453
|
+
|------|------|------|
|
|
454
|
+
| **Single Responsibility** | 에이전트당 하나의 책임 | explore, implement, review 분리 |
|
|
455
|
+
| **Loose Coupling** | 에이전트 간 최소 의존성 | 공유 상태만 문서로 전달 |
|
|
456
|
+
| **High Cohesion** | 관련 작업 그룹화 | UI 관련 작업 → designer |
|
|
839
457
|
|
|
840
|
-
|
|
841
|
-
12. [Exception Handling for AI Agents](https://datagrid.com/blog/exception-handling-frameworks-ai-agents) - 예외 처리 프레임워크
|
|
842
|
-
13. [Multi-Agent Systems Fault Tolerance](https://milvus.io/ai-quick-reference/how-do-multiagent-systems-ensure-fault-tolerance) - 결함 허용
|
|
458
|
+
### 효율적인 프롬프트
|
|
843
459
|
|
|
844
|
-
|
|
460
|
+
```typescript
|
|
461
|
+
// ❌ 모호한 지시
|
|
462
|
+
Task(subagent_type="implementation-executor",
|
|
463
|
+
prompt="뭔가 구현해줘")
|
|
845
464
|
|
|
846
|
-
|
|
847
|
-
|
|
465
|
+
// ✅ 명확한 지시
|
|
466
|
+
Task(subagent_type="implementation-executor", model="sonnet",
|
|
467
|
+
prompt=`User API 엔드포인트 구현
|
|
848
468
|
|
|
849
|
-
|
|
469
|
+
요구사항:
|
|
470
|
+
- GET /users: 사용자 목록
|
|
471
|
+
- POST /users: 사용자 생성
|
|
472
|
+
- 인증: JWT 미들웨어
|
|
473
|
+
- 검증: Zod 스키마
|
|
474
|
+
|
|
475
|
+
기존 패턴:
|
|
476
|
+
@functions/auth.ts 참조
|
|
477
|
+
|
|
478
|
+
예상 결과:
|
|
479
|
+
- functions/users.ts
|
|
480
|
+
- 테스트 포함`)
|
|
481
|
+
```
|
|
482
|
+
|
|
483
|
+
### 성능 최적화 체크리스트
|
|
484
|
+
|
|
485
|
+
- [ ] 독립 작업 → 병렬 실행
|
|
486
|
+
- [ ] 10개 이상 유사 작업 → 배치 처리
|
|
487
|
+
- [ ] 10분 이상 작업 → 백그라운드 실행
|
|
488
|
+
- [ ] 복잡도별 모델 선택 (haiku/sonnet/opus)
|
|
489
|
+
- [ ] 컨텍스트 크기 모니터링 → 컴팩션
|
|
490
|
+
- [ ] 실패 시 재시도 제한 (3회)
|
|
491
|
+
- [ ] 상태 문서화 (컨텍스트 복구)
|
|
492
|
+
|
|
493
|
+
### 안티패턴
|
|
494
|
+
|
|
495
|
+
| 안티패턴 | 문제 | 올바른 방법 |
|
|
496
|
+
|---------|------|------------|
|
|
497
|
+
| **순차 실행** | 불필요한 대기 | 병렬 실행 |
|
|
498
|
+
| **과도한 병렬** | 컨텍스트 혼란 | 3-10개 제한 |
|
|
499
|
+
| **모델 미스매치** | 비용 낭비 | 복잡도별 선택 |
|
|
500
|
+
| **컨텍스트 미보존** | 작업 손실 | 상태 문서화 |
|
|
501
|
+
| **무한 재시도** | 리소스 낭비 | 3회 제한 |
|
|
502
|
+
|
|
503
|
+
</best_practices>
|
|
850
504
|
|
|
851
505
|
---
|
|
852
506
|
|
|
@@ -872,3 +526,38 @@ while (attempt < maxRetries) {
|
|
|
872
526
|
5. 모니터링 → TaskList, 로그
|
|
873
527
|
|
|
874
528
|
</summary>
|
|
529
|
+
|
|
530
|
+
---
|
|
531
|
+
|
|
532
|
+
<references>
|
|
533
|
+
|
|
534
|
+
## 참고 자료
|
|
535
|
+
|
|
536
|
+
**관련 문서:**
|
|
537
|
+
- `.claude/instructions/parallel-agent-execution.md` - 병렬 실행 전체 가이드
|
|
538
|
+
- `.claude/PARALLEL_AGENTS.md` - 멀티 에이전트 조정 가이드
|
|
539
|
+
- `.claude/agents/*.md` - 개별 에이전트 스펙
|
|
540
|
+
|
|
541
|
+
**외부 자료:**
|
|
542
|
+
|
|
543
|
+
### Anthropic
|
|
544
|
+
1. [Effective context engineering for AI agents](https://www.anthropic.com/engineering/effective-context-engineering-for-ai-agents) - 컨텍스트 엔지니어링 원칙
|
|
545
|
+
2. [Multi-agent research system](https://www.anthropic.com/engineering/multi-agent-research-system) - 멀티 에이전트 시스템 사례
|
|
546
|
+
3. [Batch processing](https://platform.claude.com/docs/en/build-with-claude/batch-processing) - 배치 처리 API
|
|
547
|
+
|
|
548
|
+
### 아키텍처 패턴
|
|
549
|
+
4. [Multi-Agent Design Patterns (Azure)](https://learn.microsoft.com/en-us/azure/architecture/ai-ml/guide/ai-agent-design-patterns) - 에이전트 오케스트레이션 패턴
|
|
550
|
+
5. [Multi-Agent Systems (Google ADK)](https://google.github.io/adk-docs/agents/multi-agents/) - 병렬 에이전트 구현
|
|
551
|
+
6. [Multi-Agent Patterns (LangChain)](https://docs.langchain.com/oss/python/langchain/multi-agent) - 서브에이전트, 라우터 패턴
|
|
552
|
+
7. [Agentic AI Patterns (AWS)](https://docs.aws.amazon.com/prescriptive-guidance/latest/agentic-ai-patterns/introduction.html) - 워크플로우 패턴
|
|
553
|
+
|
|
554
|
+
### 성능 최적화
|
|
555
|
+
8. [Batch Query Processing (arXiv)](https://arxiv.org/html/2509.02121v1) - 배치 최적화 연구
|
|
556
|
+
9. [Parallel Processing with Claude](https://codesignal.com/learn/courses/exploring-workflows-with-claude-in-typescript/lessons/parallel-processing-with-claude) - 병렬 처리 실습
|
|
557
|
+
10. [AI Agent Performance Optimization](https://www.talktoagent.com/blog/ways-to-optimize-ai-agent-performance) - 9가지 최적화 전략
|
|
558
|
+
|
|
559
|
+
### 고급 패턴
|
|
560
|
+
11. [Fan-Out Fan-In Pattern](https://systemdesignschool.io/fundamentals/fan-out-fan-in) - 분산 처리 패턴
|
|
561
|
+
12. [Context Preservation in Multi-Agent](https://developers.googleblog.com/architecting-efficient-context-aware-multi-agent-framework-for-production/) - 컨텍스트 보존 기법
|
|
562
|
+
|
|
563
|
+
</references>
|