[BUG] Agent Teams: an in-process teammate view never loads its transcript from disk, keeps only the last 50 messages, and is cut to one message when the teammate finishes
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?
With agent teams enabled (CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1, teammateMode: auto, so teammates run in-process), switching to a teammate's view shows almost nothing: a few tool calls while it works, and about one message once it has finished. The teammate's full transcript is on disk the whole time (~/.claude/projects/<project>/<lead-session>/subagents/agent-a<name>-<hash>.jsonl), so nothing is lost; the view just never shows it.
Reading the 2.1.280 bundle, three limits stack up, and all three apply only to in_process_teammate tasks, not to plain background agents:
- The teammate view never loads the transcript from disk. When an agent view opens, the full transcript is read from disk only for a
local_agenttask (the check is roughlyisLocalAgent(task) && task.retain && !task.diskLoaded). Anin_process_teammatetask has noretain/diskLoadedfields, so its view renders only the in-memory message list. - The in-memory list keeps only the last 50 messages (a constant
50in the helper that appends to a teammate'smessages; it slices to the last 49 and pushes the new one). One tool call is two messages, so a working teammate shows roughly its last 25 tool calls. A resumed teammate is also seeded from its last 50 messages only. - On completion or failure the list is cut to one message: the in-process runner sets
messages: messages.length ? [messages.at(-1)] : []and then evicts the task. Opening a finished teammate therefore shows a nearly empty view.
A plain background agent (Agent tool without name) does not have this problem: its view re-reads the file from disk, which matches the fix in 2.1.178 ("viewing a subagent's transcript now shows tool results and live progress"). That fix does not reach in-process teammates.
What Should Happen?
Opening a teammate's view should show its whole transcript, like a background agent's view does: load it from the teammate's subagents/agent-*.jsonl when the view opens (or when the in-memory list was trimmed), and keep the finished teammate's transcript viewable instead of cutting it to the last message.
Error Messages/Logs
No error. Evidence that the data exists and only the view is empty:
# the teammate's transcript on disk after it finished (33 turns, 18 model calls)
$ wc -l ~/.claude/projects/<project>/<lead-session>/subagents/agent-a<name>-<hash>.jsonl
# the teammate view in the TUI at the same moment: one message
Steps to Reproduce
export CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1, leaveteammateModeatauto(in-process), startclaude.- Ask the lead to spawn one teammate with the Agent tool with a
name, and give it 12 sequential steps, each one Bash call (sleep 8; echo step N >> /tmp/steps.log). - While it runs, switch to the teammate's view: only the most recent part is visible, and older tool calls are missing once it passes ~25 tool calls.
- After it finishes (or after it approves a
shutdown_request), open its view again: roughly one message is left. - Compare with
~/.claude/projects/<project>/<lead-session>/subagents/agent-a<name>-*.jsonl: every step, tool call and result is there. - Control: repeat step 2 with the Agent tool without
name(a plain background agent). Its view shows the whole transcript.
Claude Model
Other
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.280 (Claude Code)
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Other
Additional Information
Related, but none of them names these three causes together:
- #92136 (open): a subagent the model spawned itself can no longer be shown; its actions are missing from the UI.
- #85065 (open): a session opened from the agents view loses its earlier output, and the Ctrl+O transcript renders only the last 30 messages behind a
Ctrl+Eline. - #48897 (closed, stale): a teammate's tab shows only its first prompt, while plain subagents show progress.
- #82687 (closed as duplicate of #75190): the team inspector shows only the spawn prompt; #75190 notes the team config has no teammate session id to find its transcript.
- 2.1.260 fixed an in-process teammate's transcript "losing messages, or going blank, during long API retry waits … as retry notices evicted real messages", which is consistent with the same capped in-memory list.
Workaround until this is fixed: spawn agents you want to watch without name, or read the teammate's subagents/agent-*.jsonl directly.
Separate note, not part of this bug: with Fable 5 / Opus 5.5, text between tool calls arrives as a narration thinking block and is hidden (#74558), which makes the few kept messages look even emptier.