An AI Coding Agent Workflow That Keeps Diffs Reviewable
A working loop for running a coding agent on a real codebase — task scoping, branch isolation, tests as the contract, and the review discipline that stops unreviewed code reaching main.
Agents are systems with failure modes, not assistants with personalities.
An agent is a loop: choose a tool, run it, read the output, choose again. That loop is the whole design surface, and everything that goes wrong in production traces back to it.
The loop needs three things a chat interface does not. A boundary on what tools exist and what they may touch. A stopping condition, so a task that cannot succeed fails visibly rather than consuming budget. And an observable trail, so you can reconstruct what happened after something surprising.
Reach for an agent when the work has a mechanical verification step — tests that pass or fail, a schema that validates, an API that returns a status code. The verification is what closes the loop; without it, the agent cannot tell progress from motion, and neither can you.
Avoid agents when the task is one API call. A single well-specified request is cheaper, faster and easier to debug than a loop that arrives at the same place. The overhead of agent scaffolding is only worth paying when the number of steps is genuinely unknown in advance.
What goes wrong most often: permission scopes set too wide because narrow ones caused approval fatigue; retry logic that hides a systematic failure behind three attempts; and evaluation done by reading transcripts rather than measuring outcomes. The first two are configuration. The third is a habit, and it is the one that lets a degraded agent run for weeks unnoticed.
Coverage here is deliberately practical — the loops, the guardrails and the review discipline — rather than a survey of frameworks.
Start here
A working loop for running a coding agent on a real codebase — task scoping, branch isolation, tests as the contract, and the review discipline that stops unreviewed code reaching main.
A reading order that builds Agents knowledge in the sequence it is actually needed.
Failure modes that come up repeatedly with Agents, and where each one is solved.
A working loop for running a coding agent on a real codebase — task scoping, branch isolation, tests as the contract, and the review discipline that stops unreviewed code reaching main.
Tool use in a loop. An agent decides which action to take, executes it, reads the result and decides again. That loop is what makes permission boundaries and stopping conditions matter.
With outcome metrics from the system it touches, not with vibes. For coding agents, diff size per merged commit and revert rate within a week are two numbers you already have in git.