Δ Delta
Read Online · Front Matter

Preface — The Day the AI Fired Itself

From the free book Delta: Closing the Specification Gap (Dhuri, 2026). The PDF is the canonical edition — figures, tables, and code formatting are simplified online.

“The most dangerous AI output is not one that is obviously wrong. It is one that is convincingly, expensively, silently wrong — and already deployed.” xi

— Sandeep Dhuri

A Tuesday Afternoon Like Many Others The story below is a teaching scenario I have constructed from the failure shapes that recur in published post-mortems and industry case studies — silent precision losses, retry-induced double charges, stale reads under contention. Each shape repeats with the same root cause: a missing constraint. I include this scenario at the front of the book because it is the failure mode every chapter that follows tries to prevent. A reconciliation discrepancy of $2,341.17 is not, on its own, a remarkable amount. The story below is about how it got there, why it took three weeks to surface, and what it reveals about the next prompt you will write. Take a payments platform six months into AI-assisted development. Velocity is up — services, tests, and ADRs drafted faster than ever — and the team is happy. Then a Monday-morning monitoring alert reveals a quiet discrepancy: the reconciliation job has produced a total $2,341.17 less than the bank statement. No crash. No exception. Just three weeks of accumulated drift (23 days, to be exact) across hundreds of thousands of transactions, sitting below monitoring thresholds the entire time. The root cause, on investigation, is humiliatingly mundane. A developer had asked an AI coding assistant to generate a batch transaction aggregation service. The assistant produced what is statistically most common in C# tutorials: double arithmetic. The team’s standard was Money<USD>. The prompt contained neither word. An incident shaped like that costs days of investigation, a regulatory disclosure, and a real reconciliation adjustment. It also illustrates the only thing that needed to change: the prompt. The distance between the prompt the developer typed and the prompt the domain required is what this book is about. xii THE COST OF THIS MISTAKE Incident: AI-generated double arithmetic in C# batch aggregation ,→ across hundreds of thousands of transactions over 23 days Total cost: $2,341.17 reconciliation discrepancy + 3 days ,→ investigation + regulatory disclosure Time to resolve: 3 days to diagnose, 15 minutes code fix, 2 weeks ,→ regulatory documentation Prevention: "Money<TCurrency> for ALL amounts — never decimal, ,→ double, or float directly" — 10 words

The Problem Is Not the AI It is worth being precise about what did not cause that incident: the AI model. The assistant did exactly what AI models do — it completed the prompt statistically. It produced the most likely code given the words it had received. The problem was that the prompt contained too few of the right words. It said nothing about Money<USD>. The assistant had no way of asking. The solution is specification: the discipline of communicating to the AI exactly what your domain requires before it generates a single line of code. That discipline — how to build it, systematize it, and share it across a team — is what this book teaches.

The Specification Gap — This Book in One Paragraph

There is a gap between what you intend for the AI to produce and what it produces. I call this the Specification Gap. It has three components: the Domain Gap (your regulatory constraints and proprietary types not in any training data), the Context Gap (your actual codebase the model cannot infer), and the Constraint Gap (your team’s hard-won invariants). Every technique in this book closes one or more of these gaps.

Why This Book Includes a Reverse Review of Its Own Prompts Appendix H is something unusual in technical publishing: a workingnotes appendix in which every major prompt in this book is examined against the standard the rest of the book sets. The exercise surfaced systematic gaps — missing output specifications, negative-only constraints, no ambiguity protocols. All were fixed. Appendix H documents what was found and what was changed. If a prompt produces inconsistent results for a team, Appendix H explains why and how to fix it.

The Ten Laws — A Preview Law

Statement

Ch

The AI produces what is average. Your domain requires what is specific.

A vague specification is a request for the model’s best guess.

Output quality is bounded by constraint quality. One missing constraint = one open failure mode.

Context not provided is context invented by the model — incorrectly.

No float for money. No exceptions.

Every public-facing AI feature is an injection surface until proven otherwise.

The best debugging prompt is a complete Evidence Brief. Fill it before you start.

Prompts are code. Unreviewed, untested prompts degrade.

An agent given a vague specification produces a system of bugs, not one bug.

The Specification Gap never closes itself.

How to Read This Book If you are…

Start Here

Junior .NET developer

Ch 1 2 3 4 (.NET) 7, 9, App C

Junior Java developer

Ch 1 2 3 4 (Java) 7, 9, App C

Senior .NET engineer

Ch 3 (skim 1–2) 4–6 11–13 18–19

Senior Java engineer

Ch 3 (skim 1–2) 4–6 11–13 18–19

.NET or Java tech lead

Ch 3, 11, 13, 14, 15, App B, C

Python / FastAPI / Django developer

Ch 1 2 3 App K (Python) 4–6, 9, App C

TypeScript / Node.js / NestJS developer

Ch 1 2 3 App K (TypeScript) 4–6, 9, App C

Go / Rust / Kotlin / other-language developer

Ch 1 2 3 App K — the translation approach generalizes 4–6

Engineering manager

Ch 11, 15, 16, 17 — start with §16.2, the AI Impact Assessment

CTO / VP Engineering

Ch 14, 15, 17 + §16.4 (token economics) and §16.2

Using prompts from this book

Read Appendix H first

If pressed for time: read Chapter 3 first, then Appendix H. Chapter 3 gives you the Specification Frame. Appendix H shows you how to improve any prompt in the book that produces inconsistent results.

Cite this section
Dhuri, Sandeep. (2026). Delta: Closing the Specification Gap. Acuity Press. Preface — The Day the AI Fired Itself.
DOI