# Software as a Byproduct: Book-Driven Programming in the AI Agent Era

- **URL:** https://wjkoh.com/posts/software-as-a-byproduct-book-driven-programming/
- **Published:** 2026-12-01
- **Author:** Woojong Koh
- **Summary:** AI coding agents invert the economics of spec-driven development and suppress both code-review and feature bike-shedding. Yet book-driven programming only works on stateful production systems when an executable contract layer sits between living prose and generated code.
- **Tags:** ai, agents, software-engineering, mcp, architecture, ghostbook, verification

---


<!-- Created: Tuesday, December 1, 2026, 8:00 PM PST -->
<!-- Modified: Tuesday, December 1, 2026, 8:23 PM PST -->

For twenty years, spec-driven development was a polite synonym for failure. Teams wrote eighty-page requirement documents, drew elaborate UML diagrams, and swore that every change would begin in the specification. Two sprints into production, real code diverged from the document, nobody had time to update both, and the specification became museum wallpaper.

AI coding agents invert that equation. Writing handlers, templates, and SQL queries now costs a fraction of what it did three years ago, while maintaining shared institutional intent remains as expensive as ever. In a previous essay on [Ghostbook](/posts/ghostbook-a-knowledge-base-only-ai-agents-can-write/), I argued that team knowledge belongs in one Git-backed book written exclusively by AI agents over the Model Context Protocol, leaving humans free to read, debate, and steer. That premise raises a sharper engineering question: **if one living book already holds the truth of a business, should application software become a downstream byproduct of writing a memo?**

**The honest answer is yes, provided an executable contract layer guards the boundary.** Book-driven programming treats a Git-backed knowledge base as the upstream source of truth and turns implementation code into a regenerable byproduct, yet it breaks the moment a team tries to compile plain prose straight into stateful production systems.

## Why Software as a Byproduct Kills Bike-Shedding

Parkinson wrote that a committee spends two minutes approving a nuclear reactor and forty-five minutes debating the paint color of the bike shed. Software teams suffer from two parallel versions of that disease, and treating software as a downstream byproduct attacks both at once.

The first version is engineering bike-shedding inside code reviews. Engineers routinely leave forty comments arguing over variable names, helper abstractions, or package layouts while rubber-stamping flawed business logic. Once implementation code becomes an agent-generated byproduct of locked contracts and tests, nitpicking implementation style becomes as pointless as arguing over the register allocation emitted by a C compiler. Human review energy snaps upward to system behavior, invariants, and data integrity.

The second version is drive-by feature bike-shedding from stakeholders. In most organizations, dropping a casual request in chat costs zero effort, so software bloats under unexamined preferences. When changing the software requires updating the canonical book with a concise problem memo, every change faces a deliberate proof-of-thought tollbooth. Anyone asking for a new workflow must articulate the underlying problem, state the operational trade-off, and fit the proposal into the existing product thesis. Weak ideas collapse on page one before they ever pollute a codebase.

Connecting an AI agent to the full book adds a third defense: an unblinking institutional coherence check. Humans forget decisions made six months ago or hesitate to push back on a senior colleague. An agent reading the full book over MCP immediately flags contradictions, pointing out when a new memo reverses an earlier custody boundary, fee rule, or scope exclusion.

One discipline matters here. The AI agent must act as an institutional prosecutor, never as the final judge. Models are easy to sweet-talk with confident prose, and an overly rigid agent can block a legitimate strategic pivot simply because it clashes with an older chapter. Let the agent cross-examine every memo against prior invariants and force every contradiction into the open; keep a named human author responsible for the Git commit that accepts or amends the rule.

## Where Prose as a Compiler Breaks Down

A living book can regenerate an executive deck from scratch in seconds. For throwaway prototypes, internal dashboards, and early demos, compiling a short memo directly into code works almost as cleanly.

Now consider an institutional fund-operations team running a Go and PostgreSQL portfolio ledger. After a client review, a product lead writes a crisp memo in the team book: add a two-stage fourteen-day capital-call reminder and apply an automatic interim valuation offset across the forty-five-day quarterly reporting lag. That offset prevents client net worth from dipping artificially between a cash wire and the next partner capital statement.

To a human executive, that sentence is crystal clear. Against a stateful production ledger, it breaks along four seams.

First, natural language is underspecified and invites silent invention. That single sentence leaves a dozen accounting rules unanswered. Do fourteen days mean calendar days or local banking business days? What happens when a partial wire lands two days early? How does a restated quarterly capital account statement retroactively unwind an interim offset? Which exchange rate governs multi-currency commitments, and how does the offset affect time-weighted return versus internal rate of return? If an agent compiles prose straight into application code, it quietly invents answers to every one of those questions. In financial software, silent guesses become trust-destroying accounting errors.

Second, slide decks are stateless while production software carries stateful gravity. Regenerating a presentation deletes nothing of value. A live PostgreSQL database holding client ledgers, encrypted document vaults, custodian account mappings, and immutable audit logs cannot be wiped and re-emitted whenever a memo changes. Schema migrations, backward compatibility, encryption key rotation, and zero-downtime rollouts obey physical operational laws that strategy prose should never have to specify.

Third, prose cannot verify itself. As I explored in [Lean for Math, Blockchain for Wealth](/posts/lean-for-math-blockchain-for-wealth/), scaling generation without a deterministic verification oracle only scales plausible mistakes. A production ledger stays trustworthy not because a chapter described double-entry bookkeeping, but because deterministic code enforces an exact balance check within \$0.01 before any human approval button unlocks. Without executable assertions and golden fixtures, regenerating software from prose introduces quiet regressions on every pass.

Fourth, truth flows in both directions. Once real operators upload sixty-page multi-currency bank statements and messy spreadsheets, production reality uncovers quirks that no upfront memo predicted. If information flows strictly one way from book to code, engineers either bypass the book to ship urgent fixes, letting the book rot into fiction, or stall production incidents waiting on memo committee reviews.

## The Three-Layer Architecture and the Narrow Waist

The clean solution replaces a fragile two-layer jump from prose to code with three bounded layers. The canonical book owns business intent, the implementation layer stays disposable and agent-synthesized, and a thin executable contract layer sits between them as the narrow waist of the entire engineering system.

```mermaid
flowchart LR
  A["Problem Memo in Book"] --> B["Agent Coherence Check"]
  B --> C["Human-Gated Contract PR"]
  C --> D["Agent Code Synthesis"]
  D --> E["Deterministic CI Gate"]
  E -->|Production findings| C
  C -->|Reverse patch| A
```

| Layer | Where It Lives | What It Owns | Human and Agent Division |
| :--- | :--- | :--- | :--- |
| **1. Intent and Domain Truth** | Canonical Git-backed book over MCP | Strategy, product scope, user workflows, regulatory posture, non-negotiable invariants, and problem memos | Human-owned and agent-assisted; prose stays crisp and readable rather than bloating into SQL or API dumps |
| **2. Executable Contracts** | Software repository under `specs/`, schema migrations, golden fixtures, and acceptance tests | Exact state machines, accounting edge cases, database and API contracts, security rules, and deterministic test oracles | Agent-drafted and human-gated; this narrow waist is where senior engineers invest primary review attention |
| **3. Implementation Code** | Software repository source trees for backend services, templates, queries, and workers | Compiled realization of Layer 2 contracts, treated as a regenerable downstream artifact | Agent-generated and refactored continuously, gated by CI, race tests, golden fixtures, and browser checks |

This middle layer redefines the job of a senior software engineer. When agents write most of Layer 3, spending an afternoon reviewing three thousand lines of boilerplate handlers yields low leverage. The compounding work moves to Layer 2: designing clean state machines, locking down multi-tenant row isolation, curating anonymized golden PDF fixtures from messy real-world documents, and writing deterministic reconciliation gates that no model hallucination can bypass. Code becomes cheap; invariants become the moat.

## How a Memo Changes Production Software

With a Git-backed book server exposing diffs over MCP, the day-to-day workflow stays tight and auditable across five steps:

1. **Author the Problem Memo in the Book:** A product lead or engineer updates the relevant chapter or appends a focused decision memo describing the core problem and desired behavior. The server commits the change to Git under the author's name and mints a permanent revision identifier.
2. **Open a Contract Pull Request from the Diff:** A coding agent reads the exact chapter diff through `get_commit_diff`, inspects the existing codebase, and opens a Contract Pull Request rather than rushing straight into application code. That pull request updates schema drafts, state-transition specs, and failing acceptance tests while listing every underspecified edge case and database migration risk as explicit questions.
3. **Gate the Contract, Not the Boilerplate:** Product and engineering resolve the surfaced edge cases in writing and approve the Contract Pull Request. Any strategic ambiguity gets settled once, before a single production handler is written.
4. **Synthesize and Verify Layer 3:** Once the contracts and failing tests merge, coding agents generate or refactor the implementation code until every deterministic gate passes, covering accounting checks, race detection, tenant isolation, and end-to-end browser verification. Every implementation commit carries a `Spec-Ref` trailer pointing to the exact book revision SHA.
5. **Close the Reverse Loop:** Whenever production operations reveal a real-world constraint, such as a custodian statement format quirk or a new regulatory logging requirement, an agent proposes a surgical `patch_chapter` update back to the book so institutional truth and running software never drift apart.

For the capital-call memo above, a concrete Contract Pull Request stays short enough for a founder and staff engineer to review in five minutes:

```text
Spec-Ref: book@r404 (chapters/04-lp-cashflows.md)
Coherence-Check: Consistent with zero-custody posture; reminders draft instructions only.

Open Edge Cases Requiring Sign-Off Before Code Synthesis:
1. Day count: 14 calendar days or 14 local banking business days before wire due date?
2. Partial funding: Does a 50% early wire create a pro-rata interim NAV offset or wait for full settlement?
3. Restatement: When Q3 capital statements arrive late, unwind the interim offset retroactively or book an adjustment delta?

Failing Acceptance Gates Added:
- migrations/0042_capital_call_interim_offsets.sql
- ledger/reconcile_test.go: TestCapitalCallInterimOffsetBalancesToOneCent
- testdata/golden/q3_restated_capital_account.json
```

Notice what is absent from that review: zero debates over helper function names, zero nitpicks over template markup, and zero silent accounting guesses hidden inside a three-thousand-line diff.

## Where Book-Driven Programming Does Not Fit

Treating every keystroke as a formal specification problem would recreate waterfall bureaucracy under a shinier name. Three boundaries keep the methodology sharp.

First, separate systemic rules from local defects, in design as well as code. Altering product scope, accounting math, permissions, or user workflows requires a problem memo in Layer 1 and a contract update in Layer 2. The same discipline cures design bike-shedding: instead of arguing over one text label at a time, a team researches human readability experiments on line length, font size, contrast, and touch targets, commits the principle to the book, encodes it as semantic design tokens and automated accessibility checks in Layer 2, and lets Layer 3 update every screen at once. Local execution bugs that already obey those rules, such as a slow SQL query, a flaky retry loop, or a clipped table cell on a narrow viewport, skip the memo and ship directly in Layer 3.

Second, guard against prose theater. Writing-first cultures sometimes trade code bike-shedding for prose bike-shedding, letting weak ideas dressed in polished memos sail past while real customer bugs wait. Every memo must anchor to concrete operational evidence, and Layer 2 tests must prove the behavior on real data.

Third, respect domains where building precedes writing. Exploratory interaction design, throwaway scripts, and low-level performance profiling reveal what the specification *should* be only after you measure something live. Prototype freely, keep what survives contact with reality, and promote only the durable invariants upward into the book.

Software engineering spent fifty years climbing layers of abstraction, moving from machine code to assembly, from assembly to high-level compilers, and from hand-configured servers to declarative infrastructure. Each jump worked for the same reason: humans stopped hand-polishing the lower layer only after the boundary above it became crisp, testable, and mechanically enforced. Putting an executable contract layer between an agent-written book and agent-generated code applies that exact lesson to the AI era. Write the memo to clarify the truth, lock the contract to eliminate ambiguity, and let the software follow.

