The Agentic Loop
Watch Claude Code on a real task and you will see a rhythm: it reads something, changes something, runs something, then reads again. That rhythm is the agentic loop. Once you can see its shape, you know exactly where to steer it.
The rule
Gather, act, check — and repeat until the check passes.
- Gather context. Read files, search for names, look at recent changes, run harmless commands to learn how the project works.
- Act. Edit files or run commands that move towards the goal.
- Check. Run the tests, read the output, compare the result with what you asked for.
- Repeat. Every tool result goes back to the model, which decides the next move. The loop ends when the check passes, when it needs your input, or when you stop it.
You are part of this loop, not outside it. You approve actions, you can interrupt at any step, and you can redirect it with a new message. Each pass also adds file contents and command output to the conversation, which is why a wandering task grows slower and costlier than a short, well-aimed one.
The weakest link in most loops is the check. If Claude has nothing to run, "check" shrinks to "this looks plausible to me", and the loop can finish on code that has never been exercised. A clear, runnable check — a failing test, a command whose output should change, an exact expected number — turns the loop from guessing into converging.