Compacting Claude Code at 400K instead of 967K cut this dev's cost per request by 43%

Awkward-Let-4628 · reddit · 2026-11-03

The author set autoCompactWindow: 400000 on 1M-window models, where Claude Code otherwise compacts near 967K. Comparing 25K requests before and 16K after, average context per request fell from 415K to 220K and cost per request dropped 43% (previously 68% of main-thread cost came from >400K requests). The tradeoff: more compactions—75 summaries in one week, 95 minutes of waiting. His fix is "sliding instead of summarizing": a hook keeps the conversation verbatim and replaces old tool outputs with a one-liner, taking milliseconds with no model call. Benchmarks show −19% to −35% cost and −17% to −33% time vs Claude Code summaries, all tests passing. He also released tokendoctor (free, local, MIT), which replays your sessions at 200K–600K windows to compute your personal savings before changing anything.

Original post →

More from coding & agent

coding & agent channel →