- Claude Code The Words You’ll Need
- Claude Code The Three Levels
- Claude Code What Agentic Really Means
In the last post, we saw that Claude Code works at Level 3: you describe a goal, and an agent does the work in your project. But what is an agent actually doing when it “does the work”? This post opens the hood. There are four ideas to know: the loop, tools, context and permissions.
The agent loop
A chatbot answers once and stops. An agent works in a loop, repeating these steps until the job is done:
- Read: look at the files and information it needs.
- Plan: decide what to do next.
- Act: do one step, such as editing a file or running a command.
- Check: look at the result. Did it work? Was there an error?
- Repeat: go back to step 1 with what it just learned, until the goal is met or it needs to ask you something.
That loop is what “agentic” means. It’s the same way you’d do the job yourself: look, try something, see what happens, adjust.
If you’ve worked in quality or management, this may look familiar. It’s close to the Deming cycle, Plan-Do-Check-Act: plan a change, do it, check the result, then act on what you learned and go round again. The agent’s loop follows the same pattern, but much faster: it can go round in seconds, many times for a single request, with each pass a small step toward the goal.
Tools: how an agent acts
An AI model on its own can only produce text. To do anything in your project, it needs tools. A tool is a specific action the agent is allowed to take. Claude Code’s tools include:
- Read a file: open one of your files and look at what’s in it.
- Search: find files by name, or find every place a word appears in your project.
- Edit or create a file: change some lines in a file, or write a new one.
- Run a command: type a command in the terminal, such as starting your app or running its tests, and read what comes back.
- Search the web: look something up online, such as how a library works.
When the agent decides to use a tool, Claude Code carries out the action and hands the result back to the model. The model reads that result and decides on its next step. That’s the loop in action.
Context: what the agent can see
The agent can only work with what’s in its context window, the text it can keep in mind at once. That includes:
- your prompts and its replies in this session
- the files it has read
- the results of the commands it has run
It does not automatically know about files it hasn’t opened, what you talked about in yesterday’s session, or what’s in your head. This is why a clear prompt helps so much. “Add a phone number to each company” works better when you also say where companies are stored, if you know.
Long sessions can fill the context window. When that happens, Claude Code summarizes the older part of the conversation to make room, and some details get lost. Starting a fresh session for a new task is often a good idea.
Permissions: where you step in
An agent that can edit files and run commands could also make a mess. So Claude Code asks first. Reading and searching usually go ahead on their own, but before it edits a file or runs a command, it shows you what it wants to do and waits. You can say yes, say no, or tell it what to do instead.
For actions you trust, such as running your tests, you can let it go ahead without asking each time. As you get comfortable, you’ll find the balance that suits you.
One request, step by step
Back to our small sales pipeline app. You type: “Add a phone number field to each company.” Here’s roughly what happens:
- Read: the agent searches the project for “company” and reads the files that define a company and the page that shows the company list.
- Plan: it works out that it needs to add a phone column to the database, a phone box to the form, and a phone column to the list page.
- Act: it asks your permission, then edits the three files.
- Check: it runs the app’s tests. One fails: the test that creates a sample company doesn’t expect a phone number.
- Repeat: it reads the failing test, updates it, and runs the tests again. They pass.
- Report: it tells you what it changed and why, so you can review it.
Notice step 4. At Level 2, that failing test would have been your problem to find and fix. Here, the agent found it and fixed it before you saw it. Checking its own work is what makes the loop so useful.
You’re still the director
The loop does the legwork, but you set the goal, approve the actions and judge the result. An agent can be confidently wrong, so always read what it says it did and look over the changes. Later in the series, we’ll see how git makes that review easy and lets you undo anything you don’t like.
Next up
Enough theory. In the next post, we’ll install Claude Code in VS Code and start a first session.