Feature Request: Support resume for Agent Team teammates (not just subagents)
Summary
When using the Agent Team framework (team_name + name parameters in the Task tool), teammates cannot be resumed across sessions. The resume parameter currently only works for subagents (anonymous agents spawned without team_name).
Problem
In long-running multi-agent projects (e.g., development pipelines with architect, engineer, QA roles), the leader session's context window eventually fills up. When starting a new leader session, there is no way to resume existing teammates and their accumulated context.
Root Cause (source code analysis)
Based on analysis of the Claude Code source (v2.1.44):
- Unreachable code path: In the Task tool's
call()method, the teammate branch (if (teamName)) returns before reaching the resume logic. The resume check is structurally unreachable for teammates.
- ID format mismatch: Teammate IDs use the format
name@team(e.g.,engineer@crypto-trading), but transcript files are named using a hex format (a+ random hex string likea1b2c3d4). There's no mapping between these two ID schemes.
- Session-scoped transcripts: Transcript files are stored under session-specific directories (
~/.claude/projects/.../sessions/<session-id>/). A new leader session gets a new session ID and cannot access transcripts from the previous session.
Code Reference
// Simplified flow in call():
if (teamName) {
// spawn or message teammate
return result; // <-- returns here
}
// resume logic below is never reached for teammates
if (resume && taskId) {
// ... resume subagent from transcript
}
Current Workaround
None that preserves teammate context. Users must re-spawn teammates from scratch in each new session, losing all accumulated context.
Proposed Solution
- Persist teammate transcripts with a stable, discoverable ID (e.g., based on
name@team) - Allow cross-session transcript access for teammates, or store teammate transcripts in a team-level directory rather than session-scoped
- Move the resume check before the teammate branch return, or add a parallel resume mechanism for teammates
- Provide a discovery API (e.g.,
list_team_members) so a new leader session can find and resume its existing team
Use Case
We run a crypto trading system development project with 9 specialized agents (architect, engineer, QA, security auditor, etc.) coordinated by a CEO/leader agent. Each agent accumulates significant domain context during a session. When the leader's context window fills up (~200k tokens), we need to start a fresh leader session but want to reconnect to the existing team members rather than re-spawning them all from scratch.
Environment
- Claude Code version: 2.1.44
- OS: Linux (Proxmox VE host)
- Model: Claude Opus 4.6
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗