Sub topic 11
Check the result against the plan
This chapter assumes you have used a coding agent on a repository, can read a diff, and can run the project's test suite. It covers the last stage of the plan-first workflow: after the agent implements a step, you compare what it did with what you approved.
Why verification is its own step
An approved plan is a contract. The agent can pass its own tests and still break the contract in three ways:
- It did something the plan did not list.
- It skipped something the plan did list.
- It did what the plan said, but the plan was wrong.
Passing tests only tells you the code behaves as the tests expect. It does not tell you that the change matches the scope you agreed to. Verification against the plan covers that gap.
You do this check after every step, not only at the end. A small diff is easy to compare with one plan step. A large diff that bundles all steps is not.
What to compare
Compare the result with each section of the plan.
| Plan section | Question to ask of the result |
|---|---|
| Files | Did the diff touch exactly the files listed, and no others? |
| Steps | Does the diff contain this step's work and nothing from later steps? |
| Risks and assumptions | Did any assumption turn out false during implementation? |
| Verification | Did the agreed checks run, and did they pass? |
The goal is to find differences between plan and result. Each difference needs a decision: accept it, or send it back.
Step 1: Compare the file list
Start with the list of changed files. Version control gives you this directly.
git status --short
git diff --statPut the output next to the plan's "Files" section. Three outcomes are common:
- Match. Every changed file is in the plan.
- Extra file. A file changed that the plan did not list. Open it and find out why.
- Missing file. A planned file is unchanged. The step may be incomplete, or the agent may have found it unnecessary.
An extra file is not always wrong. A plan can miss a legitimate edit, such as an import in a module that re-exports the new function. What matters is that you notice the deviation and decide on it. Do not accept it by default.
Step 2: Read the diff for scope
Now read the diff itself. For each hunk, ask whether the plan step explains it. Look for these patterns:
- Reformatting or renaming in lines unrelated to the step.
- Changes to error messages or response formats the constraints said to keep.
- New dependencies in a manifest or lockfile when the plan said none.
- Deleted code or tests, especially tests that were failing.
- Hard-coded values where the plan said to use configuration.
To view only the changes for one file:
git diff -- auth/routes.pyTo see the diff of a step that has been committed:
git show --stat HEAD
git show HEADCommitting after each approved step gives you one diff per step. That is the main reason the stepwise approach in the previous chapter works well with version control.
Step 3: Check constraints directly
Constraints from your planning request can often be checked mechanically. Do not rely on the agent's statement that it followed them.
For the rate-limiting example, the constraints were "no new dependencies" and "keep the existing error response format".
git diff --name-only | grep -E 'requirements|pyproject|package(-lock)?\.json'If this prints nothing, no dependency manifest changed. For the error format, find the existing tests that assert on it and confirm they still pass unmodified:
git diff --stat -- tests/
python -m pytest tests/test_auth.py -qIf a pre-existing test file shows changes in the diff, read them. An agent that cannot make a test pass may edit the test instead of the code. That is a deviation from the plan.
Step 4: Run the verification from the plan
The plan's verification section says how you will know the change works. Run those checks yourself, or ask the agent to run them and show the raw output.
python -m pytest tests/test_login_limit.py tests/test_auth.py -qLook at more than the pass count:
- Do the new tests cover the cases the plan named (under the limit, at the limit, after the window)?
- Does each test fail when the feature is removed? A test that cannot fail proves nothing.
- Did the agent run the full set of checks, or a subset?
A quick way to check that a new test is meaningful is to temporarily revert the production change and rerun it.
git stash push -- auth/routes.py
python -m pytest tests/test_login_limit.py -q
git stash popThe new tests should fail while the change is stashed. If they still pass, they do not test the feature.
Step 5: Re-check the assumptions
The plan listed assumptions. Implementation is when they get tested against real code. Ask the agent directly:
Which assumptions in the plan did you confirm while implementing step 1, and which turned out to be wrong or untested? Cite the file and line for each.An answer with file and line references can be checked. A general statement that everything matched the plan cannot. If an assumption failed, stop and update the plan before the next step. Do not let the agent quietly adapt.
Deciding what to do with a deviation
Each deviation falls into one of three groups.
| Deviation | Example | Response |
|---|---|---|
| Harmless and explained | An import added in a re-exporting module | Accept it, and note it in the plan |
| Out of scope | Reformatted unrelated functions | Ask the agent to revert those hunks |
| Plan was wrong | The IP address is not on the request object | Revise the plan, then continue |
A request to fix an out-of-scope change should be specific:
The diff changes formatting in `auth/routes.py` outside the login function. Revert those lines so the diff contains only the limiter call. Do not touch anything else, and show me the diff again.The loop for every step
The whole cycle for one step looks like this.
The final pass
After the last step, do one more review of the whole change against the whole plan. Use this checklist:
- [ ] Does the plan solve the problem I described, not a nearby one?
- [ ] Are all listed files ones I expect to change?
- [ ] Is anything changed that I did not ask for?
- [ ] Are the assumptions true for this project?
- [ ] Is there a concrete way to verify the result?
- [ ] Are the steps small enough to review one by one?Then view the combined diff of the branch against its base:
git diff --stat main...HEADReplace main with your base branch. This catches interactions that no single step showed, such as two steps that each added a similar helper.
Common errors
- Trusting the summary. The agent's description of its work is a claim. The diff is the evidence.
- Verifying only at the end. By then the diff mixes several steps and deviations are hard to separate.
- Checking only that tests pass. Tests do not catch extra files, extra dependencies, or edited tests.
- Accepting silent plan changes. If the agent changed approach, the plan and the result no longer agree. Update the plan or revert the change.
- Skipping the manual check of behavior. For user-facing changes, run the feature once yourself. For the login example, make six failed attempts and confirm the sixth is rejected in the existing error format.
Exercise
An agent finishes step 2 of a plan that lists auth/routes.py and auth/limiter.py. git status shows changes in those two files plus tests/test_auth.py and requirements.txt. The tests pass. What should you check before approving step 3, and why?
Show answer
Neither extra file is in the plan, and both break the plan's constraints or scope. Read the diff of requirements.txt: the constraint said no new dependencies, so any added package is a violation and must be reverted or the plan revised. Read the diff of tests/test_auth.py: an existing test file edited by the agent may have been changed to make a failure pass. Check whether the changes are justified, such as a legitimately updated expectation, or whether they hide a bug. Passing tests do not settle either question. Ask the agent to explain both changes, revert any that are not justified, and only then move to step 3.
Exercise
A new test for the rate limit passes. How can you confirm it actually tests the feature?
Show answer
Temporarily remove the production change, for example with git stash push -- auth/routes.py, and rerun the test. It should fail. If it still passes, it does not depend on the feature. Restore the change with git stash pop afterward.