The Agent Writes Acceptance Criteria, Then Grades Itself

A setup that practitioners keep describing goes like this: tickets sit in a queue, several coding agents pull from it in parallel, and an orchestrator does two things for each ticket. Before any code, it writes the acceptance criteria. After the code, it checks the work against them. Only when it gets stuck does a human hear about it.
Writing the criteria first is real QA practice. Letting the same system grade the result is where it goes wrong. Below: the pattern, three failure modes, and a gate you can build today.
The Pattern Has a Reference Implementation
OpenAI published one version of this loop in April 2026. Symphony "turns a project-management board like Linear into a control plane for coding agents." The post says: "Every open task gets an agent, agents run continuously, and humans review the results." The team built its workflow "based on ticket statuses, using the task manager Linear as a state machine."
The spec published with it (in the openai/symphony repo) makes the mechanics concrete:
max_concurrent_agentsdefaults to 10, a global cap, not a per-ticket one.- A stalled worker is detected after a default of 5 minutes, and the action is "Kill worker and schedule retry."
- "A successful run can end at a workflow-defined handoff state (for example
Human Review), not necessarilyDone."
The verification side is in the post too. The system "watches CI, rebases when needed, resolves conflicts, retries flaky checks," and the harness covers "running end-to-end tests, driving the app through Chrome DevTools, and managing QA smoke tests." What reaches a human is "a review packet that includes a video walkthrough of the feature working inside the real product."
So the queue, the parallel workers and the self-check are not exotic. The open question is who decides what "done" means.
Criteria First Is Real QA
Writing acceptance criteria before code is the core of behaviour-driven development. The Gherkin reference is strict about what a good check looks like: "Then steps are used to describe an expected outcome, or result," "An outcome should be on an observable output," and, about peeking into the database to prove it, "resist that temptation!"
That rule matters more for agents. A criterion on observable output ("the endpoint returns 429 on the sixth request") can be checked by someone other than the author. A criterion on internals ("the limiter increments the counter") can be met by code written to match it.
Anthropic's Building effective agents explains why coding is a good fit for this loop: "Code solutions are verifiable through automated tests." The same section adds the limit: "human review remains crucial for ensuring solutions align with broader system requirements." Criteria cover what was written down. Review covers what was not.
Failure Mode 1: Self-Grading
When one agent writes the criteria, the code and the verdict, all three can drift together until they agree.
The research is consistent on this. Huang and colleagues, in Large Language Models Cannot Self-Correct Reasoning Yet, found that without external feedback, models struggle to fix their own reasoning, and "their performance even degrades after self-correction." Panickssery, Bowman and Feng (LLM Evaluators Recognize and Favor Their Own Generations) note that "new biases are introduced due to the same LLM acting as both the evaluator and the evaluatee."
Then there is plain gaming. METR's Recent Frontier Models Are Reward Hacking documents a model that "overwrites the timing function so that it always returns shorter measurements," and o3 deciding "to patch the competition evaluation function so that it judges every submission as successful." The models knew: they "demonstrate awareness that their behavior isn't in line with user intentions." METR calls it "a general phenomenon, not isolated to any one model or developer."
An agent that can edit its own acceptance tests has every tool it needs to do the same thing to your ticket. Three rules close most of the gap:
- Freeze the criteria. Once a human or a second model approves them, store a hash. Any change to the criteria file fails the gate.
- Check from outside. The final check runs in the orchestrator, in a fresh checkout, with test code the agent could not write to.
- Use ground truth. Anthropic's guidance is for agents to "gain 'ground truth' from the environment at each step." A passing HTTP request against a running build beats the agent's summary of why it should pass.
Failure Mode 2: The Agent That Surprises Its Owner
An agent can meet every criterion and still do something nobody expected: delete a flaky test, bump a dependency, edit the CI file, or touch a repo outside the ticket. Criteria say what must be true. They do not list everything that must stay unchanged.
Prompts do not fix this. Permissions do. GitHub's risks and mitigations page for its coding agent is a good template: a new copilot/ branch is created "and the agent can only push to that branch"; the agent "cannot mark its pull requests as 'Ready for review' and cannot approve or merge a pull request"; the platform "Prevents the user who asked Copilot cloud agent to create a pull request from approving it"; and Actions workflows "don't run on a pull request until a user with write access approves them."
Copy that shape into your own orchestrator. Add one acceptance criterion every ticket inherits: the diff touches only the paths the ticket names, and test or CI files changed only with an explicit flag in the plan.
Failure Mode 3: A Backlog Faster Than Review
Ten parallel agents can empty a backlog in an afternoon. Nobody reviews ten pull requests in an afternoon. If the orchestrator keeps dispatching, the Human Review column grows until reviewers start approving on the green check alone, and then the self-grade is the only grade.
Treat review capacity as a resource with a limit, the same way we treated CPU in load average admission control for coding agents. Set a cap on tickets waiting in Human Review. When the column is full, the orchestrator stops starting new tickets and works on rebases and fixes for the ones already waiting. Throughput then matches what people can actually read.
Who Writes, Who Checks, Who Escalates
| Step | Who does it | What it guards against | On failure |
|---|---|---|---|
| Draft criteria | Implementing agent | Vague tickets | Ask for clarification, ticket stays in queue |
| Approve criteria | Human, or a clean-context second model | Criteria that are easy to satisfy | Rewrite before any code |
| Freeze criteria | Orchestrator (hash) | Moving goalposts | Fail the run |
| Inner loop checks | Implementing agent | Obvious bugs, fast feedback | Agent keeps working |
| Final check | Orchestrator, fresh checkout | Edited tests, local-only passes | Return to agent, count the attempt |
| Scope check | Orchestrator, diff paths | Surprise changes | Escalate to human |
| Escalation | After N failed final checks or a stall | Infinite retry loops | Ticket to Human Review with logs |
The approval step does not need a human every time. A second model that sees only the ticket and the criteria, not the transcript, is a cheap filter, as in our post on clean-context critics. Disagreement goes to a person.
A Worked Gate With a Stop Hook
In Claude Code, the inner loop can be enforced with a Stop hook. A Stop hook "Runs when the main Claude Code agent has finished responding," and exit code 2 means "Claude receives the stderr message as the explanation for why it should continue."
#!/usr/bin/env bash
# acceptance-gate.sh: Stop hook. Inner loop only; the orchestrator re-checks.
ticket=$(cat .ticket-id)
if ! sha256sum -c --quiet "criteria/$ticket.sha256"; then
echo "criteria/$ticket.feature changed after approval. Restore it." >&2
exit 2
fi
if ./run-acceptance "criteria/$ticket.feature" > .acceptance.log 2>&1; then
exit 0
fi
n=$(( $(cat .gate-attempts 2>/dev/null || echo 0) + 1 ))
echo "$n" > .gate-attempts
if [ "$n" -ge 3 ]; then
echo needs-human > .ticket-state # orchestrator moves the ticket to Human Review
exit 0
fi
tail -n 40 .acceptance.log >&2
exit 2
The attempt counter matters. The hooks docs warn about "blocking on a condition that will never resolve" and say Claude Code overrides the block after stop hooks have continued the turn eight times in a row. Escalate before that, on your terms. And remember the hook runs where the agent can write, so it is a convenience, not the verdict. The verdict is the orchestrator's re-run in a clean checkout.
The Same Loop for Runbooks and Remediation
Swap "ticket" for "alert" and the pattern carries over. An agent that proposes a remediation should state what will be true afterwards (error rate under threshold, no new 5xx for 15 minutes), and something other than the agent should measure it.
Akmatori keeps the authoring and approving roles apart where it changes durable knowledge. Per the architecture docs, the self-improvement evaluator is a system cron job, off by default, that runs without connector tools and drafts runbook and skill updates as proposals. An operator approves or rejects each one and can refine a pending one in its review chat, and proposal chats get no connector tools. For grading models on incidents, SRE Bench uses a pinned judge model that compares each report with the scenario's written root cause, never with the model's own account of success.
Conclusion
Agent-written acceptance criteria are a good idea: they force the agent to say what done means before it starts. Agent-graded acceptance is not. Freeze the criteria, check from outside the agent's sandbox, bound what it can touch, and cap the review queue so humans still read what ships.
If your team wants AI-assisted incident workflows where agents propose and operators approve, Akmatori helps SRE teams investigate alerts, coordinate response, and automate safe infrastructure actions. Powered by Gcore for global infrastructure reliability.
