CHAPTER 02 · The Agent Loop · 1 / 5
Why it matters
Understanding the loop demystifies everything else. Costs, context limits, the need for compaction, the value of subagents, the design of approval systems: all of them are consequences of this loop running and the prompt growing each time around. Once you can see the loop, the rest of the harness stops looking like a bag of tricks and starts looking like a set of sensible responses to one repeating process.
It also tells you where you can intervene. You (the user) are part of this loop. You can interrupt at any point to steer, add context, or redirect. The agent works autonomously but stays responsive. That is why Claude Code lets you press Escape to stop a running tool, or type a correction mid-stream that the model reads as soon as the current action finishes.