Expose active agent & background task counts in statusline JSON
Summary
The statusline script receives a JSON payload with model, context window, git, cost, rate limits, and workspace data. It would be very useful to also include counts of currently running agents and background tasks.
Requested fields
{
"agents": {
"active_count": 3,
"background_count": 2
}
}
active_count— number of subagents currently running (foreground + background)background_count— number of background tasks/agents specifically
These counts should reflect real-time state. When an agent completes, the count drops. When no agents are running, the fields return 0 (and the statusline can hide the segment entirely).
Use case
Custom statusline scripts can show a live indicator of how many parallel agents are working, giving the user visibility into what Claude Code is doing behind the scenes. For example, displaying agents:3 next to the model name when 3 subagents are active, and hiding it when none are running.
Current workaround
None. The statusline JSON payload has no fields related to agent or task state.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗