A migration agent has spent two days on one objective: move the claims service onto the new message queue. Its history holds the design it chose, the consumer it wrote, three failed load tests and the fix for each. On Wednesday morning the plan changes. Audit has frozen the migration, and the job is now a read-only export of last quarter's claims for the auditors, on the old queue. The user says so in one sentence. Every line of the last two days is still in the window, and almost all of it now argues for the wrong thing. The agent has not yet made a mistake. It is about to have every reason to.

Thesis: A change of objective is the moment the most context goes stale at once, so it is the moment to curate, not the moment the window happens to fill. Curate in order: rewrite the record first (the new objective, every decision it invalidates moved to a Superseded list with its old wording, the exact identifiers), then decide what to do with the history (clear it and carry the record over, compact it with a focus, or leave it when little has gone stale), and re-read the record after any reset. Compaction is one tool in that curation, not its point. The order follows from the mechanism; whether it prevents wrong work is unshown, because my test could not make ordinary compaction fail often enough to compare anything against it.


Shared State Needs One Writer kept decisions correct across agents, and Working Context Is Disposable argued for writing down what must cross a boundary before it arrives. This chapter keeps decisions correct across a change of plan, the one moment when the most of them go stale together. The claims service, its tickets and its identifiers are invented for the example; the test results and session counts are from my own records.

A Pivot Is a Seam

Compaction usually happens at the edge of the window: the session fills up, the harness summarises, work continues. That timing is set by a token count, which has nothing to do with the work. The summary is cut mid-derivation as readily as at a natural break, and the summariser has no way to know that half of what it is condensing was abandoned an hour ago.

A pivot is a seam in the work itself. Before it, one objective; after it, another. On 30 October, asking for tooling to manage this, I put it this way: "if there is a shift in alignment we may want to premptively [sic] compact and remove the old contradicting history". Two kinds of change count. The objective moves ("scrap that, build it as a command-line tool"), or a decision in force falls ("we don't need the migration anymore"). A tactical correction inside the same objective ("use a comprehension instead of the loop") does not; it updates one line and moves on.

Others argue for seams too. LangChain's autonomous context compression (2026-03-11) gives its agent a tool to compress its own context and suggests using it at clean task boundaries, such as when the user moves on to a new task. LangChain reports no quantitative result, says it tuned the feature to be conservative, and saw no autonomous compaction at all on Terminal-bench-2. Anthropic's compaction overview offers compaction at a token threshold, on demand, or through your own summariser; on demand is the mode that lets the application, not the token count, choose the moment.

Who notices the pivot matters less than it seems. When I calibrated a keyword detector for pivots on 377 of my own prompts, it fired on 5.0% of them, and nearly every strong hit was a false positive. The real pivots announced themselves in the first sentence. A person usually knows when they changed their mind; the useful work is in what happens next.

Rewrite the Record First

The order matters. A reset without a rewritten record throws away the old history and the reason it was abandoned, and the next context can rediscover the abandoned plan from the files it left on disk. So the first step is one edit to the record, the short file outside the conversation that When Context Turns Against You built. For the migration agent it reads:

## Objective
Read-only export of Q3 claims for audit, on the existing queue.        <- new

## Decisions in force
- D4 @p31: export as CSV per audit spec AUD-2291; no writes to claims-db. [user]

## Superseded
- D1 -> D4 @p31: "migrate claims-svc consumers to the new queue" - migration frozen by audit.
- D2 -> D4 @p31: "dual-write during cutover" - no cutover now.

## Open questions and obligations
- Q: does audit want deleted claims included? (asked @p31)
- Promised: row counts against the replica to the audit lead before the export ships.

## Exact references
- AUD-2291, claims-db (read replica only), queue topic claims.v1

At a pivot, three parts of it carry the load. The superseded decisions keep their old wording and point at what replaced them and at which prompt, so a later reader can recognise the abandoned plan when it surfaces in a file or a test name; Direction Is Not Law is why. Open obligations are carried too: questions asked and not answered, follow-ups promised, anything someone is waiting on. The stock summary tracks pending tasks, but none I have seen keeps unanswered questions or promises made to someone else, and they are the first thing a fresh context forgets it owes. And identifiers are copied exactly: What Compaction Actually Destroys measured a live compaction that lost all 31 of the record ids its work cited, and a record that says "the audit spec" instead of AUD-2291 hands the next context a search, not a fact.

A pivot also sends the work back to discovery, the phase where the agent asks until the new objective is clear; How an Agent Builds Its Context places that phase in the flow. I tested a discovery style against the default on eight hidden briefs, each run three times in each style, with a model standing in for the person answering the questions, and graded the results blind with other models that were never told what was compared. The discovery style's decisions fitted the brief better on 6 of the 8 briefs and tied on 2: 82.6% against 70.8%, a gain of 11.8 points. It wrote the record without being asked on all 8 briefs; the default wrote it on none. It also took a median of three turns to reach a direction against one, and 1.43 times the tokens. The bar, set in advance, was a 15-point gain at no more than one and a half times the turns, so the style failed on both counts, and my tooling does not open in it.

Three limits narrow that result. The switch to a terse style fired when the agent wrote its own direction down, not on a measured sign of alignment, and nothing measured whether the output got shorter after it. The discovery answers were longer and carried the record's headings, so a grader could tell the two styles apart, and seven answers the grader marked unclear scored zero. And after one compaction both styles fell close to zero fit on 6 of the 8 briefs: 22.9% against 12.5% overall, a gap that means nothing (1 of 8 briefs in that direction, p = 0.5), though the measure changed shape at that point. Read it as a trade: a consistent, modest gain in fit, bought with three times the turns.

Then Choose the Reset

With the record rewritten, there are three choices. In Claude Code they are documented commands: /clear starts "a new conversation with empty context", and /compact [instructions] summarises the conversation, where you can "optionally pass focus instructions for the summary" (commands reference, checked 2026-11-16). Other harnesses have equivalents.

Clear and carry over Compact with a focus Nothing
When The old history dominates and little of it will be reused Parts of the old history still matter: partial results, error traces The window is under about 40% full and the superseded set is small
What survives The record, exactly, and the files on disk A summary shaped by the focus text, plus the record Everything, with the record updated
Loss None for the record; the old turns are gone from the window Lossy, as every summary is None; the old turns still speak
Risk Something the record forgot is gone The summary keeps the wrong parts Old history outvotes the new objective

The 40% line is a rule of thumb from my own protocol, not a measured threshold, and none of the three choices has been shown to beat the others. Below the line, the stale turns are a small share of what the model reads and the updated record usually outweighs them; above it, the balance tips. Treat the number as a starting point to tune.

For the migration agent, the focus text for a compaction would read:

Preserve: the objective (read-only Q3 claims export for audit), decision D4, every exact reference verbatim
(AUD-2291, claims-db read replica, claims.v1), the open question and the promised row counts, the current work (the
CSV writer) and the next step (row counts against the replica).
Drop: the queue migration (D1, D2) and the work that served it: the new consumer, the dual-write code, the load tests.

It is written calmly on purpose. In earlier work of mine, imperative wording in text added to the compaction prompt made the summariser treat it as an injection attempt and refuse, and the compaction failed. Plain description of what to keep and what to drop is the safer form.

The model can prepare all of this; the user or the harness triggers it. In Claude Code a plugin cannot start a compaction or delete transcript history, and here that is right: the pivot is a human decision, and the reset is how the human makes it stick.

Re-read the Record After Every Reset

A summary is derived; the record is the source. So the record goes back into the window after every reset, word for word, rather than trusting the summary to have kept it. Claude Code exposes the moment: a SessionStart hook runs with the source compact after a compaction (and clear or resume after the others), and the context it returns "adds context for Claude" (hooks reference, checked 2026-11-16). A hook that prints the record there puts the objective, the decisions in force, the Superseded list and the open obligations back in front of the model before its next call.

Two documented details shape how. A hook's added context is capped at 10,000 characters; anything longer is written to a file, and the model gets the path and a preview of the first 2,000 characters but is not asked to read the rest, so the record has to stay short. And switching the output style mid-session keeps the prompt cache, because Claude Code delivers the new style as a message; switching the model does not, and on most models neither does changing the effort level (prompt caching, checked 2026-11-16). So moving from discovery to a terser execution style can be cheap, while a phase that also swaps the model pays to read the whole history again.

flowchart TD
    P{"Objective or<br/>decision changed?"} -->|"no"| X["Carry on<br/>against the record"]
    P -->|"yes"| R["Rewrite the record<br/>new objective, Superseded, exact ids"]
    R --> W{"How much has<br/>gone stale?"}
    W -->|"little"| N["Leave the history"]
    W -->|"most"| C["Clear<br/>carry the record"]
    W -->|"some"| K["Compact<br/>calm focus"]
    C --> I["Re-read the record"]
    K --> I
    style R fill:#5a5a8a
    style I fill:#2d6a4f

Figure: Curation at a pivot. A change of objective or a fallen decision sends the work to the record first; how much has gone stale then picks the reset: leave the history, clear it, or compact it. After a clear or a compaction the record is read again before work resumes.

Two limits apply. A subagent spawned after the pivot does not get the main system prompt, the output style or the conversation; it usually loads the project's rules file, and the subagents documentation lists the exceptions. So it needs the record in its brief; Subagents: Fresh Eyes on Demand covers why it starts fresh. And the record helps only if someone keeps writing it: nothing in my own tooling updates it by itself.

What the Evidence Says So Far

Most of what I have is about the mechanism, not the outcome. The figures come from a session plugin I built and its records.

  • The record gets written. In a scripted test with one planted pivot, run three times, the agent wrote the record every time and recorded the pivot as a supersession with the old wording kept, at 23% context; consistent with the 40% rule, it advised neither a clear nor a compaction. One model, one scripted pivot, three runs.
  • A summary does not carry the record, even when offered it. Across my sessions from 2 to 15 November, 23 automatic compactions ran with a record in place and no focus text. In each, my plugin offered the summariser a shortened copy of the record, at most about 2,000 characters, so the largest records were cut before the summariser saw them. Together, the summaries named 229 of the 510 decisions in force the records listed: all of them in 7 compactions, fewer than half in 9. That is a count of decision ids found in each summary, not of what the agent did next, and nothing was compared against it. It is why the record is read again after a reset rather than left to the summary.

None of this shows that curating at the pivot prevents wrong work, and the test I built to show it could not get that far. It forged sessions with a pivot planted, let 30,000 to 90,000 tokens of later work pile up, crossed one compaction, and was to compare five approaches on whether the agent then acted on the superseded decision: ordinary automatic compaction; a manual compaction with the record as its focus; a manual compaction with one generic calm template; the record handed to the summariser and re-read after compaction; and the last two together. (The telemetry above touches the fourth approach, uncontrolled and with no comparison.) Its first step, set before any money was spent, checked that ordinary compaction fails often enough to measure: in at least 4 of 12 sessions, about 30%. It did not. The agent acted on the superseded decision in 0 of 8 runs, then in 1 of 6 and 0 of 5 after two rounds of making the scripts harder, with about 67,000 to 95,000 tokens in context when it compacted, and one model (Claude Sonnet 4.5). The five approaches were never compared, and by the rule I set in advance my tooling keeps its current behaviour. The generic template will not run automatically at a pivot; whether it helps when a person chooses to use it is untested.

That is a fact about the instrument, not about compaction. A test that cannot produce the failure cannot show whether a fix prevents it, and it says nothing about much longer sessions, such as the one in What Compaction Actually Destroys that compacted at 998,437 tokens. Two smaller findings came out of it. A detector that flags a pivot from the user's words caught 6 of 8 planted pivots and raised no false alarm on 349 ordinary prompts: short of the 80% bar set in advance for acting on it automatically. And the checks that the record does no harm, such as never treating an unconfirmed message as a supersession, passed, but only because ordinary compaction never failed them either.

When the Opposite Wins

Compaction may not be where the failures are. One long session in my notes crossed 13 compactions in under three hours, and 12 of the 13 summaries, which the agent wrote itself, carried an explicit supersedes field. What decayed was the quality of the agent's attention, not the record; When Context Turns Against You makes the same point about keeping the history. If your agent or harness already keeps supersession, a pivot protocol adds ceremony for little gain.

A bigger window does not remove the question. "Million-token windows make this moot" is the obvious reply. The largest automatic compaction in What Compaction Actually Destroys happened at 998,437 tokens, which, by that post's inference, was a million-token window. A bigger window moves the edge later; the pivot still arrives when it arrives.

Clearing throws away what the record forgot. The record is short by design. A partial result or an error trace that nobody copied into it is gone after a clear. That is why the focused compaction exists, and why "little has gone stale" means do nothing.

The record can be wrong. A Superseded line is only as good as the evidence it was derived from. If the pivot itself was a mistake and the user reverses it on Thursday, the same derivation runs the other way and the record gets the matching edit; supersession follows the evidence, not a direction.

Short sessions do not need it. A session that ends before the window fills, or never changes course, has nothing to curate.


What to Do Next

  • At a pivot, edit the record before anything else. New objective first, then move each invalidated decision to Superseded with what replaced it and the evidence, and carry the open obligations.
  • Pick the reset by how much went stale: clear and carry over when the old history dominates, compact with a calm focus when parts matter, nothing when little changed. Tune the 40% line on your own sessions.
  • Re-read the record after every compaction and clear, from a session-start hook or its equivalent, under the hook's size cap, and put it in every subagent's brief.
  • Write focus and injected text as description, not orders. If your compactions start failing, check the wording first.
  • Count what your summaries keep. Check, for a few compactions, how many of the record's decision ids the summary still names. If it is most of them, the re-read is insurance; if not, it is the only copy.
  • Check the failure before you standardise a fix. Plant a pivot in a few of your own sessions, compact, and count how often the next action follows the old plan without the record. If it rarely does, as in my test, you cannot yet measure a fix, and the record is an untested precaution rather than a proven cure.

Next: Context Engineering in Practice, the last chapter, which runs the whole series as one routine on a single agent. Related reading: Direction Is Not Law for why a reversed decision is kept, marked; What Compaction Actually Destroys for what a summary drops at the boundary; Anatomy of a Turn for why the whole history is resent on every call; The Files Are the Memory for keeping state on disk rather than in the transcript; and Subagents: Fresh Eyes on Demand for what a subagent starts without.