Skip to main content

Module detect

Module detect 

Source
Expand description

The hybrid state detector. No single source is sufficient (PoC §3): the transcript is reliable for questions/turns but lags TUI-interrupt gates; capture-pane catches the gates but its markers shift per release; the plan file holds plan content. detect combines all three.

Modules§

jsonl
Session-transcript (JSONL) classification — the reliable signal for questions and normal turn completion (PoC §3.1–3.4). One JSON object per line.
pane
capture-pane signal — the only reliable source for TUI-interrupt gates (plan approval, tool-permission prompts) because those never reach the transcript until answered (PoC §3.3).
plan
Plan-file signal. In plan mode claude writes the plan to a markdown file under ~/.claude/plans/ before the approval gate, and the plan content lives in that file rather than the transcript message (PoC §3.3).

Enums§

State
The externally-visible session state, serialized under a status tag for JSON consumers.

Functions§

detect
Combine all three signals into a single State (precedence: capture-pane gates → transcript).