Skip to content

feat: use OSC title/progress sequences from Claude Code as high-priority status signals #263

Description

@tstapler

Migrated from TylerStaplerAtFanatics/stapler-squad#177
Originally created by @TylerStaplerAtFanatics on 2026-07-10T21:16:56Z


Motivation

From the archaeology of herdr (the terminal multiplexer), their agent detection system treats OSC title changes and OSC progress sequences from Claude Code as higher-priority signals than screen-text pattern matching.

Claude Code already emits:

  • OSC window title (\x1b]0;...\a): changes include a Braille spinner character (⠋⠙⠹...) when working, and when idle/done
  • OSC progress (\x1b]4;...): \x1b]4;0 signals completion/idle state

From herdr's detection manifests, these sequences are used to resolve ambiguity that text-based detection can't handle — for example, when Claude Code's output looks idle because it's waiting for a response, but the OSC title still shows the spinner.

Current state

session/detection/detector.go (line 120) notes that OSC sequences are parsed from terminal output, but there's no evidence the parsed OSC titles are used as status signals in the detection pipeline. Status detection relies on text pattern matching in the binary detectors (detection/binaries/claude.go).

Proposed change

  1. In the terminal output processing pipeline, capture OSC title content alongside the screen text.
  2. Pass OSC title content to the Claude detector as a first-class input field.
  3. In the Claude detector: if OSC title contains a Braille spinner char → Executing; if contains Idle/Ready.
  4. Give OSC-derived status higher priority than text-pattern-derived status.

This mirrors herdr's design where OSC signals skip the debounce queue and publish state transitions immediately, while text-pattern transitions require stabilization ticks.

Expected benefit

  • More accurate status detection with fewer false Idle states during agent "thinking" periods
  • Faster detection of completion (no need to wait for text to appear if OSC title changes first)
  • Reduced false positives from text patterns that look like idle state but aren't

References

  • herdr source: src/detect/manifests/claude.toml — defines osc_title and osc_progress rules
  • herdr source: src/pane/agent_detection.rs — OSC signals bypass stabilization debounce
  • stapler-squad: session/detection/binaries/claude.go — current Claude text-pattern detection
  • stapler-squad: session/detection/detector.go — where OSC parsing happens

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions