bulk-convert-huge-folder-of-pdfs-into-markdown
Made by JeffConverts a folder of PDFs to faithful GFM markdown with extraction, OCR, and headless agy workers or an NTM swarm that fix OCR errors. Use when converting many PDFs, OCR-ing a folder, or cleaning OCR text at scale.
From Jeffrey's Skills.md: professionally crafted skills for any AI agent, installed and kept in sync by the jsm CLI. Subscription only, $20/month.
Works With
Quality and Utility come from canonical skill metadata. Community ratings appear separately as stars when subscriber reviews exist.
Subscribe to download
Public previews are available, but downloads, CLI sync, and premium content require an active subscription.
Sign In to Subscribe- Full skill content with deterministic versioning
- CLI sync + local search index
- Access to Jeffrey’s premium library
Save to your account
Saved skills live in your cloud list. Run jsm sync on each machine to pull them locally.
What's New with this Skill
1Updates, enhancements, and release notes for this skill.
New skill: bulk-convert-huge-folder-of-pdfs-into-markdown, a folder of scans becomes markdown that survives an audit
A folder of PDFs turns into a markdown mirror in two halves. Machines do the extraction: page classification, duplicate detection, pymupdf4llm and Tesseract, a pre-pass, a validated rule library, and a glitch detector. Cheap agents then read and repair through a guarded toolkit that journals every edit and refuses to change a digit without a note. Progress is counted in pages and verdict lines, never in what a pane says about itself.
- Survey classifies every page as text, stamp, or image, finds duplicates by size, first-megabyte hash, and page count, and reports the corpus in pages. convert.py --calibrate replaces formula ETAs with a measured rate; duplicates are mirrored from their twin and never OCR'd twice.
- Extraction is hybrid per page: text layers through pymupdf4llm, image pages through Tesseract, with thread caps and a spawn context. Remediation modes cover interleaved columns (sorted text), legacy OCR layers (forced 300 DPI), and rotated pages (orientation detection).
- Before any agent is paid, prepass.py and a validated rule library remove whole glitch families. rules.py checks every rule corpus-wide and rejects anything that changes a digit beyond a glyph repair, so shal1 to shall passes and 1965 to 1956 does not.
- detect_anomalies.py ranks likely OCR errors per file with an inflection-aware dictionary. Born-digital files with zero findings are triaged OK-CLEAN by the master and skip the queue; the rest are queued hardest first, and a later pass samples the skipped ones.
- One worker toolkit, wk.py: guarded exact replacement (unique match, header protected, ordered number-token guard with a mandatory note for real digit changes), page render and OCR, placeholders for signatures and unreadable spans, a residual scan, and a verdict logger. Every edit is journaled.
- Honest credit is a grammar: FIXED n, OK-READ, OK-SCAN, OK-CLEAN, NEEDS-REOCR, UNSURE n. Gate G13 caps the scan-only share and flags any file no pass logged. The verdict line and the journal are the record; a pane saying it is done is not.
- Headless workers by default: swarm.py headless runs agy -p once per file with a fresh context, so there is no tmux session, ACK protocol or hook stall. On the synthetic smoke corpus one Gemini Flash low-effort worker repaired a two-page scan in 41 seconds for about 71 thousand tokens.
- The verify pass is risk-weighted: every edited, unsure, scan-only, or unlogged file plus a seeded sample of the rest, with wk.py diff read before the prose so changed numbers are checked against the page. The sample doubles as the acceptance sample with a 3/n bound.
- validate.py enforces thirteen gates: completeness, per-page floors, headers, legacy OCR density, residual density, GFM sanity, residue, UNSURE markers, number preservation against snapshots, index, column glue, fused words, and honesty. INDEX.md carries a verdict per document.
- 27 operator cards, a state-machine driver (pdf2md.py next prints the next command and why), and scripts/smoke-test.sh, which builds a synthetic corpus in a path with spaces and runs every script end to end, simulated fix and verify workers included.
The run starts with survey.py, which classifies every page as text, stamp, or image (a 300-character threshold, so an e-signature stamp never passes a scanned page off as digital), finds duplicates by size, first-megabyte hash, and page count, and reports the corpus in pages. convert.py --calibrate measures the real OCR rate on the machine before anyone quotes a wall time; the digital files convert in minutes while the OCR job runs in the background with thread caps and a spawn context so twelve workers do not oversubscribe fourteen cores. Files that fail the per-page floors are re-extracted p