@wipal/agent-team 1.0.4 → 1.1.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.
- package/.claude/commands/skills/discover.md +127 -0
- package/.claude/commands/skills/install.md +225 -0
- package/.claude/commands/skills/review.md +234 -0
- package/.claude/commands/utils/learn.md +142 -0
- package/.claude/commands/utils/retrospect.md +62 -0
- package/.claude/commands/utils/switch.md +113 -0
- package/.claude/commands/utils/sync.md +183 -0
- package/.claude/rules/common/general-rules.md +6 -0
- package/.claude/rules/role-rules/dev-be-rules.md +241 -0
- package/.claude/rules/role-rules/dev-fe-rules.md +76 -0
- package/.claude/skills/SKILL-INDEX.md +24 -5
- package/.claude/skills/core/knowledge-graph/SKILL.md +214 -0
- package/.claude/skills/core/sequential-thinking/SKILL.md +112 -0
- package/.claude/skills/core/sequential-thinking/references/advanced.md +122 -0
- package/.claude/skills/core/sequential-thinking/references/examples.md +274 -0
- package/.claude/skills/domain/architecture/c4-architecture/SKILL.md +314 -0
- package/.claude/skills/domain/architecture/c4-architecture/references/advanced-patterns.md +552 -0
- package/.claude/skills/domain/architecture/c4-architecture/references/c4-syntax.md +492 -0
- package/.claude/skills/domain/architecture/c4-architecture/references/common-mistakes.md +437 -0
- package/.claude/skills/domain/architecture/mermaid-diagrams/SKILL.md +238 -0
- package/.claude/skills/domain/architecture/mermaid-diagrams/references/advanced-features.md +556 -0
- package/.claude/skills/domain/architecture/mermaid-diagrams/references/architecture-diagrams.md +192 -0
- package/.claude/skills/domain/architecture/mermaid-diagrams/references/c4-diagrams.md +410 -0
- package/.claude/skills/domain/architecture/mermaid-diagrams/references/class-diagrams.md +361 -0
- package/.claude/skills/domain/architecture/mermaid-diagrams/references/erd-diagrams.md +510 -0
- package/.claude/skills/domain/architecture/mermaid-diagrams/references/flowcharts.md +450 -0
- package/.claude/skills/domain/architecture/mermaid-diagrams/references/sequence-diagrams.md +394 -0
- package/.claude/skills/domain/backend/testing-be/SKILL.md +121 -17
- package/.claude/skills/domain/design/design-system/SKILL.md +169 -0
- package/.claude/skills/domain/design/html-css-output/SKILL.md +253 -0
- package/.claude/skills/domain/design/mockup-creation/SKILL.md +230 -0
- package/.claude/skills/domain/design/responsive-design/SKILL.md +207 -0
- package/.claude/skills/domain/design/ui-design/SKILL.md +124 -0
- package/.claude/skills/domain/frontend/testing-fe/SKILL.md +143 -38
- package/.claude/skills/domain/frontend/ui-ux-pro-max/README.md +45 -0
- package/.claude/skills/domain/frontend/ui-ux-pro-max/SKILL.md +404 -0
- package/.claude/skills/domain/frontend/ui-ux-pro-max/data/charts.csv +26 -0
- package/.claude/skills/domain/frontend/ui-ux-pro-max/data/colors.csv +97 -0
- package/.claude/skills/domain/frontend/ui-ux-pro-max/data/icons.csv +101 -0
- package/.claude/skills/domain/frontend/ui-ux-pro-max/data/landing.csv +31 -0
- package/.claude/skills/domain/frontend/ui-ux-pro-max/data/products.csv +97 -0
- package/.claude/skills/domain/frontend/ui-ux-pro-max/data/react-performance.csv +45 -0
- package/.claude/skills/domain/frontend/ui-ux-pro-max/data/stacks/astro.csv +54 -0
- package/.claude/skills/domain/frontend/ui-ux-pro-max/data/stacks/flutter.csv +53 -0
- package/.claude/skills/domain/frontend/ui-ux-pro-max/data/stacks/html-tailwind.csv +56 -0
- package/.claude/skills/domain/frontend/ui-ux-pro-max/data/stacks/jetpack-compose.csv +53 -0
- package/.claude/skills/domain/frontend/ui-ux-pro-max/data/stacks/nextjs.csv +53 -0
- package/.claude/skills/domain/frontend/ui-ux-pro-max/data/stacks/nuxt-ui.csv +51 -0
- package/.claude/skills/domain/frontend/ui-ux-pro-max/data/stacks/nuxtjs.csv +59 -0
- package/.claude/skills/domain/frontend/ui-ux-pro-max/data/stacks/react-native.csv +52 -0
- package/.claude/skills/domain/frontend/ui-ux-pro-max/data/stacks/react.csv +54 -0
- package/.claude/skills/domain/frontend/ui-ux-pro-max/data/stacks/shadcn.csv +61 -0
- package/.claude/skills/domain/frontend/ui-ux-pro-max/data/stacks/svelte.csv +54 -0
- package/.claude/skills/domain/frontend/ui-ux-pro-max/data/stacks/swiftui.csv +51 -0
- package/.claude/skills/domain/frontend/ui-ux-pro-max/data/stacks/vue.csv +50 -0
- package/.claude/skills/domain/frontend/ui-ux-pro-max/data/styles.csv +68 -0
- package/.claude/skills/domain/frontend/ui-ux-pro-max/data/typography.csv +58 -0
- package/.claude/skills/domain/frontend/ui-ux-pro-max/data/ui-reasoning.csv +101 -0
- package/.claude/skills/domain/frontend/ui-ux-pro-max/data/ux-guidelines.csv +100 -0
- package/.claude/skills/domain/frontend/ui-ux-pro-max/data/web-interface.csv +31 -0
- package/.claude/skills/domain/frontend/ui-ux-pro-max/scripts/core.py +253 -0
- package/.claude/skills/domain/frontend/ui-ux-pro-max/scripts/design_system.py +1067 -0
- package/.claude/skills/domain/frontend/ui-ux-pro-max/scripts/search.py +114 -0
- package/.claude/skills/domain/product/requirements-clarity/SKILL.md +340 -0
- package/.claude/skills/skills-registry.yaml +103 -8
- package/README.md +107 -33
- package/README.npm.md +252 -0
- package/TUTORIAL.md +256 -0
- package/bin/agent-team.js +26 -7
- package/config/roles.yaml +107 -0
- package/docs/01-architecture.md +699 -0
- package/docs/02-setup-guide.md +634 -0
- package/docs/03-skills-guide.md +628 -0
- package/docs/04-workflows.md +792 -0
- package/docs/05-model-strategy.md +550 -0
- package/docs/06-extend-guide.md +1226 -0
- package/docs/07-quick-reference.md +578 -0
- package/docs/08-skills-discovery.md +342 -0
- package/docs/README.md +134 -0
- package/docs/rqm.md +560 -0
- package/package.json +9 -3
- package/scripts/postinstall.js +46 -0
- package/src/commands/add.js +131 -67
- package/src/commands/init.js +419 -9
- package/src/commands/list.js +20 -16
- package/src/commands/projects.js +127 -0
- package/src/commands/setup-hooks.js +261 -0
- package/src/index.js +0 -1
- package/src/utils/file-utils.js +147 -50
- package/src/utils/global-registry.js +224 -0
- package/templates/CLAUDE.md.tmpl +128 -20
- package/templates/MEMORY.md.tmpl +119 -0
- package/templates/agent.md.tmpl +205 -0
- package/templates/code/nestjs-controller.ts.tmpl +49 -0
- package/templates/code/nestjs-dto.ts.tmpl +63 -0
- package/templates/code/nestjs-service.ts.tmpl +45 -0
- package/templates/code/react-component.tsx.tmpl +24 -0
- package/templates/code/react-hook.ts.tmpl +54 -0
- package/templates/code/test.spec.ts.tmpl +50 -0
- package/templates/code/vue-component.vue.tmpl +49 -0
- package/templates/code/vue-composable.ts.tmpl +54 -0
- package/templates/knowledge.md.tmpl +152 -17
- package/templates/meeting-notes.md.tmpl +110 -0
- package/templates/memory/hooks.memory.json +50 -0
- package/templates/memory/settings.memory.json +16 -0
- package/templates/reports/bug-report.md.tmpl +164 -0
- package/templates/reports/code-review.md.tmpl +201 -0
- package/templates/reports/sprint-report.md.tmpl +218 -0
- package/templates/roles/ba.md +53 -0
- package/templates/roles/designer.md +82 -0
- package/templates/roles/dev-be.md +49 -0
- package/templates/roles/dev-fe.md +49 -0
- package/templates/roles/devops.md +53 -0
- package/templates/roles/pm.md +49 -0
- package/templates/roles/qa.md +53 -0
- package/templates/roles/sa.md +49 -0
- package/templates/roles/tech-lead.md +132 -0
- package/templates/skills/memory/memory-status.md +78 -0
- package/templates/skills/memory/recall.md +160 -0
- package/templates/skills/memory/reflect.md +168 -0
- package/templates/skills/memory/remember.md +105 -0
- package/templates/tasks/lessons.md.tmpl +77 -0
- package/templates/tasks/todo.md.tmpl +53 -0
- package/src/commands/switch.js +0 -53
|
@@ -0,0 +1,550 @@
|
|
|
1
|
+
# Model Strategy Guide
|
|
2
|
+
|
|
3
|
+
> **Phiên bản:** 1.0
|
|
4
|
+
> **Cập nhật:** 2025-02-25
|
|
5
|
+
> **Related:** [Architecture](01-architecture.md) | [Workflows](04-workflows.md)
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## 📋 Mục Lục
|
|
10
|
+
|
|
11
|
+
1. [Overview](#-overview)
|
|
12
|
+
2. [Task-Based Model Selection](#-task-based-model-selection)
|
|
13
|
+
3. [Decision Flow](#-decision-flow)
|
|
14
|
+
4. [Per-Role Defaults](#-per-role-defaults)
|
|
15
|
+
5. [Dynamic Model Switching](#-dynamic-model-switching)
|
|
16
|
+
6. [Cost Optimization](#-cost-optimization)
|
|
17
|
+
7. [Token Management](#-token-management)
|
|
18
|
+
8. [Best Practices](#-best-practices)
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## 🎯 Overview
|
|
23
|
+
|
|
24
|
+
### Key Principle
|
|
25
|
+
|
|
26
|
+
> **Model selection theo TASK TYPE, KHÔNG phải theo ROLE.**
|
|
27
|
+
|
|
28
|
+
Một agent có thể dùng nhiều models khác nhau tùy vào loại task đang làm.
|
|
29
|
+
|
|
30
|
+
### Models Available
|
|
31
|
+
|
|
32
|
+
| Model | Best For | Characteristics |
|
|
33
|
+
|-------|----------|-----------------|
|
|
34
|
+
| **Claude Opus 4** | Planning, Architecture, Complex Analysis | Deep thinking, best reasoning |
|
|
35
|
+
| **Claude Sonnet 4** | Implementation, Bug Fixes, Documentation | Fast, efficient, good enough |
|
|
36
|
+
| **Claude Haiku** | Simple queries, Formatting, Quick lookups | Fastest, lowest cost |
|
|
37
|
+
|
|
38
|
+
### Thinking Mode
|
|
39
|
+
|
|
40
|
+
Extended thinking mode cho phép model suy nghĩ kỹ hơn trước khi trả lời.
|
|
41
|
+
|
|
42
|
+
```yaml
|
|
43
|
+
thinking_mode:
|
|
44
|
+
enabled: true
|
|
45
|
+
model: claude-opus-4
|
|
46
|
+
max_tokens: 10000
|
|
47
|
+
use_for:
|
|
48
|
+
- "architecture-design"
|
|
49
|
+
- "code-review"
|
|
50
|
+
- "debugging"
|
|
51
|
+
- "learning"
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## 📊 Task-Based Model Selection
|
|
57
|
+
|
|
58
|
+
### Task Type → Model Mapping
|
|
59
|
+
|
|
60
|
+
| Task Type | Model | Thinking | Reason |
|
|
61
|
+
|-----------|-------|----------|--------|
|
|
62
|
+
| **Planning / Architecture** | Opus 4 | ✅ Yes | Deep analysis, complex decisions |
|
|
63
|
+
| **Code Review Analysis** | Opus 4 | ✅ Yes | Critical thinking, pattern detection |
|
|
64
|
+
| **Debugging Complex Issues** | Opus 4 | ✅ Yes | Root cause analysis |
|
|
65
|
+
| **Learning / Retrospect** | Opus 4 | ✅ Yes | Pattern extraction |
|
|
66
|
+
| **Implementation** | Sonnet 4 | ❌ No | Fast, efficient, good enough |
|
|
67
|
+
| **Bug Fixing (Simple)** | Sonnet 4 | ❌ No | Quick fixes |
|
|
68
|
+
| **Writing Tests** | Sonnet 4 | ❌ No | Standard implementation |
|
|
69
|
+
| **Documentation** | Sonnet 4 | ❌ No | Clear writing |
|
|
70
|
+
| **Formatting / Linting** | Haiku / Sonnet | ❌ No | Quick, simple |
|
|
71
|
+
| **Simple Queries** | Haiku / Sonnet | ❌ No | Fast response |
|
|
72
|
+
| **Quick Lookups** | Haiku / Sonnet | ❌ No | Low complexity |
|
|
73
|
+
|
|
74
|
+
### Task Categories
|
|
75
|
+
|
|
76
|
+
```
|
|
77
|
+
┌─────────────────────────────────────────────────────────────────────────────┐
|
|
78
|
+
│ TASK CATEGORIES & MODEL ASSIGNMENT │
|
|
79
|
+
├─────────────────────────────────────────────────────────────────────────────┤
|
|
80
|
+
│ │
|
|
81
|
+
│ ┌─────────────────────────────────────────────────────────────────────┐ │
|
|
82
|
+
│ │ THINKING TASKS → OPUS 4 + THINKING MODE │ │
|
|
83
|
+
│ │ │ │
|
|
84
|
+
│ │ 🧠 Planning → Architecture design, sprint planning │ │
|
|
85
|
+
│ │ 🔍 Code Review → Critical analysis, security review │ │
|
|
86
|
+
│ │ 🐛 Debugging → Root cause analysis, complex bug tracing │ │
|
|
87
|
+
│ │ 📚 Learning → Pattern extraction, knowledge update │ │
|
|
88
|
+
│ │ 🎯 Decisions → Technical choices, risk assessment │ │
|
|
89
|
+
│ │ │ │
|
|
90
|
+
│ │ Characteristics: Deep analysis, extended thinking, best reasoning │ │
|
|
91
|
+
│ └─────────────────────────────────────────────────────────────────────┘ │
|
|
92
|
+
│ │
|
|
93
|
+
│ ┌─────────────────────────────────────────────────────────────────────┐ │
|
|
94
|
+
│ │ IMPLEMENTATION TASKS → SONNET 4 │ │
|
|
95
|
+
│ │ │ │
|
|
96
|
+
│ │ 💻 Coding → Feature implementation, bug fixes │ │
|
|
97
|
+
│ │ 🧪 Testing → Write unit tests, integration tests │ │
|
|
98
|
+
│ │ 📝 Documentation → Write docs, README, comments │ │
|
|
99
|
+
│ │ 🔄 Refactoring → Code cleanup, optimization │ │
|
|
100
|
+
│ │ │ │
|
|
101
|
+
│ │ Characteristics: Fast, efficient, good quality, cost-effective │ │
|
|
102
|
+
│ └─────────────────────────────────────────────────────────────────────┘ │
|
|
103
|
+
│ │
|
|
104
|
+
│ ┌─────────────────────────────────────────────────────────────────────┐ │
|
|
105
|
+
│ │ LIGHT TASKS → HAIKU / SONNET │ │
|
|
106
|
+
│ │ │ │
|
|
107
|
+
│ │ ⚡ Formatting → Code formatting, lint fixes │ │
|
|
108
|
+
│ │ ❓ Queries → Simple questions, status checks │ │
|
|
109
|
+
│ │ 🔎 Lookups → Quick searches, documentation lookup │ │
|
|
110
|
+
│ │ 📊 Reports → Generate simple reports │ │
|
|
111
|
+
│ │ │ │
|
|
112
|
+
│ │ Characteristics: Fastest response, lowest cost, simple tasks │ │
|
|
113
|
+
│ └─────────────────────────────────────────────────────────────────────┘ │
|
|
114
|
+
│ │
|
|
115
|
+
└─────────────────────────────────────────────────────────────────────────────┘
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
---
|
|
119
|
+
|
|
120
|
+
## 🔀 Decision Flow
|
|
121
|
+
|
|
122
|
+
### Task Type Decision Tree
|
|
123
|
+
|
|
124
|
+
```
|
|
125
|
+
TASK RECEIVED?
|
|
126
|
+
│
|
|
127
|
+
├─ What type of task?
|
|
128
|
+
│ │
|
|
129
|
+
│ ├─ Planning / Architecture ─────────────────→ OPUS + THINKING
|
|
130
|
+
│ │
|
|
131
|
+
│ ├─ Code Review / Analysis ──────────────────→ OPUS + THINKING
|
|
132
|
+
│ │
|
|
133
|
+
│ ├─ Debugging (Complex) ─────────────────────→ OPUS + THINKING
|
|
134
|
+
│ │
|
|
135
|
+
│ ├─ Learning / Retrospect ───────────────────→ OPUS + THINKING
|
|
136
|
+
│ │
|
|
137
|
+
│ ├─ Implementation / Coding ─────────────────→ SONNET
|
|
138
|
+
│ │
|
|
139
|
+
│ ├─ Bug Fixing (Simple) ─────────────────────→ SONNET
|
|
140
|
+
│ │
|
|
141
|
+
│ ├─ Writing Tests ───────────────────────────→ SONNET
|
|
142
|
+
│ │
|
|
143
|
+
│ ├─ Documentation ───────────────────────────→ SONNET
|
|
144
|
+
│ │
|
|
145
|
+
│ └─ Formatting / Simple Query ───────────────→ HAIKU / SONNET
|
|
146
|
+
│
|
|
147
|
+
└─ Is complexity higher than expected?
|
|
148
|
+
│
|
|
149
|
+
├─ YES → UPGRADE to OPUS + THINKING
|
|
150
|
+
│
|
|
151
|
+
└─ NO → Continue with current model
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
### Complexity Detection
|
|
155
|
+
|
|
156
|
+
```yaml
|
|
157
|
+
# Triggers to upgrade from Sonnet to Opus
|
|
158
|
+
upgrade_triggers:
|
|
159
|
+
- "User asks 'why' or 'explain'"
|
|
160
|
+
- "Debugging failing tests"
|
|
161
|
+
- "Code review requested"
|
|
162
|
+
- "Architecture question"
|
|
163
|
+
- "Security concern raised"
|
|
164
|
+
- "Multiple components affected"
|
|
165
|
+
- "Performance issue"
|
|
166
|
+
- "Cross-service integration"
|
|
167
|
+
|
|
168
|
+
# Triggers to stay on Sonnet
|
|
169
|
+
stay_triggers:
|
|
170
|
+
- "User says 'implement' or 'code'"
|
|
171
|
+
- "Following existing plan"
|
|
172
|
+
- "Simple bug fix"
|
|
173
|
+
- "Adding tests"
|
|
174
|
+
- "Documentation update"
|
|
175
|
+
- "Single component change"
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
---
|
|
179
|
+
|
|
180
|
+
## 👥 Per-Role Defaults
|
|
181
|
+
|
|
182
|
+
### Role → Default Model
|
|
183
|
+
|
|
184
|
+
| Role | Default Model | Thinking | Reason |
|
|
185
|
+
|------|---------------|----------|--------|
|
|
186
|
+
| **Tech Lead** | Opus 4 | ✅ Yes | Architecture decisions, code review |
|
|
187
|
+
| **PM** | Sonnet 4 | ❌ No | Planning, communication, reporting |
|
|
188
|
+
| **Dev FE** | Sonnet 4 | ❌ No | UI implementation, components |
|
|
189
|
+
| **Dev BE** | Sonnet 4 | ❌ No | API implementation, database |
|
|
190
|
+
| **QA** | Sonnet 4 | ❌ No | Test writing, bug reporting |
|
|
191
|
+
| **QA Automation** | Sonnet 4 | ❌ No | E2E test implementation |
|
|
192
|
+
| **DevOps** | Sonnet 4 | ❌ No | CI/CD, deployment |
|
|
193
|
+
| **Designer** | Sonnet 4 | ❌ No | UI design, mockups |
|
|
194
|
+
|
|
195
|
+
### Role Configuration Example
|
|
196
|
+
|
|
197
|
+
```yaml
|
|
198
|
+
# roles/base/tech-lead/config.yaml
|
|
199
|
+
role: tech-lead
|
|
200
|
+
model:
|
|
201
|
+
default: claude-opus-4
|
|
202
|
+
thinking_mode: true
|
|
203
|
+
max_thinking_tokens: 10000
|
|
204
|
+
|
|
205
|
+
tasks:
|
|
206
|
+
thinking:
|
|
207
|
+
- architecture-design
|
|
208
|
+
- code-review
|
|
209
|
+
- technical-decisions
|
|
210
|
+
- risk-assessment
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
```yaml
|
|
214
|
+
# roles/base/dev-fe/config.yaml
|
|
215
|
+
role: dev-fe
|
|
216
|
+
model:
|
|
217
|
+
default: claude-sonnet-4
|
|
218
|
+
thinking_mode: false
|
|
219
|
+
|
|
220
|
+
tasks:
|
|
221
|
+
implementation:
|
|
222
|
+
- ui-implementation
|
|
223
|
+
- component-creation
|
|
224
|
+
- api-integration
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
---
|
|
228
|
+
|
|
229
|
+
## 🔄 Dynamic Model Switching
|
|
230
|
+
|
|
231
|
+
### Auto-Switch Rules
|
|
232
|
+
|
|
233
|
+
```yaml
|
|
234
|
+
# Dynamic model switching based on task detection
|
|
235
|
+
auto_switch:
|
|
236
|
+
# Upgrade to Opus when complexity detected
|
|
237
|
+
upgrade_to_opus:
|
|
238
|
+
triggers:
|
|
239
|
+
- "User asks 'why' or 'explain'"
|
|
240
|
+
- "Debugging failing tests"
|
|
241
|
+
- "Code review requested"
|
|
242
|
+
- "Architecture question"
|
|
243
|
+
- "Security concern raised"
|
|
244
|
+
- "Multiple files affected > 5"
|
|
245
|
+
- "Cross-service integration"
|
|
246
|
+
action:
|
|
247
|
+
model: claude-opus-4
|
|
248
|
+
thinking_mode: true
|
|
249
|
+
message: "🔄 Switching to Opus + Thinking for complex analysis..."
|
|
250
|
+
|
|
251
|
+
# Stay on Sonnet for implementation
|
|
252
|
+
stay_on_sonnet:
|
|
253
|
+
triggers:
|
|
254
|
+
- "User says 'implement' or 'code'"
|
|
255
|
+
- "Following existing plan"
|
|
256
|
+
- "Simple bug fix"
|
|
257
|
+
- "Adding tests"
|
|
258
|
+
- "Single file change"
|
|
259
|
+
action:
|
|
260
|
+
model: claude-sonnet-4
|
|
261
|
+
thinking_mode: false
|
|
262
|
+
|
|
263
|
+
# Downgrade to Haiku for simple tasks
|
|
264
|
+
downgrade_to_haiku:
|
|
265
|
+
triggers:
|
|
266
|
+
- "Format code"
|
|
267
|
+
- "Simple query"
|
|
268
|
+
- "Quick lookup"
|
|
269
|
+
- "Status check"
|
|
270
|
+
action:
|
|
271
|
+
model: claude-3-5-haiku
|
|
272
|
+
thinking_mode: false
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
### Manual Model Override
|
|
276
|
+
|
|
277
|
+
```bash
|
|
278
|
+
# Force use Opus for current task
|
|
279
|
+
./agent.sh switch payment-fe --model opus --thinking
|
|
280
|
+
|
|
281
|
+
# Force use Sonnet for current task
|
|
282
|
+
./agent.sh switch payment-fe --model sonnet
|
|
283
|
+
|
|
284
|
+
# Check current model
|
|
285
|
+
./agent.sh status
|
|
286
|
+
# Agent: payment-fe
|
|
287
|
+
# Model: claude-sonnet-4
|
|
288
|
+
# Thinking: disabled
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
---
|
|
292
|
+
|
|
293
|
+
## 💰 Cost Optimization
|
|
294
|
+
|
|
295
|
+
### Cost Comparison
|
|
296
|
+
|
|
297
|
+
| Model | Relative Cost | Use For |
|
|
298
|
+
|-------|---------------|---------|
|
|
299
|
+
| **Opus 4** | 3x | Thinking tasks only |
|
|
300
|
+
| **Sonnet 4** | 1x (baseline) | Most implementation |
|
|
301
|
+
| **Haiku** | 0.1x | Simple tasks |
|
|
302
|
+
|
|
303
|
+
### Optimization Strategy
|
|
304
|
+
|
|
305
|
+
```yaml
|
|
306
|
+
cost_optimization:
|
|
307
|
+
# Target distribution
|
|
308
|
+
model_distribution:
|
|
309
|
+
opus: 15% # Only for thinking tasks
|
|
310
|
+
sonnet: 75% # Most implementation work
|
|
311
|
+
haiku: 10% # Simple queries
|
|
312
|
+
|
|
313
|
+
# Rules
|
|
314
|
+
rules:
|
|
315
|
+
- "Use Sonnet for 80% of work"
|
|
316
|
+
- "Use Opus only when triggered by complexity"
|
|
317
|
+
- "Use Haiku for formatting and simple queries"
|
|
318
|
+
- "Review model usage weekly"
|
|
319
|
+
|
|
320
|
+
# Alerts
|
|
321
|
+
alerts:
|
|
322
|
+
opus_overuse:
|
|
323
|
+
threshold: "25% of tasks"
|
|
324
|
+
action: "Review if Opus is being used for implementation"
|
|
325
|
+
|
|
326
|
+
haiku_underuse:
|
|
327
|
+
threshold: "5% of tasks"
|
|
328
|
+
action: "Check if simple tasks are using Sonnet"
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
### Cost Tracking
|
|
332
|
+
|
|
333
|
+
```bash
|
|
334
|
+
# View model usage statistics
|
|
335
|
+
./agent.sh stats --model-usage
|
|
336
|
+
|
|
337
|
+
# Output:
|
|
338
|
+
# ═══════════════════════════════════════════════════════════════
|
|
339
|
+
# 📊 MODEL USAGE STATISTICS (Last 7 days)
|
|
340
|
+
# ═══════════════════════════════════════════════════════════════
|
|
341
|
+
#
|
|
342
|
+
# Opus 4: 12% ████████████
|
|
343
|
+
# Sonnet 4: 78% ████████████████████████████████████████
|
|
344
|
+
# Haiku: 10% ██████████
|
|
345
|
+
#
|
|
346
|
+
# Cost Savings vs All-Opus: 62%
|
|
347
|
+
# Cost Savings vs All-Sonnet: 5%
|
|
348
|
+
```
|
|
349
|
+
|
|
350
|
+
---
|
|
351
|
+
|
|
352
|
+
## 🪙 Token Management
|
|
353
|
+
|
|
354
|
+
### Token Limits
|
|
355
|
+
|
|
356
|
+
```yaml
|
|
357
|
+
# Token configuration
|
|
358
|
+
token_settings:
|
|
359
|
+
# Thinking mode limits
|
|
360
|
+
max_thinking_tokens: 10000
|
|
361
|
+
|
|
362
|
+
# Context compaction threshold
|
|
363
|
+
compact_threshold_pct: 50
|
|
364
|
+
|
|
365
|
+
# Subagent model (for parallel tasks)
|
|
366
|
+
subagent_model: haiku
|
|
367
|
+
```
|
|
368
|
+
|
|
369
|
+
### Strategic Compaction
|
|
370
|
+
|
|
371
|
+
```markdown
|
|
372
|
+
## Context Compaction Strategy
|
|
373
|
+
|
|
374
|
+
### When to Compact
|
|
375
|
+
- At logical breakpoints (NOT mid-implementation)
|
|
376
|
+
- After research/exploration phase
|
|
377
|
+
- Before implementation phase
|
|
378
|
+
- After completing a milestone
|
|
379
|
+
- After debugging, before continuing feature work
|
|
380
|
+
|
|
381
|
+
### When NOT to Compact
|
|
382
|
+
- During active implementation
|
|
383
|
+
- When debugging in progress
|
|
384
|
+
- When context is needed for current task
|
|
385
|
+
|
|
386
|
+
### Compaction Rules
|
|
387
|
+
- Keep recent messages
|
|
388
|
+
- Keep task-related context
|
|
389
|
+
- Summarize old context
|
|
390
|
+
- Preserve critical decisions
|
|
391
|
+
```
|
|
392
|
+
|
|
393
|
+
### Context Window Management
|
|
394
|
+
|
|
395
|
+
```yaml
|
|
396
|
+
# Best practices for context management
|
|
397
|
+
context_management:
|
|
398
|
+
rules:
|
|
399
|
+
- "Keep under 10 MCPs enabled per project"
|
|
400
|
+
- "Keep under 80 tools active"
|
|
401
|
+
- "Use subagents to offload research"
|
|
402
|
+
- "Compact at logical breakpoints"
|
|
403
|
+
|
|
404
|
+
# Disable unused MCPs
|
|
405
|
+
disabledMcpServers:
|
|
406
|
+
- unused-mcp-1
|
|
407
|
+
- unused-mcp-2
|
|
408
|
+
```
|
|
409
|
+
|
|
410
|
+
---
|
|
411
|
+
|
|
412
|
+
## 💡 Best Practices
|
|
413
|
+
|
|
414
|
+
### 1. Task Type First
|
|
415
|
+
|
|
416
|
+
```
|
|
417
|
+
✅ DO:
|
|
418
|
+
- Identify task type before selecting model
|
|
419
|
+
- Use Opus + Thinking for planning/review
|
|
420
|
+
- Use Sonnet for implementation
|
|
421
|
+
|
|
422
|
+
❌ DON'T:
|
|
423
|
+
- Select model based on role
|
|
424
|
+
- Use Opus for simple implementation
|
|
425
|
+
- Skip thinking mode for complex analysis
|
|
426
|
+
```
|
|
427
|
+
|
|
428
|
+
### 2. Let Complexity Guide
|
|
429
|
+
|
|
430
|
+
```
|
|
431
|
+
✅ DO:
|
|
432
|
+
- Let complexity detection auto-switch
|
|
433
|
+
- Override only when necessary
|
|
434
|
+
- Monitor model usage
|
|
435
|
+
|
|
436
|
+
❌ DON'T:
|
|
437
|
+
- Force model for every task
|
|
438
|
+
- Ignore complexity indicators
|
|
439
|
+
- Use same model for all tasks
|
|
440
|
+
```
|
|
441
|
+
|
|
442
|
+
### 3. Cost Awareness
|
|
443
|
+
|
|
444
|
+
```
|
|
445
|
+
✅ DO:
|
|
446
|
+
- Use Haiku for simple tasks
|
|
447
|
+
- Use Sonnet for most work
|
|
448
|
+
- Reserve Opus for thinking tasks
|
|
449
|
+
|
|
450
|
+
❌ DON'T:
|
|
451
|
+
- Use Opus for everything
|
|
452
|
+
- Ignore cost implications
|
|
453
|
+
- Skip model optimization
|
|
454
|
+
```
|
|
455
|
+
|
|
456
|
+
### 4. Thinking Mode Usage
|
|
457
|
+
|
|
458
|
+
```
|
|
459
|
+
✅ DO:
|
|
460
|
+
- Enable thinking for architecture
|
|
461
|
+
- Enable thinking for debugging
|
|
462
|
+
- Enable thinking for code review
|
|
463
|
+
|
|
464
|
+
❌ DON'T:
|
|
465
|
+
- Enable thinking for implementation
|
|
466
|
+
- Enable thinking for simple queries
|
|
467
|
+
- Skip thinking for complex decisions
|
|
468
|
+
```
|
|
469
|
+
|
|
470
|
+
### Quick Reference Card
|
|
471
|
+
|
|
472
|
+
```markdown
|
|
473
|
+
## Quick Model Selection
|
|
474
|
+
|
|
475
|
+
| I'm doing... | Use | Thinking |
|
|
476
|
+
|--------------|-----|----------|
|
|
477
|
+
| Planning architecture | Opus | ✅ |
|
|
478
|
+
| Code review | Opus | ✅ |
|
|
479
|
+
| Debugging complex bug | Opus | ✅ |
|
|
480
|
+
| Learning from session | Opus | ✅ |
|
|
481
|
+
| Implementing feature | Sonnet | ❌ |
|
|
482
|
+
| Writing tests | Sonnet | ❌ |
|
|
483
|
+
| Fixing simple bug | Sonnet | ❌ |
|
|
484
|
+
| Writing docs | Sonnet | ❌ |
|
|
485
|
+
| Formatting code | Haiku | ❌ |
|
|
486
|
+
| Quick query | Haiku | ❌ |
|
|
487
|
+
```
|
|
488
|
+
|
|
489
|
+
---
|
|
490
|
+
|
|
491
|
+
## 📚 Related Documentation
|
|
492
|
+
|
|
493
|
+
- [Architecture](01-architecture.md) - System architecture
|
|
494
|
+
- [Workflows](04-workflows.md) - Using models in workflows
|
|
495
|
+
- [Quick Reference](07-quick-reference.md) - Cheat sheet
|
|
496
|
+
|
|
497
|
+
---
|
|
498
|
+
|
|
499
|
+
## 📖 Appendix: Model Capabilities
|
|
500
|
+
|
|
501
|
+
### Claude Opus 4
|
|
502
|
+
|
|
503
|
+
```yaml
|
|
504
|
+
model: claude-opus-4
|
|
505
|
+
strengths:
|
|
506
|
+
- Deep analysis
|
|
507
|
+
- Complex reasoning
|
|
508
|
+
- Architecture design
|
|
509
|
+
- Code review
|
|
510
|
+
- Pattern recognition
|
|
511
|
+
best_for:
|
|
512
|
+
- Planning
|
|
513
|
+
- Critical thinking
|
|
514
|
+
- Debugging
|
|
515
|
+
- Learning
|
|
516
|
+
cost_factor: 3x
|
|
517
|
+
```
|
|
518
|
+
|
|
519
|
+
### Claude Sonnet 4
|
|
520
|
+
|
|
521
|
+
```yaml
|
|
522
|
+
model: claude-sonnet-4
|
|
523
|
+
strengths:
|
|
524
|
+
- Fast implementation
|
|
525
|
+
- Good quality code
|
|
526
|
+
- Efficient execution
|
|
527
|
+
- Clear communication
|
|
528
|
+
best_for:
|
|
529
|
+
- Feature implementation
|
|
530
|
+
- Bug fixing
|
|
531
|
+
- Test writing
|
|
532
|
+
- Documentation
|
|
533
|
+
cost_factor: 1x (baseline)
|
|
534
|
+
```
|
|
535
|
+
|
|
536
|
+
### Claude Haiku
|
|
537
|
+
|
|
538
|
+
```yaml
|
|
539
|
+
model: claude-3-5-haiku
|
|
540
|
+
strengths:
|
|
541
|
+
- Fastest response
|
|
542
|
+
- Lowest cost
|
|
543
|
+
- Simple tasks
|
|
544
|
+
best_for:
|
|
545
|
+
- Formatting
|
|
546
|
+
- Simple queries
|
|
547
|
+
- Quick lookups
|
|
548
|
+
- Status checks
|
|
549
|
+
cost_factor: 0.1x
|
|
550
|
+
```
|