Book · Beta 0.1

What the Spec Didn't Tell the Agent

Getting the Software You Actually Asked For

Valentyn Kamyshenko and Igor Plotnikov

More and more code is written by AI agents from requests in plain English. English has become the programming language of our time, and English is ambiguous. An agent builds what the request says, including what it forgot to say.

Take “bill only the active members.” Does a member in a grace period count as active? A cancelled one whose access has not run out yet? Each reading is reasonable, and each gives different code. Tests written from the same sentence share its ambiguity, so they pass.

This book shows how to write the requirements that matter in a form a machine can check. We state them in Agda, a language in which a definition is also a proof obligation, and compile the result into a test oracle that the real implementation is compared against. Agents are good at writing the proofs. People still decide what the requirements are; the book teaches you to read a specification an agent wrote and judge whether it says what you meant.

Who it is for

Working programmers in C++, Java, Python, TypeScript, Rust or Go. You do not need to know Haskell, logic or category theory, and you will not have to write Agda yourself. Each new idea is explained through its nearest equivalent in a mainstream language.

What is in it

The examples are real problems we met while building software with agents: lost data after a crash, rules that quietly changed meaning, a proxy that mangled the pages it served. Each chapter starts from what broke and builds the specification that would have caught it. Every Agda block in the book is typechecked.

Read the beta

The draft is interactive. Select any word, sentence or line of code to leave a comment or suggest a change; no account is needed.