Workflow agent count in /workflows UI is off by one

Open 💬 0 comments Opened Jun 11, 2026 by mityorn

Description

When using the Workflow tool with /workflows to monitor progress, the agent count displayed in the CLI UI is consistently one higher than the actual number of subagent .jsonl files on disk.

Reproduction

  1. Launch a workflow that spawns multiple agents via agent() calls
  2. Monitor with /workflows — note the "X out of Y agents done" count
  3. Compare against actual agent files: ls -1 <workflow-dir>/agent-*.jsonl | wc -l

Observed behavior

The UI count is always exactly 1 higher than the number of subagent files:

  • When 33 agent .jsonl files exist on disk, UI shows "X out of 34"
  • When 36 agent .jsonl files exist on disk, UI shows "X out of 37"

This was consistent across multiple checks over a ~2 hour workflow run.

Expected behavior

The count should reflect only the subagents spawned by agent() calls, not the workflow orchestrator itself (if that's what's being counted).

Environment

  • Claude Code v2.1.168
  • Workflow with ~36 subagents across 5 phases using agent(), parallel(), and pipeline()
  • Linux (Ubuntu)

🤖 Generated with Claude Code

View original on GitHub ↗