Topic 2 of 5 · 4 min read
Decomposing goals into verifiable steps
Goal: Break a goal into ordered steps that each end with a check the agent can run itself.
A good step is small enough to finish in one go and ends with a check the agent can run itself. If the agent cannot tell whether a step worked, it will say it did.
Check yourself · 1 of 3
What makes a step "verifiable" in an agent plan?
Why it matters
An agent that gets "migrate the app to the new payments SDK" and no structure will drift. It makes many edits, loses track of what is finished, and reports success from memory. Models guess and sound sure when wrong, so the check has to come from outside the model: a command, a test, a diff, a file that must exist. Anthropic's write-up on long-running agents reaches the same point: give the agent a clear list of features and a way to test each one, or it will declare victory early.
How to split a goal
- Start from the end state. Write what is true when the work is done: "All calls to
oldClient.chargeare gone; the checkout tests pass." - Split by dependency. What must exist before something else can start? Schema before queries, interface before callers.
- Size each step to one verifiable change. A useful test: could you review this step as its own small pull request? If not, split it.
- Attach a check to every step. Prefer something the agent can run: a test command, a type check, a grep that must return nothing, a curl that must return 200.
- Mark risky steps. A step that deletes data or calls a paid API should stop for approval.
Before and after
Goal: "Make the CSV export handle commas in fields."
Weak:
1. Fix the CSV export
2. Make sure it works
Better:
1. Write a failing test: a row with the value "Smith, Jo" must export as one quoted field. Check: the test fails for the right reason.
2. Switch the writer in export.ts to a CSV library that quotes fields. Check: the new test passes.
3. Run the whole export test file. Check: no other test changed status.
4. Export a real sample file and open it. Check: row count equals input row count.
The weak version has no check the agent can run. The better one starts with a failing test, which also proves the bug is real.
What goes wrong
- Steps that are too big. "Refactor the module" fails halfway and nobody knows what is done.
- Steps that are too small. Forty micro-steps burn tokens and your attention, and the agent loses the goal.
- Checks the agent cannot run. "Looks good in the browser" needs a human, so label it that way or add a script.
- Checks that cannot fail. A test that passes before and after the change proves nothing.
Examples
Test first, then fix
For a bug report, the first step is a failing test that reproduces it. Check: the test fails with the same symptom as the report. Only then change the code. The agent now has a check that is true at the end for a reason it can see, instead of a belief that the bug is gone.
A check a human must do
The step "the new empty-state screen looks right" cannot be run by the agent alone. Either add a screenshot comparison or mark it as "human check" in the plan, so the agent stops and asks instead of ticking it off.
Key points
- Write the end state first, then split the work by dependency order.
- Size each step so it could be reviewed as its own small change.
- Every step ends with a check the agent can run: a test, a command, a grep or a request.
- A check must be able to fail; a test that passes both before and after the change proves nothing.
- Mark steps that delete data or spend money so they stop for approval.
Common mistakes
- Writing steps as activities ("work on the parser") instead of outcomes with a check.
- Using checks that cannot fail, such as a test that already passed before the change.
- Making steps so large that a failure halfway leaves no clear point to resume from.
- Leaving risky steps, such as deleting files or calling a paid API, without a stop for approval.
Check yourself · 2 of 3
Goal: "Remove all uses of the deprecated oldClient.charge call." Which check best ends the last step?
Check yourself · 3 of 3
You ask an agent to fix a reported bug. Which first step gives the plan the strongest check?
Practice items, not counted towards your mastery.
Start here
- Plan-and-Solve Prompting: Improving Zero-Shot Chain-of-Thought Reasoning (opens in a new tab)PaperFree
Shows that asking a model to plan first and then carry out the plan reduces missing-step errors.
- Reflexion: Language Agents with Verbal Reinforcement Learning (opens in a new tab)PaperFree
The source for reflecting on a failed attempt in words and carrying the lesson into the next try.
- Plan-and-Execute Agents (LangChain blog) (opens in a new tab)ArticleFree
Compares plan-and-execute with a plain tool loop and explains the cost and speed trade-off.
More for this topic
- Effective harnesses for long-running agents (Anthropic) (opens in a new tab)ArticleFree
Feature lists, progress files and git checkpoints that keep long agent work honest and resumable.
- Best practices for Claude Code (Claude Code docs) (opens in a new tab)DocsFree
Advice on exploring and planning before coding and on giving the agent a way to verify its own work.