The agent stack
When an AI agent fails, the model is not always the reason. I only understood this after asking Claude to explain how it actually works — a conversation that produced what we came to call ‘the agent stack’: ten layers — from the raw model, to the loop that makes it an agent, to the memory that survives between sessions. This page is that map. It's changed how I use these tools, mostly because it tells me where to look when something goes sideways.
Where it usually goes wrong
Three failures account for most of what goes wrong, and each has an address:
L1 Context — it was never shown the thing you assumed it knew
L5 State & memory — it lost track of something from earlier
L3 Execution — a tool quietly returned nothing, and it carried on anyway
Ask “what could it actually see?” first. Most of the time that's the whole answer — and it points straight at which layer to fix.
What this explains
“Can it do X?” is rarely a question about intelligence. It's almost always about what's connected (L2 Tools) and what hands it has (L3 Execution) — which is why the answer often changes with five minutes of setup rather than a better model.
Recent progress isn't mainly a smarter model. What changed how it feels to use is better handling of what it can see (L1 Context), what it's plugged into (L2 Tools), what it remembers (L5 State & memory) and what it can hand off (L7 Delegation).
What you actually control
Your two biggest levers are L1 Context and L5 State & memory. You can't change the model, but you decide what gets put in front of it and what gets written down for next time.
Nearly all the improvement available to you lives in those two — front-load the context, write things down, and push wide searching out to helpers.
Top to bottom: the bare model first, then one layer at a time.
Inference
The trained model on its own. Text in, text out. No memory of a minute ago, and no ability to do anything — it can only produce words.
claude-opus-5. It was trained to work inside the control loop above (L4) — knowing when to reach for a tool and when to stop is part of the training, not something added afterwards.
Which is why a model built for conversation behaves badly as an agent even when it's given identical tools.
Context assembly
Everything the model is shown before it writes a word: your message, the conversation so far, its instructions, files it read, results from tools. It knows nothing else.
My instructions, our conversation, your project notes, and small reminders the software slips in as we go. Two things shape how this behaves:
Prompt caching. Everything said so far is kept ready to reuse, so it isn't re-read from scratch each turn — but only while the earlier part stays untouched. Carrying on at the end of a conversation is cheap; going back and editing an earlier message throws the saving away.
Deferred tools. About 150 tools are available to me, but only the descriptions of the ones I need get loaded, because those descriptions occupy the same space as your actual work. A session that wanders across five unrelated topics spends most of its room on setup rather than on you.
Tool interface
The menu of things the model is allowed to ask for. Asking is all it does — it writes a request, and something else decides whether to carry it out.
Reading and writing files, running commands, searching. Plus MCP — a shared standard for plugging in outside services, which is how your Gmail, Calendar, Drive, Chrome and the link to your own computer all turn up as things I can use.
Why the standard matters: anyone can build a tool without Anthropic being involved. That's the whole reason the list of things I can connect to keeps growing.
Execution / effectors
The part that actually does it — runs the command, opens the file, makes the call — then reports back what happened. Real-world friction lives here.
A real computer. Claude can create a file, run a shell command, install a package, execute a script, call an API — and, the part that matters most, see what came back: the output, the error message, the contents of the file it just made.
That second half is what makes this layer more than a remote control. Claude meets a wrong file path, a package that won't install or a service that's down the same way you would — reads the complaint, and usually works around it without asking.
Where the hands are matters too: this session works on a machine in Anthropic's cloud plus a granted link into folders on your own computer, and files don't cross between the two by themselves. Same brain, different hands is most of what separates Claude in a terminal from Cowork from Claude in Chrome.
Control loop the agent is here
Look at everything → decide the next move → do it → look at what came back → decide again. Round and round until the model judges the job done.
The loop ends when I reply to you without asking to use another tool. There's no fixed number of steps — I decide when I'm finished, which is also why I can occasionally stop too early or grind on too long.
When you interrupt me, or a permission prompt appears, you're pausing this loop part-way round.
State & memory
Anything that outlives a single step. A conversation has a size limit but a job might not fit inside it, so useful things get written somewhere they'll survive.
Four separate places, with four different lifespans — most people assume there's only one:
- What we've said in this conversationdoesn't carry over
- Files I create in the session's workspacegone when it ends
- Project memory on your computerevery future session
- Project docs on claude.aieveryone in the project
So: the default is that things disappear. Anything you'd hate to re-explain needs to land in one of the bottom two.
Planning
Breaking a big job into steps, ticking them off, and rethinking when a step fails. Useful on long jobs, overhead on short ones.
The checklist you sometimes see me build, and plan mode — where I write out what I intend to do and wait for you to approve before touching anything.
So: plan mode is the one to reach for when a mistake would be annoying to undo. For a single contained job it just slows things down — I skipped it for this page.
Delegation
Handing part of the job to a fresh copy of the agent that starts with a clean slate, then keeping only its answer.
I can send off helper agents — one each for different parts of a search — and get back short answers instead of forty files' worth of text.
The reason isn't teamwork, it's tidiness: the helper's mess stays in the helper. My main thread only ever sees the conclusion.
So: on anything broad — “check every file for X” — it's worth asking me to use helpers. It's faster and leaves more room for the actual work.
Governance
The rules about what the agent may touch and when it has to ask first. Same abilities, different leash.
The prompts asking you to approve something, plan mode waiting for your sign-off, and the fact that I can only reach the folders you specifically granted — not your whole computer.
Refusals come from two different places: some are trained into the model, some are enforced by the software around it. That's why behaviour can differ between products running the same model.
Adaptation
The agent getting better at your work over time: saved instructions, reusable procedures, preferences it picked up.
Skills — folders of written-down instructions I load only when they're relevant. One of them decided the colours on this page. Also your CLAUDE.md, and memory notes that change how future sessions behave.
The catch worth understanding: using it doesn't train it. No session updates the model — for you or anyone. What improves is the written material around it.
So: if you want next month's session to know something, it has to get written down. There's no other mechanism.