22.20 Under the hood: prompts, patterns, and verifiers⧉
The appendix How this book was created gives the methods overview; this companion goes one level deeper, into the machinery of the collaboration itself — the recurring prompt patterns that made an AI a dependable co-author rather than a fluent fabricator, and the verifier suite that catches the specific ways such a collaboration goes wrong. It is written for the reader who wants to reproduce the method, not just hear that it happened. None of it is magic; most of it is the unglamorous discipline of grounding, isolating, and checking.
22.20.1 Prompt patterns that made it work⧉
A large language model will happily write fluent, confident, subtly wrong text all day. The whole game is arranging the work so that the model's strengths (drafting, bookkeeping, code) are used and its failure modes (fabrication, drift, plausible-but-wrong) are structurally prevented. A handful of patterns did most of that work.
- Registry-first, single source of truth. Everything that must stay consistent across hundreds of pages lives in one file that the prose draws from, never re-derives: the big lessons (Big Lessons), the symbol table (Notations), the glossary and acronyms, the figure plan, and the bibliography. A lesson, symbol, or citation is defined once and referenced everywhere; the build fails loudly if a reference dangles. This is the structural cure for incoherence — the model cannot give the same symbol two meanings in two chapters because there is only one place a symbol's meaning lives.
- Source-grounding, and "flag, don't fabricate." Fleshing out a section is done against the course's slides, the lecture transcript, and the cited papers — not from the model's memory. The standing rule, enforced by a verifier, is that when a fact, citation, or number is missing or uncertain, the model flags it for a human rather than inventing a plausible one. No citation is ever conjured to fill a gap; no statistic is ever rounded into existence. This single rule is the difference between a research aid and a confabulation engine.
- Fresh context per section. Each section is drafted in a clean context window seeded with just what it needs — its outline entry, its prerequisites, the relevant registries — rather than in one ever-growing conversation. This deliberately prevents drift: the slow contamination by which a long chat starts echoing its own earlier phrasings and assumptions. The cost is repetition of setup; the benefit is that section 40 is written as carefully as section 1.
- The outline ↔ prose split, with write-back. Structure and content live in an outline; voice and phrasing live in the prose; a compile step turns the first into the second. Crucially, when a human edits the prose, the change is triaged back — a content change updates the outline, a voice change updates a style guide, a local polish is locked in place — so that re-compiling reproduces the human's corrections instead of regenerating something new and forgetting them. This is what lets the book be regenerated at all without losing months of editorial judgment.
- Hand-checkable verification for anything numeric. Generated image code is treated as guilty until tested: a new filter, resampler, or color transform is checked against an input whose answer is known by hand — a constant, an impulse, a half-plane, a single bright pixel — before it is trusted. Figures are programs that regenerate from source and are checked for legibility automatically, so a figure and the prose can never quietly disagree, and no figure ships with overlapping or sub-legible labels.
- An adversarial reviewer panel, not one opinion. The judgment-heavy checks are run as independent reviewers with distinct mandates (technical accuracy, pedagogy, voice, audience fit, figure–text fit, source coverage) rather than folded into a single "review this" prompt — because one prompt collapses into one bland opinion, while a panel of skeptics, each told to find what is wrong from its own angle, surfaces far more. Findings are collected for a human to accept or reject; the model never silently rewrites to match a reviewer.
- A verbatim prompt log. Every instruction the human gave is appended, word for word, to a running log — both for honesty (it is the real record of the human direction) and for reproducibility (the book's own word-count accounting, and this appendix, are computed from it).
- House-style instructions, repeated until reflexive. A small set of standing directives shape every draft: intuition first (lead with the idea and a picture, then only as much math as is needed to use the tool); point-first, no gratuitous cuteness; say which encoding you are in (linear vs. gamma vs. log) whenever it matters; spell out an acronym on first use or not at all; one author's voice throughout. Each of these is also a verifier (below), so "follow the house style" is not a hope but a check.
22.20.2 The verifier suite⧉
The verifiers are the book's immune system: a numbered set of checks, some mechanical and scriptable, some expert-judgment reviewer passes, run at outline time (a GO / NO-GO gate before a section is written) and again post-draft. They encode, as runnable checks, the specific failure modes of AI-assisted authoring. The current suite:
| # | Verifier | What it catches |
|---|---|---|
| V1 | encoding clarity | a histogram, average, or operation whose space (linear / gamma / log) is left ambiguous |
| V2 | notation consistency | a symbol used with two meanings, or undefined in Notations |
| V3 | prerequisite coverage | a concept used before (or without) being introduced |
| V4 | language isolation | Python and C++ snippets leaking into the same edition |
| V5 | outline readiness | a section's scaffolding tags (prereqs, figures, equations, sources) present before writing |
| V6 | missing assumptions | a claim whose conditions are unstated or too weak |
| V7 | text ↔ outline consistency | drafted prose that drifts from, or drops, what the outline specified |
| V8 | problem-set consistency | a pset that contradicts the chapter it tests |
| V9 | technical accuracy & equations | a wrong statement, a sign/factor/unit error, an undefined symbol, an over-broad claim |
| V10 | pedagogical clarity | math-first or intuition-free explanation; a missing picture or worked intuition |
| V11 | single-author voice | a tonal seam where the prose stops sounding like one person |
| V12 | ready-to-write gate | the aggregate GO / NO-GO verdict per section (rolls up the pre-generation checks) |
| V13 | CS-undergrad background fit | background assumed beyond the stated audience and not built upstream or in an appendix |
| V14 | figure opportunity | a visual concept that has no figure but should |
| V15 | text ↔ figure fit | prose that names an element a figure lacks, or a figure the prose never leverages |
| V16 | outline source coverage | the outline missing a point its slides / transcript / references make |
| V17 | text source coverage | the prose silently dropping a source's point, or replacing the author's framing with a generic one |
| V18 | citations & references | a missing, wrong, or mis-attributed citation; a dangling reference (never invent one to fill a gap) |
| V19 | big-lesson coverage | a recurring "big lesson" used but not registered, or registered but not surfaced in the recap |
| V20 | figure legibility | overlapping text, sub-floor fonts, clipped labels — checked at every figure build |
| V21 | outline ↔ draft structure parity | a chapter's section structure diverging between outline and draft |
| V22 | acronyms | an acronym used without a first-use expansion and not in the curated Acronyms list |
| V23 | concision & point-first prose | padding, hedging, or gratuitous cuteness ahead of the point |
| V24 | wikilink resolution | a link to a page or anchor that does not exist |
Two things about the table are worth saying plainly. First, the mechanical checks (V1–V8, V18–V24, in part) are scripts that run on every build and can fail the build — they are not advice, they are gates. Second, the reviewer checks (V9–V11, V13, V15, V17) produce warnings for a human, never silent edits — because the whole premise of the project is that the editorial judgment, the deciding of what is right, stays human. The verifiers make that judgment cheaper and more reliable; they do not replace it.
22.20.3 Why this is the interesting part⧉
It would be easy to read "written with an AI" as either a boast or a confession. It is neither. The model wrote fluent first drafts and tireless bookkeeping; the patterns and verifiers above are what made that output trustworthy enough to keep — the grounding that stops fabrication, the isolation that stops drift, the registries that stop incoherence, the checks that turn house style into something enforced rather than hoped for, and the human sign-off behind all of it. If there is a transferable lesson in this book's own making, it is that the value of an AI collaborator is bounded almost entirely by the scaffolding you build around it — and that the scaffolding, not the model, is where the craft lives.