Pdf ingestion

From Archive228/loopkit · View interactive version

Pdf ingestion is an AI agent skill from the GitHub repository Archive228/loopkit. Get a PDF into the model without blowing the context window or losing structure. Native PDF beats OCR-then-text for most cases; extract-then-summarize beats native for very long docs.

How to use this skill

Skill file

PDF Ingestion

Three ways to feed a PDF to the model, in increasing order of preprocessing:

  1. Native PDF input — pass the file directly. Model sees pages as images + extracted text. Best for docs under ~100 pages with meaningful layout (tables, figures, forms). Preserves structure.
  1. Text extraction then send — pdftotext / pypdf / equivalent, then send the text. Loses layout but cheap. Fine for prose-heavy docs where tables don't matter.
  1. Extract → chunk → summarize → send — for docs >100 pages or when you'll query the same doc many times. Preprocess once, cache the summary.

Deciding which path

| Doc shape | Path |

|---|---|

| <20 pages, layout matters (report, form, invoice) | Native |

| <20 pages, pure prose (article, memo) | Text extraction |

| 20-100 pages, mixed | Native, but chunk if context tight |

| >100 pages | Extract → chunk → summarize |

| Scanned PDF (no text layer) | OCR first (Tesseract or vision model), then treat as extracted text |

| Tables are the point | Native — text extractors mangle tables |

| Figures/diagrams are the point | Native + explicit "describe the figure on page N" prompt |

Native PDF — the good defaults

Extract-then-send — the traps

Extract → chunk → summarize (long docs)

Red flags

Loopkit-adjacent

If the PDF is a spec, extract it into PROMPT.md via spec-first — the agent should re-read prose, not re-scan the PDF, on every turn.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.