it2 session watch
Watch session for state transitions
Synopsis
it2 session watch [<session-id>] [flags]
Description
Event-driven monitoring that outputs state transitions.
Unlike 'monitor' which outputs raw events, 'watch' detects state changes
and only outputs when the session transitions between states.
With --agent, enables agent-specific state detection:
- Active/idle state based on spinners and work indicators
- Modal detection and type classification
- Todo tracking
- Suggested action for each state
With --auto-act, automatically executes suggested actions:
- Approves safe modals
- Sends "continue" when idle with todos
- Accepts pending edits
With --on-transition, executes a command on each state transition.
Template variables: %s=session-id, %S=state, %P=previous-state
Events are output as NDJSON (one JSON object per line).
Examples:
Watch for state changes with Claude detection
it2 session watch E0A8 --agent=claude
Watch and auto-execute suggested actions
it2 session watch E0A8 --agent=claude --auto-act
Execute command on each state transition
it2 session watch E0A8 --on-transition "eslogs annotate %s state=%S"
Verbose output with full state on each transition
it2 session watch E0A8 --agent=claude --verbose
Options
-
--agent - Agent to detect: claude, auto, or empty (generic)
-
--auto-act - Automatically execute suggested actions
-
--format(default "table") - Output format (table|json|yaml|text)
-
--on-transition - Execute command on state transition (%s=session-id, %S=state, %P=previous)
-
--poll-interval(default "2s") - Interval between state checks
-
--timeout(default "5s") - Command timeout
-
--url(default "ws://localhost:1912") - iTerm2 WebSocket URL
-
-v,--verbose - Output full state on each transition
See Also
- it2 session - Manage iTerm2 sessions