Context Engineering in Practice
A service desk's resolution agent has four complaints against it, all arriving together, and the proposal on the table is a larger model. The nine chapters before this one each took one part of context engineering: reading a call, typing what it carries, keeping direction current, enforcing law, keeping the window small, diagnosing failures, sharing state between agents, letting working context go, curating when the plan changes. This chapter runs those parts on that one agent, in order, as a routine. Each complaint turns out to have an address in what the call carries, and none of them is a model fault.
Thesis: Context engineering, put to work, is a routine you can run on any agent: read one call, type its parts, cut what the call does not need, name each remaining failure by its kind, record decisions with what they replaced, give every shared record one writer, and curate what outlives the session. The same rule carries the routine past one project into stores many agents share: every piece of context needs a kind, a writer, a lifetime and a source, and a store nobody curates turns against you more slowly than a window does, and for longer.
Shared State Needs One Writer ended on a ledger that coordinates nothing unless agents write to it, and Compaction at the Pivot argued for a record re-read after every reset. This chapter uses everything so far on one agent, then follows its notes past the project. The service desk, its gateway, its tickets and every number below are invented for the example.
The Agent and Its Complaints
An IT service desk runs three agents: intake sorts new tickets, resolution fixes what it can, and change schedules what needs a change window. The complaints about the resolution agent arrive together.
- It re-learns the VPN gateway's quirk, that sessions drop when the idle timeout is under 300 seconds, in every new session.
- After a long session it forgets which tickets it has already closed, and works one twice.
- It sometimes escalates a VPN ticket after two failed fixes, though the desk lead changed that to one last month.
- It has got slower, and its calls keep growing.
Before buying a larger model, run the routine.
Step 7 of 7
Curate what outlives the session
The agent proposes the gateway note with the ticket that proves it; an engineer approves it into the shared store, and all three agents read it. That fixes complaint 1.
Read this figure as text
Before: The Agent and Its Complaints
Four complaints arrive together against the resolution agent, and the proposal on the table is a larger model. The routine runs before anyone buys it.
1. Read one call
Taught in What Context Engineering Means
The largest part of the call is tool definitions the agent never calls and tool results it has already read; Step 4 names those as where complaint 4 was.
2. Type its parts
Taught in Four Kinds of Context
Typing each block finds two more addresses: the reversed escalation rule sits in a file that loads on every call, and closed tickets live only in the history.
3. Cut what it does not need
Taught in How an Agent Builds Its Context
Three cuts: tool search for the six systems' tools, clearing old tool results once read, and skills for the troubleshooting guides. That fixes complaint 4, by assembly; a larger model would inherit the same call.
4. Name what still fails
Taught in When Context Turns Against You
Naming each failure by its kind finds the last address: the gateway quirk was never written outside the window. None of the four is a model fault.
5. Record decisions and what they replaced
Taught in When Context Turns Against You
The escalation rule leaves the project file for a decision record put back on every call and after every compaction. D7 is in force, and D4 stays, marked as replaced. That fixes complaint 3.
6. One writer for shared state
Taught in Shared State Needs One Writer
Only the resolution agent writes "fix attempted" and "resolved" to the ticket system, and it re-reads a ticket before working it. Complaint 2 can no longer survive a compaction.
7. Curate what outlives the session
Taught in this chapter
The agent proposes the gateway note with the ticket that proves it; an engineer approves it into the shared store, and all three agents read it. That fixes complaint 1.
The fix
- Re-learns the gateway quirk: Missing. Never written outside the window. A note that outlives the session (step 7)
- Works a closed ticket twice: Missing, at compaction. Ticket ids in the history only. Ask the ticket system, not the summary (step 6)
- Escalates on the old rule: Contradicted. A superseded decision in an always-loaded file. A decision record (step 5)
- Slow, calls keep growing: Re-bought and drowned. Unused tool definitions, old tool results. The cuts in step 3
Figure: The routine. Seven steps, one per idea in the series, run in order on one agent; the next complaint starts it again at the first step.
The seven steps are this site's ordering, not a new scheme: each applies the three decisions, the four kinds or the five failures from earlier chapters.
Step 1: Read One Call
Take the agent's largest call from yesterday and split its input into parts, as What Context Engineering Means taught.
| Part | Tokens | What is in it |
|---|---|---|
| System prompt and project file | 9,000 | Identity, the escalation rule, a line about MFA resets, three pages of troubleshooting guides |
| Tool definitions | 41,000 | Every tool from six connected systems; the agent calls five of them |
| History | 62,000 | 48,000 of it tool results: log reads, ticket fetches, knowledge-base pages |
| Retrieved passages | 6,000 | Knowledge-base articles matched to the ticket |
| The new message | 200 | "User reports VPN drops every few minutes" |
The largest part is not the conversation. It is tool definitions the agent never calls and tool results it has already read.
1 of 4
One call, five parts
The agent's largest call from yesterday has five parts: the system prompt and project file, tool definitions, the history, retrieved passages and the new message.
Read this figure as text
The service desk, its gateway, its tickets and every number below are invented for the example.
One call, five parts
- System prompt and project file: 9,000. Identity, the escalation rule, a line about MFA resets, three pages of troubleshooting guides
- Tool definitions: 41,000. Every tool from six connected systems; the agent calls five of them
- History: 62,000. 48,000 of it tool results: log reads, ticket fetches, knowledge-base pages
- Retrieved passages: 6,000. Knowledge-base articles matched to the ticket
- The new message: 200. "User reports VPN drops every few minutes"
The agent's largest call from yesterday has five parts: the system prompt and project file, tool definitions, the history, retrieved passages and the new message.
What fills the call
Most of the call is tool definitions the agent never calls and tool results it has already read. The new message is only 200 tokens.
Cut What the Call Does Not Need
On these round numbers, tool search, clearing old tool results and skills take the same call from about 118,000 tokens to under 30,000.
Name What Still Fails
The call before the cut: about 118,000 tokens
- Re-learns the gateway quirk: Missing. Never written outside the window
- Works a closed ticket twice: Missing, at compaction. Ticket ids in the history only
- Escalates on the old rule: Contradicted. A superseded decision in an always-loaded file
- Slow, calls keep growing: Re-bought and drowned. Unused tool definitions, old tool results
Each complaint traces to a part of the call before the cut, or to a fact never written outside the window. None of them is a model fault.
Step 2: Type What It Carries
Put each block through the four questions from Four Kinds of Context: who may write it, who must obey it, how long it lives, how it is checked again.
- Standing capability. The identity and the five tools the agent uses. Fine where it is.
- Law written as prose. "Never reset a user's MFA without a verified callback." The model weighs that line against everything else. It moves into the reset tool, which refuses without a callback id, and the prose stays only as the reason.
- Direction in the wrong place. "Escalate VPN tickets after two failed fixes" is a decision, and it has been reversed. It sits in a file that loads whole on every call and cannot hear its own reversal. That is complaint 3.
- Coordination kept as history. Which tickets are closed lives only in the transcript. That is complaint 2 waiting for a compaction.
- Working context. The log reads and ticket fetches, the bulk of the history. They are needed once, then they ride.
Step 3: Cut What the Call Does Not Need
Pull the levers from How an Agent Builds Its Context, one per part.
- Tool search for the six systems' tools, keeping the five the agent uses loaded. The 41,000 tokens of definitions become a few thousand.
- Clear old tool results once read. Log reads can be fetched again; the history stops growing by whole files.
- Skills for the troubleshooting guides. Each guide's one-line description loads up front, and the full guide loads when a ticket matches it.
- Compaction stays, but only after steps 5 and 6, so the summary has nothing left to lose that matters.
On these round numbers the same call falls from about 118,000 tokens to under 30,000. That fixes complaint 4, and it fixes it by assembly, which a larger model would not have done: a larger model inherits the same call.
Step 4: Name What Still Fails
Map each complaint to its kind with the table in When Context Turns Against You.
| Complaint | Kind | Where it was | The fix |
|---|---|---|---|
| Re-learns the gateway quirk | Missing | Never written outside the window | A note that outlives the session (step 7) |
| Works a closed ticket twice | Missing, at compaction | Ticket ids in the history only | Ask the ticket system, not the summary (step 6) |
| Escalates on the old rule | Contradicted | A superseded decision in an always-loaded file | A decision record (step 5) |
| Slow, calls keep growing | Re-bought and drowned | Unused tool definitions, old tool results | The cuts in step 3 |
None of the four is a model fault. Each failure has an address.
Step 5: Write Down What Was Decided
The escalation rule leaves the project file for a decision record the harness puts back into the window on every call, and again after every compaction:
## Decisions in force
- D7: escalate VPN tickets to the network team after one failed fix.
[service desk lead, 2026-10-14]
## Superseded
- D4 -> D7: "escalate after two failed fixes"
## Exact references
- VPN-GW-2, runbook RB-31
The old wording stays, marked as replaced, so a reader that meets "two failed fixes" anywhere in the history can tell it is dead. The project file keeps one line: read the decision record first.
Step 6: Give Shared State One Writer
The three agents share one thing that matters: who owns each ticket and what has happened to it. The ticket system's own history is already an append-only ledger, so the resolution agent appends "fix attempted" and "resolved" events through its ticket tool, and nothing else writes them. Status is derived from those events when asked, as Shared State Needs One Writer showed. Before working a ticket, the agent re-reads its current state instead of trusting a summary, so complaint 2 cannot survive a compaction: the closed tickets were never the summary's to remember.
Step 7: Decide What Outlives the Session
The gateway quirk is the one fact all three agents keep re-deriving, so it earns a place in a store they share. A store, unlike a window, does not forget on its own, so it needs a curator: a person or a rule that decides what is kept, merged and retired.
flowchart LR
W["Working context<br/>one agent, one task"] -->|"proposed with evidence"| C{"Curator:<br/>keep it?"}
C -->|"yes: promote"| S["Durable store<br/>kind, writer, date, source"]
C -->|"no"| X["Dropped with the session"]
S -->|"retrieved for a call"| R["The next call's window"]
R --> W
S -->|"superseded or expired"| T["Retired by pointer<br/>kept in the log"]
style S fill:#5a5a8a
style T fill:#e3f2fd
Figure: A curated store. Working context is proposed with evidence; a curator keeps it in a durable store with its kind, writer, date and source, or drops it; kept entries are retrieved into later windows and retired by pointer when superseded or expired.
The resolution agent proposes the note ("gateway drops sessions when the idle timeout is under 300 seconds; fixed by raising it") with the ticket that proves it. An engineer approves it, and it enters the store with its writer, date, source ticket and the runbook version it applies to. All three agents read it. When the runbook changes, every note citing the old version is flagged for review instead of riding on. A note the intake agent tries to save from a customer's email goes through the same approval as any other write, because that is how planted text would get in.
The loop in the figure is why the curator matters. What comes back into a window was put in the store by an earlier window, so a store that admits everything, or never retires anything, feeds its errors back on every call that reads it. Anthropic's memory tool documentation gives the smallest version of the job: "Periodically delete memory files that haven't been accessed in a long time."
What You Can Now Do
That was the whole series in one afternoon's work. Here it is as what you can now do, with the chapter that taught each.
- Read any call and say what each part is, where it came from, and which part is largest. (What Context Engineering Means)
- Type each block by who may write it and how long it lives, and spot law written as prose and decisions in files that cannot hear their reversal. (Four Kinds of Context)
- Keep direction current: objective, intent and decisions in force as separate lists, with a reversed decision moved to Superseded, not deleted. (Direction Is Not Law)
- Put law where it is enforced: each rule that must hold as a check in a tool, a permission or a test that every route to the outcome crosses, with one sentence of why left in the prose. (Law Belongs in the Harness)
- Do the budget and pick the lever: tool search, clearing, skills, compaction, subagents, retrieval or a memory file, each for the part it cuts. (How an Agent Builds Its Context)
- Name a failure by kind from its symptom, in this site's words and the field's, and know which failures trimming cannot fix. (When Context Turns Against You)
- Keep a decision record whose supersessions survive a compaction. (the same chapter, and its lab)
- Run several agents from one ledger, with status derived and one writer enforced by the tool. (Shared State Needs One Writer)
- Treat working context as disposable: rederive what can change, write down what must cross a boundary before it arrives, promote notes only on purpose, and let the rest go. (Working Context Is Disposable)
- Curate at a change of plan: rewrite the record first, pick the reset by how much went stale, and re-read the record after it. (Compaction at the Pivot)
- Decide what earns a place in a durable store, and stamp it with a writer, a date and a source. (this chapter)
Beyond One Project
The routine stopped at one desk's three agents. Once a store is shared beyond one team, the same questions (who may write, how a reader knows an entry is current, where it came from) land on infrastructure you may not own, so it is worth knowing which parts already exist and which are still open.
Durable memory is shipping. Anthropic's memory tool keeps a directory of files the model reads and writes across conversations, stored by your application. OpenAI's Conversations API keeps a conversation's state as "a long-running object with its own durable identifier" that can be reused across sessions, devices or jobs.
Shared protocols settle how context is read. In the Model Context Protocol specification (version 2026-07-28), resources "allow servers to share data that provides context to language models", each named by an address, optionally stamped with a lastModified time, and open to subscriptions that notify a client when a resource changes. Subscriptions are a mechanism for keeping positions fresh. They do not decide who may write; that is still the single-writer rule, and a decision someone on the team makes and enforces.
Provenance is what the trust ranking in When Context Turns Against You needs from a store: where each piece came from. The W3C's PROV family describes provenance as information about "entities, activities, and people involved in producing a piece of data". Two problems are open. Summaries strip it: a digest of ten notes from three writers usually names none of them. And a store agents write to is an attack surface: OWASP's Top 10 for Agentic Applications (published 2025-12-09) lists Memory and Context Poisoning as its own risk, text planted once and recalled as fact long after. Provenance is what lets a reader find and discount it.
Three things are not settled, and this chapter does not claim them. That bigger windows will make stores unnecessary: so far, more room has not removed the need to choose what goes in it. That memory will move into the model: every mechanism here keeps text outside the model and puts it back, so none of it is learning. And that there is a standard for memory itself: MCP standardises how context is read and PROV how provenance is described, but no widely adopted standard says what an agent's memory store holds or how its entries are typed.
When the Opposite Wins
The routine is overhead for a single agent on short tasks: a project file and a progress log are a store already, and curating them is one person's ten minutes. A shared store also brings governance (an owner, retention rules, access control, review of writes) that a small team may not be able to staff. And a stale store is worse than none: an agent with no memory knows it does not know, while an agent with a confident wrong note does not. Build the store when the same knowledge is being re-derived across sessions or agents, and not before. Run the first four steps on everything; the last three earn their keep only where decisions change, agents share work, or knowledge outlives the session.
What to Do Next
- Run the routine on one agent this week. Pick the agent with the most complaints and go through the seven steps in order, writing down what each step found.
- Start with the biggest part of one call. Whatever step 1 shows as largest is usually the first fix, and it is usually not the conversation.
- Move one decision and one rule. Take one decision out of an always-loaded file into a record with a Superseded section, and one prose rule into a tool or a permission.
- Find the fact your agents keep re-deriving. That is the first entry your store needs; stamp it with a writer, a date and a source.
- Schedule retirement. Decide how an entry expires or is superseded, keep a pointer to everything retired, and sample what the store returns against the source.
This is the last chapter of Context Engineering. You can now read any call your agent makes, say what each part is and where it came from, pick the technique that fixes what is wrong, and keep decisions and shared state correct across sessions and agents. Next on Start here: Sandboxing and Control, starting with Shadow AI Signs In as You. A store agents write to is only as safe as what a misled agent can reach, and that series bounds the reach. To revisit this series from its start: What Context Engineering Means. Related reading: Where Retrieval Enters the Turn for how stored text reaches the window; Externalize the Knowledge for giving changing knowledge a lifecycle outside the agent; and The Files Are the Memory for the simplest durable store there is.
Next on Start here: Sandboxing and Control, chapter 1 of 8: Shadow AI Signs In as You →