claude-code - 💡(How to fix) Fix Expose active agent & background task counts in statusline JSON [2 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#46778Fetched 2026-04-12 13:33:16
View on GitHub
Comments
2
Participants
2
Timeline
7
Reactions
2
Author
Timeline (top)
labeled ×3commented ×2closed ×1subscribed ×1

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.

Root Cause

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.

Fix Action

Fix / Workaround

Current workaround

Code Example

{
  "agents": {
    "active_count": 3,
    "background_count": 2
  }
}
RAW_BUFFERClick to expand / collapse

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.

extent analysis

TL;DR

Modify the statusline script to include the requested "agents" field with "active_count" and "background_count" to display real-time agent and task state.

Guidance

  • Identify the source of the agent and task state data to integrate it into the statusline JSON payload.
  • Determine the best approach to update the "agents" field in real-time, considering the completion of agents and tasks.
  • Consider adding logic to hide the "agents" segment when both "active_count" and "background_count" are 0.
  • Review the current statusline script to ensure it can handle the new "agents" field and update the display accordingly.

Example

{
  "model": "...",
  "context_window": "...",
  "git": "...",
  "cost": "...",
  "rate_limits": "...",
  "workspace": "...",
  "agents": {
    "active_count": 3,
    "background_count": 2
  }
}

Notes

The implementation details of updating the "agents" field in real-time are not specified and may require additional development or infrastructure changes.

Recommendation

Apply workaround: Modify the statusline script to include the "agents" field, as this will provide the required functionality without relying on an upgrade to a potentially non-existent fixed version.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix Expose active agent & background task counts in statusline JSON [2 comments, 2 participants]