Core Rule
Spawn cost < task cost → delegate. Otherwise, do it yourself.
Model Tiers
| Tier | Models | Cost | Use for |
|---|
| Small | Haiku, GPT-4o-mini, Gemini Flash | ~$0.25/1M | Search, summarize, format, classify |
| Medium |
Sonnet, GPT-4o, Gemini Pro | ~$3/1M | Code, analysis, synthesis |
| Large | Opus, o1, Gemini Ultra | ~$15/1M | Architecture, complex reasoning |
Rule of thumb: Start with smallest tier. Escalate only if output quality insufficient.
Spawn Checklist
Every spawn must include:
CODEBLOCK0
Check templates.md for copy-paste spawn templates.
Error Recovery
| Error Type | Action |
|---|
| Sub-agent timeout (>5 min no response) | Kill and retry once |
| Wrong output format |
Retry with stricter instructions |
| Task too complex for tier | Escalate: Small→Medium→Large |
| Repeated failures (3x) | Abort, report to user |
Check errors.md for recovery patterns and escalation logic.
Verification
Never trust "done" without checking:
- - Code: Run tests, check syntax
- Files: Verify they exist and have content
- Data: Spot-check 2-3 items
- Research: Confirm sources exist
Don't Delegate
- - Quick tasks (<30 seconds to do yourself)
- Tasks needing conversation context
- Anything requiring user clarification mid-task
核心规则
生成成本 < 任务成本 → 委派。否则,自行完成。
模型层级
| 层级 | 模型 | 成本 | 用途 |
|---|
| 小型 | Haiku、GPT-4o-mini、Gemini Flash | 约0.25美元/百万token | 搜索、总结、格式化、分类 |
| 中型 |
Sonnet、GPT-4o、Gemini Pro | 约3美元/百万token | 编码、分析、综合 |
| 大型 | Opus、o1、Gemini Ultra | 约15美元/百万token | 架构设计、复杂推理 |
经验法则: 从最小层级开始。仅在输出质量不足时升级。
生成检查清单
每次生成必须包含:
- 1. 任务:单一明确可交付成果(而非帮忙处理X)
- 模型:明确指定层级
- 上下文:仅需相关文件/信息(绝不包含完整历史)
- 输出:预期格式(返回JSON格式,包含...、写入文件X)
- 完成:如何标记任务完成
查看 templates.md 获取可复制的生成模板。
错误恢复
| 错误类型 | 处理方式 |
|---|
| 子代理超时(超过5分钟无响应) | 终止并重试一次 |
| 输出格式错误 |
使用更严格的指令重试 |
| 任务超出当前层级能力 | 升级:小型→中型→大型 |
| 重复失败(3次) | 中止,向用户报告 |
查看 errors.md 获取恢复模式和升级逻辑。
验证
切勿轻信已完成而不检查:
- - 代码: 运行测试,检查语法
- 文件: 确认文件存在且包含内容
- 数据: 抽查2-3个项目
- 研究: 确认来源存在
不委派的情况
- - 快速任务(自行完成耗时少于30秒)
- 需要对话上下文的任务
- 执行过程中需要用户澄清的任何任务