pdf2md

A local tool for converting PDF books into structured Markdown chapters and document bundles for language-model workflows.

From book to context bundles

  1. PDF book
  2. Conversion engine Swappable, compared on the same documents
  3. Table of contents Recovered by a local language model
  4. Clean Markdown
  5. Context bundles Chapters for one conversation
The conversion engines are swappable, and regression tests keep chapter boundaries right.

Problem

Books in PDF form are hard for a language model to use: the text comes out unstructured, chapters are lost and the whole book is too long for one conversation.

Value

A long book becomes a set of chapters an agent can read in one go, without sending the text to an outside service.

Role

Designed the architecture, conversion-engine evaluation, chapter-boundary tests and design decisions. Agents implemented much of the code.

  • Set up a layered architecture in which the conversion engines are swappable and compared on the same documents.
  • Used a local language model to classify documents and to recover the table of contents.
  • Built a regression suite for chapter boundaries so a changed engine cannot silently split a chapter wrong.
  • Recorded four architecture decisions.

Limits

  • The converted books are reading material under copyright and are never shown. Only the tool is described.

Sources

  • Four architecture decision records
  • Private version that runs on a local machine