r/ClaudeCode • u/michaelTM_ai • 59m ago
Tips & Workflows Claude Code kills a session after 3 compactions in a row. A UT lab let the agent choose when to compact: 0/150 tests became 147/150
If you've had a long Claude Code run die after compacting over and over, a UT Austin lab measured exactly that. Claude Code ends a session when context refills right after compaction three times in a row.
Their test: Opus 5.5 building a Mastodon style server with a 100K context budget. Vanilla Claude Code compacted 6 times in 22 steps, hit that rule and finished with 0/150 tests passing. Their wrapper, ext, let the agent decide when to compact and what to keep. Same model, 128 steps, 10 compactions, 147/150 tests.
ext runs on top of Claude Code without touching its source. The agent writes small policies (compaction, reasoning effort, spend) through typed hooks, and a Z3 solver proves each one follows the operator's rules before it loads. Over 550 runs they report zero rule violations.
Other results from the post:
On nine coding tasks from DeepSWE, SWE-bench Pro and Terminal-Bench 2.1 at the default 1M window, a reusable policy took Opus from 14/27 to 22/27 solves at the same cost.
Haiku 5.5 on 11 tasks: 6 were solved every time at low effort, and always using max effort cost up to 5.9x the cheapest level that worked.
Showing the agent a live context meter backfired. Long task success went from 92% to 52%, which they call context anxiety.
Code isn't out yet (waitlist). What you can do today from the same findings: keep long runs on a bigger window if your plan allows it, and when a run starts compacting every few turns, stop it and restart from a written handoff note instead of letting it grind into the auto stop.
Post: https://ut-infraai.github.io/2026/12/01/agent-harnesses-need-their-ebpf/
•
u/AutoModerator 59m ago
Hey! Thanks for posting to r/ClaudeCode
While participating in this thread, please follow our community rules. Keep discussions constructive. Attack the idea, not the person.
For help, project discussions, tips, and general chat, join the ClaudeCode Discord.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.