Lab · Ongoing log

Autocompact earlier to run longer

Updated Jul 21, 2026

The harness I've developed is good enough that I spend almost all my time in Opus 4.8 in auto mode. Sonnet and Haiku subagents get deployed for anything mechanical, and Opus orchestrates. It's great for being able to walk away, but over time my average context per turn is way up. Since the full conversation gets submitted every turn, it burns my usage faster and caps how long a session can run before hitting my usage cap. I set up a dashboard to track this metric, and am running experiments to make it run smoother and longer.


The data

15.9B
Tokens measured
1,999
Sessions
11.7%
Turns over 300k
621k
Peak turn context
Line chart of context tokens per turn per day, March to July 2026. The teal average line climbs to ~245k then falls to ~160k; the coral peak line climbs to ~500k then bends down toward the dashed 300k cap after the July 7 marker where the auto-compact cap was applied.

As of Jul 21, 2026 — 1,999 sessions over 127 active days. Teal is the average context per turn; coral is the peak — the single heaviest turn — which is what the 300k cap (dashed) clips. The vertical marker is where the cap went in (Jul 7); both lines bend down after it.


What I learned

As the saying goes, the best time to build this dashboard would have been 6 months ago, but the second best time is now. Instrument early and often for data that matters. Claude can gather data on just about anything, so identify the highest order bit and put numbers to it.

After two weeks the signal is clear: a lower cap forces more compact sessions. The average context per turn dropped precipitously. It's difficult to demonstrate how much longer sessions have gone because I've been running multiple concurrent sessions almost every day, but that itself might be the proof. A week into the change I checked to see if I could further optimize by lowering the "floor" on a freshly compacted turn (cutting about 5.2k tokens out of one of my up front instruction files), but it got lost in the noise of the average.


The experiments

  1. Jul 20, 2026

    The cap paid off (two weeks of post-cap data)

    Result of the Jul 7 change. The bet was that peak context, not the average, was the thing to attack — clip the single heaviest turn and the whole session comes down with it. It did. The same turn now runs ~28% leaner; a whole session is ~40% cheaper (partly because sessions also got shorter, ~95 → ~79 turns); average context per turn fell from 242k to 164k. The savings: I'm on a Max plan, so none of that is a real invoice, just usage burn. Priced at API rates though the cap is worth about $0.06 a turn, cutting an estimated ~$450 a week.

  2. Jul 15, 2026

    Trimmed the always-loaded config to lower the fresh-session floor

    Hypothesis: every session opens by loading a fixed block of hooks/agents instructions before I type a word. If I shrink that front matter, then every session gets a little cheaper from turn one. The change: replace the always-on file with a thin trigger-map (similar to what's already in my CLAUDE.md) pointing to an on-demand detail file. Now, 5.2k tokens of instructions no longer load up front in a fresh session. What happened: The day-to-day variance of session length dwarfs the signal. The fresh-turn baseline ranged from 53k - 63k depending on the day. Cutting 5.2k of context on early turns just wasn't meaningful against a 160k average.

  3. Jul 7, 2026

    Set a 300k auto-compact window (+ a pre-compact hook to make sure I don't lose my telemetry data)

    Hypothesis: Peak context in a session, not the average, is the best indicator of usage burn. The change: a smaller auto-compact window — autoCompactWindow: 300000 in ~/.claude/settings.json (it fires ~287k on the 1M Opus) — plus a pre-compact hook to ensure my telemetry gets captured before each compaction wipes it. Now watching whether overall usage drops and sessions run longer and smoother. Result: in — see the Jul 20 block above. Short version: it worked, and by more than I expected.

  4. Jul 6, 2026

    Instrumented every transcript

    Built a parser to run over all 1,768 sessions and 78,602 turns to get per-turn token usage (deduped by message id).What it showed: reliance on Opus 4.8 (1M) and heavy use of auto mode had crept my average context per turn up; peaks were reaching 621k, and 13.6% of turns were running past a healthy 300k window. That's the signal that motivated the cap.