How Claude Code Runs Your Tasks: Where the Model Thinks and Where the Code Runs
When I started using Claude Code with Claude Opus 5.5 and Claude Fable 5.1, I had a simple question: when the agent builds or runs my code, where does that happen? On my laptop, or on Anthropic’s servers?
The short answer is both, but for different jobs. The model thinks on Anthropic’s servers. The tools run on your machine. This post explains how that works, step by step, with diagrams. I keep the language simple, and I explain each new word the first time it appears.
What you will learn:
- The two places where work happens: your machine and Anthropic’s cloud
- The agent loop: how one task becomes many small steps
- Exactly what data leaves your machine, and what stays
- Why choosing Opus or Fable doesn’t change where anything runs
- How a cloud session is different from a local session
- When your hardware matters for speed, and when it doesn’t
1. The Big Picture: Two Places, Two Jobs
Claude Code is made of two parts that talk to each other over the internet:
| Part | Where it lives | What it does |
|---|---|---|
| The model (Opus 5.5 or Fable 5.1) | Anthropic’s servers | Reads the conversation, thinks, writes text, and decides which tool to use next |
| The Claude Code app (CLI, desktop app, or IDE extension) | Your machine | Shows you the chat, runs the tools the model asks for, and sends results back |
A tool is an action the app knows how to do: run a shell command, read a file, edit a file, search the code, open a web page, and so on.
In simple words: the model is the brain, and it lives in Anthropic’s cloud. Your machine is the hands. The brain says “run dotnet test”, and your machine runs it.
One important detail: the model can’t touch your disk. It never connects to your machine. It only sees the text the app sends to it. If the app never reads a file, the model never sees that file.
2. The Agent Loop, Step by Step
An agent is a model that can use tools in a loop: it looks at the task, uses a tool, looks at the result, and decides what to do next. It keeps going until the task is done.
Let’s follow one real request: “Fix the failing test.”
Here is what happens at each step:
- You type a request in the Claude Code app.
- The app sends a request to the Anthropic API. It includes your message, the app’s instructions to the model (the system prompt), and a list of tools the model may use.
- The model replies with a tool call. A tool call is a small, structured message like “use the Bash tool with the command
dotnet test“. The model does not run anything. It only asks. - The app checks permissions and runs the tool on your machine. Depending on your permission mode, it may ask you first (“Allow this command?”).
- The tool produces output, for example a test failure message.
- The app sends that output back to the model as a tool result.
- The model reads the result and asks for the next tool, for example “edit this file”.
- The app edits the file on your disk.
- The app reports back that the edit worked.
- The loop repeats (run the tests again, read another file, …) until the model decides the task is done and writes a final answer without a tool call.
- The app shows you the answer.
Key idea: every arrow to the right of the app is a network round trip to Anthropic. Every arrow between the app and the tools stays on your machine.
3. What Data Leaves Your Machine?
This is the part I wanted to understand most. The rule is simple:
Only what goes into the conversation is sent to Anthropic. Everything else stays on your machine.
Some practical points:
- If the agent reads a file, its contents are sent. This includes
.envfiles or secrets if the agent opens them. Be careful what you ask it to read, and use permission rules to block sensitive paths. - Command output is sent, not the command’s work. A 5-minute build runs on your CPU. Only the text it prints (for example, “Build succeeded” or an error list) goes to the model.
- The model’s edits are written by your machine. The model sends the new text of the file, and the app writes it to your disk.
The whole conversation is sent every turn
The Anthropic API doesn’t remember anything between requests. So on every round trip, the app sends the whole conversation so far, not just the newest message. That is how the model “remembers” what it did three steps ago.
Two features keep this fast and affordable:
- Prompt caching: the server can reuse the unchanged beginning of the conversation instead of processing it again from scratch.
- Compaction: when the conversation gets too long for the model’s context window (the maximum amount of text it can read at once), Claude Code summarizes the older parts so work can continue.
This is also why very long sessions can feel slower: there is simply more text to send and read on every turn.
4. Does Choosing Opus 5.5 or Fable 5.1 Change Anything?
It changes which brain answers. It doesn’t change where anything runs.
When you pick a model in the app, Claude Code puts that model’s ID in every API request. The agent loop, the tools, the permission checks, and the files on your disk are exactly the same. Different models can differ in quality, speed, and price, but the workflow and the data flow in this post apply to every model.
5. Local Session vs Cloud Session
So far we talked about a local session: you run Claude Code on your own machine. There is a second option, a cloud session (for example, Claude Code on the web, or moving a desktop session to the cloud). In a cloud session, the tools run somewhere else.
| Local session | Cloud session | |
|---|---|---|
| Where the model runs | Anthropic’s cloud | Anthropic’s cloud |
| Where commands run | Your machine | A sandbox container at Anthropic |
| Which files it sees | Your real working folder | A copy of your GitHub repo |
| Which tools are installed | Whatever you installed | Whatever the cloud environment has |
| How you get the changes | They are already on your disk | A pushed branch or pull request |
| Can keep working when your laptop is closed | No | Yes |
Rule of thumb: use a local session when the task needs your machine (local databases, your SDKs, the iOS Simulator, private files). Use a cloud session for self-contained work that should keep going without your laptop.
6. Subagents Follow the Same Rule
Claude Code can start subagents: helper agents that take a smaller piece of the task (like “search the repo for every place we call this API”) and report back. Each subagent has its own conversation with the model, but its tools still run in the same place as the main session.
This matters for two reasons. Many subagents running builds at the same time can put real load on your machine. And each subagent only sends its own conversation to the model, which keeps every context small and focused.
7. Does My Hardware Make the Agent Faster?
Now we can answer the speed question with the picture from Figure 2. A task’s time is split into three kinds of work:
- Model time: the model reads the conversation and writes its reply. This happens on Anthropic’s servers. Your hardware has no effect here.
- Network time: sending each request and getting the reply. Your internet connection matters here.
- Tool time: builds, tests, installs, searches. This happens on your machine. Your CPU, RAM and disk matter here.
| Your machine affects | Your machine does NOT affect |
|---|---|
| How fast builds, tests and installs run | How fast the model thinks and writes |
| How fast large repos are searched | How smart the answers are |
| How smoothly the app, browser pane and simulators run together | Which model you get (a new laptop and an old one get the same Opus) |
Other things that change speed more than hardware: the model you choose, fast mode and effort settings, how long the conversation has become, and your network.
8. Putting It All Together
Here is the whole flow in one list:
- You type a request into Claude Code on your machine.
- The app sends the conversation to the Anthropic API, with the model ID you picked (Opus 5.5, Fable 5.1, …).
- The model thinks in Anthropic’s cloud and replies with text or a tool call.
- The app runs the tool on your machine (local session) or in a sandbox (cloud session), after checking permissions.
- The tool’s output is added to the conversation and sent back to the model.
- Steps 3–5 repeat until the model gives a final answer.
9. Cheat Sheet
| Question | Answer |
|---|---|
| Where does the model run? | Always on Anthropic’s servers |
| Where do my commands and builds run? | On your machine in a local session; in a sandbox container in a cloud session |
| Can the model read my disk directly? | No. It only sees what the app puts into the conversation |
| What gets sent to Anthropic? | Your messages, the files the agent reads, command output, and the model’s own replies |
| Does Opus vs Fable change the workflow? | No. It only changes which model answers |
| Does my hardware make the agent smarter? | No |
| Does my hardware make the agent faster? | Only for tool work (builds, tests, installs, searches) |
| What if a tool isn’t installed on my machine? | The command fails in a local session, the same as if you ran it yourself |
The one sentence to remember: the brain is in the cloud, the hands are where your session runs.
Leave a comment