Context limit reached during plan mode causes orphaned work and wasted tokens

Resolved 💬 3 comments Opened Feb 23, 2026 by Asclepius9 Closed Feb 27, 2026

Bug

When working in plan mode with a large conversation, Claude Code can hit the context limit mid-exploration. When this happens:

  1. Plan mode enters and spawns an Explore agent (27 tool uses, ~115k tokens)
  2. Explore agent completes successfully
  3. Claude reads files to continue planning
  4. Context limit reached — conversation becomes stuck
  5. /compact fails with: Error: Conversation too long. Press esc twice to go up a few messages and try again.
  6. /compact continues to fail on retry
  7. The entire plan mode session (agent work + tokens) is orphaned and wasted

Expected Behavior

  • /compact should be able to recover from context limit even in large conversations
  • Alternatively, Claude Code should proactively compact before hitting the hard limit, especially when in plan mode with active agent results
  • Plan mode work (agent results, file reads) should not be silently lost

Impact

  • ~115k tokens wasted on an Explore agent whose results were never usable
  • User has to start a new conversation and redo the entire planning phase
  • No way to recover — esc twice + /compact still fails

Environment

  • Claude Code CLI
  • Model: Claude Opus 4.6
  • Large conversation with multiple prior tool uses before entering plan mode

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗