Bug: Context becomes full and /compact stops working after using subagents (Task tool)
Resolved 💬 13 comments Opened Jan 4, 2026 by hiranotomo Closed Mar 18, 2026
Description
When using subagents via the Task tool, context usage can spike rapidly and reach 100% capacity. At this point, the /compact command becomes unresponsive, leaving users with no way to recover the session.
Steps to Reproduce
- Start a Claude Code session
- Use the Task tool to spawn a subagent (e.g.,
subagent_type: Exploreorgeneral-purpose) - The subagent performs file reads, greps, and other operations
- Context usage jumps significantly after subagent returns
- Repeat subagent usage 2-3 times
- Context reaches ~100%
- Attempt to run
/compact - Command fails or is ignored
Expected Behavior
/compactshould work especially when context is near capacity (this is when users need it most)- Or: automatic context management before reaching critical levels
Actual Behavior
/compactbecomes unresponsive when context is full- User loses all session work and must start a new session
- No warning before reaching this state
Proposed Solutions
- Reserve context space for
/compact- Always keep enough headroom to execute compaction - Subagent result summarization option - Allow users to receive summarized results instead of full output
- Context usage warnings - Alert users at 70%, 80%, 90% thresholds
- Auto-compact option - Automatically compress context when reaching a threshold
- Graceful degradation - If
/compactcan't run normally, provide a minimal emergency compaction
Environment
- OS: macOS (Darwin 24.5.0)
- Claude Code version: $(claude --version 2>/dev/null || echo "unknown")
Impact
This issue causes significant workflow disruption. Users lose context, unsaved work patterns, and must restart complex debugging or exploration sessions from scratch.
This issue has 13 comments on GitHub. Read the full discussion on GitHub ↗