Agent skill

Search Fail Pivot

by HKUDS in HKUDS/OpenSpace

Heuristic for detecting search tool failures and pivoting to domain knowledge for document generation

MITAuto-check passedLegal & Compliance

Install Search Fail Pivot

skills CLI
$ npx skills add HKUDS/OpenSpace --skill search-fail-pivot -a claude-code

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

GitHub CLI
$ gh skill install HKUDS/OpenSpace search-fail-pivot --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/search-fail-pivot .claude/skills/search-fail-pivot && 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
search-fail-pivot
GitHub stars
7.8k
Token cost
~1.1k tokens
SKILL.md length
378 words
Files
2
Skills in repo
199
Repo updated
First seen
Licence
MIT

At a glance

Heuristic for detecting search tool failures and pivoting to domain knowledge for document generation

  • Works in 4 steps: Track Search Failures → Apply the 2-Failure Rule → Pivot to Domain Knowledge → …
  • Legal & Compliance work in your project
  • SKILL.md covers Purpose, Core Heuristic, Step-by-Step Instructions and When This Applies, plus 4 more sections
  • Calls python

What it does

Search Fail Pivot is an agent skill from HKUDS/OpenSpace. Heuristic for detecting search tool failures and pivoting to domain knowledge for document generation

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

It sits in Legal & Compliance. 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

  • Legal & Compliance work in your project

Example prompts

  • “/search-fail-pivot”

Requirements

  • Python 3

Workflow steps

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

  1. Track Search Failures
  2. Apply the 2-Failure Rule
  3. Pivot to Domain Knowledge
  4. Document Generation Pattern

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

    Shell commands in SKILL.md call:

    • python

    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

Search Fail Pivot loads about 1.1k tokens when it runs. Until then it costs about 30 tokens; SKILL.md has 378 words of instructions outside code blocks.

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

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). 378 words, ~1,137 tokens.

Download SKILL.mdSave it as .claude/skills/search-fail-pivot/SKILL.md (or your agent's skills folder). This skill also uses 1 other file; get the full folder from GitHub.
name
search-fail-pivot
description
Heuristic for detecting search tool failures and pivoting to domain knowledge for document generation

Search Tool Failure Detection and Pivot Strategy

Purpose

When using search_web or similar external data retrieval tools, repeated failures waste iterations. This skill provides a diagnostic heuristic to recognize when to abandon search attempts and proceed with existing domain knowledge.

Core Heuristic

If search_web fails 2+ consecutive times with 'unknown error' or similar non-recoverable errors, pivot to domain knowledge + run_shell for document generation.

Do not attempt more than 2 retries on the same or similar queries before pivoting.

Step-by-Step Instructions

Step 1: Track Search Failures

Monitor search_web outcomes during your task:

  • Count consecutive failures (empty results, 'unknown error', timeout, access denied)
  • Note the error type - distinguish between:
    • Recoverable: Rate limiting, temporary timeout (retry 1-2 times)
    • Non-recoverable: 'unknown error', persistent empty results, access denied
Step 2: Apply the 2-Failure Rule
IF search_web failures >= 2 (same or similar queries)
THEN:
  1. Stop attempting search_web
  2. Document what information you attempted to retrieve
  3. Proceed with existing domain knowledge
Step 3: Pivot to Domain Knowledge

When pivoting:

  1. Acknowledge the limitation: Note that external verification was attempted but unavailable
  2. Use established knowledge: Draw on training data for well-known facts, laws, cases, standards
  3. Generate with run_shell: Create documents using Python/bash scripts rather than waiting for external data

Example pivot workflow:

python
# Instead of continuing search_web attempts:
# 1. Compile known information from domain knowledge
known_facts = {
    "law": "COPPA requirements for children's data",
    "precedent": "FTC v. Google/YouTube settlement patterns",
    "jurisdiction": "California privacy law framework"
}

# 2. Generate document directly
# Use run_shell with Python to create PDF/DOC
Step 4: Document Generation Pattern

When generating documents after pivoting:

bash
# Use run_shell to execute document generation
# Example: Create legal memo with Python + reportlab
python << 'EOF'
from reportlab.lib.pagesizes import letter
from reportlab.pdfgen import canvas

# Generate document with domain knowledge
c = canvas.Canvas("memo.pdf", pagesize=letter)
c.drawString(100, 750, "Legal Analysis based on established precedents")
# ... continue with known information
c.save()
EOF

When This Applies

This heuristic is particularly useful for:

Task TypeWhy It Applies
Legal researchCase law and statutes are well-documented in training
Technical documentationStandards and best practices are established knowledge
Historical analysisPast events and data are in training corpus
Regulatory complianceMajor regulations (GDPR, COPPA, HIPAA) are well-known
Show full SKILL.md (135 more words)Show less

When NOT to Pivot

Do NOT apply this heuristic when:

  • You need current/time-sensitive data (stock prices, weather, news < 24hrs)
  • The task explicitly requires external verification
  • You have not yet attempted the search (first attempt should complete)
  • Errors are clearly recoverable (rate limit with retry-after header)

Example Decision Flow

Attempt search_web → Success? → Yes → Use results
                         ↓
                        No
                         ↓
            Is this failure #1? → Yes → Retry once with modified query
                         ↓
                        No (failure #2+)
                         ↓
            Pivot to domain knowledge + run_shell document generation

Benefits

  • Saves iterations: Avoids wasting 3-4 attempts on unavailable data
  • Maintains progress: Task continues instead of stalling on search
  • Leverages training: Uses the substantial knowledge already available
  • Clear handoff: Explicitly documents the pivot decision for transparency

Anti-Patterns to Avoid

❌ Continuing search_web attempts beyond 2 failures
❌ Not documenting why you pivoted from search
❌ Applying this to tasks requiring real-time data
❌ Abandoning search on first failure without retry

✅ Apply 2-failure rule consistently
✅ Document the pivot decision in your output
✅ Use run_shell efficiently after pivoting
✅ Distinguish recoverable vs non-recoverable errors

© 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/search-fail-pivot of HKUDS/OpenSpace.

  • SKILL.md
  • .skill_id

Open the folder on GitHubat commit 3827781

Compare with similar skills

Search Fail Pivot 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.

Search Fail Pivot compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Search Fail Pivot this skillHKUDS/OpenSpace7.8k—~1.1kAutomated safety check: PassMIT
Paper to Chinese Patent DrafterYuan1z0825/nature-skills47k1 repos~1.1kAutomated safety check: PassApache-2.0
C15tc15t/c15t1.9k1 repos~1.6kAutomated safety check: PassApache-2.0
Contract Reviewevolsb/claude-legal-skill4641 repos~3.6kAutomated safety check: PassMIT
Legal Clinic Client Intakeanthropics/claude-for-legal9.6k3 repos~3.2kAutomated safety check: PassApache-2.0
Paper To Cn Patentsnipp-zha/Paper-to-patent-Skill1061 repos~959Automated safety check: PassNone

Similar skills

  • Paper to Chinese Patent Drafter

    Yuan1z0825/nature-skills

    Drafts Chinese invention patent applications and technical disclosures from research papers or inventor materials, tying each claim feature to source evidence.

    47k GitHub starsUsed in 1 repo~1.1k tokens
    Legal & ComplianceAuto-check passed
  • C15t

    c15t/c15t

    Work with c15t consent management docs, APIs, and integrations for Next.js, React, and JavaScript.

    1.9k GitHub starsUsed in 1 repo~1.6k tokens
    Legal & ComplianceAuto-check passed
  • Contract Review

    evolsb/claude-legal-skill

    Review legal contracts, NDAs, employment agreements, SaaS terms, and M&A documents.

    464 GitHub starsUsed in 1 repo~3.6k tokens
    Legal & ComplianceAuto-check passed
  • Legal Clinic Client Intake

    anthropics/claude-for-legal

    Official

    Structures a legal clinic client intake interview and produces a case summary with cross-area issue spotting, conflict flags and triage classification.

    9.6k GitHub starsUsed in 3 repos~3.2k tokens
    Legal & ComplianceAuto-check passed
  • Paper To Cn Patent

    snipp-zha/Paper-to-patent-Skill

    Convert scientific papers, theses, technical reports, source code, figures, or research manuscripts into evidence-grounded Chinese invention patent drafts.

    106 GitHub starsUsed in 1 repo~959 tokens
    Legal & ComplianceAuto-check passed
  • Employment Contract Templates

    ynulihao/AgentSkillOS

    Create employment contracts, offer letters, and HR policy documents following legal best practices.

    617 GitHub starsUsed in 12 repos~4.1k tokens
    Legal & ComplianceAuto-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 Search Fail Pivot

What does Search Fail Pivot do?

Heuristic for detecting search tool failures and pivoting to domain knowledge for document generation. Search Fail Pivot is an agent skill from HKUDS/OpenSpace.

When should I use Search Fail Pivot?

Search Fail Pivot fits situations like: legal & Compliance work in your project.

How do I install Search Fail Pivot in Claude Code?

Run `npx skills add HKUDS/OpenSpace --skill search-fail-pivot -a claude-code`. Or copy the skill folder (benchmarks/gdpval/skills/search-fail-pivot in HKUDS/OpenSpace) into .claude/skills/search-fail-pivot in your project. Claude Code loads it when a task matches its description.

How do I install Search Fail Pivot in Codex?

Run `npx skills add HKUDS/OpenSpace --skill search-fail-pivot -a codex`. Or copy the skill folder (benchmarks/gdpval/skills/search-fail-pivot in HKUDS/OpenSpace) into .agents/skills/search-fail-pivot in your project. Codex loads it when a task matches its description.

Can I use Search Fail Pivot 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 search-fail-pivot -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/search-fail-pivot, .gemini/skills/search-fail-pivot, .github/skills/search-fail-pivot and .opencode/skills/search-fail-pivot in your project.

What does Search Fail Pivot need to run?

Going by SKILL.md and its folder, Search Fail Pivot needs the command-line tools its instructions call (python). Our summary lists: Python 3.

Does Search Fail Pivot 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 Search Fail Pivot 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 Search Fail Pivot use?

Search Fail Pivot 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 Search Fail Pivot use?

About 1.1k tokens (SKILL.md is roughly 4.5k 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 Search Fail Pivot?

Skills that share tags, products or a category with Search Fail Pivot: Paper to Chinese Patent Drafter (Yuan1z0825/nature-skills, 47k stars), C15t (c15t/c15t, 1.9k stars), Contract Review (evolsb/claude-legal-skill, 464 stars) and Legal Clinic Client Intake (anthropics/claude-for-legal, 9.6k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Search Fail Pivot?

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.