What this thread does
Background
In September 2026 a technique spread on X: run a small, fast classifier over every tool call in a Claude Code or Codex session log, score how useful each one still is, and delete the low scorers to shrink the context instantly instead of waiting for /compact.
Theo (t3.gg) replied with a long critique. His main points, in short:
- Compaction isn't a filter. It exists to keep the agent focused on long runs, used sparingly, not to keep context small at all times.
- A per-tool-call judge lacks context. A small model scoring one call at a time doesn't know what the rest of the session was about, so it can delete the evidence of what the agent already tried, and the agent repeats itself.
- Reasoning is lost. Frontier APIs return reasoning as encrypted or opaque blocks that must be preserved as-is; an external pruner can't read them and may drop them.
- Models are trained on their own compaction. The built-in flows are part of how current models were tuned for long runs.
- Cache economics. Editing history early in the conversation invalidates the cached prefix after that point, and cache writes cost more than cache reads.
He still calls it an interesting experiment, but recommends the tools' defaults for everyday use.
What the Claude Code docs say about caching
Claude Code's prompt caching page (as of October 2026) confirms the mechanism behind the cost argument: the cache matches the start of each request exactly, so a change anywhere in the history recomputes everything after it. /compact itself rebuilds the cache once. The docs' advice is to pick model and effort at the start of a session and save /compact for natural breaks between tasks.
Codex CLI 0.166.0 fixes reasoning-token accounting across resume and fork to avoid premature compaction (checked 2026-11-05).
Lower-risk ways to keep context clean
/clearbetween unrelated tasks instead of carrying one long session.- Send noisy side work (big searches, log reading) to a subagent so only its summary comes back.
- Use
/contextto see what loads at startup (CLAUDE.md, rules, MCP tools) and trim it. - Quiet flags on test and build commands so tool output is short.
Open questions
- In your own harness (not Claude Code or Codex), with models that return plain reasoning, does selective pruning help?
- Has anyone measured cost and task success with and without custom pruning on the same tasks?
Sources
Primary sources, opened 18 October 2026: Claude Code prompt caching page and the API extended thinking page.
- Confirms: the cache matches the start of each request exactly, so a change anywhere in the history recomputes everything after it;
/compactreplaces the history and so rebuilds the cache; the advice to fix model and effort early and run/compactat natural breaks. The API page also says changing the thinking configuration between requests invalidates cache breakpoints and that Opus 4.5 and models from 4.6 up keep earlier turns' thinking blocks in context and bill them as input. - Not confirmed: Theo's own wording (the X post returned an HTTP 402 and did not open), the claim that current models are trained on their own compaction, and the claim that reasoning blocks cannot be dropped by an external pruner. The pages above support the cost mechanism only.
- Also on the caching page: compaction can run before the cache expires while a request reads the cached prefix, so a mid-session
/compactcosts less than the context size suggests when the cache is warm.
Started from a post by @theo, packaged by the editor. Original post