cc-mirror 1.4.0 → 1.4.1

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.
@@ -270,6 +270,79 @@ Create src/routes/auth.ts with:
270
270
  )
271
271
  ```
272
272
 
273
+ ### Model Selection
274
+
275
+ Choose the right model for each agent's task:
276
+
277
+ ```
278
+ ┌─────────────────────────────────────────────────────────────┐
279
+ │ HAIKU (model="haiku") — The Errand Runner │
280
+ │ │
281
+ │ Spawn many of these. They're fast and cheap. │
282
+ │ │
283
+ │ • Fetch files, grep for patterns, find things │
284
+ │ • Simple lookups and searches │
285
+ │ • Gather raw information for you to synthesize │
286
+ │ • Mechanical tasks with no judgment calls │
287
+ │ • Run 5-10 in parallel to explore quickly │
288
+ │ │
289
+ ├─────────────────────────────────────────────────────────────┤
290
+ │ SONNET (model="sonnet") — The Capable Worker │
291
+ │ │
292
+ │ Smart, but needs clear direction. Like a junior-mid dev. │
293
+ │ │
294
+ │ • Well-structured implementation tasks │
295
+ │ • Research: reading docs, understanding APIs │
296
+ │ • Following established patterns in a codebase │
297
+ │ • Semi-difficult analysis with clear scope │
298
+ │ • Test generation, documentation │
299
+ │ • When the task is clear and you've defined what to do │
300
+ │ │
301
+ ├─────────────────────────────────────────────────────────────┤
302
+ │ OPUS (model="opus") — The Critical Thinker │
303
+ │ │
304
+ │ Thinks for itself. Trust its judgment. │
305
+ │ │
306
+ │ • Ambiguous or underspecified problems │
307
+ │ • Architectural decisions and design trade-offs │
308
+ │ • Complex debugging requiring reasoning across systems │
309
+ │ • Security review, vulnerability assessment │
310
+ │ • When you need creative problem-solving │
311
+ │ • Tasks where quality of thinking matters most │
312
+ │ • When the path forward isn't obvious │
313
+ │ │
314
+ └─────────────────────────────────────────────────────────────┘
315
+ ```
316
+
317
+ **Example with model selection:**
318
+
319
+ ```
320
+ # Gather info - spawn haiku wildly
321
+ Task(subagent_type="Explore", description="Find auth files", prompt="...", model="haiku", run_in_background=True)
322
+ Task(subagent_type="Explore", description="Find user routes", prompt="...", model="haiku", run_in_background=True)
323
+ Task(subagent_type="Explore", description="Find middleware", prompt="...", model="haiku", run_in_background=True)
324
+
325
+ # Clear implementation task - sonnet
326
+ Task(
327
+ subagent_type="general-purpose",
328
+ description="Implement login route",
329
+ prompt="Create POST /login following the pattern in src/routes/users.ts...",
330
+ model="sonnet",
331
+ run_in_background=True
332
+ )
333
+
334
+ # Needs judgment and critical thinking - opus
335
+ Task(
336
+ subagent_type="general-purpose",
337
+ description="Design auth architecture",
338
+ prompt="Analyze the codebase and recommend the best auth approach...",
339
+ model="opus",
340
+ run_in_background=True
341
+ )
342
+ ```
343
+
344
+ **Always pass `model` explicitly.** Haiku for gathering, sonnet for well-defined work, opus when you need real thinking.
345
+
273
346
  ---
274
347
 
275
348
  ## 🚀 The Orchestration Flow
@@ -43,12 +43,17 @@ Phase 2: REDUCE (Synthesize)
43
43
  **Implementation:**
44
44
 
45
45
  ```
46
- # All in single message for parallelism
47
- Task(subagent_type="Explore", prompt="Fetch PR #123 details, understand context and related issues")
48
- Task(subagent_type="general-purpose", prompt="Review code quality: patterns, readability, maintainability")
49
- Task(subagent_type="general-purpose", prompt="Review logic: correctness, edge cases, error handling")
50
- Task(subagent_type="general-purpose", prompt="Review security: injection, auth, data exposure")
51
- Task(subagent_type="general-purpose", prompt="Review performance: complexity, queries, memory")
46
+ # All in single message for parallelism (opus for reviews - critical thinking)
47
+ Task(subagent_type="Explore", prompt="Fetch PR #123 details, understand context and related issues",
48
+ model="haiku", run_in_background=True)
49
+ Task(subagent_type="general-purpose", prompt="Review code quality: patterns, readability, maintainability",
50
+ model="opus", run_in_background=True)
51
+ Task(subagent_type="general-purpose", prompt="Review logic: correctness, edge cases, error handling",
52
+ model="opus", run_in_background=True)
53
+ Task(subagent_type="general-purpose", prompt="Review security: injection, auth, data exposure",
54
+ model="opus", run_in_background=True)
55
+ Task(subagent_type="general-purpose", prompt="Review performance: complexity, queries, memory",
56
+ model="opus", run_in_background=True)
52
57
  ```
53
58
 
54
59
  ### Pattern: Contextual Deep-Dive
@@ -287,11 +292,15 @@ TaskCreate(subject="Synthesize review", description="Aggregate findings into rev
287
292
  # Synthesis blocked by analysis tasks
288
293
  TaskUpdate(taskId="5", addBlockedBy=["1", "2", "3", "4"])
289
294
 
290
- # Spawn parallel agents for analysis
291
- Task(subagent_type="general-purpose", prompt="TaskId 1: Analyze PR context...")
292
- Task(subagent_type="general-purpose", prompt="TaskId 2: Review code quality...")
293
- Task(subagent_type="general-purpose", prompt="TaskId 3: Check security...")
294
- Task(subagent_type="general-purpose", prompt="TaskId 4: Assess performance...")
295
+ # Spawn parallel agents for analysis (opus for reviews - critical thinking)
296
+ Task(subagent_type="Explore", prompt="TaskId 1: Analyze PR context...",
297
+ model="haiku", run_in_background=True)
298
+ Task(subagent_type="general-purpose", prompt="TaskId 2: Review code quality...",
299
+ model="opus", run_in_background=True)
300
+ Task(subagent_type="general-purpose", prompt="TaskId 3: Check security...",
301
+ model="opus", run_in_background=True)
302
+ Task(subagent_type="general-purpose", prompt="TaskId 4: Assess performance...",
303
+ model="opus", run_in_background=True)
295
304
  ```
296
305
 
297
306
  ---
@@ -326,10 +326,13 @@ TaskUpdate(taskId="4", addBlockedBy=["1"])
326
326
  TaskUpdate(taskId="5", addBlockedBy=["2", "3", "4"])
327
327
  TaskUpdate(taskId="6", addBlockedBy=["5"])
328
328
 
329
- # Spawn parallel analysis agents
330
- Task(subagent_type="general-purpose", prompt="TaskId 2: Explore distributions...")
331
- Task(subagent_type="general-purpose", prompt="TaskId 3: Analyze missing data...")
332
- Task(subagent_type="general-purpose", prompt="TaskId 4: Check data quality...")
329
+ # Spawn parallel analysis agents (haiku for data exploration)
330
+ Task(subagent_type="Explore", prompt="TaskId 2: Explore distributions...",
331
+ model="haiku", run_in_background=True)
332
+ Task(subagent_type="Explore", prompt="TaskId 3: Analyze missing data...",
333
+ model="haiku", run_in_background=True)
334
+ Task(subagent_type="Explore", prompt="TaskId 4: Check data quality...",
335
+ model="haiku", run_in_background=True)
333
336
  ```
334
337
 
335
338
  ## Best Practices
@@ -320,9 +320,11 @@ TaskUpdate(taskId="4", addBlockedBy=["2"]) # Can parallel with network
320
320
  TaskUpdate(taskId="5", addBlockedBy=["3", "4"])
321
321
  TaskUpdate(taskId="6", addBlockedBy=["5"])
322
322
 
323
- # Parallel infrastructure implementation
324
- Task(subagent_type="general-purpose", prompt="TaskId 3: Implement network changes...")
325
- Task(subagent_type="general-purpose", prompt="TaskId 4: Implement compute changes...")
323
+ # Parallel infrastructure implementation (sonnet for well-structured work)
324
+ Task(subagent_type="general-purpose", prompt="TaskId 3: Implement network changes...",
325
+ model="sonnet", run_in_background=True)
326
+ Task(subagent_type="general-purpose", prompt="TaskId 4: Implement compute changes...",
327
+ model="sonnet", run_in_background=True)
326
328
  ```
327
329
 
328
330
  ## Safety Principles
@@ -320,10 +320,13 @@ TaskUpdate(taskId="4", addBlockedBy=["1"])
320
320
  TaskUpdate(taskId="5", addBlockedBy=["2", "3", "4"])
321
321
  TaskUpdate(taskId="6", addBlockedBy=["5"])
322
322
 
323
- # Spawn parallel documentation agents
324
- Task(subagent_type="general-purpose", prompt="TaskId 2: Document API endpoints...")
325
- Task(subagent_type="general-purpose", prompt="TaskId 3: Document components...")
326
- Task(subagent_type="general-purpose", prompt="TaskId 4: Document utilities...")
323
+ # Spawn parallel documentation agents (sonnet for well-structured work)
324
+ Task(subagent_type="general-purpose", prompt="TaskId 2: Document API endpoints...",
325
+ model="sonnet", run_in_background=True)
326
+ Task(subagent_type="general-purpose", prompt="TaskId 3: Document components...",
327
+ model="sonnet", run_in_background=True)
328
+ Task(subagent_type="general-purpose", prompt="TaskId 4: Document utilities...",
329
+ model="sonnet", run_in_background=True)
327
330
  ```
328
331
 
329
332
  ## Output Formats
@@ -350,9 +350,11 @@ TaskUpdate(taskId="4", addBlockedBy=["2"])
350
350
  TaskUpdate(taskId="5", addBlockedBy=["3", "4"])
351
351
  TaskUpdate(taskId="6", addBlockedBy=["5"])
352
352
 
353
- # Parallel breakdown
354
- Task(subagent_type="general-purpose", prompt="TaskId 3: Break down Story A...")
355
- Task(subagent_type="general-purpose", prompt="TaskId 4: Break down Story B...")
353
+ # Parallel breakdown (sonnet for structured planning work)
354
+ Task(subagent_type="general-purpose", prompt="TaskId 3: Break down Story A...",
355
+ model="sonnet", run_in_background=True)
356
+ Task(subagent_type="general-purpose", prompt="TaskId 4: Break down Story B...",
357
+ model="sonnet", run_in_background=True)
356
358
  ```
357
359
 
358
360
  ## Best Practices
@@ -300,10 +300,13 @@ TaskUpdate(taskId="3", addBlockedBy=["1"])
300
300
  TaskUpdate(taskId="4", addBlockedBy=["1"])
301
301
  TaskUpdate(taskId="5", addBlockedBy=["2", "3", "4"])
302
302
 
303
- # Spawn Explore agents in parallel
304
- Task(subagent_type="Explore", prompt="TaskId 2: Find auth patterns...")
305
- Task(subagent_type="Explore", prompt="TaskId 3: Find API patterns...")
306
- Task(subagent_type="Explore", prompt="TaskId 4: Find database patterns...")
303
+ # Spawn Explore agents in parallel (haiku swarm for fast exploration)
304
+ Task(subagent_type="Explore", prompt="TaskId 2: Find auth patterns...",
305
+ model="haiku", run_in_background=True)
306
+ Task(subagent_type="Explore", prompt="TaskId 3: Find API patterns...",
307
+ model="haiku", run_in_background=True)
308
+ Task(subagent_type="Explore", prompt="TaskId 4: Find database patterns...",
309
+ model="haiku", run_in_background=True)
307
310
  ```
308
311
 
309
312
  ## Agent Selection for Research
@@ -256,8 +256,9 @@ TaskUpdate(taskId="3", addBlockedBy=["2"]) # Implement after design
256
256
  TaskUpdate(taskId="4", addBlockedBy=["3"]) # Error handling after core
257
257
  TaskUpdate(taskId="5", addBlockedBy=["3"]) # Tests can parallel with error handling
258
258
 
259
- # Spawn agents for unblocked tasks
260
- Task(subagent_type="general-purpose", prompt="TaskId 1: Analyze requirements...")
259
+ # Spawn agents for unblocked tasks (haiku for analysis/exploration)
260
+ Task(subagent_type="Explore", prompt="TaskId 1: Analyze requirements...",
261
+ model="haiku", run_in_background=True)
261
262
  ```
262
263
 
263
264
  Agents mark tasks resolved immediately upon completion.
@@ -293,9 +293,11 @@ TaskUpdate(taskId="4", addBlockedBy=["2", "3"])
293
293
  TaskUpdate(taskId="5", addBlockedBy=["4"])
294
294
  TaskUpdate(taskId="6", addBlockedBy=["5"])
295
295
 
296
- # Parallel test generation
297
- Task(subagent_type="general-purpose", prompt="TaskId 2: Generate unit tests...")
298
- Task(subagent_type="general-purpose", prompt="TaskId 3: Generate integration tests...")
296
+ # Parallel test generation (sonnet for well-structured work)
297
+ Task(subagent_type="general-purpose", prompt="TaskId 2: Generate unit tests...",
298
+ model="sonnet", run_in_background=True)
299
+ Task(subagent_type="general-purpose", prompt="TaskId 3: Generate integration tests...",
300
+ model="sonnet", run_in_background=True)
299
301
  ```
300
302
 
301
303
  ## Test Execution Best Practices
@@ -36,16 +36,20 @@
36
36
 
37
37
  ### Execution
38
38
 
39
- ```python
39
+ ```
40
40
  # Phase 1: Gather context + parallel analysis (single message)
41
41
  Task(subagent_type="Explore", description="Get PR context",
42
- prompt="Fetch PR #123 details, understand what changed and why")
42
+ prompt="Fetch PR #123 details, understand what changed and why",
43
+ model="haiku", run_in_background=True)
43
44
  Task(subagent_type="general-purpose", description="Review quality",
44
- prompt="Review code quality: readability, patterns, maintainability")
45
+ prompt="Review code quality: readability, patterns, maintainability",
46
+ model="opus", run_in_background=True) # Critical thinking for review
45
47
  Task(subagent_type="general-purpose", description="Review security",
46
- prompt="Review security: injection, auth, data exposure risks")
48
+ prompt="Review security: injection, auth, data exposure risks",
49
+ model="opus", run_in_background=True) # Security needs judgment
47
50
  Task(subagent_type="general-purpose", description="Review performance",
48
- prompt="Review performance: complexity, queries, memory usage")
51
+ prompt="Review performance: complexity, queries, memory usage",
52
+ model="opus", run_in_background=True) # Performance analysis
49
53
  ```
50
54
 
51
55
  ### User Sees
@@ -91,26 +95,32 @@ Adds user profile editing with image upload capability.
91
95
 
92
96
  ### Execution
93
97
 
94
- ```python
95
- # Phase 1: Research (Pipeline)
98
+ ```
99
+ # Phase 1: Research (haiku for exploration)
96
100
  context = Task(subagent_type="Explore", description="Find styling patterns",
97
- prompt="Find existing theme/styling patterns, CSS architecture")
101
+ prompt="Find existing theme/styling patterns, CSS architecture",
102
+ model="haiku", run_in_background=True)
98
103
 
99
- # Phase 2: Plan
104
+ # Phase 2: Plan (opus for design decisions)
100
105
  plan = Task(subagent_type="Plan", description="Design dark mode",
101
- prompt=f"Given: {context}. Design dark mode implementation.")
106
+ prompt=f"Given: {context}. Design dark mode implementation.",
107
+ model="opus", run_in_background=True)
102
108
 
103
- # Phase 3: Implement (Fan-Out - single message)
109
+ # Phase 3: Implement (sonnet for well-structured work - single message)
104
110
  Task(subagent_type="general-purpose", description="Add CSS variables",
105
- prompt="Add dark theme CSS variables...")
111
+ prompt="Add dark theme CSS variables...",
112
+ model="sonnet", run_in_background=True)
106
113
  Task(subagent_type="general-purpose", description="Create toggle",
107
- prompt="Create theme toggle component...")
114
+ prompt="Create theme toggle component...",
115
+ model="sonnet", run_in_background=True)
108
116
  Task(subagent_type="general-purpose", description="Add persistence",
109
- prompt="Add localStorage persistence for theme preference...")
117
+ prompt="Add localStorage persistence for theme preference...",
118
+ model="sonnet", run_in_background=True)
110
119
 
111
- # Phase 4: Integration (Pipeline)
120
+ # Phase 4: Integration (sonnet for implementation)
112
121
  Task(subagent_type="general-purpose", description="Wire and test",
113
- prompt="Wire components together, test theme switching works")
122
+ prompt="Wire components together, test theme switching works",
123
+ model="sonnet", run_in_background=True)
114
124
  ```
115
125
 
116
126
  ### User Sees
@@ -162,25 +172,30 @@ Try it: Click the moon/sun icon in the header.
162
172
 
163
173
  ### Execution
164
174
 
165
- ```python
166
- # Phase 1: Parallel diagnosis (Fan-Out - single message)
175
+ ```
176
+ # Phase 1: Parallel diagnosis (haiku swarm - single message)
167
177
  Task(subagent_type="Explore", description="Check logs",
168
- prompt="Search for login errors, password reset issues in logs")
178
+ prompt="Search for login errors, password reset issues in logs",
179
+ model="haiku", run_in_background=True)
169
180
  Task(subagent_type="Explore", description="Find reset flow",
170
- prompt="Find password reset implementation, trace the flow")
181
+ prompt="Find password reset implementation, trace the flow",
182
+ model="haiku", run_in_background=True)
171
183
  Task(subagent_type="Explore", description="Check session handling",
172
- prompt="How are sessions/tokens handled after password change?")
184
+ prompt="How are sessions/tokens handled after password change?",
185
+ model="haiku", run_in_background=True)
173
186
 
174
187
  # Phase 2: Synthesize (after results return)
175
188
  # Identify: Password reset invalidates session but doesn't clear cookie
176
189
 
177
- # Phase 3: Fix
190
+ # Phase 3: Fix (sonnet for implementation)
178
191
  Task(subagent_type="general-purpose", description="Fix session bug",
179
- prompt="Clear session cookie after password reset...")
192
+ prompt="Clear session cookie after password reset...",
193
+ model="sonnet", run_in_background=True)
180
194
 
181
- # Phase 4: Verify
195
+ # Phase 4: Verify (sonnet for test writing)
182
196
  Task(subagent_type="general-purpose", description="Add regression test",
183
- prompt="Add test for login after password reset...")
197
+ prompt="Add test for login after password reset...",
198
+ model="sonnet", run_in_background=True)
184
199
  ```
185
200
 
186
201
  ### User Sees
@@ -229,14 +244,17 @@ The flow now:
229
244
 
230
245
  ### Execution
231
246
 
232
- ```python
233
- # Phase 1: Parallel exploration (Fan-Out - single message)
247
+ ```
248
+ # Phase 1: Parallel exploration (haiku swarm - single message)
234
249
  Task(subagent_type="Explore", description="Project structure",
235
- prompt="Analyze project structure, entry points, build system")
250
+ prompt="Analyze project structure, entry points, build system",
251
+ model="haiku", run_in_background=True)
236
252
  Task(subagent_type="Explore", description="Core patterns",
237
- prompt="Identify core architectural patterns, frameworks used")
253
+ prompt="Identify core architectural patterns, frameworks used",
254
+ model="haiku", run_in_background=True)
238
255
  Task(subagent_type="Explore", description="Data flow",
239
- prompt="Trace main data flows, API structure, state management")
256
+ prompt="Trace main data flows, API structure, state management",
257
+ model="haiku", run_in_background=True)
240
258
  ```
241
259
 
242
260
  ### User Sees
@@ -294,27 +312,31 @@ Want me to dive deeper into any area?
294
312
 
295
313
  ### Execution
296
314
 
297
- ```python
298
- # Phase 1: Run tests in background
315
+ ```
316
+ # Phase 1: Run tests in background (sonnet for test execution)
299
317
  Task(subagent_type="general-purpose", description="Run tests",
300
318
  prompt="Run full test suite, report failures",
301
- run_in_background=True)
319
+ model="sonnet", run_in_background=True)
302
320
 
303
321
  # Continue with other work or wait
304
322
  result = TaskOutput(task_id="...", block=True)
305
323
 
306
- # Phase 2: Fix failures (Fan-Out if multiple)
324
+ # Phase 2: Fix failures (sonnet for fixes - single message)
307
325
  # If 3 failures found:
308
326
  Task(subagent_type="general-purpose", description="Fix test 1",
309
- prompt="Fix failing test in auth.test.ts...")
327
+ prompt="Fix failing test in auth.test.ts...",
328
+ model="sonnet", run_in_background=True)
310
329
  Task(subagent_type="general-purpose", description="Fix test 2",
311
- prompt="Fix failing test in api.test.ts...")
330
+ prompt="Fix failing test in api.test.ts...",
331
+ model="sonnet", run_in_background=True)
312
332
  Task(subagent_type="general-purpose", description="Fix test 3",
313
- prompt="Fix failing test in utils.test.ts...")
333
+ prompt="Fix failing test in utils.test.ts...",
334
+ model="sonnet", run_in_background=True)
314
335
 
315
- # Phase 3: Verify
336
+ # Phase 3: Verify (sonnet for test execution)
316
337
  Task(subagent_type="general-purpose", description="Re-run tests",
317
- prompt="Run test suite again to verify fixes")
338
+ prompt="Run test suite again to verify fixes",
339
+ model="sonnet", run_in_background=True)
318
340
  ````
319
341
 
320
342
  ### User Sees
@@ -66,7 +66,7 @@ TaskUpdate(taskId="3", addBlockedBy=["2"])
66
66
 
67
67
  # 3. Find unblocked tasks and spawn agents
68
68
  TaskList() # Find tasks with empty blockedBy
69
- Task(subagent_type="general-purpose", prompt="TaskId 1: Setup database...", run_in_background=True)
69
+ Task(subagent_type="general-purpose", prompt="TaskId 1: Setup database...", model="sonnet", run_in_background=True)
70
70
 
71
71
  # 4. Agents mark complete, repeat
72
72
  TaskUpdate(taskId="1", status="resolved")
@@ -91,10 +91,10 @@ Orchestrator
91
91
  **Implementation:**
92
92
 
93
93
  ```python
94
- # Single message with multiple background agents
95
- Task(subagent_type="Explore", prompt="Analyze auth module...", run_in_background=True)
96
- Task(subagent_type="Explore", prompt="Analyze database layer...", run_in_background=True)
97
- Task(subagent_type="Explore", prompt="Analyze API routes...", run_in_background=True)
94
+ # Single message with multiple background agents (haiku for fast exploration)
95
+ Task(subagent_type="Explore", prompt="Analyze auth module...", model="haiku", run_in_background=True)
96
+ Task(subagent_type="Explore", prompt="Analyze database layer...", model="haiku", run_in_background=True)
97
+ Task(subagent_type="Explore", prompt="Analyze API routes...", model="haiku", run_in_background=True)
98
98
  ```
99
99
 
100
100
  **Critical:** All Task calls MUST be in ONE message AND use `run_in_background=True`.
@@ -114,16 +114,16 @@ Agent A → output → Agent B → output → Agent C → final result
114
114
  **Implementation:**
115
115
 
116
116
  ```python
117
- # Step 1: Research (background, wait for notification)
118
- Task(subagent_type="Explore", prompt="Find all API endpoints...", run_in_background=True)
117
+ # Step 1: Research (haiku - fast exploration)
118
+ Task(subagent_type="Explore", prompt="Find all API endpoints...", model="haiku", run_in_background=True)
119
119
  # → Notification arrives with result1
120
120
 
121
- # Step 2: Plan (background, uses result1)
122
- Task(subagent_type="Plan", prompt=f"Given endpoints: {result1}, design...", run_in_background=True)
121
+ # Step 2: Plan (opus - needs critical thinking for design)
122
+ Task(subagent_type="Plan", prompt=f"Given endpoints: {result1}, design...", model="opus", run_in_background=True)
123
123
  # → Notification arrives with result2
124
124
 
125
- # Step 3: Implement (background, uses result2)
126
- Task(subagent_type="general-purpose", prompt=f"Implement this plan: {result2}", run_in_background=True)
125
+ # Step 3: Implement (sonnet - well-structured from plan)
126
+ Task(subagent_type="general-purpose", prompt=f"Implement this plan: {result2}", model="sonnet", run_in_background=True)
127
127
  ```
128
128
 
129
129
  ---
@@ -143,10 +143,10 @@ Input ──►├──► Agent B ──┼──► Aggregator → Final Resu
143
143
  **Implementation:**
144
144
 
145
145
  ```python
146
- # MAP: Launch parallel agents (single message)
147
- Task(subagent_type="general-purpose", prompt="Analyze file1.ts for security issues", run_in_background=True)
148
- Task(subagent_type="general-purpose", prompt="Analyze file2.ts for security issues", run_in_background=True)
149
- Task(subagent_type="general-purpose", prompt="Analyze file3.ts for security issues", run_in_background=True)
146
+ # MAP: Launch parallel agents (opus for security - needs critical thinking)
147
+ Task(subagent_type="general-purpose", prompt="Analyze file1.ts for security issues", model="opus", run_in_background=True)
148
+ Task(subagent_type="general-purpose", prompt="Analyze file2.ts for security issues", model="opus", run_in_background=True)
149
+ Task(subagent_type="general-purpose", prompt="Analyze file3.ts for security issues", model="opus", run_in_background=True)
150
150
 
151
151
  # REDUCE: Collect and synthesize
152
152
  results = [TaskOutput(task_id=id) for id in task_ids]
@@ -170,10 +170,10 @@ Problem ─├──► Approach B ──┼──► Evaluate → Best Solution
170
170
  **Implementation:**
171
171
 
172
172
  ```python
173
- # Launch competing approaches (single message, all background)
174
- Task(subagent_type="general-purpose", prompt="Implement using recursive approach...", run_in_background=True)
175
- Task(subagent_type="general-purpose", prompt="Implement using iterative approach...", run_in_background=True)
176
- Task(subagent_type="general-purpose", prompt="Implement using memoization...", run_in_background=True)
173
+ # Launch competing approaches (sonnet for implementation)
174
+ Task(subagent_type="general-purpose", prompt="Implement using recursive approach...", model="sonnet", run_in_background=True)
175
+ Task(subagent_type="general-purpose", prompt="Implement using iterative approach...", model="sonnet", run_in_background=True)
176
+ Task(subagent_type="general-purpose", prompt="Implement using memoization...", model="sonnet", run_in_background=True)
177
177
 
178
178
  # Notifications arrive → Evaluate and select best
179
179
  ```
@@ -189,8 +189,8 @@ Long-running agents while continuing foreground work.
189
189
  **Implementation:**
190
190
 
191
191
  ```python
192
- # Launch background work
193
- Task(subagent_type="general-purpose", prompt="Run full test suite...", run_in_background=True)
192
+ # Launch background work (sonnet for test execution)
193
+ Task(subagent_type="general-purpose", prompt="Run full test suite...", model="sonnet", run_in_background=True)
194
194
 
195
195
  # Continue foreground work
196
196
  # ... do other tasks ...
@@ -271,13 +271,13 @@ results = [TaskOutput(id) for id in task_ids]
271
271
  ### Speculative + Pipeline
272
272
 
273
273
  ```python
274
- # Try multiple approaches (background)
275
- Task(subagent_type="general-purpose", prompt="Approach A...", run_in_background=True)
276
- Task(subagent_type="general-purpose", prompt="Approach B...", run_in_background=True)
274
+ # Try multiple approaches (sonnet for implementation)
275
+ Task(subagent_type="general-purpose", prompt="Approach A...", model="sonnet", run_in_background=True)
276
+ Task(subagent_type="general-purpose", prompt="Approach B...", model="sonnet", run_in_background=True)
277
277
 
278
278
  # Notifications arrive → Evaluate and continue with winner
279
279
  winner = evaluate(approach_a, approach_b)
280
- Task(subagent_type="general-purpose", prompt=f"Refine and complete: {winner}", run_in_background=True)
280
+ Task(subagent_type="general-purpose", prompt=f"Refine and complete: {winner}", model="sonnet", run_in_background=True)
281
281
  ```
282
282
 
283
283
  ---
@@ -307,7 +307,7 @@ if result.failed or result.incomplete:
307
307
  "content": f"Attempt 1 failed: {result.error}. Retrying with adjusted approach."
308
308
  })
309
309
 
310
- # Retry with more context (still background)
310
+ # Retry with more context (still background, same model as original)
311
311
  Task(subagent_type="general-purpose",
312
312
  prompt=f"""Previous attempt failed: {result.error}
313
313
 
@@ -315,6 +315,7 @@ if result.failed or result.incomplete:
315
315
  - [specific guidance based on failure]
316
316
 
317
317
  Original task: [task description]""",
318
+ model="sonnet",
318
319
  run_in_background=True)
319
320
  ```
320
321
 
@@ -375,9 +376,9 @@ for result in [result1, result2, result3]:
375
376
  "Found these relevant files: {all_files}"
376
377
  ```
377
378
 
378
- **Complex synthesis (spawn synthesis agent):**
379
+ **Complex synthesis (spawn synthesis agent - opus for judgment):**
379
380
 
380
- ```python
381
+ ```
381
382
  Task(subagent_type="general-purpose",
382
383
  prompt=f"""Synthesize these parallel review findings into a unified report:
383
384
 
@@ -398,6 +399,7 @@ Create a single PR review with:
398
399
  - Positive notes
399
400
 
400
401
  Prioritize by severity. Remove duplicates. Do not mention that multiple reviews were conducted.""",
402
+ model="opus",
401
403
  run_in_background=True)
402
404
  ```
403
405
 
@@ -413,7 +415,7 @@ if has_conflict(result1, result2):
413
415
  Approach A: {result1.summary}
414
416
  Approach B: {result2.summary}"
415
417
 
416
- # Option 2: Spawn resolution agent
418
+ # Option 2: Spawn resolution agent (opus for judgment)
417
419
  Task(subagent_type="general-purpose",
418
420
  prompt=f"""Two agents produced conflicting changes:
419
421
 
@@ -422,6 +424,7 @@ if has_conflict(result1, result2):
422
424
 
423
425
  Merge these changes, resolving conflicts by [priority rule].
424
426
  Ensure the final result is consistent.""",
427
+ model="opus",
425
428
  run_in_background=True)
426
429
  ```
427
430
 
@@ -201,10 +201,10 @@ Spawn an agent to handle work. This is how you delegate.
201
201
 
202
202
  **ALWAYS use `run_in_background=True`.** This is the foundation of powerful orchestration.
203
203
 
204
- ```python
205
- # Correct: Background agents (ALWAYS)
206
- Task(subagent_type="Explore", prompt="...", run_in_background=True)
207
- Task(subagent_type="general-purpose", prompt="...", run_in_background=True)
204
+ ```
205
+ # Correct: Background agents (ALWAYS) with explicit model
206
+ Task(subagent_type="Explore", prompt="...", model="haiku", run_in_background=True)
207
+ Task(subagent_type="general-purpose", prompt="...", model="sonnet", run_in_background=True)
208
208
  ```
209
209
 
210
210
  ### The Notification System
@@ -252,23 +252,23 @@ TaskOutput(task_id="abc123")
252
252
 
253
253
  ### Model Selection
254
254
 
255
- | Task Complexity | Model | Why |
256
- | ---------------------- | --------------- | ---------------------------- |
257
- | Simple search/patterns | `haiku` | Fast and cheap |
258
- | Standard exploration | `haiku` | Sufficient for most searches |
259
- | Complex exploration | `sonnet` | Needs reasoning |
260
- | Simple implementation | `haiku` | Pattern-based work |
261
- | Complex implementation | `sonnet` | Design decisions needed |
262
- | Architecture/planning | `sonnet`/`opus` | Complex trade-offs |
263
- | Security review | `sonnet` | Careful analysis |
255
+ | Task Type | Model | Why |
256
+ | -------------------------------- | -------- | ---------------------------------------- |
257
+ | Fetch files, grep, find things | `haiku` | Errand runner - spawn many in parallel |
258
+ | Gather info for synthesis | `haiku` | No judgment needed, just retrieval |
259
+ | Well-structured implementation | `sonnet` | Capable worker - needs clear direction |
260
+ | Research, reading docs | `sonnet` | Can follow patterns and instructions |
261
+ | Security review | `opus` | Critical thinking, trust its judgment |
262
+ | Architecture/design decisions | `opus` | Ambiguous, needs creative problem-solving|
263
+ | Complex debugging | `opus` | Reasoning across systems |
264
264
 
265
265
  ### Parallelism Strategy
266
266
 
267
- | Priority | Approach |
268
- | ------------ | ------------------------------------------------ |
269
- | **Speed** | Parallelize with sonnet, accept higher cost |
270
- | **Cost** | Sequential haiku where possible |
271
- | **Balanced** | Haiku for exploration, sonnet for implementation |
267
+ | Priority | Approach |
268
+ | ------------ | -------------------------------------------------- |
269
+ | **Speed** | Swarm of haiku for gathering, parallel sonnet work |
270
+ | **Cost** | Haiku wherever possible, sonnet only when needed |
271
+ | **Balanced** | Haiku to gather, sonnet to implement, opus to decide |
272
272
 
273
273
  ---
274
274
 
@@ -482,10 +482,11 @@ TaskUpdate(taskId="3", addBlockedBy=["2"])
482
482
  # 3. Find ready (task 1 is unblocked)
483
483
  TaskList()
484
484
 
485
- # 4. Spawn background agent (ALWAYS background)
485
+ # 4. Spawn background agent (ALWAYS background, explicit model)
486
486
  Task(subagent_type="general-purpose",
487
487
  description="Setup database",
488
488
  prompt="Create SQLite database with users table...",
489
+ model="sonnet",
489
490
  run_in_background=True)
490
491
 
491
492
  # 5. Update user and yield (or continue other work)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cc-mirror",
3
- "version": "1.4.0",
3
+ "version": "1.4.1",
4
4
  "type": "module",
5
5
  "description": "Create multiple isolated Claude Code variants with custom providers (Z.ai, MiniMax, OpenRouter, Claude Code Router)",
6
6
  "author": "Numman Ali",