Building Software
Sections

Contents Section 9, Delegating to Agents

Your Harness: Standing Context Under the Bitter Lesson

The standing context an agent reads before every task, written as who the work is for, what good looks like, conventions, tools and gates. Its step-by-step half decays with every model upgrade while its what half gains value, so you audit it each time the model changes.

Section 9 of 9, subsection 3 of 6. Depth: do. A 9-minute read.

Mistakes to catch in review

  1. A standing instruction file written as a numbered procedure (plan first, grep, rewrite whole files) that a newer model follows step by step into worse diffs.

  2. An AGENTS.md that never says what the service is for or what a good result looks like, so the agent guesses on the questions only the team can answer.

  3. A rule written to work around an old model's failure, such as whole-file rewrites for an edit tool that used to break, still in the file two model upgrades later.

  4. A harness audit that deletes 'Never run migrations against production' because it reads like a step, when it is a gate a smarter model still needs.

  5. Standing context that states the intent but gives the agent no tool or check to test its own work against it, so a violation is found only after the agent reports done.

The Harness Holds the What

Your team moves its coding agent to a newer, more capable model on Monday. By Wednesday the diffs look worse. A two-line fix to a shipping-quote bug comes back with three files rewritten from top to bottom, a PLAN.md nobody asked for, and a test run that took four tries because the agent added console.log calls between runs and left two of them in.

The agent explains each choice by quoting AGENTS.md, the instruction file at the root of the repository. It did what the file told it to do. The file was written eighteen months earlier for a weaker model, and most of it is a procedure: plan first, search with grep before editing, rewrite whole files, debug by logging. Each step fixed a real problem with the model of its day.

The file is silent on what the service is for and what a good quote looks like. The fix depended on one such question, which way to round a discounted price to the cent, and on that question the agent guessed.

Every task the agent runs starts from this file. A line in it is an instruction you repeat on every task, for as long as the line survives.

Standing context and the two kinds of line

The harness is the program around the model: the loop that sends it text, runs the tools it calls and feeds the results back. Before your task arrives, the harness loads standing context, text that sits in front of every task. In a coding agent that is a file such as AGENTS.md or CLAUDE.md at the repository root, plus whatever system prompt and rules files the tool reads. The per-task prompt from the previous lesson describes one job. Standing context describes what stays true across all of them.

Every line of it does one of two things. A what line says something about the result you want or the world the work happens in: who uses the service, what counts as a bug, which conventions the code follows, which commands exist, which actions need a person's yes. A how line prescribes the method: which steps to take, in what order, with which tool, and how to think before acting.

Daniel Miessler, who names this split Bitter Lesson Engineering, states the cost of the second kind in "Good and Bad Harness Engineering": "Bad Harness Engineering is bad because the smarter AI gets the more antiquated your instructions will become."

Why one half rots

In 2019 Rich Sutton looked back at seventy years of AI research and found one pattern in chess, Go, speech recognition and computer vision. Researchers built their own knowledge of how to solve the problem into their systems. It helped at first and it was satisfying to build. Then general methods that scale with computation, search and learning, overtook those systems, and the built-in knowledge became something to tear out. His essay puts it in one line: "We have to learn the bitter lesson that building in how we think we think does not work in the long run."

A how line in standing context is a small piece of built-in method. It records the best way you knew to get good work out of the model of its day, and there it fixes a real problem. When the next model arrives, the line stays where it was, and for a while it costs little. Then a smarter model would do better on its own, and the line holds it to the old way: a plan file written for a model that now plans as it works, a whole-file rewrite written for an edit tool that no longer fails.

Two rows read left to right across three models. Top row: a how line, rewrite whole files, leads to the model of its day, where it fixes a real problem, then the next model, where it costs little, then a smarter model, where it holds it to the old way. Bottom row: a what line, a one-cent error is a bug, leads to the model of its day, where it covers the cases it was written for, then the next model, cases you never listed, then the highlighted smarter model, more useful each time. A note reads: ages the other way.
Each upgrade moves the two kinds of line in opposite directions: the how line goes from fixing a real problem to holding the model to the old way, and the what line gets more useful each time the model improves.

A what line ages the other way. "A one-cent error is a bug customers see on the receipt" is a fact about your business that no amount of training can supply. The model of its day applies it to the cases it was written for. The next model applies it to cases you never listed, such as a discount, a currency conversion or a refund. The line gets more useful each time the model improves.

Sutton made the same point about reward signals in the reinforcement learning textbook he wrote with Andrew Barto: the reward tells the agent what you want achieved, and finding how is the agent's job. Reward a chess program for capturing pieces and it can learn to capture pieces while losing the game. Standing context plays the same role for a coding agent. It is where you say what winning looks like.

What the file should hold

A file with the how half removed can still be long. What matters is the kind of line in it. Five kinds earn their place:

  • Purpose: what the system does, who depends on it, and what is at stake when it is wrong.
  • What good and bad look like: the criteria you would judge any change by, with numbers where you have them.
  • Conventions: the rules this codebase follows that a newcomer could not guess from one file.
  • Tools and facts: the commands that build and test, the helpers to use, and the gotchas the model cannot see in the code.
  • Gates: the actions that need a person's yes, and the ones nobody takes.

The last two read like instructions, and an auditor in a hurry cuts them along with the steps. They survive for their own reasons. A smarter model still cannot know that your integration tests need a database started first, or that your shipping carrier reports some errors with HTTP 200. A gate exists because the authority to run a migration against production is yours, and a more skilled model leaves that authority where it was.

Auditing a real file

Here is the shipping service's AGENTS.md as it stood on Monday, numbered for the audit:

Markdown
# AGENTS.md

1. You are an expert senior TypeScript engineer with 20 years of experience.

## Workflow
2. Before writing any code, think step by step and write your plan to PLAN.md.
3. To find code, run `grep -rn` over src/ and open every match before editing.
4. Always rewrite the whole file when you edit it. Never use partial edits.
5. If a test fails, add console.log calls, rerun, and repeat up to three times.
6. Only read the files you need. Your context window is small.

## Rules
7. Run tests with `bun test`. Integration tests need `bun run db:up` first.
8. Never run `bun run migrate` against production. Migrations ship through the release pipeline.
9. The carrier API can return HTTP 200 with an `error` field in the body. Check the body.
10. IMPORTANT: You MUST use zod for ALL validation. NEVER skip this.
11. Do not add dependencies without asking.
12. Do not use `any`.

Take each line and ask one question: would a smarter model make this line unnecessary? A yes marks a how line. Before cutting it, ask what it was protecting, because some steps stand in for an outcome you still want.

Line Kind Verdict
1 Describes the model, says nothing about you Cut, and write who you are and what the service does
2 Step Cut; if it existed so you could see large changes first, write that gate instead
3 Step Cut
4 Workaround for an old edit tool Cut once you confirm partial edits work with today's tools
5 Step Rewrite as the outcome it protected: no console.log in committed code
6 Stale premise Cut
7 Tool fact and gotcha Keep
8 Gate Keep
9 Gotcha Keep, then move it into a tool
10 Convention, shouted Keep the convention in plain words
11 Gate Keep
12 Convention Keep

Line 10 is a convention worth keeping, written in a voice that was itself a workaround. Capital letters and MUST were how people got older models to follow a rule at all. Anthropic's prompting guide for its recent models warns that language written to stop a model from neglecting a tool can make a newer, more attentive model overuse it, and it recommends plain wording. Here the overuse would be schemas wrapped around values the service computed itself.

The audit also has to find what the file never said. Nothing in it says what the service does, what a correct quote is, how fast a quote must be, or that money is stored as integer cents. And nothing settles the question the opening fix turned on, which way to round a discounted amount. That is a business decision, so it belongs to you, and it goes in the file.

Here is the file after the audit:

Markdown
# AGENTS.md

## What this is
rates-api returns shipping quotes to the shop's checkout. Customers see
the quote on their receipt, and a slow quote loses the sale.

## What good looks like
- A quote equals the carrier rate plus our markup, to the cent.
- p95 latency for /quote stays under 300 ms.
- Every behavior change ships with a test that fails without it.

## Conventions
- Money is integer cents everywhere (`amountCents`). No floats for money.
- Discounted amounts round to the nearest cent, halves up.
- Validate request bodies and carrier responses with zod.
- No `any`. No `console.log` in committed code.

## Tools and facts
- Tests: `bun test`. Integration tests need `bun run db:up` first.
- `bun run check` runs the same checks CI runs.
- Call carriers through src/carriers/client.ts. It treats an HTTP 200
  with an `error` field as a failure.

## Ask first
- Adding a dependency.
- Changing the markup rules in src/pricing/.

## Never
- Run `bun run migrate` against production. Migrations ship through
  the release pipeline.

It is longer than the original, and nearly every line in it is something only the team knows.

Tools carry what sentences cannot

Standing context, the what, and tools, such as `src/carriers/client.ts` and `bun test`, both point to the model, which finds the how. The model's change goes to the highlighted checks, which name the broken line and send failures back to the model. A change that passes goes to you, reported done.
Standing context and tools feed the model. Its change goes through checks that send a failure back naming the line it broke, so the agent fixes it before it reports done to you.

Line 9 survived the audit, and it is still weaker than it could be. A sentence asking the agent to check the response body works only when the agent recalls it on the call that matters. A client function that treats an HTTP 200 carrying an error field as a failure works on every call, for the agent and for every person on the team. Once that client exists, the standing file needs one line: call carriers through src/carriers/client.ts.

The tools the model can call are part of the harness too, and they are the place for the how you still own. A tool is method written as code, where it runs the same way each time and has its own tests. Advice about method tells a capable model how to work. A tool gives it something more to work with. When an agent keeps making one kind of mistake, the fix that lasts is usually a tool or a check, plus one line in the file saying it exists.

The harness checks the work against what you said

A line in the file states intent, and a check proves a change keeps to it. Some what lines are mechanical enough for a program to check after every change: integer cents, no console.log, no new dependency without a yes. Put those checks in a command the agent can run itself, the same one CI runs, and make each failure name the line it breaks. The agent then finds the violation and fixes it before it reports done.

Here is that check run against the agent's next change, a 10% shipping discount on orders over $75:

TypeScriptRuns in your browser
type Change = {
  addedLines: { file: string; text: string }[];
  depsBefore: string[];
  depsAfter: string[];
  quote: (weightGrams: number, subtotalCents: number) => { amountCents: number };
};

// Each mechanical line from AGENTS.md, paired with a check that can fail.
const rules: { says: string; check: (c: Change) => string[] }[] = [
  {
    says: "Money is integer cents everywhere (`amountCents`).",
    check: (c) =>
      [500, 1250, 4999].flatMap((g) => {
        const { amountCents } = c.quote(g, 8000);
        return Number.isInteger(amountCents) ? [] : [`quote(${g} g) returned ${amountCents} cents`];
      }),
  },
  {
    says: "No `console.log` in committed code.",
    check: (c) => c.addedLines.filter((l) => l.text.includes("console.log")).map((l) => `${l.file}: ${l.text}`),
  },
  {
    says: "Ask first: adding a dependency.",
    check: (c) => c.depsAfter.filter((d) => !c.depsBefore.includes(d)).map((d) => `new dependency: ${d}`),
  },
];

// The agent's change: 10% off shipping when the subtotal is over $75.
const change: Change = {
  addedLines: [
    { file: "src/pricing/discount.ts", text: "const discounted = base * 0.9;" },
    { file: "src/pricing/discount.ts", text: "console.log('discount', discounted);" },
  ],
  depsBefore: ["zod"],
  depsAfter: ["zod", "lodash"],
  quote: (weightGrams, subtotalCents) => {
    const base = 495 + Math.ceil(weightGrams / 500) * 150;
    return { amountCents: subtotalCents > 7500 ? base * 0.9 : base };
  },
};

for (const rule of rules) {
  const problems = rule.check(change);
  console.log(`${problems.length ? "FAIL" : "ok  "}  ${rule.says}`);
  for (const p of problems) console.log(`      ${p}`);
}

All three rules fail, and each failure quotes the line it broke, so the message tells the agent what to fix without you. The money check found half-cent quotes such as 580.5, which is the rounding question the file now answers.

Notice what a pass would prove. Suppose the agent drops the log line and the new dependency and changes the discount to Math.floor(base * 0.9). Every check goes green, yet the 580.5 quote becomes 580 where the file says halves round up to 581. The checks prove the change keeps to the file's mechanical lines. Whether each quote is the right number takes a test with the expected amount written in it, the subject of Tests as Specifications. Standing context states the criteria, and the harness runs every check that can be automated against them.

Auditing after every model upgrade

Each how line is a bet about the current model's weaknesses, and an upgrade changes the weaknesses. So run the audit each time the model under your agent changes, and on a schedule in between:

  1. Ask of every line whether a smarter model would make it unnecessary, and mark the ones where the answer is yes.
  2. For each marked workaround, check that the failure it was written for is gone with the current model and tools. Ask the agent for a partial edit to a large file and read what it produces.
  3. Cut the marked steps and rerun a few recent real tasks without them, judging the results against the criteria in the file.
  4. Read where the agent guessed or asked a question. Each guess marks a what line you have not written yet.
  5. Write a dated reason beside each surviving workaround, so the next audit can tell it from a convention.

Leave the conventions and preferences out of step 3. Most tasks never touch a given preference, so a run with and without it will report the line as useless when it is the only place that fact is written down.

Each line goes to a highlighted box, what it protects, which splits three ways: want or fact, covering purpose, criteria and tools; needs a yes, a gate; and a step, a method or order. Want or fact and needs a yes both lead to keep. A step leads either to rewrite, when it protected an outcome, or to cut, when it protected nothing. A note reads: whatever mood its verb is in.
Sort each line by what it protects. Wants, facts and gates stay however they are worded; a step goes, rewritten as the outcome it protected or cut when it protected nothing.

The usual mistake in an audit is to sort by grammar. "Never run bun run migrate against production" reads like a command, so an auditor sorting by tone deletes it with the plan file. Sort by what the line protects. If it says what you want, what is true, or what needs a yes, it stays, whatever mood its verb is in. The production line stays even after you take migration credentials out of the agent's environment, because it also tells the agent where migrations go, which saves a session spent probing a credential it lacks.

A line belongs in standing context when a smarter model would still need it: it says something only you know about your users, your stakes or your taste, it guards an action whose authority is yours, or it names a fact about your tools that the code does not show. Every other line is a bet on a weakness of the current model, and the bet expires with that model.

Check your understanding

7 questions on this lesson. Pick an answer to see whether it holds and why.

  1. 1After a model upgrade you audit this excerpt from a team's standing file. Which line should the audit cut?
    Markdown
    - Before creating a file, search with `rg` and open the three closest matches.
    - Push notifications go through `notify()`, which drops duplicates by `eventId`.
    - Times are stored in UTC and shown in the user's own time zone.
    - A push to more than 1,000 users needs a person to approve the batch.
    Show the answer

    Answer C. The search line is a step: a capable model finds similar files without being told how, so a smarter model makes the line unnecessary. The notify() line is a fact about your tools that saves the agent from writing a second deduplicator, the UTC line is a team convention, and the approval line is a gate whose authority stays with a person however good the model gets.

  2. 2A line added in 2024 says 'Always rewrite the whole file instead of making partial edits', after an agent of that time mangled partial edits. What should the audit after this month's model upgrade do with it?
    Show the answer

    Answer B. The line is a workaround for a weakness, so it earns its place only while the weakness exists, and one try settles that. Keeping it untested leaves whole-file diffs in every task. Cutting it untested risks the old failure returning if the edit tool still breaks, which is why the check comes before the cut.

  3. 3The standing file says discounted amounts round to the nearest cent, halves up. An agent wrote the discount below, and the harness check that every quote is a whole number of cents now passes. What does the passing check tell you?
    TypeScript
    const base = 645; // cents
    const discounted = Math.floor(base * 0.9);
    console.log(discounted); // 580
    Show the answer

    Answer D. The check tests the mechanical line it was built from, integer cents, and Math.floor satisfies it. 645 * 0.9 is 580.5, and rounding halves up gives 581, so the quote is a cent low. A passing check proves the change keeps to the rule it encodes; the right amount needs a test with the expected value written in it.

  4. 4A clinic-booking service's standing file says: 'Our customers are small clinics. A reminder sent at the wrong local time causes a missed appointment they cannot bill.' Why does this line become more useful as the model improves?
    Show the answer

    Answer A. The line states facts and stakes that live outside the code, which no training run supplies. A weaker model applies them to the cases someone wrote down, and a stronger one applies them to cases nobody listed. Context window size only decides whether the line fits, and the code shows what the service does but says nothing about what a wrong time costs a clinic.

  5. 5After an upgrade, an agent starts wrapping values the service computes itself in schema validation. The standing file contains the line below. What is the likely cause, and the fix?
    Markdown
    IMPORTANT: You MUST validate ALL values with `zod`. NEVER skip this.
    Show the answer

    Answer C. Capitals and MUST were how people got older models to follow a rule at all. A model that attends more closely takes ALL at its word and validates values it computed itself. The convention is still worth having, so keep it in plain words and name what gets validated, such as request bodies and carrier responses. Deleting it loses a team decision a model cannot infer.

  6. 6Your payments provider sometimes returns HTTP 200 with an error field in the body, and agents keep treating those responses as successes. Which change to the harness fixes this for good?
    Show the answer

    Answer B. A sentence works only when the agent recalls it on the call that matters. Code that treats the error body as a failure works on every call, for agents and people alike, and the standing file then needs one line saying to use it. The checklist and the louder warning are both method written as advice, and both still depend on the model remembering.

  7. 7An automated audit of your standing file removes 'Never run bun run migrate against production' because it reads like a prescriptive step. What is wrong with that cut?
    Show the answer

    Answer A. Sorting by tone treats every line that starts with Never as a step. This one guards an action whose authority belongs to a person, and more skill on the model's side does not move that authority. Taking production credentials away from the agent adds a second guard, and the line still tells the agent where migrations go.

You understand it when you can

Drill

Take the standing instruction file of a repository you work in, or of an open-source project that ships an AGENTS.md or CLAUDE.md. Mark every line with what it protects, cut or rewrite each step a smarter model would make unnecessary, and confirm each workaround's failure is gone before you cut it. Then write down three things the file never tells the agent about who the work is for or what good looks like, and add them.

Topics

The What and the How
Every line of standing context either says something about the result and the world it lives in, or prescribes the method for getting there.
Why How Rots and What Appreciates
Sutton's Bitter Lesson applied to instructions: method written for one model holds the next one back, while the facts, stakes and taste only you can supply gain value as models improve.
Standing Context Files
Writing AGENTS.md and similar files as purpose, what good looks like, conventions, tools and gates, in plain words, with the step lists left out.
Tools as Part of the Harness
Moving a recurring warning into a tool or client that makes the mistake impossible, and leaving one line in the file that names it.
Checking Output Against Stated Intent
Turning the mechanical lines of the file into checks the agent can run itself, each failure naming the line it broke, and knowing what a passing check leaves unproven.
Auditing After a Model Upgrade
Asking of every line whether a smarter model would make it unnecessary, confirming a workaround's failure is gone before cutting it, and keeping gates and gotchas however they are worded.

Further reading

Start here

  • The Bitter Lesson. Paper.

    Rich Sutton's one-page 2019 essay: seventy years of AI research in which built-in human method helped at first, then held systems back once general methods scaled with computation.

Short reads

  • Good and Bad Harness Engineering. Daniel Miessler, 2026.

    The split this subsection is built on, in a few hundred words: a harness of prescribed steps ages as models improve, and one that describes who you are and what good looks like keeps paying off.

  • Agentic Coding Things That Didn't Work. Armin Ronacher, 2025.

    A working developer's account of the commands and automations he built around his agent and then deleted, and why giving it more context in plain talk won out.

  • My AI Adoption Journey. Mitchell Hashimoto, 2026.

    Its step on engineering the harness names the habit behind tools and checks: each time an agent makes a mistake, add a line to AGENTS.md or build a tool so it cannot make that mistake again.

Watch

Books

  • Reinforcement Learning: An Introduction. Richard S. Sutton and Andrew G. Barto, 2018, 2nd. Free to read online.

    The textbook by the Bitter Lesson's author. Its section on goals and rewards states the rule this subsection applies to standing context: the reward tells the agent what you want achieved, and finding how is the agent's work.

  • The Art of Action: How Leaders Close the Gaps between Plans, Actions and Results. Stephen Bungay, 2022.

    How armies learned to direct people by stating intent and boundaries, because detailed plans break on contact with situations the planner could not see. The same reasoning holds for an agent working in code you have not read.

  • The Checklist Manifesto: How to Get Things Right. Atul Gawande, 2011.

    Argues that a good checklist holds only the critical items skilled people still miss and leaves the rest to their skill, the same test that decides which lines survive in an agent's standing file.

Primary sources

  • Prompting best practices. Manual.

    Anthropic's guide for its current models, including the warning that emphatic wording written to make older models use a tool can make newer ones overuse it, a documented case of a how line aging badly.