zoe@dev:~$PID 1337
zoe@dev:~$ cat ~/blog/knuths-problem-again.mdx

Knuth's Problem, Again: Building a LaTeX Editor for AI Agents

2026-07-26·Zoe Lin·4 min read·#magictex#ai-agents#latex#git#essay
EN中文日本語한국어EspañolFrançaisDeutschPortuguês

In the spring of 1977, Donald Knuth received the galley proofs for a new edition of The Art of Computer Programming and found them ugly. His publisher had traded hot-metal type for phototypesetting, and the mathematics that had once looked carved now looked photocopied. He did not write an angry letter. He estimated the fix at about six months, set his research aside, and began building a typesetting system of his own. It took him closer to ten years. The LaTeX most of us type today is Leslie Lamport's later kindness, a layer of friendly macros over the machine Knuth built and named TeX.

My mentor David Turnbull told me this story on one of our Zoom catch-ups. He recommended Knuth's books. In the same conversation he showed me two editors he admired: Typst, which collapses writing and rendering into one live surface, and LiquidText, which lets you pin a thought to the exact spot on the page that provoked it. I didn't realize it that afternoon, but he had handed me a reading list and a design brief in the same breath.

What stayed with me about the Knuth story is not the heroic decade. It's the refusal at the start of it. The pages were wrong, and there was no way for him to reach in and make them right, so he built the reaching-in. He would not accept output he couldn't inspect and control.

Fifty years later, I write papers with an AI agent, and the same problem has quietly returned wearing new clothes.

The agent writes LaTeX better than I do. That was never the issue. Ask Claude to tighten a paragraph and you get a tighter paragraph. The two things it cannot give you are place and proof. Place: which sentence, on which page, in which file — the agent edits blind, because it never sees the rendered page you're reading. Proof: after the edit, what exactly changed? You can ask, and the model will answer, and the answer will be testimony. A model's account of its own edits is a memory of an intention. It is not a diff.

Knuth's answer to bad output was a system in which every mark on the page traces back to a command he wrote. Building MagicTeX, our answer was the mirror image: every mark the agent leaves must trace forward to a record the human owns.

So the editor works like this. You read the rendered PDF the way a supervisor reads a printout, and you comment on the page itself: select a passage, write "large compared to what?" The agent receives that not as a vibe but as a located instruction — the page, the quoted passage, the source file and line, your ask. It edits exactly there. And the moment the paper recompiles, the new state is snapshotted into a hidden git ref: not your branches, not your git log, a parallel ledger the workspace keeps on your behalf. Every compile is a checkpoint. Every checkpoint diffs. Any file can be put back the way it was. Typst taught the window; LiquidText taught the margins; git, quietly, does the remembering.

The ledger is what lets us be generous with autonomy. MagicTeX has a mode called /ultra-agents, in which a reviewer agent critiques the paper, accepts its own suggestions, and fixes them, round after round, with no human approval in between. Described like that, it sounds reckless. It is defensible for exactly one reason: it can never outrun the ledger. Each round lands as an ordinary, revertible checkpoint, and when the dust settles you read the history like a referee rather than a hostage. You can hand the pen to something faster than you, provided you keep the page, the margins, and the history.

Knuth understood this social contract from the other side. He famously mails a check for $2.56 — one hexadecimal dollar — to anyone who finds an error in his books. Most recipients frame the checks instead of cashing them, which rather proves the point: the money was never the reward. The reward is belonging to a system that says errors are findable here, and finding them is honored. That is what an audit trail is for. Not suspicion. Hospitality to correction.

I don't think the lesson of 1977 is to distrust your tools. Knuth didn't retreat to the typewriter; he built a better machine and then wrote an errata bounty into its culture. The lesson is that delegation and control are not opposites — that you can embrace the fastest collaborator you've ever had and still insist, politely, on evidence.

That is the whole idea of MagicTeX, and it began with a story told over Zoom. You mark up the page. The agent works the source. And git remembers what actually happened, whoever — or whatever — did the typing.

cd ~/blog ←