본문으로 건너뛰기
Skillpedia
에이전트7.8k · #12951

resilient-context-extraction

하는 일

이 스킬은 AI 에이전트가 첨부한 파일을 읽고 이를 주요 사실의 출처로 삼도록 안내합니다. 참고 파일을 AI에게 주고 작업을 시키는 사람에게 맞습니다.

사용하는 경우

  • ✓스프레드시트, PDF 또는 데이터 파일을 첨부하고 그 내용으로 무엇인가를 만들라고 할 때.
  • ✓AI의 답변이 제가 준 파일을 무시하는 것처럼 보일 때.
  • ✓파일 읽기가 불완전해 보여서 다른 방법으로 열어 보게 하고 싶은 경우.

스킬 링크

https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/prioritize-context-data-enhanced/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/prioritize-context-data-enhanced/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“첨부한 판매 파일의 숫자를 보고서에 사용해 주세요. 그 숫자는 웹에서 검색하지 마세요.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

에이전트는 제공된 모든 파일을 나열하고, 작업에 맞는 파일을 고른 뒤, 다른 곳을 찾기 전에 그 파일을 읽습니다. 읽기가 불완전해 보이면 다른 방법을 씁니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

Resilient Context Extraction

Objective

Prevent data hallucination and inefficiency by mandating that agents inspect, validate, and fully extract data from provided reference files before attempting web searches or generating synthetic data. When extraction is incomplete, use fallback strategies before making assumptions.

Critical Rule

If a reference file is provided in the task context, it is the source of truth. Do not fabricate data or search the web for information that may exist within the provided attachments. If extraction appears incomplete, attempt alternative methods before proceeding.

Workflow Steps

1. Scan Context for Attachments

At the start of every task, explicitly list all files provided in the context window or attachment panel.

  • Check for spreadsheets (.xlsx, .csv), documents (.pdf, .docx, .pptx), or data dumps (.json, .txt, .xml, .yaml).
  • Note the filename, file size (if available), and inferred content type.
  • Record this list for later verification.

2. Evaluate Relevance

Determine if any provided file contains the data required to complete the task.

  • Match Keywords: Do filenames or expected column headers match task requirements?
  • Check Scope: Does the data cover the necessary timeframe or region?
  • Prioritize: Rank files by likelihood of containing required data.

3. Extract Data with Validation

If relevant files are found:

  • Read the file content using appropriate tools (e.g., read_file, pandas, pdf_reader).
  • Validate Extraction Completeness (NEW CRITICAL STEP):
    • Check if output appears truncated (e.g., sudden cutoff mid-sentence, character limits hit).
    • Compare expected data points vs. extracted data points (e.g., "Task mentions pricing tiers; did extraction include pricing numbers?").
    • Look for structural indicators of incompleteness (e.g., unclosed tables, missing document endings).
  • If extraction is incomplete or suspicious, proceed to Step 4 (Fallback Strategies) before using the data.

4. Apply Fallback Extraction Strategies

When initial extraction is incomplete or critical data is missing, attempt these strategies in order before making assumptions:

4a. Alternative Library/Tool Approach

  • For .docx: Try python-docx directly via execute_code_sandbox if read_file was truncated.
  • For .xlsx/.csv: Try pandas with explicit sheet selection or openpyxl directly.
  • For .pdf: Try pdfplumber, PyPDF2, or shell-based pdftotext if available.
  • For any format: Try reading as raw bytes/text via shell commands (cat, xxd, strings).

4b. Shell-Based Extraction

  • Use shell_agent or run_shell for format-specific tools:
    • unzip -p file.docx word/document.xml | xmllint --format - (extract raw docx XML)
    • in2csv file.xlsx (convert Excel to CSV via shell)
    • pdftotext file.pdf - (extract PDF text via command line)
  • This bypasses potential sandbox or library limitations in read_file.

4c. Targeted Re-Reading

  • If specific sections are missing (e.g., "pricing table on page 3"), attempt to re-read with focus on that region.
  • Use tools that support page/section ranges if available.

4d. Document What's Missing

  • Before any assumptions or external searches, explicitly document:
    • What data was expected but not found.
    • What extraction methods were attempted.
    • Why each method failed or what portions remain unavailable.
  • Example: "Attempted read_file on Pricing_email.docx (truncated at 980 chars). Attempted python-docx extraction via sandbox—pricing table in section 2 not present in file. Pricing numbers unavailable from provided context."

5. Cite Source Explicitly

When presenting data in the final output:

  • Explicitly state which file the data came from.
  • Example: "According to Massabama_active_listings.xlsx..."
  • If fallback methods were used, note this: "Extracted via shell-based pdftotext from report.pdf..."
  • This verifies to the user that real data was used, not hallucinated.

6. Fallback to Search (Last Resort Only)

If all extraction strategies fail to provide the specific data needed:

  • State clearly what was missing from the files.
  • Document all extraction methods attempted and why they failed.
  • Then proceed with web search or estimation.
  • Mark any non-file data clearly as "External Search" or "Estimated (file data unavailable)".
  • Never present estimated data as if it came from the file.

Che

자주 묻는 질문

에이전트가 파일에 사실이 없어도 웹을 검색하나요?

스킬은 에이전트가 먼저 파일에 정말 그 정보가 없는지 확인하라고 요구합니다. 그 뒤에야 다른 곳을 찾아야 합니다.

이 스킬은 어떤 파일 형식을 다루나요?

스프레드시트, PDF, Word 파일, CSV, JSON, 텍스트 파일을 확인할 파일로 언급합니다.

에이전트가 여전히 제 파일을 무시하면 어떻게 하나요?

에이전트에게 볼 수 있는 파일 목록을 말하게 하고, 필요한 파일을 먼저 읽도록 요청합니다.

상세 정보

작성자의 원본 설명

Ensures agents extract data from context files with validation and fallback strategies before resorting to assumptions or external searches.

repo: HKUDS/AgentPilot

인기도

GitHub 스타
7.8k
순위
#12951
라이선스
MIT
업데이트
2026. 11. 1.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬