Skip to main content

Module classify

Module classify 

Source
Expand description

Classify Claude/Codex’s UI state from a tmux pane snapshot.

We can’t query Claude Code’s internal state directly, so we read what the user sees: the visible portion of the tmux pane. The Claude TUI is distinctive enough that a tail-of-pane regex hits each state cleanly:

  • AwaitingDecision — selection / permission dialog up. Most visible cue is the universal “Enter to select · ↑/↓ to navigate · Esc to cancel” hint at the bottom.
  • Working — Claude is composing or running a tool. The bottom line carries an “esc to interrupt” hint and the input box is replaced by an active spinner glyph (✻/✱/✷/✸/✹/✺).
  • Ready — Claude is parked at the chat prompt. The hallmark is a bare ❯ line followed by the model footer.
  • Unknown — pane has no Claude UI markers we recognise. Caller decides how to map that (typically Idle).

Patterns intentionally bias toward false negatives over false positives — when in doubt we’d rather show “idle” than mis-claim “decision”.

Enums§

ClaudeUiState

Functions§

classify
Classify the visible pane content. Looks at roughly the last 30 lines — enough to cover the input box plus footer without scanning the entire scrollback.