Sub topic 4
Write the planning request
This chapter covers how to phrase the message that asks a coding agent for a plan. It assumes you have used a coding agent on a repository, can read a diff, and can run the project's tests. Earlier chapters covered why a plan comes first and what a useful plan contains. Here the focus is the request itself.
What the request has to do
A planning request has one job: get a plan you can review, and nothing else. If the request is vague, the agent fills the gaps with guesses. If it does not forbid edits, the agent may start changing files because it treats "add rate limiting" as an instruction to do the work.
A good planning request has four parts:
- Goal. What should be true when the work is done, stated so you could check it.
- Constraints. Limits on how the goal may be met, such as no new dependencies or an unchanged response format.
- A no-edits rule. An explicit statement that the agent must only read and plan.
- Required sections. The parts the plan must contain, so that you can review it in a predictable shape.
You can also invite questions. That adds a fifth part, covered later in the chapter.
A worked example
Here is a planning request for adding rate limiting to a login endpoint.
I want to add rate limiting to the /login endpoint.
Goal: reject more than 5 failed attempts per IP address in 10 minutes.
Constraints: do not add new dependencies; keep the existing error response format.
Do not edit any files yet. Read the relevant code and give me a plan with:
1. The files you expect to change and why
2. Ordered implementation steps
3. Risks and anything you are assuming
4. How we will test that it works
Ask me questions if something is unclear.Each part of this request does specific work.
- The opening line names the feature and the endpoint. The agent knows where to start reading.
- The goal line contains numbers: 5 attempts, 10 minutes, per IP address. "Add rate limiting" alone leaves the agent to choose a threshold, a window, and a key. Each of those choices changes the design.
- The constraints line removes two common detours. Without it, the agent might add a library or change the error JSON, and you would learn that only when you read the diff.
- "Do not edit any files yet" sets the mode. The word "yet" tells the agent that editing comes later, after approval.
- The numbered list defines the shape of the answer. Files, steps, risks, and verification match the parts of a useful plan from the previous chapter.
- The last line gives the agent permission to ask instead of guessing.
Write a goal you can check
A goal is checkable when someone could write a test for it. Compare these two:
| Weak goal | Checkable goal |
|---|---|
| Make login more secure | Reject more than 5 failed attempts per IP in 10 minutes |
| Speed up the report page | The report page's database queries drop from about 40 to fewer than 5 |
| Clean up the config code | Read all settings in one module, with no behavior change |
The weak goals are directions, not outcomes. An agent given "make login more secure" might add password rules, rate limiting, or logging, and each of those is a reasonable reading. You then review a plan for a problem you did not mean to pose.
If you cannot state a checkable goal yet, say so in the request. For example: "I am not sure what the right limit is. Propose options with trade-offs and recommend one." That asks for a plan that includes a decision, which is a legitimate request.
Choose constraints that matter
Constraints are the things you would otherwise reject in review. Think about what a reasonable but uninformed engineer might do that you would not accept. Common categories:
- Dependencies. "Do not add new packages."
- Compatibility. "Keep the existing error response format." "Do not change the public function signatures."
- Scope. "Only touch the
authpackage." - Style and tooling. "Follow the existing test layout in
tests/." - Operational limits. "Must work with several server processes."
Keep the list short. Five precise constraints are easier for the agent to honor and for you to check than fifteen general ones. State only constraints that are true. A constraint you do not actually hold wastes the agent's effort and can rule out the best solution.
Note that the example above omitted the multi-process constraint. That omission is deliberate in this tutorial, because it produces a plan with a wrong assumption for you to catch in review. In your own requests, include operational facts you already know.
Make the no-edits rule explicit
Agents differ in how they treat a request that sounds like a task. Some have a dedicated planning mode that blocks writes. Others rely only on your wording. Do not assume either. Write the rule in the request, and then check the result.
Effective wording is direct and bounded:
- "Do not edit any files yet."
- "Do not run commands that change state. Reading files and searching are fine."
- "Do not create a plan file. Print the plan in your reply."
The second form is worth using when the agent has shell access, because a command such as a formatter or a migration can change files without an explicit edit. The third form avoids a stray file landing in your working tree. If you do want the plan saved, the chapter on plan artifacts covers that.
After the agent replies, confirm that nothing changed:
git status --shortAn empty result means the agent kept to the rule. If files appear, revert them before reviewing the plan, so the plan and the working tree stay separate.
Specify the sections you want
Asking for named sections gives you a plan you can compare against a checklist. The four sections in the example each guard against a different failure:
| Section | What it protects you from |
|---|---|
| Files and why | Changes in places you did not expect |
| Ordered steps | One large change you cannot review in pieces |
| Risks and assumptions | Hidden guesses that turn into bugs |
| Verification | A result no one can check |
You can add sections when the task calls for them. A schema change might need "rollback approach". A user-facing change might need "what the user will see". Add a section only when its absence would leave a real gap.
Invite questions
Ending with "Ask me questions if something is unclear" lets the agent stop and ask. Without it, many agents choose an interpretation silently and present the plan as settled. With it, ambiguities surface early, when they are cheap to resolve.
You can tighten this. "If any answer would change the design, ask before writing the plan" makes the agent hold the plan until you reply. "State your assumptions instead of asking, unless a wrong guess would be costly" suits a task where you want a draft quickly. Pick the one that fits how much you want to be interrupted. The next chapters cover how to answer questions and check assumptions.
Point at the code, not only the feature
The agent will read the repository, but you can shorten that by naming starting points. "The login handler is in auth/routes.py" saves a search and avoids the agent choosing a similarly named file. If a similar feature already exists, say so: "The password reset endpoint already has a throttle; follow that pattern if it fits." This steers the plan toward your codebase's conventions.
Do not paste large amounts of code into the request. The agent can read files itself, and pasted code goes stale. Name paths and let it read them.
Common mistakes in planning requests
- Describing the solution, not the goal. "Add a Redis counter in
login()" skips the plan. If you already know the design, say that you want a plan that confirms or challenges it. - Leaving out the no-edits rule. The agent starts implementing, and you review a diff instead of a plan.
- Asking for a plan and implementation together. "Make a plan and then do it" removes the approval point. The reason for planning is that you decide between the two.
- Overloading one request. A request that spans three features gets a shallow plan. Split it and plan one piece at a time.
- Unmeasurable goals. Words like "better", "cleaner", and "faster" give you nothing to verify against.
Summary of the template
You can reuse this skeleton for most tasks:
I want to <change> in <area or file>.
Goal: <a checkable outcome>.
Constraints: <only the limits that are true>.
Do not edit any files yet. Read the relevant code and give me a plan with:
1. The files you expect to change and why
2. Ordered implementation steps
3. Risks and anything you are assuming
4. How we will test that it works
Ask me questions if something is unclear.Exercise
A teammate writes this request: "Make the search page faster. Go ahead and make a plan and then implement it." Name three problems with it and rewrite it as a planning request.
Show answer
Problems: (1) "faster" is not a checkable goal, (2) there are no constraints, so the agent may add dependencies or change behavior, and (3) "then implement it" removes the approval point, and there is no no-edits rule or list of required sections. A rewrite: "I want to speed up the search page. Goal: the search endpoint makes fewer than 5 database queries per request, down from about 40. Constraints: do not add new dependencies; keep the response format unchanged. Do not edit any files yet. Read the relevant code and give me a plan with: 1. The files you expect to change and why 2. Ordered implementation steps 3. Risks and anything you are assuming 4. How we will test that it works. Ask me questions if something is unclear."
Exercise
You sent a planning request that said "Do not edit any files yet." After the reply, how do you confirm the agent obeyed, and what do you do if it did not?
Show answer
Run git status --short. An empty result means no files changed. If files are listed, revert those changes before you review the plan, so the working tree matches the state the plan describes. Then tighten the wording, for example by adding "Do not run commands that change state."