Should your coding agent compact its context? A new study says no
What HarnessTax found when it moved Claude Code's compaction threshold, and why I read it as a memory problem
Short version: a new paper from UC Berkeley and Arena, HarnessTax: How Much Does the Harness Matter for Coding Agents? (arXiv 2612.05657), changed one thing at a time inside production coding-agent harnesses. When they made Claude Code compact its context earlier, runs got slower, more expensive and less successful. When they never compacted at all, with a 1M-token window, they saw no statistically detectable effect.
What the paper measured
The authors (Melissa Z. Pan, Shuo Yang, Negar Arabzadeh, Wei-Lin Chiang, Ion Stoica and Matei Zaharia) ran 11,887 runs across eight models in three production harnesses: Claude Code, Codex and Pi. Benchmarks were SWE-bench Lite, Terminal-Bench 2.0 and 4.0, and Terminal-Bench Science 0.1.
Their headline finding: for a fixed model, the harness barely moves the success rate but moves cost a lot. They call that gap the harness tax. One example from the abstract: with the same model on Terminal-Bench 4.0, Claude Code cost 2.1x as much as Pi, with no statistically detectable gap in success. Pi, with only four tools, sat on the cost-success Pareto frontier on every benchmark.
Where does the extra cost come from? Mostly the system prompt, the tool definitions and the accumulated context that the harness re-sends on every model call, including definitions of tools the model never calls.
The compaction experiment
In one of the single-component studies, they lowered Claude Code's compaction threshold from 167K tokens to 100.8K or 64.8K. Compared with the default:
- runs took about 1.6x longer
- cost went up 1.47-1.70x
- success dropped 13-24%
Never compacting, using a 1M-token window, had no statistically detectable effect on time, cost or success.
Scope matters here. This slice used Opus 5.5 on 15 Terminal-Bench 4.0 tasks, so it's a narrow test, not a law. Also worth knowing: Arena sponsored the model API credits and runs its own leaderboard. Weigh that as you would any study.
Why I read this as a memory decision
Compaction is the harness deciding, by a token threshold, what the agent is allowed to remember. A summary is lossy in exactly the places a coding agent cares about: the exact command it ran, the exact error string, the file path and line it was looking at. Once those are summarised away, the agent has to rediscover them, which means more tool calls, more tokens and more chances to go wrong. That's my reading of why earlier compaction cost more and failed more, not something the paper claims to have isolated.
The practical takeaways I'm taking from it:
- Don't lower the compaction threshold to save money. In this test it did the opposite.
- Keep exact artifacts outside the context window. If something must be dropped from context, write the command, output and error to disk or a store the agent can search, so a lookup replaces a rerun.
- Audit what your harness re-sends every turn. Unused tool definitions are paid for on every call.
What I'd like feedback on
Do you let your agent compact, or do you start fresh sessions with a written handoff? And if you've measured either, I'd love to see the numbers.
Source: HarnessTax, arXiv 2612.05657, read 5 Dec 2026.
About the author
- Engineer at ClickHouse building AI agent infrastructure: agent memory, MCP, context engineering and code intelligence. I built ClickHouse Loom, open source shared memory, document search and a code index for AI agents. Memories point at the files and symbols they're about. MCP server, Claude Code and Codex plugins, SDKs, self-hosted on ClickHouse.
Comments
Join the discussionNo comments yet. Be the first to comment.


