/compact fails with 'Conversation too long' when context limit is reached during multi-agent workflow

Resolved 💬 4 comments Opened Mar 1, 2026 by TholeG Closed Apr 1, 2026

Environment

  • Claude Code CLI (Opus 4.6)
  • macOS Darwin 25.3.0
  • Agent Teams enabled (CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1)

Steps to Reproduce

  1. Start a multi-agent workflow that spawns 3 teammate agents (using Agent tool with team_name)
  2. Teammates work in parallel, send messages back to the lead agent as they complete tasks
  3. Once all teammates finish, attempt to read their output files (3 files)
  4. Context limit is reached at this point — "Context limit reached · /compact or /clear to continue"
  5. Run /compact as suggested by the error message

Expected Behavior

/compact should compress the conversation and allow continuing the session.

Actual Behavior

/compact fails with:

Error: Error during compaction: Error: Conversation too long. 
Press esc twice to go up a few messages and try again.

This creates a dead-end: the system tells you to use /compact to continue, but /compact itself fails because the conversation is too long. The only option left is /clear, which loses all context.

Impact

  • ~13 minutes of multi-agent work (3 research agents running in parallel) completed successfully, but the results couldn't be used because the session became unrecoverable
  • The workflow requires reading the agent outputs to proceed to the next step (writing), so there's no way to skip past the context limit
  • This is particularly frustrating because the expensive work (agent research) was done — only the "read results and continue" step failed

Suggestion

  • /compact should have a more aggressive fallback mode when the standard compaction itself exceeds limits (e.g., summarize more aggressively, drop older agent messages first)
  • Alternatively, warn earlier when context is approaching limits during agent workflows, so the user can compact proactively before it's too late
  • The error message "Press esc twice to go up a few messages and try again" is unclear — what does "go up a few messages" mean in a CLI context?

View original on GitHub ↗

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