A local, single-user web app where you re-write Milewski's Category Theory for Programmers with your own hands. The book's LaTeX source streams onto the screen and you type it letter by letter, math notation included, lightning cracking as you go. After each paragraph a checkpoint opens: the rendered original, a markdown notes pane fed by highlighting, and an LLM TA for questions. Each chapter's Challenges section is a boss fight: a sentient, LLM-voiced creature whose seals are broken only by correct answers, graded by an LLM judge. A living concept graph shows the journey; conquered chapters ignite.
- Node.js 20 or newer (the repo is developed on Node 22+).
- The book's LaTeX source cloned at
../milewski-ctfp-pdf(used byscrollgen; the text stays local and gitignored). ANTHROPIC_API_KEYin.envfor the real TA, boss judge, and taunts. No key is required to play: keyless mode runs a canned TA and a mock judge (MOCK:HIT/MOCK:MISSin an answer drives the verdict).- Optional: a running ComfyUI server on
127.0.0.1:8188(overrideCT_DOJO_COMFY) for generated boss artwork. Without it,bossgenfalls back to deterministic procedural sigils.
npm install
npm run scrollgen # LaTeX -> content/scroll-NN.json (add --all to parse and verify all 31 chapters)
npm run graphgen # chapters.yaml -> data/graph.json
npm run bossgen # boss personas (LLM) + art (ComfyUI) -> data/bosses.json + app/public/bosses/
npm run dev # server on :5175 and vite on :5174, run concurrentlycontent/, notes/, data/progress.json, and .env are gitignored.
The book text never leaves your machine except inside TA/judge API calls.
Open http://localhost:5174 in your browser.
- The graph shows the chapters as glowing sigil nodes wired by prerequisite arrows. Available nodes breathe and show your scribing progress; conquered nodes are ignited.
- Click an available node to enter the Typing Arena and start re-writing the chapter. Typing is strict: the cursor only advances on the correct character. Inline and display math are typed as raw LaTeX and resolve into rendered form when completed. Code blocks are typed verbatim; indentation is inserted for you.
- At each paragraph checkpoint the stream pauses: reread the rendered original, highlight text to quote it into your markdown notes, or ask the TA. Press Enter to resume typing instantly.
- Typing past the last paragraph summons the chapter's boss. Each Challenge is a seal on its HP bar; answer in the editor and Cast. Hits shatter seals, glances chip them, misses earn you a taunt. Break every seal to conquer the chapter and unlock what it feeds, with an unlock ceremony on the graph.
- The mute toggle in the top bar silences the synthesized sound palette.
| Path | Purpose |
|---|---|
PRD.md |
Product intent. |
DESIGN.md |
Binding technical contracts shared by all parts. |
chapters.yaml |
Hand-authored source of truth for chapter metadata. |
shared/scroll.ts |
The Scroll schema and typeable-projection helpers (single source of truth). |
pipeline/scrollgen.ts |
Parses the book's LaTeX into per-chapter scroll JSON. |
pipeline/bossgen.ts |
Generates boss personas (LLM) and artwork (ComfyUI or procedural sigils). |
pipeline/graphgen.ts |
Emits data/graph.json from chapters.yaml. |
content/ |
Gitignored scroll JSON and figure images (never committed). |
notes/ |
Gitignored per-chapter markdown notes you take at checkpoints. |
data/bosses.json |
Generated boss personas (committed; contains no book text). |
data/progress.json |
Gitignored, server-owned user state. |
gates/chapters/NN/ |
Optional fast-check verifiers used as ground truth for code exercises. |
server/ |
Hono server on port 5175: progress, notes, TA streaming, boss judge, ComfyUI client. |
app/ |
Vite + React frontend on port 5174: graph, typing arena, checkpoints, boss fights. |
| Script | What it does |
|---|---|
npm run dev |
Runs the server (tsx watch) and vite together via concurrently. |
npm run server |
Runs only the server with tsx watch. |
npm run app |
Runs only the vite dev server (add ?fixture=1 to an arena URL to play a built-in fixture without the server). |
npm run build |
Builds the frontend with vite. |
npm run scrollgen |
Parses the book LaTeX into scrolls; -- --all verifies all 31 chapters. |
npm run bossgen |
Generates missing boss personas and art (idempotent). |
npm run graphgen |
Regenerates data/graph.json from chapters.yaml. |
npm run test |
Runs the vitest suite (scrollgen + server + shared). |
npm run gates |
Runs vitest; scope it to a chapter with npm run gates -- gates/chapters/02. |