Chuyển đến nội dung
Skillpedia
Agent7.8k · #12951

resilient-context-extraction

Skill này làm gì

Skill này yêu cầu AI agent đọc mọi file bạn đính kèm và xem chúng là nguồn sự thật chính. Nó dành cho những người đưa cho AI các file tham khảo để làm việc.

Khi nào nên dùng

  • ✓Khi bạn đính kèm một bảng tính, file PDF hoặc file dữ liệu và nhờ AI xây dựng gì đó từ đó.
  • ✓Khi câu trả lời của AI dường như bỏ qua file bạn đã cung cấp.
  • ✓Khi đọc một file có vẻ chưa đầy đủ và bạn muốn AI thử các cách khác để mở nó.

Liên kết skill

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

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/prioritize-context-data-enhanced/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Dùng các con số trong file bán hàng đính kèm cho báo cáo của tôi, và đừng tìm trên web để lấy chúng.”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Agent liệt kê mọi file bạn đã cung cấp, kiểm tra file nào khớp với nhiệm vụ rồi đọc chúng trước khi tìm ở nơi khác. Nếu việc đọc có vẻ chưa đầy đủ, agent sẽ thử một phương pháp khác.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

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

Câu hỏi thường gặp

Agent có còn tìm trên web nếu thiếu một dữ kiện trong file của tôi không?

Skill yêu cầu agent xác nhận file thực sự thiếu dữ kiện đó trước. Chỉ khi ấy nó mới nên tìm ở nơi khác.

Skill này bao gồm những loại file nào?

Skill nêu các loại file cần kiểm tra gồm bảng tính, PDF, file Word, CSV, JSON và file văn bản.

Nếu agent vẫn bỏ qua file của tôi thì sao?

Hãy yêu cầu nó liệt kê các file nó nhìn thấy và đọc file bạn cần trước khi tiếp tục.

Chi tiết

Mô tả gốc của tác giả

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

repo: HKUDS/AgentPilot

Độ phổ biến

Sao GitHub
7.8k
Vị trí xếp hạng
#12951
Giấy phép
MIT
Cập nhật
1/11/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự