Sub topic 2
Let the Agent Read Before It Plans
Assume you can read the repository, run its tests, and use version control. This chapter focuses on planning changes safely before implementation.
Let the Agent Read Before It Plans
A plan based only on your request may miss the project’s architecture, existing helpers, configuration, or test conventions. Ask the agent to inspect relevant files first, but forbid edits during this phase.
Read-only exploration should answer:
- Where is the behavior implemented?
- Which modules, configurations, and tests are related?
- Which existing patterns should the change follow?
- What constraints does the repository impose?
I want to add rate limiting to the /login endpoint.
Before proposing a plan, inspect the relevant routes, configuration, and tests.
Do not edit any files.
Then describe the affected files, implementation steps, risks, assumptions,
and verification method. Ask questions about anything unclear.Answer Questions and Check Assumptions
Treat the first plan as a proposal, not a fact. Check claims about deployment, storage, interfaces, dependencies, and testing. For example, an in-memory limiter is incorrect if the application runs in several processes. Correct the assumption before implementation.
Review and Revise the Plan
Review the plan like a design proposal. Confirm that it solves the requested problem, names expected files, orders the work, identifies risks, and explains verification. Remove unnecessary files or steps. Ask for a revision when the plan uses the wrong shared service, hard-codes configuration, or changes an error format you need to preserve.
Keep revising until the scope and assumptions match the repository and your goal.
Approve Before Editing
Approval is a deliberate control point. Say exactly what may happen next, such as: “Approved. Implement step 1 only. Then show the diff and test results.” This keeps each change small and checkable. After implementation, compare the diff and test results with the approved plan.
Exercise
The plan proposes a new in-memory counter, but the application uses multiple worker processes. What should you do?
Show answer
Reject that assumption, tell the agent to use the project’s shared store, and request a revised plan before approving any edits.