diegoalvarezf.dev
Back
In progress

docdiet

Makes Claude Code read PDFs as Markdown, using less than half the tokens.

Why I built it

I fed lots of PDFs to Claude Code (notes, documentation) and they ate the context. Every page is sent as text and also as an image, even though the agent rarely needs the image.

How it works

  1. 01Hooks into Claude Code: when it is about to read a PDF, it gets Markdown instead.
  2. 02Drops headers, footers and page numbers, and joins words split across lines.
  3. 03A small neural network detects tables, figures and columns. If the PDF is mostly images, it steps aside and lets the original through.

Try it

Pick how many pages the PDF has.

PDF as is~44.582 tokens
With docdiet~19.361 tokens

57% fewer tokens

Estimate for a typical text document, calibrated against real reads.

What I learned

To measure before promising anything: I calibrated the token estimates against real Claude Code reads before quoting any savings.

Built with

TypeScriptNode.jsONNXClaude Code
docdiet — Diego Álvarez