Mark Levy/Writing/The Word Machine

A dungeon master sits behind a wooden screen at a table covered with character sheets, a thick spellbook, and a rolled map. The brass golem sits as a player with a small owl on its shoulder. Glowing runes are carved into the doorframe.

[ Floor 3 of 3 ] The harness

The Word Machine

Agents, tools, rules files, subagents, hooks, and evals: the scaffolding around the one machine.

System
You typeFix the failing test in parse.ts
Still one monster. The loop around it just got a job.

Floor 1 established the monster: given some text, predict a plausible next word, with trillions of frozen knobs and the context as its only memory. Floor 2 showed the costume: a transcript that ends with ASSISTANT:, so the plausible continuation is an answer. Nothing on either floor could do anything. The machine writes; that's all.

This floor is what happens when the plumbing gets ambitious. Let the machine's text be read by a program that will act on it (run the code, open the file, search the web) and paste back what happened. Wrap that in rules. Give it a budget, a map, a few helpers. The result is what the current vocabulary calls an agent, and the program around the machine is a harness. Everything else you hear about (tools, MCP, system prompts, CLAUDE.md, subagents, hooks, guardrails, evals, context engineering) is a part of that harness.

The frame for this floor is the tabletop game, because it fits unusually well: a player who can only say what they'd do, and a dungeon master who decides what actually happens. Six rooms. Same rule as before: every demo is a hand-built toy, and the point is the mechanism.

Room 1 of 6The Dungeon Master

A harness is a loop with hands

At a game table the player never touches the world. They say what they'd do: "I check the door for traps." The dungeon master resolves it against the world and narrates what happened; the player decides again. The machine is the player. It only ever emits text.

A harness is the dungeon master: a plain program that reads the machine's output, notices when it's a request to do something, does it, pastes the result into the context, and runs the machine again. Repeat until the machine writes a final answer instead of a request. That loop, with the machine inside it, is what agent means. Step through one.

The table: one task, five turnshand-built toy
The taskHow much did we spend on hosting last quarter? The invoices are in /invoices.
The table is set. The machine has not spoken yet.
Loot

The machine never acts. It writes a request in a shape the harness recognizes; the harness acts and pastes back what happened. Every "agent" you'll meet is this loop, and its autonomy is just the number of turns it takes before a human is asked.

Back in town Agent mode in a coding tool, an agentic workflow, an AI that "browses the web for you": all this loop. When the machine's request names a function and its arguments, the vendors call it tool use or function calling. A workflow is the same parts with the order fixed in code ahead of time; an agent is when the machine's own output decides what happens next.

Room 2 of 6The Character Sheet

Scaffolding is text that shapes the next word

A character is a sheet of paper: class, stats, equipment, a few lines of backstory. None of it lives in the player's head. It's re-read every time it matters. A harness hands the machine a sheet the same way: a role, house rules, facts about the project, an example of good output, the format to answer in. That's a system prompt, a rules file, a persona. All text, placed in the context every pass, enforced by nothing but the attention look-backs from Floor 1, Room 4.

The whole trade is visible on the sheet. Every line makes the wanted next word likelier, and every line costs tokens and attention. Build one and watch the answer change; then add the forty-page style guide and watch it drift.

The sheet builder: what lands in the context, and what comes outcanned outputs, for the shape
The requestReview this diff.
Loot

Scaffolding is text. It works by making the wanted next word the likely one, and it costs exactly what text costs: tokens on every pass, and attention that a longer sheet spreads thinner.

Back in town The system prompt, a CLAUDE.md or AGENTS.md at the root of a repo, "custom instructions," a saved persona, the two examples you paste in before your question (few-shot): all sheets. The craft of writing them was called prompt engineering; as harnesses grew, the name widened to context engineering (Room 6), because the sheet is only one thing in the pack.

Room 3 of 6The Spellbook

Tools are spells the harness agreed to cast

A spell is an entry in a book: a name, what it does, what it needs. The player casts by speaking the incantation; the dungeon master decides what happens. A tool works exactly this way. The harness writes each tool's entry (name, description, the shape of its arguments) into the context as text. The machine "casts" by writing the incantation: a small structured message naming the tool and its arguments. It has no idea whether the spell is real. It writes the incantation because, given the sheet and the training, an incantation of that shape is the likely next thing. The harness reads it, runs real code, and pastes the result back (Room 1).

Take the entry out of the book and the spell is gone. The machine will then do what it always does: write a plausible answer. Try it.

The spellbook: which entries are in the contextcanned outputs, for the shape
The requestWhat's the weather in Portland right now?
Choose the entries in the book, then ask.
Loot

A tool is a description in the context plus a promise from the harness. Remove the description and the spell is gone. Keep it and you've paid for it on every pass, cast or not, which is why a harness with three hundred tools is slower and dimmer than one with the twelve it needs.

Back in town Tool use, function calling, "connectors," "integrations," plugins: entries in the book. MCP (Model Context Protocol) is a shared format for the book, so a weather server, a database, or your calendar can publish its spells once and any harness can read them. Computer use is the same trick with a very general spell: a screenshot comes in as patches (Floor 2, Room 5), and the incantation is a click at coordinates.

Room 4 of 6The Familiars

Subagents: the same machine with an empty backpack

One context window fills up (Floor 1, Room 5), and everything the machine reads competes for attention. So a harness can summon a familiar: a fresh run of the same machine with a fresh, empty context, handed one task and only the text it needs. The familiar works in its own window. Only its final report comes back to the summoner.

Familiars share nothing. They can't see the main conversation, and the main loop never sees their working. That's the point: the log file the familiar read never enters the main window; three lines of summary do. Deciding what to delegate, to how many familiars, in what order, is orchestration, and the orchestrator is the same machine wearing a different sheet.

The summoning circle: two ways to read a very large loghand-built toy, illustrative numbers
The main loop is at 38,000 tokens: a sheet, a spellbook, and a conversation. The log is 92,000 tokens.
Loot

A familiar is the same machine with an empty context. Delegation buys room and parallelism. It costs shared memory, so the summons has to carry everything the familiar needs, and the report has to carry everything you need back.

Back in town Subagents, "agent teams," orchestrator and workers, "swarms," multi-agent systems: familiars with different sheets. The failure you'll meet first is a summons that forgot to include something obvious, because the familiar has no idea what "the file we were just discussing" refers to.

Room 5 of 6Wards and Traps

Guardrails: what the harness enforces, the machine can't undo

The machine is a bettor (Floor 1, Room 6), and now it has hands. So the harness carves wards at the doors: rules written in ordinary code that run whether or not the machine "remembers" them. Before a tool runs: is this command on the allowlist? Does deleting a directory need a human's yes? After a tool runs: run the formatter, run the tests, paste the failures back so the next turn sees them. Before the harness ships at all: run it against a fixed set of tasks with known answers and grade it. Those are evals.

None of this lives inside the machine, which is exactly why it's reliable. A ward doesn't get tired at line 400 of a long context. Step through a session with the wards up, then drop them.

The warded door: four proposed actionscanned outputs, for the shape
Evals on this harness build: 47 of 50 tasks pass
The machine is about to propose its first action.
Loot

Anything that must be true every time belongs in a ward, not on the sheet. The sheet persuades; the ward enforces. And a harness is judged by its evals, not by one impressive run: a single good session is a bet paying off, a graded set of fifty tasks is a measurement.

Back in town Hooks are wards at fixed points in the loop (before a tool, after a tool, at session start). Permission modes and allowlists are wards on the spellbook. A sandbox is a ward on the whole world: the hands can only reach a copy. Guardrails is the umbrella word, human-in-the-loop is the ward that asks you, and evals are the ward on the release, sometimes graded by another run of the machine (LLM-as-judge), which is a bettor grading a bettor and should be checked like one.

Room 6 of 6The Map

Context engineering: deciding what the machine reads

Everything on this floor lands in one place: the context window. The sheet, the spellbook, the tool results, the familiars' reports, the conversation so far. It's a backpack with a weight limit, and the harness's real job, under all the other names, is packing it: what goes in this turn, what gets summarized, what gets thrown out, what gets fetched only when needed.

The moves have names. Compaction replaces old turns with a summary. Memory files are notes written to disk and re-read next session. Retrieval fetches the few documents that matter (RAG, from Floor 2's inventory). Loading on demand keeps a skill's instructions out of the pack until the task calls for them. Truncation turns a 50,000-line tool result into its first and last hundred. Pack the bag.

The backpack: a 200,000-token windowhand-built toy, illustrative numbers
Loot

The harness's real job is deciding what the machine reads. Every feature on this floor is a packing strategy, and a small, relevant pack beats a large, complete one, because attention is the budget that matters (Floor 1, Room 4).

Back in town Context engineering is the name for this room. Compaction is what a coding agent does when the session gets long. Memory files, skills that load only when their name comes up, RAG over your documents: each is a way to keep the pack small. A model with a "long context" has a bigger bag; a harness with good context engineering packs a better one.

InventoryThe harness vocabulary

What you're carrying now

The words of current AI development, each with its exact address on this floor:

Inventory: 15 items
  • harnessThe program around the machine (Room 1): it runs the loop, holds the sheet and the spellbook, executes tools, keeps the wards, and packs the context. The dungeon master.
  • agentThe machine inside a harness loop, where its own output decides the next action. A workflow is the same parts with the order fixed in code.
  • tool use · function callingThe machine writing a structured request (Room 3) that the harness recognizes and executes. The incantation, not the spell.
  • MCPModel Context Protocol: a shared format for spellbooks, so a server can publish tools and resources once and any harness can list them into the context.
  • system prompt · rules fileThe character sheet (Room 2): a role, house rules, project facts, and format, as text at the top of every pass. CLAUDE.md and AGENTS.md are sheets that live in the repo.
  • skillA sheet section loaded on demand (Room 6): instructions for one kind of task, kept out of the pack until the task calls for it.
  • hookA ward at a fixed point in the loop (Room 5): code that runs before or after a tool, or at session start and end, regardless of what the machine remembers.
  • subagentA familiar (Room 4): the same machine with an empty context, given one task, returning only a report.
  • orchestrationThe main loop deciding what to delegate, to how many familiars, in what order. Done by the same machine wearing an orchestrator's sheet.
  • guardrails · permissionsWards on the spellbook and the world (Room 5): allowlists, approval prompts, and policies enforced in code before a tool runs.
  • sandboxA ward on the world itself: the hands can only reach a copy, so a bad incantation costs a copy.
  • evalsA fixed set of tasks with known answers, run against the whole harness and graded. The measurement a demo is not.
  • compactionReplacing old turns with a summary so the pack fits (Room 6). Nothing is remembered; a shorter text is read.
  • context engineeringRoom 6 as a discipline: choosing what the machine reads each turn. The successor to "prompt engineering" once the sheet stopped being the only thing in the pack.
  • human-in-the-loopThe ward that asks you. Autonomy is how many turns pass between its questions.
Loot

Every item is text or code around the machine. Not one of them changed a knob. The vocabulary is large because the scaffolding is large; the thing being scaffolded is still the guessing game from the top of Floor 1.

Dungeon clearedWhat this buys you

Four skills unlocked

Four rules fall straight out of these six rooms, and they are the rules people building with these tools keep re-learning:

  • Put invariants in wards and preferences on the sheet. If a thing must be true every time, code enforces it. If it should usually be true, text suggests it. Confusing the two is how a "never push to main" rule ends up as a prompt that got outvoted at line 400.
  • Every addition is context. A tool, a rule, a file, a familiar's report: each costs tokens and attention on every pass. Budget the pack, not just the prose. The best harnesses are the ones that read less.
  • You are engineering the loop, not the model. The knobs are frozen. What you control is what the machine reads, what it may do, and what comes back. That's the whole surface, and it's a lot.
  • Judge a harness by its evals, not its demos. One good session is a bet paying off. A graded set of tasks, re-run after every change to the sheet, the spellbook, or the wards, is a measurement.

That's the dungeon. One monster that guesses the next word; a costume that makes it answer; a loop that gives it hands; a sheet, a spellbook, familiars, wards, and a backpack around it. All of it text and code around the one trick at the top of Floor 1, and, used with that in mind, the most useful scaffolding anyone has built around a word machine.

System

Dungeon cleared. There is no Floor 4 yet. When there is, the map will say so.

Back to the map Start again from Floor 1
Inspiration and further reading

The loop-with-hands framing and the workflow-versus-agent distinction follow Anthropic's "Building effective agents". The backpack in Room 6 follows their "Effective context engineering for AI agents", and the evals stance follows "Demystifying evals for AI agents". The spellbook format is the Model Context Protocol.

The machine's mechanics are Floor 1's territory and follow John Mount's "A Simplified Mental Model of LLMs"; this floor extends the same non-magical framing to the scaffolding. All demos on this page are illustrative toys, not real model outputs, and the token counts are round numbers chosen to make the shapes visible.