The model only talks. The harness makes it work.
A hands-on guide to the software around an AI model. Build it piece by piece, and watch its power grow.
Same model, two different worlds
YouRead app/build.gradle.kts and tell me the minSdk value.
- Press Send with the switch off, then again with it on. Notice the difference.
The model: a next-word machine
Start with the part everyone talks about, and see how little it can do alone.
An AI model (here, a large language model) is a neural network with a fixed set of trained numbers called . It turns your text into small pieces called , then predicts the most likely next token. It repeats that until the answer is done. Running text through the model like this is called .
The parameters never change while you use it. The model does not learn from your chat. When the request ends, nothing about the model is different.
Is the model everything?
An (or benchmark) is a fixed set of tasks used to score models. The top models now score close to each other. So when one app clearly beats another that uses a similar model, the reason is usually what was built around the model.
But that does not mean the model does not matter. Nothing rescues a weak model. You will see both, with numbers, in level 7.
The model sees
Its top guesses for the next token
Each press is one step of inference: pick the likeliest token, add it, guess again.
Ask the model alone to…
Tap each request to see what really happens when there is no harness.
“Open app/build.gradle.kts”
It cannot. It writes what a file like that usually contains. The text looks confident, but it is a description, not a reading. That gap between describing and doing is what this whole guide is about.
“Run the tests”
Nothing runs. You may get a made-up test report that looks real. Only a harness with a code-execution tool can run a command and hand back the true exit code and output.
“What changed in the library released last week?”
It does not know. Its parameters froze on the day training ended. Without a web tool, it can only answer from old knowledge, or guess.
“Remember my project rules for tomorrow”
It will forget. Each request starts from zero. It feels like memory inside one chat only because the app sends the whole conversation again with every message. Real memory across days is a harness job (Level 4).
The harness: what turns talk into action
Everything around the model: the tools it can ask for, what stays in front of it, the loop that keeps it going, and the rules it follows.
The is the software that sits between the model and the outside world. It sends requests to the model, reads what the model asks for, actually does it, and hands the results back.
Put a model and a harness together, give them a goal, and let them work over many steps instead of one reply. That pair is called an .
There are many pieces, but they come in four families: tools (the model's hands), memory (what stays in front of it), the loop (many steps instead of one reply) and rules (what is allowed). Instead of explaining them now, build one yourself.
The lab: build the harness with your own hands
Drag pieces onto the board, pick a task and a model, then press Run. Every piece adds a skill, and you see it on the drawing right away. Run again and again, and watch the power grow.
Task
Model
Drag a piece here, or press one above.
Press Run with only the model on the board. Then add a piece and run again.
Power of each run
What happened, step by step
- No run yet. In step-by-step mode the run pauses after every step, so you can read how it happened and why.
Why this score?
The numbers are illustrative, not a measurement of any one model. They follow what real benchmarks show, and you will see those in level 7.
Part 2 · The pieces
Tools: how the model reaches out
A tool is a function the harness offers. The model asks for it. The harness does it.
A is described by three things: a name, what it is for, and the inputs it takes. The model never runs the function. It writes a structured request that names the tool and fills in the inputs. The harness checks that request, runs the function, and sends the result back as new input.
A real tool definition, as the model sees it
- name
read_file- description
- Read a text file inside the project and return its contents.
- parameters
path(text, required): the file path from the project root
One tool call, step by step
- The harness sends the model the list of tools, along with the conversation.
- The model replies with a tool call: “read this path”.
- The harness checks the call against its permission rules.
- The harness runs the call and captures the output.
- The harness adds the output to the conversation and calls the model again.
Your hand of tool cards
Every ability below is the same trick: the model asks, the harness does. Pick a card and watch, in 30 seconds, exactly what happens, step by step.
On a phone: play the video full screen and turn the phone sideways, so the text is easy to read.
Pick a card to see what the model asks for, what the harness does, and what to watch out for.
See the difference: fixing a failing test
A developer asks the model to fix a failing unit test in LoginViewModelTest.kt.
The model has neither the test file nor the failure output. It writes a fix that sounds right, based on the test name alone.
You apply it, run the suite, and get the same failure. A guess
The model reads the test and the class under test, runs the suite, and reads the real error:
$ ./gradlew :app:testDebugUnitTest --tests "*LoginViewModelTest*" LoginViewModelTest > emitsErrorOnEmptyPassword FAILED expected: LoginState.Error(message=Password required) but was: LoginState.Idle
Now it can see the real cause: the validation branch returns before it emits the error state. It edits line 47 only, reruns the suite, and sees it pass. Checked
One checked fix instead of a guess, apply, fail cycle. In practice that saves two or three review rounds per bug.
Memory: a small table that fills up
The model’s only working memory is its context window. It has a fixed size, and everything piles onto it.
The is the most tokens a model can take in one request. It holds the harness’s instructions, the whole conversation, every tool result so far, and the answer being written.
Two things follow. First, each request carries more than the last, because tool results stay in the conversation. Second, when the session ends, all of it is gone. The next session starts empty.
The harness handles both. Inside a session it can run : when the table gets full, it swaps old detail for a short summary that keeps the goal, the decisions, the changed files and the open errors. Across sessions it loads an so the model starts each day knowing your project’s rules.
Do some work
Add work until the bar turns red, then try Compact.
The instruction file: memory that survives the night
An instruction file sits in your project folder and loads into the context at the start of every session. Common names are AGENTS.md and CLAUDE.md. It tells the model the rules it would otherwise have to guess: approved libraries, folder layout, build and test commands, and what must not be touched. Switch it off and on to see the difference.
YouAdd a settings screen to the app.
See the file
# Project Conventions ## Architecture - MVVM with Clean Architecture: data, domain, presentation - Dependency injection with Hilt ## UI - Jetpack Compose only. Do not add XML layouts. ## Commands - Build: ./gradlew :app:assembleDebug - Test: ./gradlew :app:testDebugUnitTest - Lint: ./gradlew ktlintCheck ## Constraints - Do not edit files under /generated - Network calls go through Retrofit interfaces in data/remote
Keep it short and specific. It loads on every request, so you pay for every line every time.
Search first, instead of loading everything
A real codebase is far bigger than any context window. Loading most of it wastes space even when it fits, because unrelated text drowns out what matters. Task: change how login tokens refresh in a 4,000-file Android app.
Plan A
Plan B
- Pattern search
- Exact text or regex matching across files, like
grep -rn. Fast when you know the name. - Semantic search
- Matches on meaning using . Useful when your words differ from the code’s words.
- Code index
- A map of definitions, references and who calls what. Answers “which functions call this method?”
The loop: plan, act, look, repeat
One reply is a chatbot. Many rounds, each one checking the last, is an agent.
The is the cycle the model and the harness repeat until the job is done. Plan: the model picks the next step and asks for a tool. Act: the harness runs it for real. Observe: the harness hands back the result, and the model reads it before deciding what comes next. It stops when the goal is met, the model says it is done, or the harness hits a limit.
Observe is the step that matters most. A model that acts without reading the result of its last action cannot correct itself. It keeps building on a broken state.
Try it: add a field to a database table
A developer asks for a new email field on a Room entity. Run it once with checking off, then once with it on.
- Press “Next round” to start.
Checking the work, inside the loop
means checking against reality while the loop runs, not after it. The common kinds: tests run after each change, build and lint checks catch what tests miss, visual checks take a screenshot of the running app, and reviewer models are a second model that reads the diff and reports problems back into the loop. Each check catches a wrong step while it is still cheap to fix. It is the strongest sign that a long-running agent will stay on track.
Rules: you are the harness now
The model asks. The harness decides. Take the harness’s seat for eight requests.
Limits live in the harness, not in the model, because the model only writes a request and the harness chooses whether to run it. Typical rules: an allow list of safe commands, a deny list of destructive ones, a pause for a human before writing outside the project, a cap on rounds, and a cap on spend. For each request, pick the safest choice that still lets the work move.
Model
Part 3 · The big picture
Model or harness? Both, multiplied
A harness cannot create intelligence that is not there. And intelligence without a harness stays talk.
You will often hear “the harness is everything, the model does not matter”. You will also hear the opposite. The truth is simpler than both: the result behaves more like multiplication than addition. If either side is close to zero, the result is close to zero, however strong the other side is.
The kitchen test
Flip the two switches and see what comes out of the kitchen.
Every combination in one table
This is the same engine as the lab, run for every combination at once. Rows are model strength, columns are harness strength. Press any cell to see why.
What do the real numbers say?
The lab is simplified. These are published results from benchmarks that measure the model and the harness together.
Same harness, different models
SWE-bench Verified: fixing real issues in Python projects. One harness for everyone: 100 lines of code and a single bash tool.
Source: swebench.com, the “bash only” board.
Same model, different harness
Terminal-Bench 2.0: real terminal tasks. Each model was tried inside more than one harness.
Source: tbench.ai. Note: the best harness is not always the model maker's own. What matters is the fit.
Read the two panels together. Under the same harness, results range from 9% to 77%: the model matters a lot. And the same model moves 21 points when only the harness changes: the harness matters a lot. One last example: GPT-4o in its best harness reached 38.8%, while a recent strong model inside a 100-line loop reached 76.8%. The harness did not rescue the weaker model.
The model sets the ceiling. The harness decides how close you get to it.
This is the sentence for anyone who asks: “does the model matter if the harness is strong?”- Between two strong, similar models, the harness usually decides. That is where “the harness is everything” comes from. It is true, but only in that case.
- No harness rescues a weak model. The harness carries out the model's decisions, it does not make them: which tool to ask for, what an error message means, when to stop. All of that is the model's mind.
- Harnesses became possible because models learned. Asking for a tool correctly and staying on a goal for hours are skills the model was trained for. In BFCL's multi-step tool test, very small models scored close to 0%, and strong models above 60%.
- As models get stronger, the harness gets simpler. With the Claude 5 models, Anthropic removed more than 80% of Claude Code's system prompt with no loss on its coding evals. Harness and model grow together.
And the shortest version: if the harness alone were enough, we would put the best harness on a model from 2019 and be done. That does not work.
When an agent fails: which half broke?
Knowing the culprit tells you what to fix. Pick the culprit for each failure.
It mentions a file that does not exist.
It ignores your project's rules.
It forgets earlier decisions in a long session.
It says “done”, but the code does not even run.
It ran a command that wiped someone else's work.
The code works, but the logic is poor.
Fix in this order, cheapest first
- InstructionsAdd or improve the instruction file. The cheapest, and often the most useful.
- VerificationRun the build and the tests after changes, and feed the result back to the model.
- SearchReplace loading everything with search, so the space goes to what matters.
- ToolsAdd the missing capability, built in or through MCP.
- The modelWhen the model has become the ceiling. And if it is very weak from the start, begin here.
One last thing: the line between the two keeps moving. Skills that used to live in harness code, like long planning and checking work, are now trained into models. And staying steady on long tasks, once seen as a model trait, now depends a lot on harness habits and instruction files. So check where a skill lives, do not assume.
What happens when… (things most explainers skip)
Six things that were not in the original guide, and they explain a lot of what real agents do. Press a card to flip it.
Part 4 · Build it yourself
The SDK: build an agent in code
The same harness that runs Claude Code, as a library inside your project. You choose the pieces, the SDK runs the loop.
The is a library for Python and TypeScript. It comes with built-in tools (read, edit, commands, search), the loop, context management, permissions, hooks and subagents. You do not write the loop yourself. You write the settings: what the agent knows, what it can do, and what is off limits.
The loop inside the SDK is four steps: gather context, act, verify, repeat. The same loop you met in level 5.
pip install claude-agent-sdk npm install @anthropic-ai/claude-agent-sdk
Use query() for one request whose result you read to the end, and ClaudeSDKClient for a conversation with more than one message.
Every setting is a piece from the lab
- system_prompt
- Memory: who it is and how it works
- allowed_tools
- Tools: what it can do
- mcp_servers
- Tools: apps and services from outside
- permission_mode
- Rules: what needs your approval
- hooks
- Rules: code that runs before or after a tool, every time
- agents
- The loop: subagents with their own memory
- max_turns
- Rules: a cap on the number of rounds
Build SDK settings for your kind of work
Pick a kind of work, then add what you need. The code changes with you, and new lines light up.
Kind of work
Add
Permissions
The code is for learning, based on the official SDK docs as of September 2026. Before real use, check the docs, because names can change.
Small rules for a better agent
- Start with as few tools as possible. Every tool's description takes space in the context, and every extra tool is one more chance to go wrong.
- Write each tool description as if for a new colleague. A tool description is an instruction to the model. When Anthropic made its edit tool always require a full path, path mistakes almost disappeared.
- A rule that must never break belongs in a hook. The instruction file is advice. A hook is code that runs every time and never forgets.
- Give the agent a way to check its work. Tests, a rule-based check, or a screenshot of the result. Clear rule-based checks are the strongest.
- Measure before you improve. Start with 20 real tasks, taken from mistakes that actually happened. Read what the agent did step by step, not only the final result.
Subagents: how to make one that works
A subagent is a smart colleague who missed the meeting. All it knows is what you write to it.
A is a second agent that the main agent starts for a side task. It has its own fresh context, its own instructions, and tools you choose. It works alone, then returns a short summary. Three benefits: the main agent's memory stays clean, several jobs run at the same time, and specialization with fewer, safer tools.
The clean table
The same task: find why the app is slow, in 3 places. Watch the main agent's memory.
Fix this subagent
This is a weak subagent file, the kind most people write the first time. Press each red line and choose a better one. Watch the effectiveness meter.
.claude/agents/code-reviewer.md
Eight rules for an effective subagent
- The description is a routing rule. Say what it does and when to call it: “use after every edit”. The main agent reads only the description to decide.
- One clear job that ends in a summary.
- Write down everything it needs, because it starts empty: the goal, the shape of the answer, the tools and sources, and the limits. Anthropic found that very short orders made agents misread the task or repeat the same search.
- Fix the shape of the reply: short and fixed. Big things go into a file, and only the file name comes back.
- Give it only the tools it needs. Researchers and reviewers read, they do not write.
- One agent writes. Subagents search, read and review. Only one edits files, so decisions do not clash.
- Effort matches the task. A simple question: one agent. Medium research: 2 to 4 subagents. Big research: more than 10. Pick a cheaper model for narrow jobs.
- Treat it like any code. Try it, read what it did, improve its description, and keep it in git.
In parallel, without collisions
Reading in parallel is safe. Writing in parallel is where agents collide. Cognition's lesson from April 2026: multi-agent systems work best today when writes stay single-threaded and the additional agents contribute intelligence rather than actions.
Try it yourself. One task: add "saved searches" to an app. A main agent and three helpers work on it: the API, the screen, and the tests. Turn the rules off, run it, and see where they collide, and why.
Time and tokens here are illustrative. The stories under each rule are real, and have sources.
Rules for working in parallel
- Read in parallel freely. Write with one pair of hands, or split the files strictly.
- The main agent writes the plan first: the contract between the parts, who owns which file, the branch names, and how to check that each part is done.
- Every writer gets its own space (a worktree or a container), and commits only its own files.
- Claim work where everyone can see it: a lock file, or a shared task list. When Anthropic built a C compiler with 16 agents, an agent claimed a task by writing a file into
current_tasks/. - Results go to files, and a short summary in a fixed shape comes back, about 1,000 to 2,000 tokens.
- Put limits on everything: the number of agents by task size, the number of turns, tokens, and time.
- One merge step that waits for everyone. Merge one at a time, in dependency order, and run the tests after each merge.
- Review with agents that did not write the code, with fresh context, and rely on real tests.
- When every agent gets stuck on the same bug, do not add agents. Split the problem, or change the model.
When is parallel worth it?
- Wide reading and research. In Anthropic's research system, parallel work cut the time by up to 90%.
- Many independent units, each with its own test: files to port, or tests to fix.
- More than one review angle, or more than one theory for the same bug.
And when is it not?
- Tightly connected work, or edits to the same file.
- When the output is more than a person can review. Simon Willison says he can review and land only one significant change at a time.
- When the task is not worth the price: an agent uses about 4 times the tokens of a chat, and several agents about 15 times.
When not to use a subagent
- When the task needs a lot of back and forth with you.
- When the steps share the same context: plan, then build, then test the same thing.
- For a small, quick edit, or when time matters.
- When more than one agent would write to the same files.
The numbers from Anthropic
In their research system, a lead agent with subagents beat a single agent by 90.2% on their internal eval. But it spent about 15 times the tokens of a normal chat. Use it when the task is worth that price.
RAG: how an agent finds the answer in thousands of pages
The model does not know your company's documents. RAG finds the right pages and puts them in front of it before it answers.
stands for Retrieval-Augmented Generation: “search first, then write”. The harness splits the documents into small pieces () and turns each piece into an , a list of numbers that stands for its meaning. When a question arrives, it turns the question into numbers too, finds the closest chunks, and puts the best ones in the context. The model answers from them, and names the source.
- Your question
- Turned into numbers
- Closest chunks
- Rerank
- Best 3 chunks
- The model answers
The RAG machine: a shoe shop's documents
Pick a question and see which chunks reach the model. Three of these questions fail. Fix them with the switches.
The chunks, ranked by closeness to your question
What reached the model, and its answer
RAG, everything in the context, or searching with tools?
| Approach | When it fits | Example |
|---|---|---|
| Everything in the context | Small document sets: under 200,000 tokens, about 500 pages. Anthropic advises skipping RAG entirely here. | One product manual |
| RAG | Thousands of pages, questions in people's own words, and documents that do not change every hour. | Customer support from company docs |
| Searching with tools | Files that change all the time, and exact text like function names. The model searches itself with grep and glob, then reads. | Claude Code inside your project |
The Claude Code team tried RAG at first, then dropped it. Boris Cherny, who built Claude Code, wrote: Claude Code doesn't use RAG currently. In our testing we found that agentic search out-performed RAG for the kinds of things people use Code for.
The reason: searching with tools is simpler, and there is no index that goes stale.
And if you do use RAG, Anthropic's numbers are clear: adding context to every chunk cut failed retrievals by 35%. With keyword search as well, 49%. With reranking too, 67%. Source.
Five ways RAG fails, and the fix for each
- The chunk lost its context. “The window here is 7 days”, but where is “here”? Fix: context for every chunk, and smarter splitting.
- The right chunk ranked too low. Fix: keyword search next to meaning search, then rerank.
- The answer is not in the documents at all. So the model makes one up. Fix: let it say “I don't know”, and set a minimum closeness.
- The chunk arrived, but the model did not use it. It got lost among many chunks. Fix: fewer, better chunks, and always require a source.
- The index is stale. The documents changed, the index did not. Fix: re-index on every change, or search the live files with tools.
Frameworks: all made from the same pieces
Once you know the pieces, you can read any framework in minutes. What differs: which piece it focuses on, how much it hides from you, and who decides the next step.
A is a library that hands you the harness pieces ready made, so you do not write them from scratch. Under the different names, almost all of them are built from the same pieces. Press a piece to see who focuses on it.
"Focuses on" is based on each framework's official docs as of September 2026. They all change fast, so check the docs before you choose.
What makes a framework strong?
- You can see what goes into the model. The prompt, the context, and every tool call. A framework that hides this is hard to fix when it goes wrong.
- Few, clear pieces. You learn it in a day, not a month.
- A way out. You can write any part yourself when the ready-made one is not enough.
- It holds up in real work. It resumes after a crash, streams the reply as it is written, allows a human approval, and logs every step.
- It does not tie you to one model. Switching models is one line, and it supports MCP.
- It is alive. Updated often, not in maintenance mode.
Start by using the model's API directly. Many patterns take a few lines of code.
Anthropic's advice in "Building effective agents". The reason: frameworks can hide the prompts and replies, which makes mistakes hard to fix. And if you do use a framework, understand the code underneath. SourceFive patterns you will find in every framework
Anthropic grouped the most common ways to combine models into five patterns. Any framework is a way to write these patterns.
- Prompt chainingStep after step, each one working on the result of the one before. Example: write a draft, then translate it.
- RoutingSort the request first, then send it to the right place. Example: a returns question goes one way, a technical question another.
- ParallelizationSeveral parts at the same time, then combine them. Or the same question more than once, then take the majority view.
- Orchestrator-workersOne model splits the work, sends out the parts, then gathers the results. This is what you saw in level 10.
- Evaluator-optimizerOne model writes, another critiques, and this repeats until the critic is satisfied.
Then comes the full agent: a model that uses tools inside a loop and decides by itself when to stop. Anthropic's advice here is simple: start with the simplest pattern that solves your problem. Do not build an agent if a chain is enough.
Six ways to build an agent, and one question that separates them
Every framework picks a way. The question that separates the ways: who decides the next step? You, in code, or the model? And then: where is the work saved? The rest is packaging. Press each way and see where it sits on the line.
Quick comparison (5 is best)
The 1 to 5 scores are a judgment based on the docs and user complaints up to September 2026, not a measurement. The examples and dates have sources.
"Layers" can mean three things
When someone says "an ADK built in layers", they can mean one of three very different cuts. LangChain splits into , then , then harness. DeepSeek builds a tiny kernel with plugins around it. Anthropic separates the brain from the hands. Pick a cut, then press any layer.
The most important point: the companies are converging. The harness from Microsoft, OpenAI, Anthropic, DeepSeek and LangChain has almost the same pieces: a loop, context compaction, files, subagents, approvals, and a sandbox. tools are adding agents, and agent tools are adding graphs. So learn the pieces, not the names.
Before you use DeepSeek Harness
- It is weeks old. Released on 13 August 2026 as a developer preview, and it may change a lot.
- A critical flaw (CVE-2026-82533, rated 9.4 out of 10): the agent could switch off its own sandbox through the local web UI. Fixed in version 0.1.2-alpha.1 on 27 August.
- Its own SAFETY.md says it has not been audited and is not ready for production.
- The session file format changed twice in one week.
- It uses a lot of tokens. And a reviewer saw it say "Done" when the code did not work, because it only ran a shallow check on itself.
The practical rule in 2026
- The known path: write it as code or a graph.
- Steps that need judgment: a model-driven loop, inside that step.
- Steps with many tools: let the model write code that batches them.
- Subagents: for parallel work that reads, not work that writes.
- Hosted services: this is where lock-in happens. Know how to leave before you go in.
Factor 8 of "12-factor agents": Own your control flow
. In other words, do not hand every decision to the framework. Source
Part 5 · Under the hood
Who are you really talking to?
Short answer: you talk to the harness, and the harness talks to the model. Your words never reach the model on their own.
When you type into claude.ai or Claude Code, your message goes to the app first. That app is the harness. Anthropic says it plainly: Claude Code is “the agentic harness around Claude”.
The harness does not pass your words along as they are. It builds a package: its own instructions (the ), the list of tools, your project files like CLAUDE.md, the whole conversation so far, and only then your new message, at the very end.
It sends that package over the internet to the . The model reads the package and writes a reply, a few tokens at a time. The reply goes back to the harness, not to you. The harness decides what happens next: show it on your screen, or, if the reply is a tool request, check the rules and run the tool.
Three things that follow
- The model sees only text. Not your screen, not your keyboard, not your files. If it knows today’s date, the harness wrote the date into the package.
- The model does not remember you. The API is . It feels like memory because the harness sends the whole conversation again with every message.
- Your message is the smallest part. In a coding session, what you typed can be far less than one percent of what the model reads.
The app you use
Which message
YouWhy does my login test fail?
- Youtype and read
- The harnessclaude.ai
- The APIapi.anthropic.com
- The modeltext in, text out
Sizes are rough examples to show the proportions. Real numbers change with every version.
Watch the trip
On a phone: play the video full screen and turn the phone sideways, so the text is easy to read.
The harness is not AI
If you guessed this, you guessed right. The harness is ordinary software: functions, rules, tools and instructions. The only part that predicts words is the model.
Code does the same thing every time for the same input. A line like “if the command is on the deny list, block it” never changes its mind. The model is different: it predicts, so the same package can get a different reply.
Engineers write the harness. Its control flow, meaning what happens in which order, is code: send the package, read the reply, if it asks for a tool check the rules and run it, send the result back, repeat. There is no intelligence in that loop. It is a machine that keeps the model working.
Instructions are not rules
Some parts of the harness are text: the system prompt, CLAUDE.md, skills. The harness only delivers that text. The model reads it and usually follows it, but nothing forces it. Anthropic’s docs call CLAUDE.md “context, not enforced configuration”.
Rules that must never break are code: permission rules and . Claude Code checks permissions itself, not the model, in a fixed order: deny first, then ask, then allow.
The same moment, seen from both sides
The harness: code
reply = api.send(package)
while reply.stop_reason == "tool_use":
call = reply.tool_call
if call in deny_rules:
result = "blocked by a rule"
else:
result = run(call)
package.add(result)
reply = api.send(package)
show(reply.text)
The model: AI
It reads the package. It predicts that the best next move is to look at LoginTest.kt. It writes that as a tool request, then stops. It does not run anything, check anything or remember anything. Every line on the left is someone else’s job.
Where it gets blurry
Some harness features call a model as a helper. That does not make the harness AI. Code still decides when to call it and what to do with the answer, the same way a weather app that asks a weather service does not become the weather.
- : when the context is nearly full, the harness sends the old messages to a model to be summarized.
- : extra model calls, each with its own fresh context, started and collected by the harness.
- Auto mode: in Claude Code, a second model (a classifier) reviews risky actions before they run. It sees your messages and the tool calls, not the tool results.
- Web fetch: a small model reads the page and hands Claude its answer, not the raw page.
- Small jobs: naming the session and writing background summaries.
Who does this job?
Pick a job, then pick who does it. A wrong pick gets a hint, not the answer. The third column is the tricky one.
Skills: know-how that waits until it is needed
A skill is a folder of instructions and scripts. An agent can carry dozens of them and pay almost nothing, until one fits the task.
A is a folder with one main file, SKILL.md. At its top sit the two lines that matter most: a name and a description. Below them come the instructions. Next to the file can sit scripts, templates and reference files.
Anthropic compares a skill to an onboarding guide for a new colleague. And their shortest explanation is this one: “MCP connects Claude to data; Skills teach Claude what to do with that data.”
Why skills matter so much
- They cost almost nothing until used. At the start, the agent sees only each skill’s name and description, about 100 tokens per skill. The instructions load only when a task needs them (Anthropic suggests keeping them under 5,000 tokens). Extra files load only when opened.
- Scripts run without being read. When a skill runs a script, only the output enters the context, never the code. A 400-line PDF tool can cost 40 tokens.
- The same work, the same way, every time. Your checklist, your template, your tested script. Not a fresh guess each session.
- One folder, many tools. Skills became an open standard on December 18, 2025. The same folder works in Claude Code, the Claude apps and the API, and in other tools such as OpenAI Codex and GitHub Copilot.
- They are shared like code. Keep them in git, review them, and ship them to a team inside a plugin.
A small skill, as it sits on disk
pdf-forms/
├── SKILL.md
├── scripts/
│ └── fill_form.py
└── reference/
└── field-names.md
--- name: pdf-forms description: Fill in PDF forms, such as tax or visa forms, from data the user gives. Use when the user asks to fill, complete or sign a PDF form. --- # Filling PDF forms 1. List the fields: python scripts/fill_form.py --list 2. Match each field to the user's data. 3. Ask about any field you cannot fill. 4. Fill it: python scripts/fill_form.py --fill data.json
- name
- Lowercase letters, numbers and hyphens, up to 64 characters.
- description
- Up to 1,024 characters. The only part the model sees when it decides, so say what it does and when to use it.
- the rest
- Loads only after the model picks this skill.
See the budget: 30 skills, one task
Choose where the know-how lives, then give the agent a task. Watch what enters the context, step by step.
Where the know-how lives
The task
The 100 tokens per skill and the 5,000-token guide for instructions come from Anthropic’s docs. The other sizes are examples.
A skill next to its neighbours
| Thing | When it enters the context | What it gives | Best for |
|---|---|---|---|
| CLAUDE.md | In full, on every request | Standing rules and facts | What every session must know |
| Skill | The description always, the rest when needed | Know-how and scripts | Repeatable tasks and procedures |
| MCP server | Its tool list (often deferred), then each result | New abilities: reach a service | Data and actions outside your machine |
| Subagent | Its own separate context | A clean desk for a side job | Big reading or searching |
| Hook | Never | A rule that always runs | Anything that must never be skipped |
In Claude Code, custom slash commands have been merged into skills. Old command files still work.
Where skills go wrong
- A skill that never fires is useless. The model picks from the description alone. In a public test by Vercel in January 2026, a skill went unused in 56% of runs, and an always-loaded index in AGENTS.md did better on that task. Name the exact tasks in the description, and check that the skill really fires.
- Every skill still costs its description. Hundreds of skills means thousands of tokens on every request, and more chances to pick the wrong one.
- A skill can run code on your machine. Anthropic says to use skills only from trusted sources. A February 2026 scan by Snyk found a flaw in about a third of 3,984 public skills, and 76 were plainly malicious.
- A skill is advice, not a lock. Like CLAUDE.md, it is text the model reads. A rule that must hold goes in a hook or a permission.
Tools, CLI, MCP, plugins: four different things
People mix them up because they all “give the agent more power”. But each one lives on a different layer, and each answers a different question.
The model can do exactly one thing to act: write a request for a . Everything else on this page is either a way for the harness to carry that request out, or a way to deliver know-how and settings to the harness.
1 · What the model sees
2 · How the harness carries it out
3 · How know-how and setups travel
Pick a job, then a path
Five real jobs. For each one, try all four paths and see which fit, and why.
The job
The path
What each one costs before it is used
Sources: Anthropic’s bash tool docs, and “Advanced tool use” (November 2025). Since then GitHub cut its server’s size about in half, and Claude Code now loads MCP tool definitions only when they are needed.
The 2026 argument: “just use the CLI”, or “MCP still matters”?
Just use the CLI
- Models already know
git,ghandcurl, and can read--helpfor the rest. - One shell tool instead of dozens of tool definitions. In one vendor’s benchmark (Scalekit, March 2026), a task took 1,365 tokens by CLI and 44,026 by MCP.
- Output can be filtered before it ever reaches the context.
- Permission rules can allow
gh pr viewand blockgh pr merge.
Voices: Armin Ronacher, Mario Zechner, Simon Willison, and Eric Holmes (“MCP is dead. Long live the CLI”, February 2026).
MCP still matters
- Apps with no shell, like claude.ai in a browser, cannot run a CLI at all.
- Each person logs in as themselves (OAuth), and admins can see and control which servers are used.
- Typed inputs and outputs, and one server works in every app that speaks MCP.
- The token cost is being fixed inside the harness: tool search loads definitions only when needed.
Voices: Charles Chen, Cloudflare, and Simon Willison, who wrote in July 2026 that he plans to “lean into MCP a whole lot more” for sensitive applications.
Where most people land: “the protocol is just plumbing” (Mario Zechner). Anthropic’s own advice follows the same ladder:
- A CLIThere is a shell, and the tool is already logged in.
- A skillYou are pasting the same playbook for the third time.
- An MCP serverClaude needs data it cannot reach, there is no shell, or each person must log in as themselves.
- A pluginA second repository or a teammate needs the same setup.
MCP up close: one protocol, two ways to carry it
A local server talks through pipes on your computer. A remote one talks through a web address. The messages inside are the same.
has three roles. The host is the app you use: Claude Code, Claude Desktop, an editor. Inside it, one client connects to each server. A server is a small program that offers things. The model is not part of MCP at all: it only sees the tools the host puts in its list.
A server can offer three kinds of things: tools (actions the model can ask for), resources (data the app can attach, like a file or a record) and prompts (ready-made templates you can pick, often shown as slash commands).
Every message is : a request with an id, a reply with the same id, or a notification with no id and no reply.
The newest spec changed a lot
The version from July 28, 2026 made MCP stateless. The opening handshake (initialize) and the session id are gone. Every request carries its own version and client details, and a new call, server/discover, tells a client what a server can do. But Claude Code still uses the classic handshake with local stdio servers by default, so you need to know both. Try both below.
Local:
The host starts the server as a child process. It writes messages into the server’s stdin, one per line. The server answers on stdout, one per line. Logs go to stderr. The spec is strict: the server “MUST NOT write anything to its stdout that is not a valid MCP message.”
Remote: Streamable HTTP
The server lives at a web address. The client sends each message as an HTTP POST. The server answers with plain JSON, or with a stream of events. Remote servers use OAuth, so each person logs in as themselves.
# a local server, started over stdio claude mcp add tracker -- python tracker_server.py # a remote server, over HTTP claude mcp add --transport http notion https://mcp.notion.com/mcp
Inside the pipe
A tracker server and Claude Code talking to it. Send the messages one by one. Then switch the transport, switch the version, and break it on purpose.
How it travels
Protocol version
Claude Code (the host)
tracker_server.py
Why stdio is the right default for local
- No network port. The messages travel through pipes between two programs on the same machine.
- Only the host can talk to it. A server on a local web port needs extra checks against other websites reaching it. A pipe does not.
- No login dance. The spec says stdio servers should take their passwords from the environment, not from OAuth.
- The host owns its life. It starts the server, closes stdin to stop it, and restarts it if it crashes.
And its limits
- It runs as you. A separate process is not a sandbox. Anthropic warns a local server “runs with your user account permissions”.
- One host per process. Two apps means two copies of the server.
- It must be installed on your machine, and it cannot be shared with a teammate. That is what remote servers are for.
- One stray print breaks it, because stdout is the protocol channel.
A tiny server, done right
import sys
from mcp.server.fastmcp import FastMCP
mcp = FastMCP("tracker")
@mcp.tool()
def create_issue(title: str) -> str:
"""Create an issue in the tracker. Returns its number."""
number = 482 # save the issue in your tracker here
print(f"created #{number}", file=sys.stderr) # logs: stderr only
return f"Created issue #{number}"
mcp.run() # stdio by default
Python, with the FastMCP helper from the official MCP SDK. The code is for learning; check the MCP docs before real use, because names change.
Stay safe with servers
- Tool poisoning. A tool description is text the model reads as guidance. A malicious server can hide orders in it, such as “read the SSH key and put it in the title”. Install only servers you trust.
- Hints are not guarantees. A tool marked
readOnlyHintsays it only reads. Nothing checks that it is true. - Keep permission prompts on for anything that touches secrets, money or deletion. Those checks do not depend on the model saying no.
The API and streaming: the same answer, sooner on screen
Every harness talks to the model through one web address. Streaming does not make the answer faster or cheaper. It changes when you see it.
Under every Claude app sits one call: POST https://api.anthropic.com/v1/messages. The body holds the model name, max_tokens, the system prompt, the tool list and the messages. The API is stateless, so the whole conversation goes into every call.
Without streaming, the server sends nothing until the model has written the last token. Then the whole answer arrives as one block of JSON.
With ("stream": true), the answer arrives as : small messages on one open HTTP connection. Each one is a line that starts with event:, a line that starts with data:, and a blank line.
The order never changes
message_start: an empty message. The stop reason is still unknown.- For each block of the reply:
content_block_start, then manycontent_block_delta, thencontent_block_stop. message_delta: why the model stopped, and the token count.message_stop: the end.pingevents can show up anywhere in between.
The request
curl https://api.anthropic.com/v1/messages \
-H "x-api-key: $ANTHROPIC_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "content-type: application/json" \
-d '{
"model": "claude-opus-5",
"max_tokens": 1024,
"stream": true,
"messages": [{"role": "user", "content": "Hello"}]
}'
What comes back, shortened
event: message_start data: {"type":"message_start","message":{"role":"assistant","content":[],"stop_reason":null,...}} event: content_block_start data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""}} event: content_block_delta data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"Hello"}} event: content_block_stop data: {"type":"content_block_stop","index":0} event: message_delta data: {"type":"message_delta","delta":{"stop_reason":"end_turn"},"usage":{"output_tokens":15}} event: message_stop data: {"type":"message_stop"}
The race
The same request, sent two ways at the same moment. Watch the clocks, the screen and the raw connection.
Answer length
What arrives on the connection
What arrives on the connection
Demo speeds: the first token after 0.6 s, then 55 tokens a second. Real numbers depend on the model, the size of the request and the load.
Why streaming wins
- The first words arrive right away. This is called the . People feel it as speed, even though the total time is the same.
- Long answers do not time out. The official SDKs refuse a non-streaming request that is expected to take more than about 10 minutes: “Streaming is required for operations that may take longer than 10 minutes.”
- The harness can react early. It can show progress, stop a reply that went wrong, and prepare a tool call while it arrives.
What it does not change: the tokens, the price, or how fast the model writes. The cheaper option is the Batch API, at half price, for work that can wait.
What gets harder
- Pieces are not words. A delta can be
"ello frien". You join them yourself, or let the SDK do it. - Tool input arrives as broken JSON. The pieces only become valid JSON when joined, so the harness parses at
content_block_stop. - A 200 is not a promise. The status line goes out first. An
overloaded_errorcan still arrive later, as an event. - Some proxies hold the stream back and deliver it in lumps. Servers turn buffering off for event streams.
Extra · Memory in files, and the final test
Obsidian and a knowledge graph: memory that lives in files
An extra, for anyone who wants it. The model forgets everything between sessions. These two tools keep what matters in plain files, so the harness can put the right pieces in front of it.
Obsidian is a notes app. Its is just a folder of Markdown files on your disk. That is exactly why it works with any AI: an agent that can read and write files can use it, with no special connection. Notes link to each other with [[wikilinks]], and Obsidian draws those links as a graph.
Graphify is an open-source tool, and also a skill, that turns a code repository into a : which function calls which, what imports what, and which document explains which code. It can write that graph out as Obsidian notes.
Neither one changes the model. They change what the harness can hand it: a few small notes and a map, instead of every file.
Who holds what
- CLAUDE.md holds the rules, plus one line that points to the vault. It loads every session.
- Your Obsidian notes hold what the code cannot tell: decisions, the reasons behind them, and history. You and the agent write them.
- The Graphify graph holds structure that can always be rebuilt from the code. Claude Code’s own auto memory skips exactly this part, on purpose.
- Skills stay in their skills folder, where the harness finds them. The vault can hold a short note that says when to use each one.
How they work together
- 1 · The repoCode and docs.
- 2 · GraphifyParses the code on your machine, sends the docs to a model, builds the graph.
- 3 · The vaultGenerated code notes, plus your own decision notes that link into them.
- 4 · The agentReads the index, follows two or three links, runs one graph query, opens only the files that matter.
uv tool install graphifyy # two y's graphify install # adds the skill /graphify . --obsidian # inside Claude Code
Commands as written in Graphify’s README on September 14, 2026. The package really is spelled graphifyy. Obsidian also has an official CLI since February 2026, and its CEO publishes agent skills for writing correct Obsidian notes.
Look inside a small vault
A tiny shop with four code files. Some notes you write yourself, others Graphify generates. Click a note or a dot in the graph, and follow the links.
The same question, two ways
“Can I raise the order limit to 100? What breaks?” Picture the same shop grown to 400 files, then run both.
Without a map
With the vault and the graph
The numbers are illustrative. Graphify’s author once claimed 71.5 times fewer tokens per question on a 52-file mix; one user measured the opposite with an always-on hook. Measure on your own repository.
Where it goes wrong
- Stale notes are served as truth. The model trusts what it reads. Date your decisions, say which note replaces which, and delete what is wrong.
- The graph is a snapshot. It is right only until the next commit. Rebuild it with a hook, or on demand.
- Always-on is not free. In one public report, Graphify’s always-on hook cost about 651,000 tokens while the model used the graph in only 3.2% of its searches. Start with “on demand”.
- More notes is not better. Quality drops as the context fills, and two notes that disagree get picked almost at random.
- Local is not private. Whatever the agent reads is sent to the model provider, and a note can carry injected instructions that stay for weeks.
Start simple
- CLAUDE.md and auto memoryNothing to install.
- A small vaultAn index note, a decisions folder and a log, plus one pointer line in CLAUDE.md.
- Graphify on big repositoriesRun it on demand. Add its hook to keep it fresh.
- An MCP server for the notesOnly if your app has no file access, like a browser chat.
Three names that sound alike
The hard test
26 questions across the whole guide. They are built to make you think, not to check that you remember a sentence.
How it works
- No answer is shown before you try. A wrong try earns a hint, written as a question. A second wrong try earns a closer hint.
- Points drop with each try: 3, then 2, then 1. After three wrong tries, or if you ask, the answer is shown for 0.
- Say how sure you are before you check. At the end you see how often your “Certain” was right. Being certain and wrong is the most useful thing to find out.
- The wrong options use the same words as the right one. Read every option to the end.
Your answers are saved in this browser only.
The whole guide in five lines
The model predicts text. Alone, it cannot read a file, run a command, reach the web, or remember anything after the request ends.
Tools let it act on real systems: files, code, the web, screens, the command line and MCP servers.
Memory manages the fixed context window with instruction files, compaction and search.
The loop repeats plan, act, look until the goal is met, with checks that keep long runs correct.
Under the hood, you talk to the harness and the harness talks to the model. Skills, CLIs, MCP servers and plugins are all ways to give that harness more to offer.
The sentence that ties it all together: the model sets the ceiling, and the harness sets how close you get to it. When you judge whether AI fits a task, name both: which model, and which harness.
Before you rely on an agent
Tick what your setup already has. 0 of 13 ready. Saved in this browser only.
Comparing two AI tools? Ask these
- Which tools does it have? Can it run shell commands and tests?
- Does it load a project instruction file on its own, and what filename does it expect?
- When the context window fills, does the session end, or does it compact and carry on?
- How does it find code: bulk loading, pattern search, semantic search, or an index?
- Does it check its own work before it reports done?
- What permission controls exist? Are destructive actions confirmed?
- Can it connect to outside services? Does it support MCP?
Learn more, from the source
This guide is built on these sources. The Anthropic Academy courses are all free, and come with a certificate.
Anthropic Academy courses
- Claude Code 101An hour and a half. Planning, context, CLAUDE.md, subagents, skills, MCP, and hooks.
- Introduction to subagents45 minutes. When to use a subagent, how to make one, and when not to.
- Introduction to agent skillsThe SKILL.md file, and how skills differ from CLAUDE.md.
- Claude Code in ActionAn hour. Long sessions, permissions, hooks, and GitHub Actions.
- Claude Platform 101The loop, tools, context, and your first agent.
- Building with the Claude API9 hours. Tools, RAG, agentic search, MCP, and agent patterns.
- Introduction to Model Context ProtocolBuild an MCP server in Python.
Anthropic engineering posts
- Building effective agentsThe five patterns, and when you need an agent at all.
- Effective context engineering for AI agentsHow to choose what goes into the context, and why quality drops as it fills.
- Writing effective tools for agentsA tool description is an instruction to the model.
- How we built our multi-agent research systemSubagents, with numbers.
- Effective harnesses for long-running agentsAn agent that finishes a long task across many sessions.
- Harness design for long-running application developmentA planner, a builder, and a grader. March 2026.
- Decoupling the brain from the handsThe brain, the hands, and the session. April 2026.
- Introducing Contextual RetrievalRAG that fails 67% less.
- Demystifying evals for AI agentsHow to measure an agent, starting with 20 tasks.
Other views worth reading
- Agent frameworks, runtimes, and harnesses, oh my!LangChain's three layers. October 2025.
- Don't build multi-agentsCognition: share context, and share full traces. June 2025.
- Cognition on what works in multi-agent systemsWhy writes stay single-threaded. April 2026.
- 12-factor agentsGood agents are mostly just software. Own your control flow.
- DeepSeek HarnessEverything is a plugin. Read its SAFETY.md first.
Under the hood, from the source
- How Claude Code worksAnthropic on the model and the harness around it.
- Agent Skills overviewProgressive disclosure, with the token numbers.
- The Agent Skills specificationThe open standard, since December 18, 2025.
- Claude Code features overviewHow CLAUDE.md, skills, subagents, hooks, MCP and plugins fit together.
- Claude Code and MCPLocal and remote servers, scopes and tool search.
- MCP 2026-07-28 changelogThe newest spec: stateless, with server/discover. July 2026.
- The MCP stdio transportThe exact rules for stdin, stdout and stderr.
- Advanced tool useTool search, and what big tool lists cost. November 2025.
- Code execution with MCPFrom 150,000 tokens down to 2,000. November 2025.
- Streaming messagesEvery event type, in order.
- GraphifyA repository turned into a knowledge graph, with an Obsidian export.
- The Obsidian CLIOfficial since February 2026.
- kepano/obsidian-skillsAgent skills for writing correct Obsidian notes.
Word list
Every term in this guide, in plain words. Terms with a dotted underline open these definitions in place.
- Agent
- A model plus a harness, working toward a goal over many steps instead of giving one reply.
- Agentic harness
- The software around a model that gives it tools, manages its memory, runs its loop, and enforces the rules.
- Agentic loop
- The repeating cycle of plan, act and observe that runs until the goal is met or a limit is hit.
- API (Messages API)
- The one web address every Claude app talks to. The harness sends the whole package there, and the reply comes back from it.
- BM25 (keyword search)
- An old, strong search method that matches the words themselves. It finds exact codes like E-1042 that meaning search misses.
- Chunk
- A small part of a long document, usually a paragraph or two. RAG searches chunks, not whole documents.
- CLI
- A program you use by typing commands, like git or npm. An agent reaches every CLI through one shell tool.
- Compaction
- Replacing older parts of a long conversation with a summary, so the session can continue when the context window is nearly full.
- Context window
- The most tokens a model can process in one request: instructions, conversation, tool results and the answer. Its only working memory.
- Embeddings
- Lists of numbers that capture what text means, so a search can match meaning instead of exact words.
- Eval (benchmark)
- A fixed set of tasks used to score and compare models. With agents, the model and the harness are measured together.
- Framework
- A library that hands you the harness pieces ready made: the model connection, tools, the loop, memory, and coordination between agents.
- Graph
- A way to build an agent as a map: steps, and arrows between them. You set the path, and the model works inside the steps.
- Hook
- A script the harness runs automatically at a set moment, such as before a tool runs or after a file is edited.
- Inference
- Running input through a trained model to get output. Every reply is inference.
- Instruction file
- A text file in the project, such as AGENTS.md or CLAUDE.md, that loads at the start of every session with the project’s rules.
- JSON-RPC
- The message format MCP uses: a request with an id, a reply with the same id, or a notification with no id and no reply.
- Knowledge graph
- A map of things and the links between them, like “this function calls that one”. Tools like Graphify build one from a code repository.
- MCP (Model Context Protocol)
- A standard way to plug outside tools and data into any harness that supports it. Write a server once, use it everywhere.
- Parameters
- The billions of numbers learned during training. They define the model and do not change while you use it.
- Plugin
- A package for Claude Code that installs skills, commands, subagents, hooks and MCP settings in one step.
- Prompt caching
- The provider reusing the unchanged start of a context across requests, which lowers cost and wait time.
- Prompt injection
- Hidden instructions inside content the agent reads, such as a web page, that try to take control of it.
- RAG (search, then write)
- Short for Retrieval-Augmented Generation. The harness finds the chunks of your documents closest to the question and puts them in front of the model before it answers.
- Rerank
- After a fast search brings back many chunks, a small model sorts them by how close they really are to the question, and only the best are kept.
- Runtime
- The layer that runs the agent and saves every step, so it can resume after a crash, pause for a human approval, and stream the reply as it is written. Example: LangGraph.
- Sandbox
- An isolated place to run code, with limited access to files, the network and the system, so a bad command does less harm.
- SDK (Claude Agent SDK)
- A code library with a ready-made harness: tools, the loop, memory, and permissions. You write the settings, it runs the rest.
- Server-Sent Events (SSE)
- A way for a server to send many small messages over one open HTTP connection. Streamed replies arrive this way.
- Skill
- A folder with a SKILL.md file, plus instructions or scripts for one kind of task. The agent sees only its name and description, and opens it when it needs it.
- Stateless
- Keeps nothing between requests. The API is stateless, so the harness must send the whole conversation every time.
- stdio
- A program’s three standard streams: stdin (input), stdout (output) and stderr (logs). A local MCP server talks to its host through them.
- Streaming
- Getting a reply piece by piece while it is being written, instead of all at once at the end.
- Subagent
- A second model instance the harness starts for a side job, with its own small context, that reports back a summary.
- System prompt
- Hidden instructions the harness puts at the top of every request: the model’s role, tools and rules.
- Time to first token
- How long you wait before the first piece of the reply arrives. Streaming makes it short; the total time stays the same.
- Token
- A small piece of text, often part of a word, that the model reads and writes. Limits and prices are counted in tokens.
- Tool
- A function the harness offers the model, described by a name, a purpose and its inputs. The model asks, the harness runs it.
- Vault (Obsidian)
- A folder of Markdown notes on your disk. Obsidian shows it, links it and draws it as a graph. Any agent with file tools can read it.
- Verification
- Checking work against reality inside the loop: tests, builds, lint, screenshots or a reviewer model.