Expose per-session/bg-job state visually in the terminal (extend agent-view color cues to split panes)
Problem
When running many Claude Code sessions in parallel, the new agent view does a great job of surfacing "needs input" via a kanban on the main screen. But many of us split a single terminal vertically into multiple Claude Code panes and want at-a-glance visual state per pane — without context-switching to the agent view.
What works today
For interactive sessions, you can hook Stop / UserPromptSubmit / PermissionRequest to emit an iTerm2 OSC 1337 SetColors escape sequence to /dev/tty, which colors the pane (e.g. green = idle, blue = working, red = permission pending). This is exactly what the community iterm-claude-colors skill does.
What doesn't work
Background jobs (spawned via run_in_background: true) are detached children with no controlling terminal, so:
- Their own hooks can't write to
/dev/tty— they fail withFailed with non-blocking status code: /bin/sh: /dev/tty: Device not configured. (Currently noisy; we guard with[ -w /dev/tty ] && … || true.) - Even if they could open a tty, they don't know their parent pane's tty, so they can't reach back to color the pane that launched them.
The harness already classifies bg-job state (working / needs input / completed / failed) — that's what the agent view consumes. There's just no way to plumb that state into the originating terminal pane.
Proposed feature (any of these would solve it)
- Parent-side hook event for child bg-job state changes. A hook that fires in the parent session's process (which still has the pane's TTY) when one of its bg jobs transitions state, with the new state as input. Hook authors can then emit color escapes themselves.
- Built-in pane-color signaling. A config flag like
"terminalStateColors": truethat, in iTerm-capable terminals, emits the OSC 1337 sequence from the foreground process whenever the session's aggregate state (own state ∪ children's state) changes. - Machine-readable state file per session. Write current state to e.g.
$CLAUDE_SESSION_DIR/state.jsonso external watchers (iTerm Triggers, a tmux statusline, a custom daemon) can drive their own coloring.
Setup
- macOS, iTerm2, multiple vertical split panes each running
claude - Heavy use of bg jobs launched from those panes
- Already using the agent view; this is a complement, not a replacement
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗