All pages
Agentic development foundations · Lesson 1.2 · 12 min
Plan, act, verify
The loop behind every good run, and how to watch it happen in the Agent sidebar.
After this lesson you can recognise the three phases of a good agent run, ask for each one on purpose, and follow a run in the Agent sidebar closely enough to catch it going wrong before it costs you anything.
Time: 12 minutes · Works on: macOS app.
The loop
Every agent run that ends well goes through the same three phases, whether you ask for them or not.
- Plan. Read enough of the code to understand the change, then decide what to do: which files, in what order, and how to check the result.
- Act. Make the change, in small steps, using tools: edit a file, run a command, read the output.
- Verify. Check the result against the goal. Run the tests, build the project, load the page. If the check fails, go back to plan or act.
A run that goes badly almost always skipped a phase. The agent that edits six files before reading any of them skipped planning. The agent that announces "done" without running anything skipped verifying. The agent that tries the same failing fix four times is stuck in act and has stopped planning.
You can't make a model think harder, but you can make each phase visible and deliberate. That is most of what "managing an agent" means in practice.
Ask for the plan first
For anything beyond a one-line fix, ask for a plan before any edits:
Read
src/billing/and the tests undertests/billing/. Then give me a numbered plan for adding arefundPartial(orderId, amountCents)function: which files change, what each change is, and which test proves it works. Don't edit anything yet.
A plan is cheap to read and cheap to correct. If step 3 says it will change the
public Invoice type and you know three services depend on it, you say so now,
before it's written into twelve files. Once the plan looks right, reply
"Go ahead with the plan" and the same conversation carries it into act.
Two things make plans better:
- Ask for the smallest first step. A plan that ends with a step you can check in a minute gives you an early signal that the approach works.
- Ask what it's unsure about. "List anything you'd want to confirm before starting" surfaces the guesses an agent otherwise makes silently.
Act in small, readable steps
During act, your job is to watch, not to type. Each step is a tool call. Read
the ones that change things. A command you don't recognise, a write to a file
the plan didn't mention, or a sudden rm is your cue to deny the call and ask
why.
Keep steps small enough to approve with confidence. If a single approval would rewrite most of a file, stop and ask the agent to make the change in parts.
Make verification part of the task
The cheapest verification is the one the agent runs itself, before telling you it's finished. Put it in the request:
When the change is made, run
npm test -- billing. If anything fails, fix it and run it again. Stop after three attempts and show me the failure.
That last sentence matters. An agent that can't make a test pass will sometimes start changing the test. A limit and an instruction to show you the failure turns a spiral into a question you can answer.
Then do your own verification. The agent's check tells you the code does what the agent understood. Your review tells you it does what you meant. The Close the loop course goes deeper on both.
When to step in
Stop the turn and re-brief when you see:
- The same tool call, or the same failing command, more than twice.
- Edits to files that have nothing to do with the task.
- A plan that has quietly changed without the agent saying so.
- The agent asking to weaken a check, such as skipping a test or adding
--force.
Stopping is not a failure. A short correction ("the bug is in the parser, not
the formatter; start from parse.ts") usually gets a stuck run moving again.
Do it in TRMNLY
Run one task through all three phases and watch each one in the Agent sidebar.
- Open the Agent tab in the right sidebar (
⇧⌘\) in a project with tests. - Plan without risk. Open the gear menu and, under Persona, choose
Planner. The Planner persona is built for reading: its tool list has no
file-writing or shell tools, and it's told to end with the smallest first step. Send a plan
request like the
refundPartialexample. Setting the posture chip to Observe (⇧⇥in the composer cycles it) has a similar effect for any persona. - Read the plan and correct it in a reply. When it's right, switch the persona back to Default and the posture back to Approve, then send "Go ahead with the plan, then run the tests."
- Watch act. Each step shows as a tool card. Read tools run on their own.
Write tools wait for you with the exact command line or the diff. Use
⌃Jand⌃Kto move between the turn's cards,⌘↩to approve the focused card and⌘⌫to deny it. Edit args lets you fix a call before it runs. - When one turn wants to write two or more files, a banner shows how many file changes are pending. With Self-critique multi-file edits on in the gear menu (it's on by default), a cheaper model tries to find problems with the combined change and shows its objections on the approval cards. Read them before you press Approve all.
- Watch verify. The test run appears as a card with its output. If it
fails and the agent tries again, count the attempts. If it repeats itself,
press
⌘.to stop the turn and send a correction. - While a turn is running you can type your next instruction and press Return. It's queued and sent when the turn finishes. Stopping a turn clears the queue.
- When the run finishes, open the Snapshots list in the transcript to see every file the agent wrote. The restore arrow beside a file undoes that write if you need it.
- Try the review diff smart action above the composer. It starts by
running
git diffand reviewing what changed, which is a quick second look before you open the Review tab yourself.
Two gear-menu items help when a long run gets hard to follow. Fold tool calls in transcript collapses the cards so the agent's reasoning reads as one thread. What the model sees… shows the exact context the next turn will start from, which is the first place to look when the agent seems to have forgotten something.
The footer under the transcript shows what the session has cost and how many tokens it used. Glance at it after each phase. A plan should be cheap. If act is costing far more than you expected, that's another reason to stop and look.
Check yourself
- You got a numbered plan from the Planner persona before any file changed.
- You approved or denied at least one write by reading its diff or command.
- The agent ran a test as part of the task, and you saw the result in a card.
- You can name two signs that a run is stuck and should be stopped.
Go further
- Your first task — tool cards, approvals and the queue in detail
- Choose a posture — how much the agent may do unasked
- Tests are the contract — a failing test as the definition of done
- Agent — personas, the queue and the Context Inspector