Heavy File Ingestion
Problem
Agents waste money and context when they read heavyweight files raw. This skill turns bulky documents into cheaper working artifacts first, then tells the main agent how much reasoning power the file actually deserves.
Trigger Conditions
- The user asks to read or analyze a PDF, slide deck, spreadsheet, or word-processing file
- The file is large, structured, or expensive enough that raw ingestion is a bad trade
- The user wants a markdown working copy, CSV extraction, or a quick map of the file before analysis
- The agent needs a deterministic first pass before choosing whether a model fallback is worth the cost
Core Policy
- Convert before reading. Do not dump raw heavyweight files into model context if a deterministic converter can create a cheaper artifact.
- Index before reasoning. Read the generated
index.md or index.json first. It should tell you what is in the file, how clean the extraction was, and whether escalation is justified.
- Match the converter to the file type.
- PDFs and documents: markdown artifact
- Presentations: markdown slide outline
- Spreadsheets: CSV per sheet plus a markdown manifest
- Escalate by cost tier, not instinct.
- Tier 1: deterministic converter plus index
- Tier 2: cheap model on the extracted artifact only if quality flags say the deterministic pass lost structure
- Tier 3: expensive model only after the file has already been compressed into markdown, CSV, or a sampled subset
Process
- Identify the file path, extension, and rough size.
- Run the converter script instead of reading the original file directly:
uv run \
--with pdfplumber \
--with python-docx \
--with python-pptx \
--with openpyxl \
python skills/heavy-file-ingestion/scripts/convert_heavy_file.py /absolute/path/to/file.ext
- If you already have
markitdown installed and want to prefer it for PDF or DOCX conversion, rerun with:
python skills/heavy-file-ingestion/scripts/convert_heavy_file.py /absolute/path/to/file.ext --prefer markitdown
- Read the generated
index.md first.
- Only read the extracted markdown or CSV outputs that the index says are worth reading.
- If the index flags weak extraction, use a cheap fallback:
- Try an alternate deterministic converter
- Use a small model to rebuild only the structure or outline from the extracted artifact
- Escalate to a stronger model only when the cheaper passes still leave critical ambiguity
Output
The skill should leave behind:
- A deterministic artifact the agent can work from
index.md with file counts, structure hints, preview lines, and a recommended next step
index.json with the same information in machine-friendly form
- Warnings when the deterministic pass is not trustworthy enough for direct reasoning
Notes
- Prefer the bundled script over rewriting ad hoc conversion code each time.
- Do not treat "sub-agent" as the default answer to messy files. A cheap deterministic pass beats a cheap model when the task is conversion, counting, routing, or indexing.
- For scanned PDFs, image-heavy decks, or bizarre layouts, the deterministic pass is still useful because it tells you that a fallback is needed before you waste a stronger model on the original file.
- Use
references/open-source-stack.md when you need to choose a better extractor or explain why one was picked.
1---2name: heavy-file-ingestion3description: Use when a user asks to read, analyze, summarize, or extract from a heavyweight file such as PDF, DOCX, PPTX, XLSX, CSV, or TSV. Convert the file into markdown or CSV first, generate a lightweight index, and only spend model tokens on the compressed artifact. Trigger on requests like "read this PDF", "look through this spreadsheet", "summarize this deck", or any time raw file ingestion would waste tokens.4---56# Heavy File Ingestion78## Problem910Agents waste money and context when they read heavyweight files raw. This skill turns bulky documents into cheaper working artifacts first, then tells the main agent how much reasoning power the file actually deserves.1112## Trigger Conditions1314- The user asks to read or analyze a PDF, slide deck, spreadsheet, or word-processing file15- The file is large, structured, or expensive enough that raw ingestion is a bad trade16- The user wants a markdown working copy, CSV extraction, or a quick map of the file before analysis17- The agent needs a deterministic first pass before choosing whether a model fallback is worth the cost1819## Core Policy20211. **Convert before reading.** Do not dump raw heavyweight files into model context if a deterministic converter can create a cheaper artifact.221. **Index before reasoning.** Read the generated `index.md` or `index.json` first. It should tell you what is in the file, how clean the extraction was, and whether escalation is justified.231. **Match the converter to the file type.**24 - PDFs and documents: markdown artifact25 - Presentations: markdown slide outline26 - Spreadsheets: CSV per sheet plus a markdown manifest271. **Escalate by cost tier, not instinct.**28 - Tier 1: deterministic converter plus index29 - Tier 2: cheap model on the extracted artifact only if quality flags say the deterministic pass lost structure30 - Tier 3: expensive model only after the file has already been compressed into markdown, CSV, or a sampled subset3132## Process33341. Identify the file path, extension, and rough size.351. Run the converter script instead of reading the original file directly:3637```bash38uv run \39 --with pdfplumber \40 --with python-docx \41 --with python-pptx \42 --with openpyxl \43 python skills/heavy-file-ingestion/scripts/convert_heavy_file.py /absolute/path/to/file.ext44```45461. If you already have `markitdown` installed and want to prefer it for PDF or DOCX conversion, rerun with:4748```bash49python skills/heavy-file-ingestion/scripts/convert_heavy_file.py /absolute/path/to/file.ext --prefer markitdown50```51521. Read the generated `index.md` first.532. Only read the extracted markdown or CSV outputs that the index says are worth reading.543. If the index flags weak extraction, use a cheap fallback:55 - Try an alternate deterministic converter56 - Use a small model to rebuild only the structure or outline from the extracted artifact57 - Escalate to a stronger model only when the cheaper passes still leave critical ambiguity5859## Output6061The skill should leave behind:6263- A deterministic artifact the agent can work from64- `index.md` with file counts, structure hints, preview lines, and a recommended next step65- `index.json` with the same information in machine-friendly form66- Warnings when the deterministic pass is not trustworthy enough for direct reasoning6768## Notes6970- Prefer the bundled script over rewriting ad hoc conversion code each time.71- Do not treat "sub-agent" as the default answer to messy files. A cheap deterministic pass beats a cheap model when the task is conversion, counting, routing, or indexing.72- For scanned PDFs, image-heavy decks, or bizarre layouts, the deterministic pass is still useful because it tells you that a fallback is needed before you waste a stronger model on the original file.73- Use [`references/open-source-stack.md`](./references/open-source-stack.md) when you need to choose a better extractor or explain why one was picked.