textbook-to-note

Turn your own PDF textbooks into an AI-searchable knowledge base and structured, fully-cited notes — figures included. A local-first pipeline that spends (almost) zero LLM tokens on the heavy lifting and reserves the frontier model for the one thing it's uniquely good at: synthesizing a note you can actually learn from.
繁體中文說明 → README.zh-TW.md
New here? → 5-minute quickstart: convert a bundled sample chapter and have Claude answer from it with page citations. Skills as a plugin: Install as a Claude Code plugin.
🧋 Saved you some time? Buy me a drink.
Why I built this
I've loved taking notes since med school, and over the years I've built up thousands of them — but I can no longer keep every one at the same quality by hand. In an age of information overload, trustworthy high-quality sources become the precious thing, and textbooks are among the best; yet my specialty alone has 40+ designated reference books, with a single concept scattered across chapters in many of them. Reading them all cover to cover just isn't realistic. LLMs are great at long context, but you can't dump hundreds of books on one at once — so the real unlock is pairing good search and a database with teaching the AI my own note-making process, so it produces grounded, structured notes I only have to absorb.

Left: one of the templates in templates/. Right: a real note in my vault, written against it — every claim traceable, every section where I expect it.
Which path are you on?
Not everyone wants the whole pipeline, and the parts stack in one direction — each profile
below is the one above it plus one more thing. Pick the smallest one that solves your
problem; you can move up later without redoing anything.
| Profile | What you get | What you set up |
|---|
| A · Converter only | Your PDFs/EPUBs as clean, greppable markdown with page markers, tables, and figure-reference markers. Search with grep. | pip install -r requirements.txt, then converter/convert.py. Nothing else — no GPU, no ollama, no index. |
| B · A + the note workflow | An AI writes structured, per-claim-cited notes from that corpus, with figures extracted through a QC gate. | A, plus the two skills in skills/ and workflows/note-writing.md. |
| C · B + semantic search | Cross-book retrieval by meaning rather than keyword — worth it once "which book was that in?" stops being obvious. | B, plus the companion repo ask-your-library and a local embedding model. Then three commands: convert.py → convert.py --resplit <output> --out <corpus> → corpus.py add <corpus> (run in ask-your-library). |
This repo ships no indexer and calls none. It produces a corpus folder; making that folder
searchable is an opt-in step done by ask-your-library with one command, server/corpus.py add <corpus>. --resplit is what turns converted output into such a corpus (a per-book
_manifest.json and a root corpus.json, format
t2n-corpus/1).
Profiles A and B need no RAG at all — no index, no embedding model, no ask-your-library. Profile A
is a fully supported end state, not a degraded one — for a few dozen books, grep over the
converted markdown is genuinely enough.
If you're having an AI set this up, tell it which profile you want; AGENTS.md
asks this first and then skips the steps your profile doesn't need.
Why this is hard (and why naive approaches fail)
Feeding a raw PDF to a frontier model seems simple until you hit the real problems:
- Cost & latency — a 600-page book is 1-2M tokens. Re-reading it for every question is untenable.
- Silent data loss — scanned pages and broken font encodings produce garbage that the model quietly skips. You never learn your note is missing half the chapter.
- Scrambled text — most textbooks are two-column. Default PDF text extraction interleaves the columns, and a naive "is this garbled?" check passes the shuffled output because the characters themselves are fine.
- Figures vanish — the anatomy diagram, the classification table, the treatment algorithm: often the most valuable part of a chapter, and text extraction drops all of it.
- Ungrounded output — an AI writing notes from memory hallucinates. Every claim needs to trace back to a source.
This pipeline treats each of those as a distinct engineering problem with a deliberate solution, organized as five stages.