← Back to Blog

Using Coral's Context Reset to reduce average turn cost by 50-75%

Long-running agents carry everything they’ve ever read into every new request. Each turn re-reads that entire accumulated history from the cache, and those cache reads dominate the API bill. Context Reset lets an idle agent shed that bloat without losing its working state.

On 10 November at 04:31 UTC I turned on Automated Context reset in Coral. Here is what happened.

Breaking it down by model:

Opus 5.5Sonnet 5.5 $0.00 $0.10 $0.20 $0.30 reset on, Nov 10 $0.29 $0.11 Nov 7 $0.26 $0.11 Nov 8 $0.27 $0.10 Nov 9 $0.10 $0.05 Nov 10-11
Cost per turn by day (24 hours from 04:31 UTC), Opus 5.5 and Sonnet 5.5 shown separately. The last group is the first day after the switch.

Throughput didn't drop. We sustained ~1,230 turns/hour after the switch, squarely inside our pre-switch baseline of 630 to 1,620 turns/hour.

Where the Savings Actually Come From

A turn is a single call to the model. Its token breakdown tells the whole story:

Opus 5.5 1 10 100 1,000 10,000 100,000 1,000,000 reset on, Nov 10 Nov 7 Nov 8 Nov 9 Nov 10 Nov 11 input (new) cache write cache read Sonnet 5.5 1 10 100 1,000 10,000 100,000 1,000,000 reset on, Nov 10 Nov 7 Nov 8 Nov 9 Nov 10 Nov 11 input (new) cache write cache read
Tokens per turn by model, in 6-hour steps, on a logarithmic scale (each gridline is ten times the one below). Both models show the same step: cache read falls from about 500,000 to about 170,000 and nothing else moves much. The Opus step just before the switch has only 649 turns.

How it works

Once a minute Coral looks at each agent in a team that has the setting on. It acts only when the agent is idle, its context is over the team's limit (225,000 tokens by default), it has no unread board message, and it is not stopped by a usage limit. It never types over a draft or a dialog, and it leaves each agent alone for 30 minutes after a reset.

Coral's Health check settings: Compact an idle agent's large context is on, past 225 thousand tokens, when the context is large, with the options Compact (keep a summary), Clear then the next task, and Ask for a handoff note, clear, then the note; Compact the orchestrator too is on
The setting, in Health check: on or off, the size it acts past (225 thousand tokens), when it acts, and what it does.

Then it types one fixed line: the agent's own compaction command. For Claude it carries one instruction: keep open tasks, team rules, recent decisions, and what the agent was last asked. For the others it is the bare command. Nothing from a task or a message goes into that line. The same setting offers two stronger choices: "Clear, then the next task", and "Ask for a handoff note, clear, then the note", where the agent first writes down what it needs. The orchestrator is included by default.

What a compaction drops, the agent can fetch. It searches its own earlier words with coral-agent history search "words" and reads around a hit with coral-agent history context N.

Any harness

Context Reset is harness agnostic. It acts on the agent, not on the model or the company behind it: the checks (idle, nothing unread, no dialog open), the size limit and the handoff note are the same for every agent. Claude, Codex, Antigravity and Pi each have a compaction command of their own, and Coral sends the right one.

A note on how we found it

Before building anything, we measured our own transcripts: 14 days, 107 sessions, 301,377 requests, 139 billion cache-read tokens. The mean context was 463,000 tokens, and 94% of all cache reads happened in requests whose context was over 200,000.

We then replayed five ideas on those sessions to see what each would have saved:

IdeaCache reads saved
Compact when the context passes 200k, at a quiet moment51.9%
Compact at every finished task45.2%
Start a fresh session at every finished task46.6%
Compact only when waking from a wait, over 200k32.3%
Cap how long a tool result can beunder 2%

Two results shaped the design. Capping tool output was the smallest idea, because results are short. And a fresh session starts at about 39,000 tokens while a real compaction lands at about 56,000, so a full reset beats a compaction by only about 11,000 tokens a request, and it costs the agent its place. So we built the first row. These figures are upper bounds: they assume nothing has to be re-read after a compaction loses detail.

What's next

We will continue to experiment with different settings and track total performance against our tasks per touches metrics. Have any ideas? Let us know.

Try Coral

Open source. Runs on your own computer.

Download Coral