Sub topic 3
Implementing a Coding Agent’s Plan Safely
Assume you can read a repository, run its tests, and inspect Git diffs. Once you approve a plan, keep the implementation narrow and reviewable.
Implement One Step at a Time
Tell the agent which approved step it may perform. Do not ask it to “finish the feature” when the plan has several independent steps. After each step, inspect the diff and run the relevant tests.
For example:
git diff --check
pytest tests/test_login.py
git diff -- auth/routes.py auth/limiter.pyA small step makes unwanted changes easier to detect. It also lets you revise the plan when the code reveals a new constraint. Approval should apply to the next stated step, not automatically to every possible change.
The workflow is a controlled loop:
Check the Result Against the Plan
After the feature is complete, compare the final diff with the approved plan.
- Are only the expected files changed?
- Does each change implement a planned step?
- Did the agent preserve stated constraints, such as the existing error format?
- Do tests cover the expected behavior and important failure cases?
- Did the agent introduce an assumption that the plan rejected?
Run the project’s normal checks, then review the diff as a design review rather than trusting test success alone.
Keep the Plan for Later Sessions
Save a stable plan in a project document when the work spans sessions or people. Include the goal, constraints, assumptions, ordered steps, decisions, and verification commands. Update it when the scope changes. A saved plan prevents a later session from treating an old assumption as fact.
When to Skip the Plan
Skip a formal plan for a clearly isolated change, such as correcting a typo or changing one documented configuration value. Use a plan when the change crosses modules, affects data or permissions, has several valid designs, or could be difficult to undo.
Common Ways Plans Go Wrong
Plans fail when they describe implementation details before the code is inspected, omit constraints, assume the wrong runtime architecture, or lack a verification method. They also become dangerous when approval is treated as permission for unrelated cleanup.
Exercise
The agent needs to modify an unlisted file during step two. What should you do?
Show answer
Pause, inspect why the file is needed, and revise the plan before approving that additional change.