| exercises | ||
| CLAUDE.md | ||
| README.md | ||
The Agent Loop
Claude Code reads, thinks, acts, and repeats until your task is done. This is the core pattern that makes it different from every other AI coding tool.
Companion repo for the article The Agent Loop on From AI to Chitta.
What You Will Learn
By working through the exercises in this repo, you will be able to:
- Recognize the agent loop in action and understand what Claude is doing at each step
- Control the loop with Plan Mode, /rewind, and manual intervention
- Design prompts that give the loop clear goals and produce reliable results
These are not theoretical outcomes. Complete the exercises and you will see the loop working on your own tasks.
Prerequisites
- Claude Code installed (
claude --versionprints a version) - A Claude Pro, Team, or Enterprise subscription
- Basic comfort with the terminal (cd, ls, opening files)
No npm install, no Docker, no build step.
Exercises
| # | Exercise | What It Covers |
|---|---|---|
| 01 | Watch the Loop | See the read-think-act cycle on a real task |
| 02 | Control the Loop | Plan Mode, /rewind, stopping a runaway agent |
| 03 | Design for the Loop | Write prompts that guide the loop effectively |
Start at exercises/01-watch-the-loop.md. Each exercise links to the next.
How to Use This Repo
"Show me what it does": Browse exercises/ and read through
the prompts. Understand the pattern before you run anything.
"Let me actually do it": Open Claude Code in this directory and follow the exercises in order. Each one has an expected output section so you know when you have succeeded.
git clone https://git.fromaitochitta.com/fromaitochitta/claude-code-agent-loop.git
cd claude-code-agent-loop
claude
Then open exercises/01-watch-the-loop.md and paste the prompt into Claude Code.
Domain
Claude Code - This repo is part of the Claude Code Foundation series on From AI to Chitta. See the full series for related concepts.
About
Built by Kjell Tore Guttormsen as part of the From AI to Chitta project, exploring the intersection of AI tools and inner development.
MIT License.