Feature: Expose sub-agent context window usage in statusline / parent session telemetry
Summary
When using agent teams, the statusline command only receives context window data for the team lead (main session). Sub-agent context windows are isolated and not surfaced anywhere the parent session can observe.
Current behaviour
The statusline JSON input contains context_window.used_percentage and related fields scoped to the current session only. Spawned sub-agents have no mechanism to report their context usage back to the team lead or to the statusline renderer.
Desired behaviour
One or more of the following would address this:
- Statusline JSON includes a
sub_agentsarray with per-agent{ name, context_window }entries when a team is active, allowing the statusline command to render e.g.agents: planner 45% | implementer 12%.
- A shared telemetry file or IPC channel that sub-agents can write their context snapshots to, and the statusline (or any script) can read from.
- An environment variable or flag injected into sub-agent shells containing the agent's own
used_percentage, so agents could self-report to a shared file.
Use case
Working with multi-agent teams on long tasks, it is useful to know which sub-agent is approaching its context limit before it silently degrades or loses earlier context. Currently the only signal is when a sub-agent starts producing lower-quality output.
Workaround attempted
Sub-agents could write to /tmp files manually, but they have no access to their own context usage percentage — that data is only injected into the statusline JSON by Claude Code, not available inside a running agent's environment.
Environment
- Claude Code v2.1.63
- Platform: Windows 11 / Git Bash
- Feature: agent teams (
CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1)
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗