Agent count indicator in statusline persists after agent completion

Resolved 💬 3 comments Opened Mar 14, 2026 by arwoxb24 Closed Mar 18, 2026

Description

The agent count indicator (yellow badge showing "N agents") in the Claude Code CLI statusline does not clear after background agents complete their work. The indicator persists indefinitely, showing stale agent counts that confuse users about the actual system state.

Steps to Reproduce

  1. Launch Claude Code CLI (v2.1.76)
  2. Start a background agent using the Agent tool with run_in_background: true
  3. Wait for the agent to complete (notification appears)
  4. Observe the statusline — the yellow "N агентов" indicator remains

Expected Behavior

The agent count indicator should decrement (or disappear) when a background agent completes its work.

Actual Behavior

The indicator persists showing the peak agent count, even after all agents have completed. Users must use /clear to reset the statusline.

Environment

  • Claude Code v2.1.76
  • Opus 4.6 (1M context)
  • Linux (Ubuntu)
  • tmux terminal

Additional Context

This is a UI-only issue — the agents themselves complete correctly and return results. The problem is purely in the statusline state management.

Screenshot showing "2 агента" persisting after all work is done:
The indicator shows agents are still running when they have already completed.

View original on GitHub ↗

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