[BUG] Statusline JSON payload for teammate sessions is `null`
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?
The statusline JSON payload's agent field is always null for teammate sessions spawned via Agent Teams (TeamCreate), even though teammates are launched with --agent-name, --agent-type, and --team-name CLI flags. This makes it impossible for custom statusline scripts to distinguish teammate sessions from the main session.
The agent field is null for all sessions - both the team lead and all teammates. The teammate's --agent-name, --agent-type, and --team-name flags are not propagated to the statusline JSON payload.
Additionally, none of these CLI flags are exposed as environment variables. The statusline script's process environment contains no CLAUDE_CODE_TEAM_NAME, CLAUDE_CODE_AGENT_NAME, or similar variables.
What Should Happen?
- The
agentfield in the statusline JSON should contain the teammate's identity when the session is launched with agent team flags. - Expected payload
``json``
{
"agent": {
"name": "explorer",
"type": "context-fetcher",
"team_name": "my-team"
}
}
- The CLI flags are already present at launch
``text``
/path/to/claude --agent-id explorer@my-team --agent-name explorer \
--team-name my-team --agent-type context-fetcher --parent-session-id <uuid> \
--model sonnet
Error Messages/Logs
Steps to Reproduce
- Configure a custom statusline script in
settings.json:
``json``
{
"statusLine": {
"type": "command",
"command": "python3 -c \"import json,sys; d=json.load(sys.stdin); print(d.get('agent'))\""
}
}
- Start a session and create a team with
TeamCreate - Spawn a teammate via the
Tasktool withteam_nameparameter - Observe the teammate's statusline output
Claude Model
Not sure / Multiple models
Is this a regression?
No, this never worked
Last Working Version
_No response_
Claude Code Version
2.1.42
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
WSL (Windows Subsystem for Linux)
Additional Information
Investigation Details
- To verify, I added debug logging to a statusline script that captured the full JSON payload keys and all environment variables for every session.
- Across 5 unique sessions (1 lead + 4 teammates)
payload_keyswere identical across all sessions - no extra fields for teammatesagentfield wasnullin every entry- No environment variables contained "team", "agent", or "name" (beyond the standard
CLAUDE_CODE_*set which is identical across all sessions)
The only data available to differentiate teammates is the process tree - reading /proc/{ppid}/cmdline to find --team-name in ancestor process args. This works but is a Linux-specific hack.
Impact
- Custom statusline scripts cannot
- Display the agent's name or role
- Show which team the agent belongs to
- Use a different format for teammates vs. the main session (e.g., compact single-line for small tmux panes)
Related
- #21210 - Request to suppress startup banner (relevant because banner + statusline are the main UI concerns for agent team panes)
- #10052 - Request to expose agent information for external monitoring
Environment
- Claude Code v2.1.42
- Linux (WSL2, Ubuntu)
- Agent Teams (experimental)
- Custom statusline script (Python, configured via
settings.json)
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗