Developers relying on the default claude --resume behavior in Anthropic's Claude Code are inadvertently degrading agent performance and inflating operational costs, according to a new deep-dive published on DEV.to. The core issue lies in how session persistence works: resuming a session re-injects the entire conversation history, including stale tool calls and failed exploratory branches, into the model's context window. This creates a scenario where the 'signal' of recent decisions is buried under the 'noise' of hundreds of prior interactions.
The High Cost of Context Accumulation
The financial and performance implications are stark. As sessions grow, the cache read cost becomes the dominant factor in agentic workloads. The source material illustrates that a 100-turn session forces the model to re-read approximately 200,000 tokens on every new turn, compared to just 500 tokens for a fresh session with a concise prompt. This means that for every new instruction, the agent is processing 400 times more data than necessary, leading to slower response times and significantly higher token consumption.
Distinguishing State From Conclusions
To mitigate this, the article advocates for a 'brief-first' pattern that strictly separates session state from session conclusions. Session state—such as unfinished goals, pending approvals, or specific permission modes—warrants resumption because it cannot be easily rebuilt. However, session conclusions—decisions made, constraints discovered, and rationale explained—should be extracted into a concise markdown brief. This brief then serves as the initial prompt for a fresh session, allowing the agent to start with high-signal context rather than a bloated transcript.
Implementation Pitfalls and Retention Limits
Technical implementation requires careful attention to Claude Code's architecture. Sessions are stored as JSONL transcripts in ~/.claude/projects/, and the default retention period is 30 days. After this window, transcripts are purged, rendering the session unresumable despite the metadata row remaining in the agent view. Furthermore, automatic session management APIs, such as continue: true in the TypeScript SDK, default to resuming the most recent session. While convenient for chat, this default is dangerous for task-based agentic work, as it forces new, unrelated tasks to inherit the stale context of previous, potentially unrelated sessions.
Key Takeaways
- Resume sessions only when they hold unfinished state (e.g., pending approvals) that cannot be rebuilt.
- Extract conclusions into a 'brief' and start a new session to avoid re-reading stale exploration data.
- Cache read costs scale with total session size, not just the new prompt, making long sessions exponentially more expensive.
- The
--forkoption preserves the original session but still inherits the same bloated context, offering no performance benefit over--resume. - Sessions are locally stored and deleted after 30 days by default, preventing cross-machine resumption without a custom SessionStore adapter.
The Bottom Line
Treating session length as an asset is a fundamental misunderstanding of LLM context economics. Developers must treat context as a finite, expensive resource and actively prune their agent workflows to maintain signal-to-noise ratios.