Skip to content

feat(workflows): display workflow agent cohort in statusline#68

Draft
tmck-code wants to merge 3 commits into
mainfrom
feat/workflows
Draft

feat(workflows): display workflow agent cohort in statusline#68
tmck-code wants to merge 3 commits into
mainfrom
feat/workflows

Conversation

@tmck-code

@tmck-code tmck-code commented Jun 10, 2026

Copy link
Copy Markdown
Owner

Context

The Workflow tool runs multi-agent orchestrations whose subagents are invisible to the statusline. yas globs subagents/*.meta.json, but workflow agents live a directory deeper (subagents/workflows/<runId>/) and their meta.json carries only {"agentType":"workflow-subagent"} — no description, no per-agent type. A user running a workflow sees nothing, even while several agents are actively burning tokens. This change surfaces those agents, grouped by their workflow run, so the statusline reflects what is actually executing.

Spec: openspec/changes/display-workflow-agents/ (new workflow-cohort capability).

Changes

  • Detection (claude/yas/info/workflows.py, new): glob subagents/workflows/<runId>/ dirs under the session — a dir exists the instant an agent starts. Opportunistically read the session-level workflows/<runId>.json to enrich a run with workflowName, current phase, and the agentId → label map; fall back to the transcript's first prompt line and the runId when JSON is absent/stale, so detection never depends on JSON liveness.
  • Token/activity reuse: every workflow agent reuses the existing _parse_transcript for tokens, activity snippet, and Done detection (end_ts > 0) — no new per-agent reader.
  • Liveness: workflow runs get their own ~120s window (separate from the cohort's 30/60s) so a run survives between-phase lulls without flickering.
  • Rendering (renderer.py, layout.py, constants.py): each live run renders as a distinct grouped block after the subagent cohort and task row — header (▸ <name> [<phase>]), per-agent rows reusing subagent_row, summary footer (└ N agents · M done · <tok>). Width <80 collapses to header+summary; per-run rows cap at 6 (overflow → summary); at most 2 workflow blocks render concurrently.
  • SessionView gains a @cached_property constructing RunningWorkflows.from_session(...) (info/__init__.py).
  • CONTEXT.md glossary gains the workflow-run terms; ops/demo.py gains demo coverage; test/test_workflow_cohort.py (new, 22 tests) covers detection, label fallback, liveness/retirement, narrow collapse, and the agent/run caps.

Checklist

  • Tests added or updated for new/changed behaviour

Screenshots / recording

image

Benchmark

Command Mean [ms] Min [ms] Max [ms] Relative
main 53.2 ± 3.0 49.3 66.8 1.00
PR 54.0 ± 2.7 50.0 66.2 1.01 ± 0.08

System info

Key Value
OS Linux debian-work 6.12.90+deb13.1-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.12.90-2 (2026-05-27) x86_64 GNU/Linux
Claude Code 2.1.170 (Claude Code)
Terminal TERM=tmux-256color TERM_PROGRAM=tmux SHELL=/bin/bash COLORTERM=truecolor
Locale LANG=en_AU.UTF-8 LC_ALL=
Python Python 3.12.7
uv uv 0.9.17

🤖 Generated with Claude Code

tmck-code and others added 3 commits June 10, 2026 16:01
Add workflow cohort tracking and rendering so active workflow subagents
appear in the statusline alongside regular subagent activity.

- yas/info/workflows.py: gather live workflow agents from the filesystem
- renderer/layout/subagents: render the workflow cohort row
- ops/demo.py: demo coverage for the new row
- openspec/changes/display-workflow-agents: proposal, design, spec, tasks
- test/test_workflow_cohort.py: cohort tests

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
# Conflicts:
#	claude/yas/info/subagents.py
#	claude/yas/layout.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant