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.
How complex features get built right — and why they fall apart when the specification doesn’t travel
“One agent with a perfect specification produces one correct result. Five agents with a drifting specification produce five consistent results, all based on the same wrong assumption.” — The agent did not go rogue. It followed the specification it was given. The problem was the specification it was given was not the specification you wrote. In This Chapter
An agent given a vague specification does not produce one bug. It produces a system of bugs. A human given a vague specification writes one class, gets confused, and asks for clarification. An agent given the same vague specification writes fifteen files, a test suite, a migration, and a deployment manifest — all internally consistent, all based on the same wrong assumption. The cost of specification vagueness multiplies by every file the agent autonomously creates.
10.1 The Four-Stage Pipeline Complex features have four logical stages. AI assistance adds value at every stage. Human expertise is non-replaceable at the first two. Most teams get this backwards — they use the AI to help think through the domain model (Stage 1) and let the agent autonomously execute the contracts (Stage 2). The model is terrible at Stage 1 and very good at Stages 3-4. The discipline is keeping the humans where they belong. Stage
Input
Output
AgentExecutable?
1 — Domain Model
Are the invariants correct for your domain?
No — requires domain expertise.
2— Contracts
Is every business failure named?
No — requires domain expertise.
3 — Implementation
Does it honor the contracts?
Yes — Claude Code, Cursor Agent.
4 — Tests
Critical paths covered?
Yes — Claude Code, Cursor Agent.
ANTI-PATTERN — Skipping Stage 1-2 and Delegating to the Agent AVOID: ”Build the insurance policy issuance feature. Validate inputs, persist the policy, send a confirmation email.”
USE: Run Stage 1 (domain model) and Stage 2 (interface contracts) with human review. Only then delegate Stage 3 implementation to the agent. Why: Without Stages 1-2, the agent invents the domain model and the error cases. At Stage 4, the tests pass — against the invented domain, not yours. The code ships. The incident is four months later when an edge case in the invented domain meets your actual business rules.
A development team used a two-agent pipeline: a design agent produced the domain model (Stage 1-2), an orchestrator summarized it and passed it to an implementation agent (Stage 3). The design agent described the aggregate as ’PolicyIssuance’. The orchestrator summarized it as ’PolicyCreation’ when constructing the implementation prompt — the terms sounded equivalent. The implementation agent built a consistent, well-tested ’PolicyCreationService’ with ’CreatePolicyCommand’ and ’PolicyCreatedEvent’. The team’s actual domain used ’PolicyIssuance’ throughout — in the database schema, in existing events, in the audit log, in the compliance documentation. The integration failed in eleven places. The fix took four days. The root cause: an orchestrator summary had silently renamed a domain concept.
THE COST OF THIS MISTAKE Incident: Specification drift: orchestrator renamed domain concept ,→ from PolicyIssuance to PolicyCreation Total cost: 4 days integration failure + 11 broken integration points ,→
+ compliance documentation inconsistency
Time to resolve: 4 days to identify and refactor, 1 additional sprint ,→ for compliance review update
Prevention: "Pass original specification verbatim as immutable XML. ,→ Never summarize. Never reformulate."
BEFORE — Tier 1 (What most developers type) "ORCHESTRATOR SUMMARY: The system should create insurance policies ,→ with validation and events." AFTER — Tier 3 (Specification Frame) "<original_specification>[verbatim copy of Stage 2 interface ,→ contracts and domain invariants — unchanged, unformatted, ,→ exactly as written by the domain expert]</ ,→ original_specification> Complete the task in <
,→ original_specification> exactly as written. Do NOT interpret, ,→ summarize, or reformulate it." Result: Orchestrator summary loses domain vocabulary and collapses ,→ nuance. Verbatim XML preserves every term, invariant, and ,→ constraint exactly as the domain expert specified them.
Prevention
DomainContractsImplTests
CriticGenerator
Non-termination
OrchestratorWorker
Human-in-theLoop
Use different framing for validator; different instruction set
Look at your last multi-agent workflow. Does the implementation agent receive your original interface specification verbatim, or does it receive a summary? Change any summary to a verbatim XML block this week. Measure the quality difference in the first output.
stages, but humans must own Stages 1-2. Agents can safely execute 3-4 when Stage 2 contracts are complete and precise. + Law 9: agents + vague specs = systems of bugs. All consistent. All based on the same wrong assumption. + Specification drift is the dominant multi-agent failure. Fix: pass original specification as verbatim immutable XML. Never let the orchestrator summarize. + Human review gates belong only at Stage 1-2 output. Reviewing every agent-generated file defeats the productivity advantage. + Six patterns, six failure modes. Know which pattern you are using and which failure mode to design against.
UP NEXT — Chapter 11: Prompt Files — Treat Your Prompts Like Code
The prompt that took your team two months to get right is currently in someone’s chat history. Chapter 11 shows you how to versioncontrol it, test it, and make it available to everyone on the team.
80