Prune team member conversation history when team is deleted
Feature Request
When a team is deleted via TeamDelete (or manual cleanup), the terminated teammates' conversation history remains in the session context. This adds noise and consumes tokens for the rest of the session without providing value.
Current Behavior
After TeamDelete or teammate shutdown:
- Team/task directories are cleaned up
- But all teammate idle notifications, shutdown requests/responses, and build output summaries remain in the conversation history
- These messages continue consuming context window space
Desired Behavior
When a team is deleted during a session, automatically prune (or compress) the conversation history related to that team's members — specifically:
- Teammate idle notifications
- Shutdown request/response exchanges
- System
teammate_terminatedmessages - Optionally: teammate build/task result messages (or at least compress them to a summary)
Why This Matters
In a typical team workflow (spawn 6 build agents, collect results, shut down), the teammate messages can easily add 20-30 conversation turns of protocol overhead (idle notifications, shutdown handshakes, terminated confirmations). After the team is deleted, none of this is actionable — it just burns context tokens.
Suggested Approach
On TeamDelete, trigger the same compression/pruning logic used for context window management, but targeted specifically at messages from the deleted team's members.
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗