AI Agent Definition of Done: Make Coding Agents Prove the Task Is Complete A developer outlined a model- and framework-agnostic approach for gating AI coding agents with an executable "definition of done": a per-task contract specifying allowed paths, acceptance criteria, required evidence, and an independent process that accepts or rejects completion. The contract is paired with a receipt format that records command, exit code, environment, artifact path and timestamp for each criterion, so agents can propose completion but cannot grade their own work. The guide argues that model-generated explanations, unverified screenshots and green test commands without captured output are clues rather than acceptance evidence. An AI coding agent can change the right-looking files, write a cheerful summary, and still leave the task unfinished. A test may never have run. A migration may work only on an empty database. A visual bug may be hidden outside the agent's viewport. “Done” is a claim; production systems need evidence. The fix is not a longer prompt asking the agent to be careful. Give every task an executable definition of done: a small contract that names the allowed change, expected observable outcome, required evidence, and the independent process that accepts or rejects it. The agent may propose completion. It should not grade its own homework. This guide shows how to build that gate for coding-agent workflows without tying it to a particular model, IDE, or orchestration framework. Coding agents optimize for finishing the assigned interaction. They can infer the wrong intent, stop after a partial fix, or interpret a passing command as proof of a broader requirement. Even a careful agent has limited visibility into production data, browser states, deployment configuration, and implicit team conventions. This is not an argument against agent autonomy. It is an argument for separating two decisions: That separation mirrors normal engineering. A pull request is not merged because the author says it is correct; it is merged after checks and review. The same principle becomes more important when a single agent can edit many files quickly. Recent agent-evaluation work also measures more than a final answer. NVIDIA describes a hierarchy from benchmarks through trials, tasks, turns, and steps, while trajectory-focused benchmarks inspect tool use, verification attempts, and repository state—not merely a success sentence. NVIDIA's overview of agent evaluation https://developer.nvidia.com/blog/how-to-evaluate-ai-agents-from-tool-calls-to-task-completion/ is a useful reminder: completion needs an observable outcome. Before the agent receives write access, translate the task into a compact contract. Do not ask it to invent the criteria after it edits code. task id: checkout-tax-042 goal: "Calculate regional tax before rendering the order total" scope: allowed paths: - apps/checkout/ - packages/tax/ forbidden paths: - infra/ - db/migrations/ acceptance: - id: unit-tax kind: command run: "pnpm test --filter tax -- --runInBand" expects: { exit code: 0 } - id: total-visible kind: browser route: "/checkout?region=CA" expects: text: "Tax" screenshot: true - id: no-regression kind: command run: "pnpm lint --filter checkout" expects: { exit code: 0 } policy: max files changed: 8 human review required: false Good criteria have three qualities: The contract should also say what is not proof. A model-generated explanation, an unverified screenshot, and a green test command with no captured output are useful clues, not acceptance evidence. Store a receipt for every criterion. This makes the handoff reviewable, lets a failed run resume safely, and provides a concrete artifact when a user reports a regression. { "taskId": "checkout-tax-042", "commit": "9ac63c1", "criteria": { "id": "unit-tax", "status": "passed", "evidence": { "kind": "command", "command": "pnpm test --filter tax -- --runInBand", "exitCode": 0, "stdoutDigest": "sha256:...", "artifact": "artifacts/unit-tax.log" } }, { "id": "total-visible", "status": "passed", "evidence": { "kind": "browser", "url": "http://preview.local/checkout?region=CA", "screenshot": "artifacts/total-visible.png", "checkedAt": "2026-11-11T10:20:00Z" } } } Capture the command, exit code, environment reference, artifact path, and timestamp. Hash large output instead of placing secrets or full logs in a chat transcript. For browser checks, record the URL, viewport, and screenshot. For API tasks, capture a redacted request shape and response assertion. Evidence should be enough for a reviewer or a later verifier to rerun the check. Do not confuse “a test exists” with “this change was tested.” The receipt binds a criterion to the tested commit and environment. The safest default is a second execution role that has read access plus narrowly scoped test commands, but no write capability, production credentials, or permission to change the contract. It can validate the implementation without fixing it into compliance. That role can be a deterministic CI job, a separate agent with constrained tools, or both. Deterministic checks should lead: type checks, unit tests, contract tests, diff policy, and deployment smoke tests. Use an AI verifier where judgment is genuinely needed—for example, assessing whether a screenshot contains a required user flow—but require it to cite its evidence and mark uncertainty. type Verdict = "accepted" | "rejected" | "needs review"; async function verify task: Task, receipt: Receipt : Promise