The agent loop: read, plan, act, verify
What you'll learn
Estimated time: 12 minutes
Autocomplete finishes your line. An agent finishes your task. Between 2024 and 2026, every major coding tool converged on the same underlying loop: read the relevant context, plan a change, act on files or the terminal, verify the result, wrapped in a harness that decides what the model is allowed to touch. This course uses Claude Code and Codex CLI for its worked examples, since they carry the loop furthest into the terminal and the editor; the same four steps show up in GitHub Copilot’s agent mode and in Cursor too, under different menu names.
- Describe the read, plan, act, verify loop in plain terms.
- Map that loop onto Claude Code and Codex CLI in detail, and recognise the same steps in Copilot agent mode and Cursor.
- Explain why the harness and its permission model, not the model itself, decide how much you can trust unattended work.
Video lesson
The same bug-fix task runs through Claude Code and Codex CLI side by side inside VS Code, showing the identical read-plan-act-verify loop; a shorter clip shows Copilot agent mode and Cursor running the same four steps under their own names.
From a suggested line to a finished task
GitHub Copilot began in 2021 by finishing the line you were typing. An agent is a different kind of tool: given a task, it reads the files and commands it needs, decides what to do, makes the change itself, and checks whether the change worked. GitHub Copilot itself now ships this pattern too, as agent mode in the editor and a Copilot CLI with a Plan mode and an Autopilot mode, alongside Cursor’s Agent mode and Background Agents. This course focuses on the two tools most teams reach for first, Claude Code and Codex CLI, and uses them for every worked example.
Anthropic’s Claude Code and OpenAI’s Codex CLI both started as terminal-native agents, and both now run inside VS Code through an official extension, so the same read-plan-act-verify loop is available whether you work from the command line or the editor. Claude Code added subagents, skills (both covered later in this course) and cloud sessions you can start and return to later; Codex CLI added multi-step plans, repository-stored skills and subagents you can use to split up a larger investigation, plus cloud tasks with the same hand-off-and-check-later pattern.
The same four steps, in Claude Code and Codex CLI
Read means the agent inspects the relevant files, tests, and sometimes a running process, before proposing anything. Plan means it states an approach, ideally one you can approve or correct before code changes exist. Act means it edits files or runs commands inside whatever the harness allows. Verify means it checks its own work against tests, a build, or another form of evidence, rather than declaring success by assertion.
A worked example in Claude Code: prompted with “The signup form accepts an email with no @ character. Find why, fix it, and tell me how you checked,” it read src/forms/signup.ts and its test file first, stated a one-line plan (add a guard clause before the existing regex check), made the edit, then ran the test suite. Its final message: “Added a guard clause for missing @ in validateEmail(). Ran npm test — 47 passed, 0 failed.” Four steps, one sentence each, no vendor jargon required to follow any of them.
- Claude Code: reads via its own file and search tools, offers a plan mode you approve before anything changes, edits files and runs commands inside a permissioned session, and can eliminate routine prompts with its classifier-based auto mode once you trust the pattern; verification runs through your tests or hooks.
- Codex CLI: multi-step plans, skills stored in the repository, and multiple concurrent subagents for splitting up a larger investigation; sandbox modes from read-only through workspace-write to full access pair with an approval policy that decides whether it asks first, and cloud tasks let you hand a run off and check on it later (as of mid-2026).
- GitHub Copilot’s agent mode and CLI, and Cursor’s Agent mode and Background Agents, run the identical loop under their own menu names and their own approval settings.
Why the harness decides how much to trust it
The harness is the program wrapped around the model: what it can read, which commands it can run without asking, whether it can reach the network, and where a human has to approve before anything proceeds. A capable model inside a permissive harness with no verification step is not more productive than a careful one; it is simply further from view before something goes wrong.
This is why Claude Code separates what a session may do automatically from what needs your explicit approval, and why Codex CLI pairs a sandbox mode (what it can technically touch) with an approval policy (when it must ask first) rather than treating autonomy as one on/off switch. Cursor’s Background Agents and Copilot CLI’s Autopilot mode raise the same question under their own settings. The vendor names change every year; asking what this agent can read, what it can change without asking, and how you will know if it got something wrong does not.
Put it into practice
1. Prepare your practice material
Write three to five sentences describing a real or fictional situation in which you need to explain the loop every coding agent runs, and apply it using Claude Code and Codex, recognising the same steps in Copilot and Cursor. Include the intended user, one constraint and how you will check the result.
2. Choose your AI tool
Choose one tool for this exercise. The remaining steps will adapt to it.
3. Copy the prompt
Prompt you will use
Open Claude Code or Codex CLI, in the terminal or inside VS Code. Give it one small, bounded task (fix one failing test, or add one guard clause). Before it changes any file, ask it to state its plan in three sentences: what it will read, what it will change, and how it will verify the result. Compare that plan against what actually happened afterwards. If your team uses Copilot agent mode or Cursor instead, run the same check there; the four steps and the comparison still apply.
4. Open ChatGPT · Paste the prompt into a new chat
Open a new chat in ChatGPT and paste the copied prompt into the message box.
Open ChatGPT5. Add your practice material
Paste your prepared scenario beneath the prompt, separated by a heading such as “Practice scenario”.
6. Send, then review the result
Answer any clarifying questions. Before using the result, check it against your source and the completion checks below.
Before you continue
You can name the four steps of the loop without referring to any one vendor.
You identified what your tool’s harness lets the agent do without asking first.
The agent’s stated plan was checked against what it actually did.

