Agent skill

Context Anchored Fallback Report

by HKUDS in HKUDS/OpenSpace

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

MITAuto-check passedAI & LLM Engineering

Install Context Anchored Fallback Report

skills CLI
$ npx skills add HKUDS/OpenSpace --skill context-anchored-fallback-report -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install HKUDS/OpenSpace context-anchored-fallback-report --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/HKUDS/OpenSpace.git skills-src && mkdir -p .claude/skills && cp -r skills-src/benchmarks/gdpval/skills/write-file-fallback-report-enhanced-4bc5c2 .claude/skills/context-anchored-fallback-report && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
context-anchored-fallback-report
GitHub stars
7.8k
Token cost
~2.6k tokens
SKILL.md length
490 words
Files
2
Skills in repo
199
Repo updated
First seen
Licence
MIT

At a glance

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

  • Works in 6 steps: Context Anchor (BEFORE pivoting) → Detect and Declare Failure Pattern → Pre-Compute Available Knowledge → …
  • Tasks that involve LLM guardrails
  • SKILL.md covers Critical Warning: Context…, When to Use This Skill, Step-by-Step Instructions and Code Example: Full Pattern, plus 5 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Context Anchored Fallback Report is an agent skill from HKUDS/OpenSpace. Generate documents with writefile when retrieval tools fail, with explicit guardrails against task context drift

Its SKILL.md is about 2.6k tokens, which your agent loads only when the skill is triggered. The skill folder holds 1 other file.

It sits in AI & LLM Engineering, covering LLM guardrails. The repository describes itself as: "OpenSpace: The Skill Management Layer for AI Agents" -- https://open-space.cloud/. The licence is MIT.

When your agent uses it

  • Tasks that involve LLM guardrails

Example prompts

  • “/context-anchored-fallback-report”

Requirements

  • Python 3

Workflow steps

6 steps, taken from the step headings in SKILL.md.

  1. Context Anchor (BEFORE pivoting)
  2. Detect and Declare Failure Pattern
  3. Pre-Compute Available Knowledge
  4. Generate Document with write_file
  5. Execute and Verify
  6. Context Integrity Check

What it can do on your machine

Read from SKILL.md and the folder at commit 3827781. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are python and markdown).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Context Anchored Fallback Report loads about 2.6k tokens when it runs. Until then it costs about 37 tokens; SKILL.md has 490 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~37
When it runs · the whole SKILL.md, loaded when a task matches
~2.6k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from HKUDS/OpenSpace at commit 3827781, republished under its MIT licence (© HKUDS). 490 words, ~2,635 tokens.

Download SKILL.mdSave it as .claude/skills/context-anchored-fallback-report/SKILL.md (or your agent's skills folder). This skill also uses 1 other file; get the full folder from GitHub.
name
context-anchored-fallback-report
description
Generate documents with write_file when retrieval tools fail, with explicit guardrails against task context drift

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
python
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:

python
# 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:

markdown
# [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
python
# 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

python
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.
Show full SKILL.md (223 more words)Show less
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                         │
└─────────────────────────────────────────────────────────┘

© HKUDS, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 1 other file in benchmarks/gdpval/skills/write-file-fallback-report-enhanced-4bc5c2 of HKUDS/OpenSpace.

  • SKILL.md
  • .skill_id

Open the folder on GitHubat commit 3827781

Compare with similar skills

Context Anchored Fallback Report next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Context Anchored Fallback Report compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Context Anchored Fallback Report this skillHKUDS/OpenSpace7.8k—~2.6kAutomated safety check: PassMIT
Aisafetyhotwuyoscar/AISafetyHot-Hub641—~1.4kAutomated safety check: PassCustom licence
ObliteratusRedWoodOG/Hermes-Desktop1775 repos~3.8kAutomated safety check: PassMIT
Lemonade Router Builderamd/skills406—~4kAutomated safety check: PassMIT
Execution Guardrailsmrtooher/fable-mode872—~1kAutomated safety check: PassNone
Writing Eval Scenariosopen-bias/open-bias143—~1.5kAutomated safety check: PassApache-2.0

Similar skills

  • Aisafetyhot

    wuyoscar/AISafetyHot-Hub

    Query AI Safety HOT news, research papers, incidents, hot topics, and daily/weekly/monthly reports through its public read-only MCP service.

    641 GitHub stars~1.4k tokensUpdated today
    AI & LLM EngineeringAuto-check passed
  • Obliteratus

    RedWoodOG/Hermes-Desktop

    Remove refusal behaviors from open-weight LLMs using OBLITERATUS — mechanistic interpretability techniques (diff-in-means, SVD, whitened SVD, LEACE, SAE decomposition, etc.) to excise guardrails…

    177 GitHub starsUsed in 5 repos~3.8k tokens
    AI & LLM EngineeringAuto-check passed
  • Turns a natural-language description of routing intent into a valid Lemonade collection.router policy JSON.

    406 GitHub stars~4k tokensUpdated today
    AI & LLM EngineeringAuto-check passed
  • Execution Guardrails

    mrtooher/fable-mode

    Always-on operational guardrails, model-independent. An agent skill from mrtooher/fable-mode.

    872 GitHub stars~1k tokensUpdated 1 mo ago
    AI & LLM EngineeringAuto-check passed
  • Writing Eval Scenarios

    open-bias/open-bias

    Guide for writing eval conversation JSONs and running them through policy engines

    143 GitHub stars~1.5k tokensUpdated 2 days ago
    AI & LLM EngineeringAuto-check passed
  • Wp Project Triage

    gambitph/Stackable

    A skill your agent uses when you need a deterministic inspection of a WordPress repository (plugin/theme/block theme/WP core/Gutenberg/full site) including tooling/tests/version hints, and a…

    351 GitHub starsUsed in 3 repos~371 tokens
    AI & LLM EngineeringAuto-check passed

More from HKUDS/OpenSpace

All 199 skills in this repo
  • Walks through producing a master audio track plus stems in Python, from checking a reference file and timing sections by BPM to effects, a zip archive and final verification.

    7.8k GitHub stars~2.9k tokensUpdated 1 mo ago
    Auto-check passed
  • Handle cascading data retrieval tool failures by falling back to embedded knowledge generation

    7.8k GitHub stars~765 tokensUpdated 1 mo ago
    Auto-check passed
  • Gives an agent a workaround when its code-execution sandbox keeps failing: save the Python script to a file and run it through the shell instead.

    7.8k GitHub stars~588 tokensUpdated 1 mo ago
    Auto-check passed
  • A recovery routine for agents whose sandboxed code runner keeps failing: save the Python script to disk, then run it through the shell and read the output.

    7.8k GitHub stars~652 tokensUpdated 1 mo ago
    Auto-check passed
  • Fallback ladder for failed sandboxed code runs, plus the habit of fixing the working directory first so generated files land in the right place.

    7.8k GitHub stars~1.1k tokensUpdated 1 mo ago
    Auto-check passed
  • Fallback workflow for executing Python code when executecodesandbox fails repeatedly

    7.8k GitHub stars~1.1k tokensUpdated 1 mo ago
    Auto-check passed

Questions about Context Anchored Fallback Report

What does Context Anchored Fallback Report do?

Generate documents with writefile when retrieval tools fail, with explicit guardrails against task context drift. Context Anchored Fallback Report is an agent skill from HKUDS/OpenSpace.

When should I use Context Anchored Fallback Report?

Context Anchored Fallback Report fits situations like: tasks that involve LLM guardrails.

How do I install Context Anchored Fallback Report in Claude Code?

Run `npx skills add HKUDS/OpenSpace --skill context-anchored-fallback-report -a claude-code`. Or copy the skill folder (benchmarks/gdpval/skills/write-file-fallback-report-enhanced-4bc5c2 in HKUDS/OpenSpace) into .claude/skills/context-anchored-fallback-report in your project. Claude Code loads it when a task matches its description.

How do I install Context Anchored Fallback Report in Codex?

Run `npx skills add HKUDS/OpenSpace --skill context-anchored-fallback-report -a codex`. Or copy the skill folder (benchmarks/gdpval/skills/write-file-fallback-report-enhanced-4bc5c2 in HKUDS/OpenSpace) into .agents/skills/context-anchored-fallback-report in your project. Codex loads it when a task matches its description.

Can I use Context Anchored Fallback Report in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add HKUDS/OpenSpace --skill context-anchored-fallback-report -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/context-anchored-fallback-report, .gemini/skills/context-anchored-fallback-report, .github/skills/context-anchored-fallback-report and .opencode/skills/context-anchored-fallback-report in your project.

What does Context Anchored Fallback Report need to run?

SKILL.md names no scripts, command-line tools or credentials: Context Anchored Fallback Report is instructions for the agent only. Our summary lists: Python 3.

Does Context Anchored Fallback Report access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Context Anchored Fallback Report safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Context Anchored Fallback Report use?

Context Anchored Fallback Report is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Context Anchored Fallback Report use?

About 2.6k tokens (SKILL.md is roughly 11k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Context Anchored Fallback Report?

Skills that share tags, products or a category with Context Anchored Fallback Report: Aisafetyhot (wuyoscar/AISafetyHot-Hub, 641 stars), Obliteratus (RedWoodOG/Hermes-Desktop, 177 stars), Lemonade Router Builder (amd/skills, 406 stars) and Execution Guardrails (mrtooher/fable-mode, 872 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Context Anchored Fallback Report?

HKUDS (a GitHub organization) maintains it in HKUDS/OpenSpace, which has 7,750 GitHub stars. The repository holds 199 skills in this directory. The repository was last updated on August 12, 2026.

Source: HKUDS/OpenSpace on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.