Plan, build, review
Planning, implementation and review are different jobs. Keep them apart, and build through tests.
Most people use one AI model for everything. They open a chat or a coding agent, pick whatever is best this month, and use it to think about the problem, write the code and check the result.
That is a reasonable way to start. It is not a good way to ship. The three stages of a feature have different responsibilities, they reward different strengths, and they cost different amounts. Once you separate them, a lot of things get simpler: which model to use, what to automate, and when a human actually needs to look.
This post is about that loop as we run it: plan, build, review. The most important part of it is the middle one, and the way we make it work is test-driven development.
read the rest, free
Enter your email to unlock the article. You will also get the AI Builder's Newsletter with practical notes on building & shipping products with AI.
No payment, no card, nothing else to fill in. Unsubscribe any time.
By continuing you agree to receive the PO2 newsletter. We use your email for that and nothing else. Privacy policy.
Three stages, three responsibilities
Planning turns an idea into requirements, acceptance criteria and appropriately sized vertical slices, each one an issue in your tracker. It is also where the decisions that are hard to reverse come up: a change to the architecture, or a new service or third party. The planner proposes those, and a human accepts them. How to build the rest is left to the builder. Planning deserves the strongest model you have, because its mistakes are the expensive kind, and it uses few tokens, so the best model is affordable.
One habit to drop: having the planner write the code, or instructions close to it, for a cheaper model to type out. It made sense when coding models could not be trusted with technical decisions. Now it pays for the implementation twice, and it ties the builder to decisions made before anyone was in the code. We go into why in How to plan features for AI coding agents.
Building turns a slice into working, tested code. It uses most of the tokens, so this is where a cheaper model pays off. But there is a floor. The builder makes every technical decision the plan left open, and a model without good technical judgement makes poor ones that still pass their own tests. A clear slice and tests written first give a capable model a tight target; they do not rescue one that is too weak.
Reviewing checks the result against the acceptance criteria, the architecture and the standards of the codebase. What it needs most is independence: a different model from the builder, ideally from a different company, so it does not share the builder's blind spots. It has to be capable, but it does not have to be stronger than the builder. Reviews use few tokens, so a strong reviewer is cheap anyway.
Build through tests
The single biggest improvement to implementation quality we have found is test-driven development, and it works for agents for the same reason it works for people: the tests state the expected behaviour before the code exists.
For an agent, that matters even more. A test written first is a concrete definition of done, and a way for the agent to check its own work without asking anyone. An agent that works this way catches its own regressions, and its output is far easier to review, because the tests say what it believed the requirement to be. Without them, an agent writes the code and the tests together, and they agree with each other whether or not they agree with the requirement. Tests first do not stop an agent misreading the requirement, but they put its reading in plain sight, which is why the reviewer checks the tests against the acceptance criteria and not just whether they pass.
This depends on the plan. A vertical slice delivers something a user could actually do, through whichever layers it needs, so its test can be written at the boundary the user touches, whether that is a browser, an API or a command line, before any of the code exists. A slice cut by layer, such as "add the orders table", has nothing a user can do, so there is nothing to test from the outside until the rest is built.
This is how our agents build a slice:
- Acceptance tests first. One test per acceptance criterion in the slice, at the outermost level that shows it: the browser for a user flow, the API for a backend rule. Run them and watch them fail before writing any code. A test that has never failed has not proved anything.
- Then test-drive the inside. Write a failing test, make it pass, refactor, and repeat until the acceptance tests pass.
- Then check the real thing. Run the application and use it, in a browser for anything with a screen. Passing tests are evidence, not proof.
- Then delete the acceptance tests. Once they pass, they have guided the build, and we deliberately do not keep them all. What stays is the unit tests from the inside, and a small end-to-end suite with one happy-path test per core flow of the product, run through what users actually use: the browser for anything with a screen. That keeps the suite fast, and stops it growing into a record of every feature ever built. The cost is less end-to-end cover for edge cases, which is why riskier changes get more edge-case tests from the start.
Writing the test first also shapes the code. A test has to be able to set the code up, call it and check the result, so code written to pass one tends to come out in small pieces with clear inputs and outputs, rather than logic buried in a button handler or tangled up with the database. Agents left to themselves often write the second kind: it works, and nothing can check it short of running the whole application. Tests first push them the other way, and code that is easy to test is also easier to review and to change later, by an agent or a person.
The same goes for anything outside the codebase. We put every external service, such as a payment provider or an AI model, behind an interface with a fake, so the whole application runs and is tested offline. The tests never depend on a network, a test account or someone's credit, and an agent can run the full suite as often as it likes. A fake cannot prove the real service behaves as assumed, though. That is what checking the real thing is for, and the agent reports what it checked against the real service and what is still left for a person.
Tests are also what make a cheaper builder viable, as long as it clears that floor. A clear, failing test is a target it can hit without the strongest reasoning, and a passing one, checked by an independent reviewer, is evidence you do not have to take on trust.
Automate the basic verification
Alongside the tests, everything that can be checked mechanically should be: type checking, linting, formatting, the test suite, a build. Run them in commit hooks and in CI so that nothing reaches review with problems a machine could have found.
The point is not only quality. It is that these checks give the agent a feedback loop that does not involve a human. A failing type check is a message to the agent, not an interruption for you.
Review independently
When the build is done, a separate model reviews it, in a fresh context. It reads the acceptance criteria, the diff and the tests, and it answers a few questions: does this do what the slice asked, does it fit the architecture, is the quality acceptable, and is there anything risky in it.
Independence is what makes this worth doing. A model reviewing its own work carries all its own assumptions in. A fresh one does not.
Let agents fix their own mistakes
Here is the habit that changes the economics. When a test fails or the review finds a problem, the default should be another implementation attempt, not a human stepping in.
Failed tests and review findings are precise, machine-readable feedback. Hand them back to the implementing agent and let it try again. Most problems are fixed on the second pass. Only what survives that loop needs a person: our builders stop and say so when the same failure or finding survives three fixes.
Escalate only when necessary
So when does a human look? When there is genuine ambiguity in the requirement. When the agent and the reviewer disagree and neither can resolve it. When there is an important decision to make, such as a trade-off the plan did not anticipate. And when the change is high risk: authentication, payments, data migrations, anything destructive.
Those are the cases that deserve human attention, and they are rarer than most teams expect once the rest of the loop is working. How much oversight a project needs beyond them is a decision to make per project, by risk, not a default inherited from a tool. We write about making that decision, and encoding it, in Why we built our own coding skills.
Do not interfere unnecessarily
The flip side is worth saying plainly. Models already outperform many humans at particular coding tasks. A person stepping into the middle of a build to steer it can introduce errors, impose a worse design, or constrain a solution that was going somewhere better. The urge to intervene is natural. It is often not helpful.
If you find yourself wanting to correct the agent mid-task, ask whether the problem is really in the requirement or the tests. Fix those, and let the loop run again.
Why the separation matters
Plan, build, review is not a new idea. Engineering teams have worked that way for decades. What is new is that each stage can now be done by an agent, and that the agents do better when the stages are kept apart: a planner that does not write code, a builder that works to tests it wrote first, and a reviewer that did not do the building.
Keep the stages apart and make the builder prove its work with tests written first, and most of the building no longer needs you watching it.

