Check what your agent restarts with after compaction
If you run a coding agent for days at a time and let it compact its own context, this is for you. The story starts when Alexander Yue argued recently that a fresh session, with the old conversation saved to a file it can search, beats compaction.
To check it, I started with my own agent. I run several coding agents on each project, and the head agent plans the work, hands it to the others through a mailbox, and merges what comes back.
It’s one Claude Code session that runs for days. At my cap of 300,000 tokens, Claude Code compacts it: the model summarises the conversation, the session clears, and it carries on from the summary.
The restart was the surprise. I measured the first call after each of 149 compactions and split it by where each part came from.
A fresh session starts at about 70,000 tokens: the system prompt, tools, instructions and skill list. Compaction brings back about 75,000 more, mostly recent messages and the skills it had loaded.
Do the same split on yours. What matters is how much of the restart sits above what a fresh session would load anyway, which for me was about 75,000 tokens.
Count what the restart costs on every call
Each call to the model sends the whole context again. Most of it comes from the prompt cache at a tenth of the price, but it’s still billed.
So after a compaction, every call starts from 145,000 tokens and grows. On a busy day the head climbs to the limit and compacts up to 36 times.
Waiting costs time too. A third of my summaries were written on the spot rather than ahead, each holding the agent up for a median of 86 seconds.
Yue measured the handover itself, on a session of about 400,000 tokens. Searching a saved log took 15 seconds and $0.10, against 29 seconds and $0.17 for compaction with a warm cache.
His numbers are about the moment of the handover. Mine are about every call after it, which turned out to be the bigger cost, so I now price every call rather than the handover alone.
Replay your own calls before changing settings
To compare settings without waiting weeks, I replayed those four days, keeping every real call and what it added to the context, and changing only the restart size and limit.
A bigger window was the most expensive setting. With more room, the head spends longer at high context before each reset, and every one of those calls is large.
I picked 200,000 because it resets about as often as compaction does now. Each fresh session gets the same room to work in, and starts with half the load.
A second project’s head agent agrees. Replaying its October, a fresh start at 200,000 costs 25% less than compaction at 300,000. Replay your own calls the same way before you change a setting.
Keep the agent’s state outside the conversation
Rigby, the small supervisor I wrote to run my agents, already covered most of what a fresh start needs. The head keeps its state outside the conversation: in its inbox, in git and in the plan it works from.
I wrote about that in how to make git the system of record for your AI coding agents. A fresh session could already find out what every agent was doing without the old conversation.
Before you start fresh, check that a new session could find out what every agent is doing without the old conversation. Mine could, so the handover only needed four more pieces, and it only ever runs between turns.
List the failures and set the bar first
The replay prices the calls. It can’t tell me whether a fresh session does the job as well as a compacted one, and that’s where this could fail.
Forgetting was my first worry. So the note carries my last messages and its own last replies, and it reads them before it touches anything.
Cutting work off is the second. The handover never happens mid-turn: if anything new arrived after the turn ended, Rigby skips and tries at the next one. I checked that rule against 7,620 real turn ends.
It also waits while the head has its own agents, shells or test runs going. A fresh session would get their results without knowing why it asked for them.
Rigby now writes one line per agent per day, read from the session transcripts, so the comparison won’t rest on my impression.
The second project stays on compaction until the first clears a bar I set before switching it on.
And if it all goes wrong, compaction is still on at 300,000 tokens as the backstop, and one setting turns the handover off.
How far to trust it
The compaction numbers are measured on one agent. The fresh start is a projection from replayed calls, and whether it does the work as well is the open question.
Update, 12 November 2026: in its first 40 fresh starts, 1 to 4 November, the head restarted at 78,000 tokens, under my 90,000 bar.
Calls cost about the same, so it missed the 15% cut per call I asked for. It needed fewer of them instead: 30.5 per task, down from 39.5. The numbers are in the rework article.
Try a fresh start on one agent first
To try this on one agent, save its old conversation to a file with a note on top, and start the new session with a message that points at it. Mine are below, shortened.
The saved log opens with a note on where the head was: my last messages, its last three replies and the skills it had loaded. Then comes the old conversation, one line per message, so a search lands on the right moment.
The saved log, note first (illustrative, shortened)
## Where you were
Skills this session loaded: cross-rig-loop, rigby-fix
The operator's last messages, oldest first:
#412 10-27 04:31:07 operator: Ship the export fix once both reviews pass.
Your last replies, oldest first:
#413 10-27 04:31:15 you: Both reviews passed. Merging the export fix.
## The conversation, oldest first
[#412 10-27 04:31:07 operator] Ship the export fix once both reviews pass.
[#413 10-27 04:31:15 assistant] Both reviews passed. Merging the export fix.
[#414 10-27 04:31:16 tool Bash] git merge --no-ff export-fix
[#415 10-27 04:31:19 result] Merge made by the 'ort' strategy.
[#521 10-27 05:02:44 mailbox] The parser agent finished its unit and asks for review.The new session’s first message tells it to read that note, check its inbox and git, and search the log only when it needs something.
The fresh session’s first message (simplified)
RIGBY HANDOVER: session 3f2a ended at 214,880 tokens.
You are the head, in a fresh session replacing a compaction.
First read where you were: the note at the top of history/3f2a.txt.
Then check your inbox, your agents, git status, git log
and the plan you were on.
The rest of that file is the old conversation, one entry per line.
Search it with rg when you need something from before.
Never read it whole.
Carry on from there. If that work is finished, wait for mail.Change the names and the checks to match your setup, and leave one agent on compaction until this one clears your bar.
How the handover works
So, will it work? On paper, yes. I’ll compare the two weeks either side of the switch and update this post with what happened.