Agent harness
Plan, checkpoint, then execute
Have the agent propose a plan and stop. Approve or correct it before any changes are made.
The problem
When an agent plans and executes in one go, a wrong early assumption turns into many files of wrong work. Correcting direction after the fact costs far more than correcting it before.
The pattern
Split the run into two phases with a hard stop in between:
- Plan: the agent reads the relevant code, then writes a numbered plan: files to touch, approach, risks, open questions. It makes no changes.
- Checkpoint: you review the plan. Fix misunderstandings, answer questions, cut scope.
- Execute: the agent follows the approved plan, step by step, and flags any deviation instead of improvising silently.
Saving the plan to a file also gives you something to resume from if the session ends.
Template
Phase 1 – plan only. Do not edit any files or run state-changing commands.
Read what you need, then reply with:
1. Your understanding of the task in 2–3 sentences.
2. Files you will create/modify/delete, one line each with the reason.
3. Step-by-step plan (numbered, each step small enough to verify).
4. Risks and how you'll check for them.
5. Open questions (if any, ask them and stop).
Save this plan to `PLAN.md`, then wait for my "approved".
Phase 2 – after approval
Execute the plan in order. After each step, tick it off in PLAN.md.
If you need to deviate from the plan, stop and explain before doing it.When not to use it
- Small, well-understood edits where the plan would be the diff.
- Fully automated pipelines with no human in the loop. Use an automated plan check (a reviewer step or rules) instead of a human checkpoint.
Further reading: Anthropic engineering: Building effective agents