[BUG] Multi agents run out of context, unable to /compact and tasks are marked as completed when they are not
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
I set off a task for 12 agents to go and create documentation in my codebase. I hit a very annoying issue when doing this:
The agents reached their context limit and I couldn't use /compact at all. This meant that I basically got stuck and had to use /clear, and then lost all context of the session.
This was extra infuriating because it also used up my entire session usage to do this (at Claude's suggestion), and it means I have to start from scratch.
None of the tasks were documented or in detail but all tasks returned as 'complete', even though they weren't complete (or if they were, I couldn't get them because I had to /clear).
It is likely that the agents generated documentation but didnt complete their output and therefore failed.
If this many agents isn't possible to use, there shouldn't be a suggestion of it/should be a max concurrent to be ran.
<img width="1011" height="132" alt="Image" src="https://github.com/user-attachments/assets/6b359e3c-ed2c-4db0-8091-d27405814d67" />
<img width="455" height="277" alt="Image" src="https://github.com/user-attachments/assets/fe6b8b4a-b2f8-473c-abbe-c9a168aab71e" />
What Should Happen?
I would expect them to complete one by one, or if they cannot complete not mark as completed and save state somehow before they run out of context.
Error Messages/Logs
Steps to Reproduce
- Ask Claude to document a codebase comprehensively
- When it creates the task list and identifies that it can run mutli-agent, use it
- Wait!
Claude Model
Sonnet (default)
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.0.76
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
_No response_
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗