Sub topic 2
What a Useful Plan Contains
This chapter covers what a plan from a coding agent should contain before you approve it. It assumes you have used a coding agent on a repository, can read a diff, and can run the project's test suite. Later chapters cover how to request a plan and how to review one. Here the goal is to recognize a good plan when you see one.
Why the contents matter
A plan is a short document the agent writes before it changes anything. It is only useful if you can check it. A plan that says "I will add rate limiting and update the tests" cannot be wrong, so it tells you nothing. A useful plan makes claims you can compare with your own knowledge of the project: which files, in what order, resting on which assumptions, and proved by which check.
A good plan has four core parts. Each part answers a question you would otherwise have to ask after the code is written.
| Part | Question it answers | What you check |
|---|---|---|
| Affected files | Where will the change land? | Are these the files you expected? Is anything missing or surprising? |
| Ordered steps | In what sequence is the work done? | Can each step be reviewed alone? Does each depend only on earlier steps? |
| Risks and assumptions | What could be wrong, and what is taken for granted? | Are the assumptions true for this project? |
| Verification | How will we know it works? | Can you run the check yourself? |
The four core parts
Affected files
The plan should list the files it expects to change, and for each one say why. Mark new files as new. The reason matters as much as the path. "auth/routes.py: call the limiter before checking credentials" lets you confirm the change is placed correctly. A bare path only tells you the agent found a file.
Scope creep appears here first. If you asked for a change to one endpoint and the list includes a shared utility module, the plan has already shown you a side effect. That is far cheaper to catch now than in a diff of forty files.
Ordered steps
Steps should be in an order you could follow by hand. Each should be small enough to produce one reviewable diff and, ideally, one commit. Good steps usually build from the inside out: first the new component, then the code that uses it, then the tests.
Look for two things. First, each step should name a concrete action, such as "add a function that records a failure and reports whether the limit is exceeded." Second, no step should quietly depend on a later one. If step 2 calls code that step 4 creates, the order is wrong.
Risks and assumptions
An assumption is something the agent believes but has not confirmed. A risk is something that could go wrong even if the assumptions hold. Plans that leave this section out are not assumption-free. They simply hide the assumptions where you cannot see them.
A good risks section is specific to the codebase. "Assumes a single server process; an in-memory counter is not shared across processes" is useful because you can answer it: if you run several processes, the plan is wrong and you can say so. "There may be edge cases" is not useful because you cannot act on it.
Verification
The plan must say how success will be shown. Prefer checks that run: named tests, a command, or a request you can send and a response you should see. List the cases that matter, not just "add tests." For the rate limit, those cases are under the limit, at the limit, and after the window expires. Include existing tests that must still pass, because they catch accidental breakage.
A complete example
This is the kind of plan to expect for the request "reject more than 5 failed attempts per IP address in 10 minutes on /login":
## Plan: rate limit /login
### Files
- `auth/routes.py`: call the limiter before checking credentials
- `auth/limiter.py` (new): in-memory counter keyed by IP
- `tests/test_login_limit.py` (new): tests for the limit
### Steps
1. Add the limiter module with a function that records a failure and reports whether the limit is exceeded.
2. Call it from the login route and return the existing error format when exceeded.
3. Add tests for under the limit, at the limit, and after the window expires.
### Risks and assumptions
- Assumes a single server process; an in-memory counter is not shared across processes.
- Assumes the client IP is available from the request object.
### Verification
- Run the new tests and the existing auth tests.Every part can be checked. The file list matches the request. The steps are ordered from the module to its caller to its tests. The assumptions are concrete, and one of them may turn out to be false for your deployment. The verification names commands you can run.
How the parts connect
The parts constrain each other. The files determine the steps, the steps expose assumptions, and the verification confirms that the steps achieved the goal.
If you change one part during review, re-read the others. Correcting an assumption, such as moving from one process to several, usually changes the files (a shared store appears) and the verification (a test that spans processes).
Weak and strong versions
The same section can be present but useless. Compare:
| Section | Weak | Strong |
|---|---|---|
| Files | "Update the auth code" | "`auth/routes.py`: call the limiter before checking credentials" |
| Steps | "Implement the feature, then test it" | "1. Add limiter module. 2. Wire it into the route. 3. Add three test cases." |
| Assumptions | "Should work in most setups" | "Assumes the client IP is available from the request object." |
| Verification | "Make sure it works" | "Run `tests/test_login_limit.py` and the existing auth tests." |
The pattern is the same each time. The strong version names a thing you can look at.
Common errors
- The plan restates the request. If the plan only repeats your words, the agent did no exploration. Ask it to read the relevant code and cite files.
- Files are named but not justified. You cannot tell whether a file is needed or incidental. Ask for a reason on each.
- One giant step. "Implement the limiter and update the routes and tests" cannot be reviewed in pieces. Ask for it to be split.
- Assumptions are missing. Almost every plan rests on some. Ask directly: "What are you assuming about the deployment, the data, and the existing code?"
- Verification is vague or untestable. "It should work" is not a check. Ask for specific commands and cases.
- The plan solves a nearby problem. It may be well formed and still address something you did not ask for. Compare it to your stated goal, not just to itself.
Optional parts that help on larger changes
Two additions are worth requesting when the change is big or risky.
- Out of scope. A short list of things the plan will not touch, such as "no changes to the session middleware." It gives you a line to hold the agent to later.
- Open questions. Points where the agent needs your decision. A plan that surfaces a question is better than one that guesses silently.
A quick checklist
Use this list when you read a plan, and again when you compare the finished diff to it:
- [ ] 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?The first three items test the files and the goal. The fourth tests the assumptions. The last two test the steps and the verification. If any answer is no, send the plan back for revision before you approve it.
Exercise
An agent returns this plan for "add a --verbose flag to the export command": "Files: update the CLI code. Steps: add the flag and make it work. Assumptions: none. Verification: confirm the flag works." Name the weakness in each of the four parts and rewrite one of them so it can be checked.
Show answer
Files: "the CLI code" names no path or reason. Steps: "add the flag and make it work" is one vague step with no order. Assumptions: "none" is implausible, since the plan must assume something about how arguments are parsed and where logging happens. Verification: "confirm the flag works" names no command or case. A checkable rewrite of the files part: "cli/export.py: add a --verbose option to the argument parser and pass it to the export function; tests/test_export.py: add a test that runs the command with and without the flag." A checkable rewrite of the verification part: "Run tests/test_export.py and confirm that output includes progress lines only when --verbose is set, then run the existing export tests."