Detailed Analysis
A recent surge in reports about an "Autocompact is thrashing" error signals a specific failure mode in Claude Code's context-management system that appears to be catching users off guard after previously smooth sessions. The error message itself is fairly explicit about the mechanism: Claude's agent harness uses an automatic compaction routine to summarize and shrink conversation history once it approaches the model's context window limit, freeing up space for continued work. When that compaction happens but the context immediately refills to capacity within just a few turns—and this cycle repeats three times consecutively—the system halts the agent entirely rather than looping indefinitely. The stated culprit is typically an oversized file read or tool output being reintroduced into context repeatedly, effectively defeating the purpose of compaction.
The fact that users are reporting this as a new phenomenon, distinct from their prior experience, points to either a change in default behavior, a shift in how autocompact thresholds are tuned, or new usage patterns (larger codebases, bigger file reads, more verbose tool outputs) colliding with existing limits. This kind of regression—or at least perceived regression—is common in agentic coding tools that rely on iterative summarization to manage long-running sessions. Because Claude Code is designed to operate autonomously across many tool calls (reading files, running tests, editing code), any tool output that scales with codebase size can quickly overwhelm a fixed context budget, especially if the agent's task involves large log files, verbose build outputs, or bulk file reads rather than targeted, chunked access.
This matters because it exposes a structural tension in agentic AI systems: the more autonomous and capable an agent becomes at multi-step tasks, the more it depends on effective memory management to avoid running out of "working space." Context window limits remain a hard constraint even for frontier models with expanded windows, and autocompaction is essentially a stopgap—summarizing history to simulate a larger effective memory. When that stopgap itself fails or thrashes, it reveals how fragile these workarounds can be under certain workloads, particularly ones involving large unstructured data. The suggested workarounds in the error message—reading files in smaller chunks or manually invoking /clear—place the burden back on the user to manage context hygiene, which cuts against the promise of a fully autonomous coding agent.
More broadly, this incident reflects a recurring theme in the deployment of large-context AI agents: infrastructure and product-level constraints often lag behind the ambitions of agentic workflows. As Anthropic and competitors push Claude Code and similar tools toward handling increasingly complex, multi-file, multi-step engineering tasks, edge cases in context management become more visible and more consequential. Community reports like this one function as informal bug tracking for Anthropic, surfacing friction points that may prompt either backend fixes to compaction heuristics or clearer user-facing guidance about how to structure large-scale agentic tasks to avoid hitting these failure modes.
Read original article →