Squad 智能体错误恢复
error-recovery
面向所有 squad 智能体的标准恢复模式。当出现失败时,应主动适配调整——而不只是报告失败。
- License 许可
- MIT
- 最近更新
- 2026-10-27
- Stars
- ★ 0
- Forks
- 3
01 前言 Front Matter
- name
- error-recovery
- domain
- reliability, agent-coordination
- license
- MIT
- confidence
- high
- description
- Standard recovery patterns for all squad agents. When something fails, adapt — don't just report the failure.
03 SKILL.md 正文
Error Recovery Patterns
Standard recovery patterns for all squad agents. When something fails, adapt — don't just report the failure.
1. Retry with Backoff
When: Transient failures — API timeouts, rate limits, network errors, temporary service unavailability.
Pattern:
- Wait briefly, then retry (start at 2s, double each attempt)
- Maximum 3 retries before escalating
- Log each attempt with the error received
Example: API call returns 429 Too Many Requests → wait 2s → retry → wait 4s → retry → wait 8s → retry → escalate if still failing.
2. Fallback Alternatives
When: Primary tool or approach fails and an alternative exists.
Pattern:
- Attempt primary approach
- On failure, identify alternative tool/method
- Try the alternative with the same intent
- Document which alternative was used and why
Example: Primary CLI tool fails → fall back to direct API call for the same operation.
3. Diagnose-and-Fix
When: Build failures, test failures, linting errors — structured errors with actionable output.
Pattern:
- Read the full error output carefully
- Identify the root cause from error messages
- Attempt a targeted fix
- Re-run to verify the fix
- Maximum 3 fix-retry cycles before escalating
Example: Build fails with a type error → check for missing import → add it → rebuild.
4. Escalate with Context
When: Recovery attempts have been exhausted, or the failure requires human judgment.
Pattern:
- Summarize what was attempted and what failed
- Include the exact error messages
- State what you believe the root cause is
- Suggest next steps or who might be able to help
- Hand off to the coordinator or the appropriate specialist
Example: After 3 failed build attempts → "Build fails on line 42 with null reference. Tried X, Y, Z. Likely a design issue in the Foo module. Recommend the code owner review."
5. Graceful Degradation
When: A non-critical step fails but the overall task can still deliver value.
Pattern:
- Determine if the failed step is critical to the task outcome
- If non-critical, log the failure and continue
- Deliver partial results with a clear note of what was skipped
- Offer to retry the skipped step separately
Example: Generating a report with 5 sections — section 3 data source is unavailable → produce the report with 4 sections, note that section 3 was skipped and why.
Applying These Patterns
Each agent should reference these patterns in their charter's ## Error Recovery section, tailored to their domain. The charter should list the agent's most common failure modes and map each to the appropriate pattern above.
Selection guide:
| Failure Type | Primary Pattern | Fallback Pattern |
|---|---|---|
| Network/API transient | Retry with Backoff | Escalate with Context |
| Tool/dependency missing | Fallback Alternatives | Escalate with Context |
| Build/test error | Diagnose-and-Fix | Escalate with Context |
| Auth/permissions | Retry with Backoff | Escalate with Context |
| Non-critical data missing | Graceful Degradation | — |
| Unknown/novel error | Escalate with Context | — |
04 同仓库更多 Skills
{技能名称}
{skill-name}
{本技能教会智能体做什么}
azd 种子钩子
azd-seed-hook
暂无简介
{技能名称}
{skill-name}
{此技能向智能体传授的内容}
智能体分层记忆模型
tiered-memory
三层智能体记忆模型(热/冷/维基),用于减少每次派生(spawn)智能体时的上下文占用。
API 变更同步更新测试
test-discipline
更改 API 时必须同步更新测试——无一例外。
squad 命令目录与交互菜单
squad
Squad 的命令目录与交互式菜单。通过 /squad(斜杠命令)或自然语言(“squad commands”、“what can squad do”、“show me squad options”)调用。以交互式选择器形式呈现分类操作(安装与升级、团队管理、议题与 PR、插件与技能、模型与成本、会话与状态)。路由到相应的 squad CLI 命令或 Squad 协调器智能体。