Expose active subagent/task count in statusLine JSON input

Resolved 💬 3 comments Opened Feb 26, 2026 by danieljchuser Closed Mar 3, 2026

Summary

When using a custom statusLine command, the JSON input does not include any information about currently running subagents/tasks. The default (built-in) status bar shows the count of active agents, but this data is lost when a custom statusLine replaces it.

Current behavior

The statusLine JSON input includes: model, workspace, cost, context_window, session_id, version, output_style, agent, and exceeds_200k_tokens.

There is no field for the number of currently running subagents spawned via the Task tool.

Expected behavior

Include a field like active_subagents (or tasks.running_count) in the statusLine JSON so custom statusLine scripts can display the agent count — matching what the default built-in status bar already shows.

Example:

{
  "active_subagents": 3,
  ...
}

Why this matters

Custom statusLine scripts are useful for showing project-specific context (git branch, Jira tickets, project name, etc.), but adopting one means losing the agent count indicator. There's no reliable workaround — a hook-based approach (PreToolUse/PostToolUse on Task) has race conditions, doesn't work for background tasks, and leaks counters on denied calls or crashes.

Since the data already exists internally (the default UI renders it), exposing it in the JSON input would be a small change that closes this gap.

Environment

  • Claude Code v2.1.59
  • macOS

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗