Handle cascading data retrieval tool failures by falling back to embedded knowledge generation
复制下面这句话,粘贴给 Claude Code、Codex、Cursor 等 AI 编程工具,它会读取安装说明并在你确认后完成安装。
请阅读 https://ai.atlankj.com/install/asset/gh-cascade-fail-recovery-c44273a9e576 ,按照其中的说明把「cascade-fail-recovery」安装到你(当前 AI 工具)中。执行前先告诉我将运行的命令和写入的位置,等我确认。
查看 AI 将读取的安装说明正在读取 GitHub 原文…
内容来自 GitHub 原始文件,由原作者维护。在 GitHub 查看
When multiple data retrieval tools (read_webpage, search_web) fail in succession, immediately fall back to generating content from embedded knowledge rather than attempting repairs or abandoning the task. This preserves task context and ensures completion.
Use this pattern when you observe:
Identify the failure pattern:
Iteration N: read_webpage failed - connection error
Iteration N+1: search_web failed - timeout/unavailable
Iteration N+2: [risk] Agent may abandon task or switch objectives
Before switching strategies, explicitly restate the original objective:
ORIGINAL OBJECTIVE: [Restate the core task goal]
CONTEXT PRESERVED: [Key requirements, constraints, deliverables]
Immediately switch to embedded knowledge generation:
Generate the required document:
# Fallback to generating from embedded knowledge
write_file(
path="output/document.md",
content="[Generate content from internal knowledge base]"
)
Scenario: PACT Act veterans benefits document needed, but web access failing
Wrong approach (observed failure):
Iter 11: read_webpage failed - access error
Iter 12: search_web failed - unavailable
Iter 13: [ABANDONED] Switched to unrelated musician payroll task
Correct approach (with this skill):
Iter 11: read_webpage failed - access error
Iter 12: search_web failed - unavailable
Iter 13: CASCADE FAIL DETECTED - invoking fallback
Iter 14: write_file - generate PACT Act document from embedded knowledge
- Note: "External verification unavailable; content based on training knowledge"
write-file-fallback: Generate documents when data sources unavailabletask-context-preservation: Maintain objective continuity through errors