Context compaction drops subagent results, causing redundant re-runs and wasted tokens
Bug Description
During a long conversation involving a multi-batch code review (launching multiple subagents to review backend, frontend, and infrastructure code), the automatic context compaction kicked in and dropped the results of a completed subagent (a backend code review agent).
Claude then stated: "The backend review agent's results were lost during context compaction. Let me re-run it quickly and then compile the full report." — and re-launched the same agent, duplicating the work and consuming tokens for results that had already been generated and returned.
Steps to Reproduce
- Start a long conversation that launches multiple subagents (e.g., 3 parallel code review agents)
- All agents complete and return results
- Continue the conversation with follow-up work until context compaction triggers
- The compaction drops one or more subagent results from the conversation history
- Claude detects the missing results and re-runs the agent(s), consuming additional tokens
Expected Behavior
Context compaction should preserve subagent results, or at minimum preserve a summary of them. These results represent completed, paid-for work and are often critical to the ongoing conversation.
Actual Behavior
Context compaction silently dropped subagent output. Claude noticed the data was missing and re-ran the agent, doubling the token cost for that portion of work with no way to recover the spent tokens.
Impact
- Direct cost: Tokens spent on the original agent run were wasted, and the user paid again for the re-run
- No recourse: There is no way to undo or refund the redundant token usage
- Trust: Users relying on multi-agent workflows need confidence that completed work won't be silently discarded
Environment
- Claude Code CLI
- Model: Claude Opus 4.6
- Platform: Windows 11
- Workflow: Multi-agent parallel code review (3 concurrent subagents)
Suggested Fix
Subagent results (or at least their summaries) should be prioritized during context compaction and not dropped. If compaction must reduce them, it should retain enough context that Claude doesn't re-run the same work.
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗