跳到正文
cccskills
免费在 GitHub 公开

context-anchored-fallback-report

Keep report writing focused on the original request when information retrieval fails. This skill guides agents to use existing knowledge, disclose missing information, create a structured document with write_file, and verify that the file exists.

中文简介正在准备中。当前显示英语简介。

原文查看原文说明

Generate documents with write_file when retrieval tools fail, with explicit guardrails against task context drift

查看安装方法

适用场景

  • Drafting a report when web search fails
  • Continuing document work after repeated tool errors
  • Documenting gaps in available source information
  • Checking that a fallback report meets the original goal

包含的文件(2)

  • SKILL.md10.8 KB
  • .skill_id56 B

SKILL.md(原文)

安装前可以查看交给 AI 代理的指令内容。

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:

  1. 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.
    
  2. Declare the pivot explicitly:

    Pivoting to write_file-based document generation with embedded knowledge.
    Task remains: [CONTEXT_ANCHOR]
    
  3. 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 embedded domain knowledge
- **Data Limitations**: [Brief note on what was unavailable]

Step 4: Execute and Verify

# Execution pattern
write_file(
    path="[output_path].md",  # or .txt, .html based on task
    content=professionally_structured_markdown
)

# Verification
list_dir(path=".")  # Confirm file creation
# Optional: read_file to verify content quality

Step 5: Context Integrity Check

Before declaring task complete, verify:

CONTEXT_CHECKLIST = [
    "✓ Output addresses ORIGINAL task goal",
    "✓ No unrelated task content included",
    "✓ Document is professionally structured",
    "✓ Limitations are transparent but not over-emphasized",
    "✓ Actionable guidance is provided",
    "✓ File was successfully created"
]

If any check fails, revise before completing the task.

Code Example: Full Pattern

def context_anchored_fallback(original_task, failed_tools):
    """
    Generate document when tools fail, maintaining task context.
    """
    # Step 0: Anchor context
    context_anchor = original_task
    print(f"CONTEXT ANCHOR: {context_anchor}")
    
    # Step 1: Declare pivot
    limitation_note = """
    Note: External data retrieval tools experienced failures.
    This document is generated using established domain knowledge.
    """
    
    # Step 2-3: Generate structured content
    document = f"""# {original_task} - Report

## Executive Summary
{limitation_note.strip()}
This report provides guidance based on established domain knowledge.

## Core Guidance
### Key Framework
[Structured content with headers, bullets, tables]

### Process Overview
1. Step one
2. Step two
3. Step three

## Data Source Notes
> Specific data from [expected sources] was unavailable.
> Recommendations reflect established best practices.

## Action Items
1. [Actionable step 1]
2. [Actionable step 2]

## Task Status
- **Goal**: {context_anchor}
- **Status**: Completed via fallback generation
- **Limitations**: Data sources unavailable, content based on domain knowledge
"""
    
    # Step 4: Execute
    output_path = "generated_report.md"
    write_file(path=output_path, content=document)
    
    # Step 5: Verify
    files = list_dir(path=".")
    assert output_path in [f['name'] for f in files]
    
    return f"Task completed: {context_anchor}"

Guardrails Against Context Drift

RED FLAGS (Stop immediately if you notice these)

Red FlagCorrective Action
Thinking about a different task than the originalSTOP. Re-read CONTEXT_ANCHOR.
More than 3 tool retry attemptsSTOP. Trigger fallback immediately.
Considering "maybe this task isn't possible"STOP. Generate with available knowledge.
Output doesn't match original task goalSTOP. Regenerate aligned with CONTEXT_ANCHOR.
Spending >5 iterations on tool troubleshootingSTOP. Pivot to write_file approach.

GREEN FLAGS (You're on track)

  • Every output references the original task goal
  • Tool failures trigger fallback within 2 attempts
  • Document is generated even with data limitations
  • Final output clearly serves the original user request
  • No unrelated task content appears in output

Best Practices

DoDon't
Write CONTEXT_ANCHOR before any fallback actionStart generating without anchoring to original task
Trigger fallback after 2 tool failuresRetry failing tools 5+ times
Generate complete document with available knowledgeLeave task incomplete due to missing data
Mark unverifiable specifics clearlyPresent猜测 as verified facts
Verify output matches original taskAssume task is complete without checking
Use professional document structureOutput unstructured text

Common Pitfalls & Solutions

PitfallSolution
Context drift after tool failuresWrite CONTEXT_ANCHOR visibly before generating; check every output against it
Over-apologizing for limitationsState limitation once, then deliver value
Under-delivering (no output)A structured partial report beats no report
Misrepresenting certaintyUse hedging: "typically", "generally", "established practice"
Skipping verificationAlways run list_dir to confirm file creation

Success Criteria

Task is successfully completed when ALL are true:

  • Document generated despite tool failures
  • Output addresses ORIGINAL task goal (CONTEXT_ANCHOR)
  • No unrelated task content in output
  • Professional structure (headers, sections, lists, tables)
  • Limitations transparently noted (not over-emphasized)
  • Actionable guidance provided
  • File successfully created and verified
  • Fallback triggered within 2-3 tool failures (not after excessive retries)

Quick Reference Card

┌─────────────────────────────────────────────────────────┐
│  CONTEXT-ANCHORED FALLBACK - QUICK TRIGGER              │
├─────────────────────────────────────────────────────────┤
│  IF 2+ retrieval tools fail                             │
│  THEN:                                                  │
│    1. Write CONTEXT_ANCHOR = [original task]            │
│    2. Stop retrying failed tools                        │
│    3. Generate document with write_file                 │
│    4. Use embedded domain knowledge                     │
│    5. Verify output matches CONTEXT_ANCHOR              │
│    6. Confirm file created with list_dir                │
│                                                         │
│  NEVER:                                                 │
│    - Switch to unrelated task                           │
│    - Retry >3 times without pivoting                    │
│    - Abandon original task goal                         │
└─────────────────────────────────────────────────────────┘

评价

还没有评价。欢迎分享你的使用感受。

评论

无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。

还没有评论。来写第一条吧。

提交后会立即公开。请勿填写邮箱、电话等个人信息。URL 最多 2 个。

0 / 1000 字

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

同一仓库的技能

Prepare audio stems, the separate parts of a track, for mixing by matching their durations with silence, loops, or crossfades. Verify each generated and processed file before moving to the next production step.

中文简介正在准备中。当前显示英语简介。

  • Match audio parts with different durations
  • Extend drums and melodic parts using suitable methods
  • Check audio specifications before mixing
HKUDS/OpenSpace77572026年8月13日 更新

Produce audio in separate stems, meaning individual instrument tracks, and verify each output as you go. Align track lengths with silence, loops, or crossfades, then apply effects, mix a master, and package the files.

中文简介正在准备中。当前显示英语简介。

  • Align instrument tracks to a reference audio file
  • Choose how to extend tracks that are too short
  • Verify audio properties after generation and effects
HKUDS/OpenSpace77572026年8月13日 更新

Build serverless endpoints that relay external API requests for a dashboard while keeping API keys on the server. Includes Vercel examples for input checks, caching, cross-origin access, and consistent JSON responses.

中文简介正在准备中。当前显示英语简介。

  • Connect a dashboard to external APIs without exposing API keys
  • Create endpoints for stock quotes and news
  • Standardize API responses and error handling
HKUDS/OpenSpace77572026年8月13日 更新

Produce a master track and separate audio parts through a structured Python workflow. Apply filters and reverb, export WAV files with consistent settings, package them in a ZIP archive, and check that the deliverables meet the requested specifications.

中文简介正在准备中。当前显示英语简介。

  • Export a master track with separate audio parts
  • Apply filters and reverb to audio
  • Check duration and format across deliverables
HKUDS/OpenSpace77572026年8月13日 更新

Keep document creation moving when web searches and page retrieval repeatedly fail. The skill preserves the original task, uses the model’s existing knowledge, and clearly identifies information that could not be checked against external sources.

中文简介正在准备中。当前显示英语简介。

  • Continue drafting after repeated web retrieval failures
  • Preserve task requirements during network errors
  • Mark information that could not be externally verified
HKUDS/OpenSpace77572026年8月13日 更新

When Python execution repeatedly fails in execute_code_sandbox, use a file-based alternative: save the script, run it through the shell, and capture results or errors. The guidance covers paths, imports, timeouts, structured output, and optional cleanup.

中文简介正在准备中。当前显示英语简介。

  • Retry Python work through the shell after repeated sandbox failures
  • Run longer tasks with an adjusted timeout
  • Execute Python work that needs multiple files or system utilities
HKUDS/OpenSpace77572026年8月13日 更新

查看 HKUDS 的全部技能

报告此技能的问题