context-anchored-fallback-report
What it does
This skill guides the AI agent to keep to the original report goal when several data tools fail. It is for people who need a document produced even when the sources are unavailable.
When to use it
- βWhen two or more data tools fail while the agent is writing a document or report.
- βWhen the agent is at risk of switching to an unrelated task after tool errors.
- βWhen a report must still be written with the agent's own knowledge and saved to a file.
Skill link
https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/write-file-fallback-report-enhanced-4bc5c2/SKILL.mdCopy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.
How to use
The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.
Ready-to-paste message
For Claude Code, Codex or Cursor: run it in your project folder and the skill gets installed.
Download the SKILL.md and drop it into your agentβs skills folder.
Example of what to ask your AI
βWrite the market report I asked for. The web tools keep failing, so use what you know, stay on this topic, and save it as a file.β
5 new skills a week. 1 minute to read.
How it works
After two failures, the agent locks onto the original goal, stops retrying the failing tools and writes the report with its own knowledge. It saves the output with a file-writing tool and notes the limits of its sources.
Technical content (original SKILL.md)
Original text by the author, straight from 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
FAQ
What does 'context drift' mean here?
It means switching to an unrelated task after tool errors, which the skill warns against.
When does the fallback start?
The skill says to trigger it after the second failed tool attempt.
Where is the report saved?
The agent saves it as a file with the file-writing tool.
Details
Original description by the author
Generate documents with write_file when retrieval tools fail, with explicit guardrails against task context drift
repo: HKUDS/AgentPilot
Popularity
- GitHub stars
- 7.8k
- Ranking position
- #13031
- License
- MIT
- Updated
- 11/1/2026
Comments
- β¦
More skills from this repository
agentpilot
7.8kHelps your agent improve a project step by step by preparing a task and running the AgentPilot loop that proposes, tests and scores changes.
openspace
7.8kHelps your agent set up OpenSpace, a tool that stores and fetches agent skills, and connect it to your AI app through MCP.
rsi-arena
7.8kHelps your agent set up and run standard AI benchmark tests, such as AIME and Terminal-Bench, to compare different improvement methods.
experiment-guide
7.8kHelps your agent plan small experiments, read their results and record findings while it investigates how to improve a program.
Similar skills
obsidian-vault-maintainer
394kHelps your agent keep an Obsidian-friendly memory vault tidy, with working wiki links, consistent properties, and safe generated sections.
wiki-maintainer
394kHelps your agent maintain an OpenClaw memory wiki with repeatable pages, safe managed blocks, and checks for contradictions or gaps.
obsidian
394kLets your agent read, search, create, and edit Obsidian notes, tasks, links, and properties using the official Obsidian command line.