context-anchored-fallback-report
它能做什么
这项技能指导智能体在多个数据工具失败时,始终遵循原始报告目标。适合即使无法获取来源,也需要生成文档的人。
适用场景
- ✓当智能体在撰写文档或报告时,两个或更多数据工具失败的时候。
- ✓当智能体在工具报错后有偏离、转去做无关任务的风险时。
- ✓当报告仍需依靠智能体自身知识撰写并保存为文件的时候。
技能链接
https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/write-file-fallback-report-enhanced-4bc5c2/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请撰写我要求的市场报告。网络工具一直失败,所以请运用你所知道的内容,围绕本主题,并保存为文件。”
每周 5 个新技能,1 分钟读完。
工作原理
在两次失败之后,智能体会锁定原始目标,停止重试失败的工具,并依靠自身知识撰写报告。它用文件写入工具保存输出,并注明其来源的局限性。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Context-Anchored Fallback Report Generation
Critical Warning: Context Drift Prevention
DO NOT ABANDON THE ORIGINAL TASK when tools fail. The most common failure mode is switching to an unrelated task after encountering tool errors.
CONTEXT_DRIFT_WARNING:
IF tool_failures occur (read_webpage, search_web, execute_code_sandbox)
THEN you MUST stay on the ORIGINAL task
AND you MUST NOT switch to unrelated tasks
AND you MUST generate output for the original goal using write_file
When to Use This Skill
Activate this workflow when multiple primary data source tools fail during document/report generation:
Trigger Decision Tree
START: Attempting to generate document/report
│
├─→ Tool #1 fails (read_webpage/search_web/read_file/execute_code_sandbox)?
│ │
│ ├─→ YES → Count = 1, Continue attempting
│ │
│ └─→ NO → Proceed normally with retrieved data
│
├─→ Tool #2 fails (same or different tool)?
│ │
│ ├─→ YES → Count = 2, TRIGGER FALLBACK NOW
│ │ │
│ │ ├─→ LOCK to original task goal (write it down)
│ │ ├─→ Stop attempting failing tools
│ │ └─→ Generate document with write_file + embedded knowledge
│ │
│ └─→ NO → Continue with 1-2 more attempts max
│
└─→ 2+ consecutive failures without document output?
│
└─→ CRITICAL ERROR: You are drifting from task. STOP and apply this skill.
Tool Failure Indicators
FALLBACK_TRIGGERS = {
"read_file": "returns binary/image data instead of text, or file not found",
"search_web": "returns unknown error, empty results, or rate limited",
"read_webpage": "returns unknown error, connection timeout, or blocked access",
"execute_code_sandbox": "fails with unknown error or timeout repeatedly",
"any_retrieval_tool": "2+ consecutive failures on data retrieval attempts"
}
Activation threshold: 2+ failures from the above triggers = IMMEDIATE fallback activation.
Step-by-Step Instructions
Step 0: Context Anchor (BEFORE pivoting)
CRITICAL STEP: Before any fallback action, write down the original task:
CONTEXT_ANCHOR = "[Original task goal from user request]"
Example:
CONTEXT_ANCHOR = "Create PACT Act veterans benefits document explaining claim process"
Rule: Every subsequent action must reference and serve this CONTEXT_ANCHOR. Never deviate.
Step 1: Detect and Declare Failure Pattern
When 2+ tool failures occur:
State the limitation clearly (once, briefly):
Note: External data sources (web search, webpage access) are currently unavailable. This report will be generated using established domain knowledge.Declare the pivot explicitly:
Pivoting to write_file-based document generation with embedded knowledge. Task remains: [CONTEXT_ANCHOR]Do NOT:
- Apologize repeatedly
- Continue retrying failed tools beyond 2 attempts
- Suggest the task cannot be completed
- Switch to a different task
Step 2: Pre-Compute Available Knowledge
Before writing, inventory what you CAN provide:
# Knowledge inventory for the task
available_knowledge = {
"domain_frameworks": "General best practices, standard procedures",
"structural_templates": "Professional document formats for this type",
"actionable_guidance": "Step-by-step processes based on established patterns",
"placeholder_markers": "Where specific data would enhance (clearly marked)"
}
Step 3: Generate Document with write_file
Create professionally structured content:
# [Document Title - aligned with CONTEXT_ANCHOR]
## Executive Summary
[2-3 sentences on what this document covers, noting data source limitations if relevant]
## Background & Scope
[Context based on embedded domain knowledge]
## Core Content
[Organized sections with:
- Clear headers (##, ###)
- Bullet points and numbered lists
- Tables where appropriate
- Code blocks for technical content
]
## Data Source Notes
> **Note**: Specific data points that would typically come from [expected sources]
> were unavailable at generation time. Content reflects established practices
> in this domain.
## Actionable Recommendations
1. [Concrete step 1]
2. [Concrete step 2]
3. [Next steps for obtaining specific data if needed]
## Task Completion Status
- **Original Goal**: [CONTEXT_ANCHOR]
- **Completion Method**: Generated via write_file with embedde
常见问题
“上下文偏移”是什么意思?
指工具出错后转去做无关任务,技能对此提出了警告。
备用方案何时启动?
技能要求在第二次工具尝试失败后启动。
报告保存在哪里?
智能体使用文件写入工具将其保存为文件。
详情
作者的原始描述
Generate documents with write_file when retrieval tools fail, with explicit guardrails against task context drift
repo: HKUDS/AgentPilot
热度
- GitHub 星标
- 7.8k
- 排名
- #13031
- 许可证
- MIT
- 更新时间
- 2026/11/1
评论
- …
同一仓库的更多技能
agentpilot
7.8k帮你的智能体准备任务并运行 AgentPilot 循环,逐步改进项目:循环会提出修改、测试修改并为其打分。
openspace
7.8k帮你的智能体设置 OpenSpace,这是一个用于存储和获取智能体技能的工具,并通过 MCP 将其连接到你的 AI 应用。
rsi-arena
7.8k帮你的智能体设置并运行标准 AI 基准测试,例如 AIME 和 Terminal-Bench,用来比较不同的改进方法。
experiment-guide
7.8k帮你的智能体规划小型实验、阅读实验结果并记录发现,同时研究如何改进一个程序。