---
name: pdf-toolchain
description: Research and maintain PDFtoMD toolchain compatibility for Marker, Nougat, PyMuPDF, PyTorch/CUDA, model cache, and licensing. Use when Codex needs dependency pins, runtime compatibility checks, official-source research, or updates to docs/TOOLCHAIN.md and related ADRs.
---

# PDF Toolchain

## Workflow

1. Read `AGENTS.md`, `PLAN.md`, `PROGRESS.md`, `docs/TOOLCHAIN.md`, `docs/ARCHITECTURE.md`, and `docs/ADR.md`.
2. Prefer official or primary sources for current facts.
3. Verify local facts with commands when relevant:
   - `.\venv\python.exe -m pip check`
   - `.\venv\python.exe -c "import torch; print(torch.__version__, torch.version.cuda, torch.cuda.is_available())"`
   - `.\venv\Scripts\nougat.exe --help`
4. Preserve the verified GTX 1070 Ti baseline unless a replacement is tested.
5. Update `docs/TOOLCHAIN.md` and `docs/ADR.md` when dependency decisions change.

## Guardrails

- Do not upgrade `torch`, `transformers`, `albumentations`, `pypdfium2`, `opencv-python-headless`, `Pillow`, or `fsspec` without re-running compatibility checks.
- Do not switch the primary parser away from Marker without an ADR update.
- Do not download model weights unless the user explicitly asks.
