statusLine: expose focused-subagent context and running-hook status
Is your feature request related to a problem?
The custom statusLine only ever receives steady-state main-session context. Two kinds of transient state the TUI knows about are invisible to it:
1. Focused subagent. When a session has multiple subagents running, I can navigate between them with the keyboard (Enter shows a subagent's session, ESC returns to the main session). While a subagent's session is displayed, the statusLine keeps rendering the main session's state — model, effort level, cwd/branch/worktree, context-window usage. There is no way to tell from the status bar which model or effort the currently-displayed subagent is running with, or which worktree it is operating in. The statusLine input JSON has no field identifying the focused subagent, so no custom script can render this — it is not solvable user-side.
2. Running hooks. While a hook executes (most notably long-running Stop hooks — e.g. a plugin review gate with a 900s timeout), the statusLine is neither re-invoked nor told anything about the hook. Per-hook statusMessage covers hooks I define myself, but there is no way to surface hook progress for plugin-provided hooks short of patching the plugin's hooks.json (reverted on every plugin update), and no hook context ever reaches the statusLine.
Describe the solution you'd like
Extend the statusLine input JSON with optional transient-state blocks, and refresh the statusLine when they change:
{
"focused_subagent": {
"id": "a30f...",
"name": "reviewer",
"type": "code-reviewer",
"status": "running",
"model": { "id": "claude-sonnet-5", "display_name": "Sonnet 5" },
"effort": { "level": "high" },
"cwd": "/path/to/worktree",
"worktree": { "name": "...", "branch": "..." },
"context_window": { "used_percentage": 42.0 }
},
"hooks": {
"running": [
{ "event": "Stop", "name": "codex: stop-review-gate", "source": "plugin:codex", "elapsed_ms": 12500 }
]
}
}
Both fields absent when not applicable — existing scripts keep working unchanged, and a script can branch on their presence. This implies two new refresh triggers: subagent-focus navigation, and hook start/finish (or a periodic tick while a hook runs).
Describe alternatives you've considered
subagentStatusLinecustomizes the per-agent rows in the agent panel and does receive per-taskmodel/effort/cwd— but it renders panel rows, not the global status bar, and doesn't know which agent the user has focused.- Per-hook
statusMessageshows a spinner message, but only for hooks in my own settings; plugin hook configs can't be annotated or overridden from user/project settings (and the override semantics are undocumented). - Inferring from
transcript_path/ session files — fragile, laggy (statusLine isn't refreshed during hook execution anyway), and can't observe UI navigation at all.
Additional context
The per-task data already exists in the harness (it's handed to subagentStatusLine), and hook start/finish are already harness-observed events — so this is largely plumbing existing state plus two refresh triggers into the existing statusLine invocation.