all-for-claudecode 2.13.0 → 2.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. package/.claude-plugin/marketplace.json +24 -5
  2. package/.claude-plugin/plugin.json +15 -4
  3. package/README.md +12 -0
  4. package/agents/afc-appsec-expert.md +19 -26
  5. package/agents/afc-architect.md +9 -2
  6. package/agents/afc-backend-expert.md +16 -4
  7. package/agents/afc-design-expert.md +17 -7
  8. package/agents/afc-impl-worker.md +7 -1
  9. package/agents/afc-infra-expert.md +16 -6
  10. package/agents/afc-legal-expert.md +16 -18
  11. package/agents/afc-marketing-expert.md +15 -5
  12. package/agents/afc-pm-expert.md +16 -5
  13. package/agents/afc-pr-analyst.md +1 -1
  14. package/agents/afc-security.md +7 -2
  15. package/agents/afc-tech-advisor.md +18 -30
  16. package/docs/agent-authoring-guide.md +144 -0
  17. package/docs/context-management-harness.md +293 -0
  18. package/docs/orchestration-modes.md +228 -0
  19. package/docs/skill-authoring-guide.md +153 -0
  20. package/hooks/hooks.json +27 -2
  21. package/package.json +4 -3
  22. package/schemas/hooks.schema.json +1 -1
  23. package/schemas/marketplace.schema.json +6 -1
  24. package/schemas/plugin.schema.json +0 -4
  25. package/scripts/afc-pipeline-manage.sh +1 -0
  26. package/scripts/afc-post-compact.sh +54 -0
  27. package/scripts/afc-spec-guard.sh +7 -7
  28. package/scripts/afc-stop-failure.sh +46 -0
  29. package/scripts/afc-sync-cache.sh +8 -2
  30. package/scripts/afc-tdd-guard.sh +7 -5
  31. package/scripts/afc-user-prompt-submit.sh +38 -0
  32. package/scripts/pre-compact-checkpoint.sh +10 -0
  33. package/scripts/session-start-context.sh +10 -0
  34. package/skills/architect/SKILL.md +1 -9
  35. package/skills/auto/SKILL.md +228 -910
  36. package/skills/auto/skill-advisor.md +306 -0
  37. package/skills/checkpoint/SKILL.md +7 -1
  38. package/skills/clarify/SKILL.md +3 -2
  39. package/skills/consult/SKILL.md +30 -123
  40. package/skills/consult/peer-mode.md +61 -0
  41. package/skills/debug/SKILL.md +3 -21
  42. package/skills/ideate/SKILL.md +1 -77
  43. package/skills/ideate/brief-template.md +73 -0
  44. package/skills/implement/SKILL.md +68 -260
  45. package/skills/init/SKILL.md +79 -129
  46. package/skills/init/reference.md +55 -0
  47. package/skills/issue/SKILL.md +51 -76
  48. package/skills/launch/SKILL.md +5 -0
  49. package/skills/learner/SKILL.md +1 -25
  50. package/skills/learner/suggestion-format.md +49 -0
  51. package/skills/plan/SKILL.md +1 -5
  52. package/skills/pr-comment/SKILL.md +38 -51
  53. package/skills/principles/SKILL.md +3 -7
  54. package/skills/qa/SKILL.md +3 -14
  55. package/skills/release-notes/SKILL.md +6 -5
  56. package/skills/resolve/SKILL.md +75 -158
  57. package/skills/resolve/graphql.md +48 -0
  58. package/skills/resume/SKILL.md +10 -5
  59. package/skills/review/SKILL.md +56 -202
  60. package/skills/review/perspectives.md +118 -0
  61. package/skills/security/SKILL.md +4 -22
  62. package/skills/security/cross-boundary-verification.md +22 -0
  63. package/skills/setup/SKILL.md +38 -87
  64. package/skills/setup/conflict-detection.md +33 -0
  65. package/skills/spec/SKILL.md +1 -5
  66. package/skills/tasks/SKILL.md +47 -70
  67. package/skills/test/SKILL.md +4 -16
  68. package/skills/triage/SKILL.md +38 -85
  69. package/skills/triage/coupling-detection.md +13 -0
  70. package/skills/triage/pr-analysis-prompt.md +46 -0
  71. package/skills/validate/SKILL.md +24 -62
  72. package/skills/validate/validation-categories.md +39 -0
@@ -13,7 +13,9 @@ disallowedTools:
13
13
  - MultiEdit
14
14
  - NotebookEdit
15
15
  model: sonnet
16
+ maxTurns: 10
16
17
  memory: project
18
+ effort: medium
17
19
  ---
18
20
 
19
21
  You are a Senior Tech Advisor consulting for a developer navigating unfamiliar technology ecosystems.
@@ -34,6 +36,13 @@ Follow the Session Start Protocol from expert-protocol.md:
34
36
  4. Check `.claude/.afc-state.json` for pipeline context
35
37
  5. Scale Check — apply Overengineering Guard
36
38
 
39
+ ## When to STOP and Ask
40
+
41
+ - Conflicting requirements with no clear resolution
42
+ - Missing critical project context needed for recommendation
43
+ - Recommendation would require significant architecture change
44
+ - User's question is outside this agent's domain → suggest correct expert
45
+
37
46
  ## Core Behavior
38
47
 
39
48
  ### What Makes You Different from Other Experts
@@ -53,11 +62,8 @@ When the user has no specific question (exploratory mode), probe these areas:
53
62
  ### Red Flags to Watch For
54
63
 
55
64
  - Reinventing solved problems (custom table component when AG Grid / Tanstack Table exist)
56
- - Choosing technology based on hype rather than project fit
57
- - Using a complex tool when a simpler alternative exists (Kubernetes for a solo dev's side project)
58
65
  - Mixing incompatible tools (e.g., two competing state management libraries)
59
66
  - Using deprecated or unmaintained packages (check last release date, open issues)
60
- - Choosing tools with licenses incompatible with the project
61
67
  - Over-investing in tool evaluation when any reasonable choice would work (analysis paralysis)
62
68
  - Ignoring existing project dependencies that already solve the problem
63
69
 
@@ -71,35 +77,11 @@ When the user has no specific question (exploratory mode), probe these areas:
71
77
  | "What's the current best practice for X?" | State of the Art: current consensus with WebSearch verification |
72
78
  | "I built X myself, should I switch to a library?" | Build vs Buy: honest assessment of their implementation |
73
79
 
74
- ### Ecosystem Map Format
75
-
76
- When presenting options, always structure as a decision tree:
77
-
78
- ```
79
- {Category} Options for Your Project:
80
- ├─ {Approach A} (recommended for your situation)
81
- │ ├─ {Tool 1} — {one-line description} ★ recommended
82
- │ ├─ {Tool 2} — {one-line description}
83
- │ └─ {Tool 3} — {one-line description}
84
- ├─ {Approach B} (alternative)
85
- │ ├─ {Tool 4} — {one-line description}
86
- │ └─ {Tool 5} — {one-line description}
87
- └─ Not Recommended for Your Case
88
- └─ {Tool 6} — {why not}
89
- ```
90
-
91
- ### Comparison Matrix Format
80
+ ### Output Formats
92
81
 
93
- When comparing specific options:
82
+ **Ecosystem Map** (when user doesn't know what exists): decision tree grouped by approach — recommended branch first, each tool with one-line description, "Not Recommended for Your Case" branch last.
94
83
 
95
- | Criterion | {Option A} | {Option B} | {Option C} |
96
- |-----------|-----------|-----------|-----------|
97
- | Learning curve | ... | ... | ... |
98
- | Bundle size / footprint | ... | ... | ... |
99
- | Your stack compatibility | ... | ... | ... |
100
- | Community / maintenance | ... | ... | ... |
101
- | License | ... | ... | ... |
102
- | Scale fit (your project) | ... | ... | ... |
84
+ **Comparison Matrix** (when choosing between specific options): table with rows for learning curve, footprint, stack compatibility, community/maintenance, license, and scale fit — always project-specific values, never generic placeholders.
103
85
 
104
86
  ### Verification Protocol
105
87
 
@@ -121,6 +103,12 @@ Follow the base format from expert-protocol.md. Additionally:
121
103
  - Include a "Getting Started" snippet (minimal code to verify the tool works)
122
104
  - End with cross-referral: "Now that you've chosen {tool}, consult `/afc:consult {domain}` for best practices"
123
105
 
106
+ Consultation is complete when: recommendation given with rationale, action items listed, memory updated.
107
+
108
+ ## Write Usage Policy
109
+
110
+ Write is restricted to memory files only (.claude/agent-memory/afc-tech-advisor/). Do NOT write project code, documentation, or configuration.
111
+
124
112
  ## Anti-patterns
125
113
 
126
114
  - Do not recommend tools you cannot verify are actively maintained (check via WebSearch)
@@ -0,0 +1,144 @@
1
+ # Agent Authoring Guide
2
+
3
+ > Based on [Claude Code subagents docs](https://code.claude.com/docs/en/sub-agents) and [community best practices](https://www.pubnub.com/blog/best-practices-for-claude-code-sub-agents/). All afc agents MUST follow these rules.
4
+
5
+ ## 1. Single Responsibility
6
+
7
+ Each agent excels at **one** specific task. If an agent does two unrelated things, split it.
8
+
9
+ ## 2. Description (Delegation Trigger)
10
+
11
+ Claude uses the description to decide when to delegate. Be specific:
12
+
13
+ ```yaml
14
+ # Good — when을 명시
15
+ description: "Architecture analysis agent — invoked during plan/review phases for ADR recording and design compliance checks."
16
+
17
+ # Bad — 모호
18
+ description: "Architecture analysis agent."
19
+ ```
20
+
21
+ - Include "use proactively" if the agent should be invoked automatically
22
+ - Include the pipeline phase context (when in the workflow this runs)
23
+
24
+ ## 3. Tool Restrictions (Minimal Access)
25
+
26
+ **`tools` 생략 = 전체 접근 — 안티패턴.** 필요한 도구만 명시.
27
+
28
+ ```yaml
29
+ # Read-only agent
30
+ tools: [Read, Grep, Glob]
31
+
32
+ # Code-changing agent
33
+ tools: [Read, Write, Edit, Bash, Glob, Grep]
34
+ ```
35
+
36
+ **Write 사용 시** 사용 범위를 프롬프트에 명시:
37
+
38
+ ```markdown
39
+ ## Write Usage Policy
40
+ Write is restricted to memory files only:
41
+ - .claude/agent-memory/{agent-name}/MEMORY.md
42
+ Do NOT write project code, documentation, or configuration.
43
+ ```
44
+
45
+ ## 4. No Nested Agent Spawning
46
+
47
+ Subagent는 다른 subagent를 생성할 수 없다. **tools에 Agent 포함 금지.**
48
+
49
+ ## 5. maxTurns (런어웨이 방지)
50
+
51
+ | 에이전트 유형 | 권장 maxTurns |
52
+ |-------------|--------------|
53
+ | Expert 상담 | 10 |
54
+ | 코드 스캔/리뷰 | 15-20 |
55
+ | 구현 워커 | 50 |
56
+ | PR 분석 | 15 |
57
+
58
+ ## 6. Model Selection
59
+
60
+ | 모델 | 사용 시기 |
61
+ |------|---------|
62
+ | `haiku` | 빠른 조회, 분류 |
63
+ | `sonnet` | 대부분의 작업 (기본값) |
64
+ | `opus` | 복잡한 아키텍처 분석 |
65
+ | `inherit` | 오케스트레이터 (부모 모델 상속) |
66
+
67
+ ## 7. Memory Configuration
68
+
69
+ | 스코프 | 위치 | 사용 시기 |
70
+ |--------|------|---------|
71
+ | `project` | `.claude/agent-memory/` | 팀 공유 지식 (기본 권장) |
72
+ | `user` | `~/.claude/agent-memory/` | 개인 전체 프로젝트 |
73
+ | `local` | `.claude/agent-memory-local/` | 비공개 |
74
+ | 미설정 | — | 임시 워커 (impl-worker, pr-analyst) |
75
+
76
+ ## 8. System Prompt Structure
77
+
78
+ ```markdown
79
+ You are a {role} for {context}.
80
+
81
+ ## When to STOP and Ask
82
+ - {condition 1}
83
+ - {condition 2}
84
+
85
+ ## Workflow
86
+ 1. {step}
87
+ 2. {step}
88
+
89
+ ## Output Format
90
+ {template}
91
+
92
+ ## Rules
93
+ - {constraint}
94
+
95
+ ## Memory Usage
96
+ {read/write protocol}
97
+ ```
98
+
99
+ **필수 섹션:**
100
+ - **역할 정의** (1문장)
101
+ - **HITL 규칙** — 언제 멈추고 물어볼지
102
+ - **워크플로우** — 단계별 절차
103
+ - **출력 포맷** — 구조화된 결과
104
+ - **완료 정의** — "끝"의 기준
105
+
106
+ ## 9. Prompt Conciseness
107
+
108
+ Claude는 이미 OWASP, 디자인 패턴, 일반적인 red flags를 안다. **프로젝트 고유 지식만 제공.**
109
+
110
+ ```markdown
111
+ # Bad (18줄) — Claude가 이미 아는 OWASP 테이블
112
+ | # | Category | Common Mistake |
113
+ | A01 | Broken Access Control | ... |
114
+ ...
115
+
116
+ # Good (1줄)
117
+ Apply OWASP Top 10 2025 checklist, focusing on project-specific attack surface.
118
+ ```
119
+
120
+ **Red Flags 목록**: 모델이 범용적으로 아는 것(N+1, XSS, SQL injection 등)은 삭제. 프로젝트/도메인 특화 항목만 유지.
121
+
122
+ ## 10. Shared References
123
+
124
+ 인라인 복제 금지. 공유 문서 참조만:
125
+
126
+ - `docs/expert-protocol.md` — Expert 에이전트 공통 프로토콜
127
+ - `docs/critic-loop-rules.md` — Critic Loop 규칙
128
+ - `docs/phase-gate-protocol.md` — Phase gate 프로토콜
129
+
130
+ ## Checklist
131
+
132
+ 에이전트 작성/수정 시 확인:
133
+
134
+ - [ ] 단일 책임 — 하나의 구체적 작업
135
+ - [ ] Description에 delegation trigger 명시
136
+ - [ ] tools 명시적 나열 (생략 금지)
137
+ - [ ] Agent 도구 미포함 (중첩 금지)
138
+ - [ ] maxTurns 설정
139
+ - [ ] HITL 규칙 포함 (언제 멈추고 물어볼지)
140
+ - [ ] 출력 포맷 정의
141
+ - [ ] 완료 기준 명시
142
+ - [ ] Claude가 이미 아는 것 설명하지 않음
143
+ - [ ] Write 사용 시 범위 문서화
144
+ - [ ] Memory 100줄 제한 명시 (해당 시)
@@ -0,0 +1,293 @@
1
+ # Context Management Harness
2
+
3
+ > afc 파이프라인의 정확성, 신뢰성, 토큰 효율을 위한 공식 기능 활용 가이드.
4
+ > 모든 내용은 [Claude Code 공식 문서](https://code.claude.com/docs/en/) 기반.
5
+
6
+ ## 설계 철학
7
+
8
+ **1M 컨텍스트 ≠ "더 많이 담기". 1M = "auto-compact 전에 제어할 여유를 얻은 것".**
9
+
10
+ 200k 시절에는 auto-compact가 갑자기 발생하여 제어 불가. 1M에서는 5배의 여유가 생겨 **내가 원하는 시점에, 원하는 내용을 보존하면서** compact할 수 있다.
11
+
12
+ ```
13
+ ┌────────────────────── 1M Context Window ──────────────────────┐
14
+ │ [고정] CLAUDE.md + rules + 스킬 메타데이터 (~5%) │
15
+ │ [고정] auto-memory MEMORY.md 첫 200줄 (~1%) │
16
+ │ [누적] 대화 기록 + 도구 결과 (Phase 진행에 따라 증가) │
17
+ │ .... │
18
+ │ ├── Phase 1 (Spec): ~50-100 prompts │
19
+ │ ├── Phase 2 (Plan): ~50-100 prompts │
20
+ │ ├── Phase 3 (Implement): ~100-300 prompts (서브에이전트 격리) │
21
+ │ └── Phase 4 (Review): ~50-100 prompts (서브에이전트 격리) │
22
+ │ .... │
23
+ │ [여유] ← 이 공간이 "선제적 제어 여유" │
24
+ │ [경계] auto-compact 95% (CLAUDE_AUTOCOMPACT_PCT_OVERRIDE로 조절) │
25
+ └───────────────────────────────────────────────────────────────┘
26
+ ```
27
+
28
+ ---
29
+
30
+ ## 1. 선제적 Compact 제어 (Phase-Boundary Protocol)
31
+
32
+ ### 1.1 원리
33
+
34
+ Auto-compact는 95% 도달 시 Claude가 임의로 요약 — 무엇을 보존할지 제어 불가.
35
+ **Phase 경계에서 선제적으로 compact하면**: 보존 대상을 지정하고, 다음 phase를 깨끗한 컨텍스트로 시작.
36
+
37
+ ### 1.2 Phase-Boundary Compact Protocol
38
+
39
+ ```
40
+ Phase 1 완료 → compact "spec.md ACs, edge cases, NFRs 보존"
41
+ Phase 2 완료 → compact "File Change Map, Implementation Context, ADR 보존"
42
+ Phase 3 완료 → compact "changed files list, CI results, 미해결 이슈 보존"
43
+ Phase 4 완료 → compact "review findings, fix status 보존"
44
+ ```
45
+
46
+ ### 1.3 구현 방법
47
+
48
+ `afc-user-prompt-submit.sh`의 Pipeline ACTIVE 분기에서, **phase 전환 직후** 첫 프롬프트에 compact 권고 주입:
49
+
50
+ ```
51
+ [afc:context] Phase 전환 감지 ({prev} → {current}).
52
+ 이전 phase 컨텍스트를 정리하세요: /compact {phase별 보존 지시}
53
+ ```
54
+
55
+ **트리거**: `afc-pipeline-manage.sh phase {new}` 실행 시 state에 `phaseTransition: true` 플래그 기록 → 다음 UserPromptSubmit에서 감지 후 주입 + 플래그 해제.
56
+
57
+ ### 1.4 Auto-Compact를 Safety Net으로 전환
58
+
59
+ `CLAUDE_AUTOCOMPACT_PCT_OVERRIDE` 환경변수로 auto-compact 트리거 시점을 조절:
60
+
61
+ ```
62
+ 기본값: 95% → auto-compact 발동
63
+ 권장값: 98% → 선제 compact(1.2)가 주도권, auto-compact는 최후 안전장치
64
+ ```
65
+
66
+ **구현**: `/afc:init`에서 프로젝트 settings에 권장값 안내, `/afc:setup`에서 글로벌 설정 안내.
67
+
68
+ **공식 출처**: [How Claude Code works - When context fills up](https://code.claude.com/docs/en/how-claude-code-works)
69
+
70
+ ### 1.5 Context Budget Monitor
71
+
72
+ `promptCount`로 컨텍스트 사용량 추정:
73
+
74
+ | promptCount 구간 | 추정 사용량 | 조치 |
75
+ |-----------------|-----------|------|
76
+ | 0-100 | ~30-50% | 정상 |
77
+ | 100-150 | ~50-70% | `[afc:context] 50%+ 추정. 불필요한 탐색 결과는 서브에이전트에 위임 권장.` |
78
+ | 150-200 | ~70-90% | `[afc:context] 70%+ 추정. /compact {현재 phase 보존 지시} 강력 권장.` |
79
+ | 200+ | ~90%+ | auto-compact 임박 (safety net) |
80
+
81
+ **구현**: UserPromptSubmit의 drift checkpoint 로직 확장. `totalPromptCount` 기준으로 budget 힌트 주입.
82
+
83
+ ---
84
+
85
+ ## 2. Compaction 품질 보장
86
+
87
+ ### 2.1 Compact Instructions (CLAUDE.md)
88
+
89
+ `/afc:init`에서 프로젝트 CLAUDE.md에 자동 추가:
90
+
91
+ ```markdown
92
+ # Compact instructions
93
+ When compacting, always preserve:
94
+ - Active pipeline feature name and current phase
95
+ - File Change Map from plan.md (file paths + task assignments)
96
+ - All unresolved ESCALATE items with their options
97
+ - context.md contents (spec summary + plan decisions + advisor results)
98
+ - Changed files list and CI/test pass/fail status
99
+ - Current task progress (completed/total)
100
+ ```
101
+
102
+ ### 2.2 PreCompact Hook 강화
103
+
104
+ 현재 `pre-compact-checkpoint.sh`가 저장하는 것: git status, tasks 진행률.
105
+
106
+ **추가**: context.md 내용도 checkpoint에 포함 → compaction 후 `/afc:resume`으로 풍부한 복구.
107
+
108
+ ```
109
+ # checkpoint.md에 추가될 섹션
110
+ ## Feature Context (from context.md)
111
+ {context.md 전문 또는 요약}
112
+
113
+ ## Advisor Insights
114
+ {Skill Advisor가 수집한 expert 권고}
115
+ ```
116
+
117
+ ---
118
+
119
+ ## 3. Phase 간 컨텍스트 브릿지
120
+
121
+ ### 3.1 context.md 누적 패턴
122
+
123
+ 현재 갭: Skill Advisor가 expert를 호출하지만 결과가 context.md에 기록되지 않음.
124
+
125
+ ```
126
+ Phase 1 → context.md 생성 (spec 요약, 핵심 AC)
127
+ Advisor A → context.md 갱신 (security 권고 추가)
128
+ Phase 2 → context.md 갱신 (plan 결정사항, ADR 요약)
129
+ Advisor B → context.md 갱신 (architect 권고 추가)
130
+ Advisor C → context.md 갱신 (consult 결과 추가)
131
+ Phase 3 → impl-worker에 context.md 주입 (skills preload 또는 프롬프트)
132
+ Phase 4 → reviewer에 context.md 주입
133
+ ```
134
+
135
+ ### 3.2 구현 방법
136
+
137
+ auto.md의 각 Skill Advisor Checkpoint에 지시 추가:
138
+
139
+ ```markdown
140
+ After advisor skill completes, append a 3-line summary to context.md:
141
+ ## Advisor: {skill_name} ({checkpoint})
142
+ - Key insight: {1-line}
143
+ - Action required: {1-line}
144
+ ```
145
+
146
+ ---
147
+
148
+ ## 4. Subagent 컨텍스트 최적화
149
+
150
+ ### 4.1 SendMessage Resume (의존 태스크)
151
+
152
+ ```
153
+ 현재: Task A → worker-1 생성 → 완료 → Task B(A 의존) → worker-2 생성 (A의 컨텍스트 없음)
154
+ 개선: Task A → worker-1 생성 → 완료 → Task B(A 의존) → worker-1 resume (A의 전체 컨텍스트 유지)
155
+ ```
156
+
157
+ **구현**: implement.md의 Sequential/Batch 모드에서 의존 관계 태스크를 동일 worker에 SendMessage로 전달.
158
+
159
+ ### 4.2 Skills Preload
160
+
161
+ ```yaml
162
+ # agents/afc-impl-worker.md
163
+ ---
164
+ skills:
165
+ - docs/orchestration-modes.md # 실행 모드 참조
166
+ ---
167
+ ```
168
+
169
+ **주의**: skills preload는 서브에이전트 시작 시 전체 내용이 컨텍스트에 주입됨. 큰 스킬은 오히려 토큰 낭비 → **작고 핵심적인 참조만**.
170
+
171
+ ### 4.3 Effort Level
172
+
173
+ ```yaml
174
+ # agents/afc-backend-expert.md (상담은 deep thinking 불필요)
175
+ effort: medium
176
+
177
+ # agents/afc-architect.md (아키텍처 분석은 기본)
178
+ # effort 미설정 → inherit
179
+ ```
180
+
181
+ ---
182
+
183
+ ## 5. 토큰 효율 전략
184
+
185
+ ### 5.1 !`command` 프리페치
186
+
187
+ 스킬에서 `!`command``로 데이터 프리페치 → 모델의 별도 Bash 턴 절약 (1-2턴/스킬).
188
+
189
+ **현재 적용**: 15개 스킬. **추가 대상**: 없음 (완료).
190
+
191
+ ### 5.2 Hook 기반 전처리
192
+
193
+ 테스트 출력, 로그 등 대량 데이터는 hook으로 필터링 후 전달.
194
+
195
+ ### 5.3 스킬 vs CLAUDE.md vs rules
196
+
197
+ | 내용 | 위치 | 로드 시점 | 컨텍스트 비용 |
198
+ |------|------|----------|-------------|
199
+ | 항상 필요한 규칙 | CLAUDE.md (200줄 이하) | 매 세션 시작 | 항상 |
200
+ | 특정 워크플로우 | Skills | 호출 시만 | on-demand |
201
+ | 특정 파일 패턴 | .claude/rules/ (paths) | 해당 파일 작업 시 | conditional |
202
+ | 서브에이전트 전용 | skills preload | 에이전트 시작 시 | 에이전트별 |
203
+
204
+ ### 5.4 MCP 도구 오버헤드
205
+
206
+ 각 MCP 서버가 매 요청마다 도구 정의를 컨텍스트에 추가. 미사용 서버 비활성화. CLI 도구 선호.
207
+
208
+ ---
209
+
210
+ ## 6. 신뢰성 패턴
211
+
212
+ ### 6.1 검증 루프
213
+
214
+ Claude는 **자체 검증 가능 시 극적으로 성능 향상**. 테스트, 예상 출력을 제공.
215
+
216
+ ### 6.2 /clear 패턴
217
+
218
+ 2번 이상 같은 문제 수정 → `/clear` → 배운 것 반영한 더 나은 프롬프트로 새 시작.
219
+
220
+ ### 6.3 Checkpoint + Rewind
221
+
222
+ 모든 편집 전 스냅샷. `Esc+Esc`로 복원. PreCompact hook이 자동 체크포인트.
223
+
224
+ ### 6.4 Selective Summarize (구간 요약)
225
+
226
+ `/rewind` → 특정 메시지 선택 → **Summarize from here** — 해당 지점부터만 요약하고 이전 컨텍스트는 원본 유지.
227
+
228
+ **활용**: 긴 탐색/디버깅 후 탐색 구간만 요약, plan/spec 부분은 원본 보존.
229
+
230
+ **공식 출처**: [Best practices - Manage context aggressively](https://code.claude.com/docs/en/best-practices)
231
+
232
+ ### 6.5 Non-blocking Expert 상담 (background)
233
+
234
+ 에이전트에 `background: true` 설정 → 메인 대화를 차단하지 않고 병렬 실행. 결과 완료 시 자동 알림.
235
+
236
+ ```yaml
237
+ # Skill Advisor에서 expert 호출 시
238
+ background: true # 메인 작업 중단 없이 조언 수신
239
+ ```
240
+
241
+ **적합**: Skill Advisor의 Enrich/Observe 모드 (결과가 blocking 아닌 참고용)
242
+ **부적합**: Transform 모드 (결과가 다음 단계에 필수)
243
+
244
+ ---
245
+
246
+ ## 7. Agent Teams (실험적, 보류)
247
+
248
+ 비용 ~7x. 현재 subagent 패턴이 충분. cross-module 대규모 구현에서 향후 검토.
249
+
250
+ ---
251
+
252
+ ## 구현 계획
253
+
254
+ ### P1: 선제적 Context 제어 — "1M = 제어 여유"
255
+
256
+ | # | 작업 | 대상 파일 | 설명 |
257
+ |---|------|----------|------|
258
+ | 1.1 | **Phase-Boundary Compact 권고** | `afc-pipeline-manage.sh` + `afc-user-prompt-submit.sh` | phase 전환 시 state에 `phaseTransition: true` 기록 → 다음 prompt에서 phase별 보존 지시 포함 `/compact` 권고 주입 → 플래그 해제 |
259
+ | 1.2 | **Auto-Compact를 Safety Net으로** | `skills/init/SKILL.md` + `skills/setup/SKILL.md` | init/setup에서 `CLAUDE_AUTOCOMPACT_PCT_OVERRIDE=98` 권장 안내 (선제 compact가 주도, auto-compact는 최후 보루) |
260
+ | 1.3 | **Context Budget Monitor** | `afc-user-prompt-submit.sh` | `totalPromptCount` 100/150/200 구간별 힌트 주입: 서브에이전트 위임 권장 → compact 강력 권장 → 임박 경고 |
261
+ | 1.4 | **Compact Instructions 자동 삽입** | `skills/init/SKILL.md` + `templates/afc.config.template.md` | `/afc:init` 시 CLAUDE.md에 `# Compact instructions` 섹션 추가 (feature/phase/File Change Map/context.md/ESCALATE 보존) |
262
+ | 1.5 | **PreCompact checkpoint 강화** | `pre-compact-checkpoint.sh` | context.md + advisor insights를 checkpoint에 포함. compaction 후 resume 시 풍부한 복구 |
263
+
264
+ ### P2: Phase 간 컨텍스트 브릿지
265
+
266
+ | # | 작업 | 대상 파일 | 설명 |
267
+ |---|------|----------|------|
268
+ | 2.1 | **Advisor → context.md 누적** | `skills/auto/SKILL.md` + `skills/auto/skill-advisor.md` | 각 Checkpoint(A-E)에서 advisor 완료 후 context.md에 3줄 요약 append 지시 추가 |
269
+ | 2.2 | **SendMessage resume 패턴** | `skills/implement/SKILL.md` + `docs/orchestration-modes.md` | Sequential 모드에서 의존 태스크를 동일 worker에 SendMessage로 전달. Batch 모드에서 phase 내 의존 체인을 resume로 연결 |
270
+ | 2.3 | **Selective Summarize 안내** | `skills/auto/SKILL.md` | Phase 3(Implement) 시작 전 "긴 탐색 구간이 있으면 `/rewind` → Summarize from here로 정리" 지시 |
271
+
272
+ ### P3: Subagent 효율
273
+
274
+ | # | 작업 | 대상 파일 | 설명 |
275
+ |---|------|----------|------|
276
+ | 3.1 | **effort: medium** | 8개 expert agent `.md` | expert 상담 에이전트의 thinking 토큰 절약 |
277
+ | 3.2 | **background 모드 검토** | `skills/auto/skill-advisor.md` | Enrich/Observe 모드의 advisor 호출에 `run_in_background: true` 적용 가능성 검토 (Transform은 blocking 필수) |
278
+ | 3.3 | **skills preload 제한적 적용** | `agents/afc-impl-worker.md` | 프로젝트별 동적 config → preload 부적합. shell script conventions 같은 정적 참조만 후보 |
279
+
280
+ ---
281
+
282
+ ## Sources
283
+
284
+ - [Best practices](https://code.claude.com/docs/en/best-practices)
285
+ - [How Claude Code works](https://code.claude.com/docs/en/how-claude-code-works)
286
+ - [Create custom subagents](https://code.claude.com/docs/en/sub-agents)
287
+ - [How Claude remembers your project](https://code.claude.com/docs/en/memory)
288
+ - [Common workflows](https://code.claude.com/docs/en/common-workflows)
289
+ - [Manage costs effectively](https://code.claude.com/docs/en/costs)
290
+ - [Orchestrate teams](https://code.claude.com/docs/en/agent-teams)
291
+ - [Subagents in the SDK](https://platform.claude.com/docs/en/agent-sdk/subagents)
292
+ - [Skill authoring best practices](https://platform.claude.com/docs/en/agents-and-tools/agent-skills/best-practices)
293
+ - [Best practices for sub-agents](https://www.pubnub.com/blog/best-practices-for-claude-code-sub-agents/)