The Payload Contract

Deep Dive · The Route, Deeper Practitioner · 8 min

Some of the longest arguments of my career were about what goes in a message. Which fields belong in the request body, which travel as headers, what the size limit is, who may add a field and who must version. To outsiders it looked like pedantry. It was the opposite: the contract was the system. Then the industry started calling a two-hundred-thousand-token paste "context", and the old reflex fired before I could stop it. That is not a payload. That is a landfill. And a new generation was about to relearn, token by token, why we argued about fields.

// the crux

Context engineering is not a new discipline; it is two old ones wearing one window: payload design, which decides what goes in the message, and relevance, which decides what deserves to. The window is a contract with a budget – every token either earns its seat or costs you one.

// in one breath
  • Why the window is the model's entire world, and the five seats everything you send competes for.
  • Selection is ranking and retrieval is the new results page: how a search veteran reads the 2026 reframe.
  • Five moves, each with a smell that betrays its absence, one index-or-tools decision, and the day prompt-fiddling becomes engineering.

Stage 02 of the Route calls context engineering the 2026 reframe, in a single line. This piece is that line, expanded to working size. Not prompt tricks – the discipline: what the window actually is, why growing it did not solve the problem, and the small set of moves that separate systems which answer well from systems which merely answer long.

the window

The Window Is the Whole World

Strip away the product surfaces and every model call is the same shape: one sequence of tokens in, one sequence out. The model holds no session, keeps no server-side state, remembers nothing between calls that you do not send again. It is the most stateless protocol you have integrated since HTTP – and just as with HTTP, everything the transaction needs must travel in the request. Whatever the model appears to know about your situation, it knows because something put it in the window.

And "something" is rarely one thing. By the time a production request reaches the model, five different claimants have written into that one sequence:

the hard truth

Bigger Windows Did Not Fix It

Context windows have grown by orders of magnitude, and for a while each jump came with the same quiet hope: soon we will just send everything. The problem did not disappear. It changed costume, three times. Cost: every token in the window is rent – prefill time, cache memory, money – a meter the serving layer runs whether or not the answer ever uses what you sent. Latency: a fat prompt is a slow first token, and your users feel the prefill even when they cannot name it. And attention: models do not read the window evenly. Material buried in the middle of a long context is measurably more likely to be missed than material near the start or the end – long is not the same as attended.

A bigger window is a bigger room, not a better librarian. Someone still has to decide what is on the desk when the work happens. That someone acquired a job title.

the lineage

You Called It Relevance

Chapter 3 of this series makes a claim I keep returning to: if you understand what query expansion solved, you understand what RAG solves. Follow that thread one step further and it lands here. Search engineering spent decades on a single question – given a query and a corpus too large to read, which handful of documents deserve the user's attention? Ranking, freshness against authority, deduplication, position bias: an entire discipline about rationing a scarce resource called attention.

Context selection is that exact problem with one substitution: the reader is now a model. Top-k retrieval is the results page. The window is above-the-fold. Even position bias came along for the ride – the middle of the context is where good documents go to be ignored, just as page two always was. The window made everyone a search engineer, whether they wanted the badge or not. The ones who had the badge already start this stage three moves ahead.

the craft

The Five Moves

Everything I have watched work in practice reduces to five moves. Each has a smell that betrays its absence – and the smells are easier to detect in someone else's prompt than in your own, which is the oldest code-review lesson there is.

  1. Select

    Decide what earns a seat. Retrieve narrowly and raise the bar per document; prune history by importance, not just by age. The test for every block is brutal and simple: does the answer change if this leaves the window? If not, it is paying rent for nothing.

    // the smell: a document included because deleting it felt risky.
  2. Shape

    Structure beats prose for a machine reader. Labelled sections, delimiters, consistent schemas for tool results – the same fact in the same shape every time. The model reads contracts, and a well-shaped window is simply a well-written one.

    // the smell: the same kind of fact arriving in three different formats.
  3. Compress

    When history must shrink, summarise with intent instead of truncating by age. Decide what a summary must preserve – decisions made, constraints discovered, questions still open – and let the pleasantries go. Lossy is fine when you chose the loss.

    // the smell: the one decision that matters ageing out while small talk survives.
  4. Place

    Order is part of the contract. Standing instructions live at the start, where attention is strong; the critical fact and the ask sit near the end, where it is strongest; the middle is the cheap seats, for supporting material that can afford to be skimmed.

    // the smell: the must-follow rule buried at token nine thousand.
  5. Guard

    The window is also the attack surface. Retrieved documents and tool results are input, not instruction – label their provenance, and keep what the model may read structurally separate from what it should obey. Chapter 17 covers what happens when that line is not drawn.

    // the smell: a retrieved document that speaks in the imperative and gets obeyed.
the decision

When Not to Build the Index

Stage 02's most quietly useful sentence is a warning: often a few sharp tools beat an index. Retrieval pipelines – embed, index, search, rerank – earn their complexity when the corpus is large, mostly static, and asked about in fuzzy, semantic ways. But when the data is live, structured, and precisely addressable – an account, an order, a balance – pre-loading guesses into the window is the wrong move entirely. Let the model fetch what it needs through a tool contract, at the moment it needs it, exactly as your systems already answer every other client.

The heuristic that has served me: index what you cannot query; query what you cannot index. And expect production to do both – a small, sharp index for the knowledge, a small, sharp toolset for the facts, and a window that stays lean because each is doing the job the other cannot.

the contract

The Contract, Written Down

If the window is a payload, it deserves what every payload you have ever shipped deserved:

Request schema= prompt structure: sections, delimiters, one shape per fact
Field selection= context selection: only what changes the answer
Pagination= retrieval depth: top-k is a dial, not a default
Size limits= the token budget, enforced before the model enforces it for you
API versioning= system prompts versioned, diffed, and reviewed like config

That last row is the cultural one. The day a system prompt gets its first real code review – a diff, a reviewer, a test that fails when the behaviour regresses – is the day prompt-fiddling becomes engineering in that organisation. The eval discipline of Chapter 12 is what makes those reviews mean something: change the window, run the set, know what moved.

One boundary, drawn deliberately: everything in this piece is the discipline of one call, one session. What an agent remembers across sessions – working state, summaries, long-term preference – is a different discipline with different failure modes. That is Stage 04's territory, and a dive of its own on this shelf in due course.

ground it

Feed It Like You Mean It

Stage 02 of the Route is called Ground It: make the model answer from your data, not its memory. The grounding, it turns out, is mostly rationing. The engineers who argued about fields were never being pedantic – they were rationing attention before anyone had a word for it, and the window has simply made the ration visible, priced, and shared by five claimants. You have written payload contracts your whole career. This one just happens to be read by something that takes every word literally.

// carry forward

A grounded model is still a voice in a box. The next stage gives it hands: One Contract, Every Tool · How MCP Works is this shelf's Stage 03 dive, and the same contract discipline carries straight into it. Or step back onto the Route at Stage 02 – and for the machine that reads all of this, Chapter 4 remains the tour.