Skip to main content

Module prompt

Module prompt 

Source
Expand description

Prompt detection patterns for agent PTY output.

Each agent family has different output conventions. This module provides compiled regex patterns and a PromptKind classification so the supervisor can decide what to do (auto-answer, escalate, log, etc.).

§Design notes

Claude Code and Codex CLI use full-screen TUIs (alternate screen buffer, cursor positioning). Raw PTY scraping sees ANSI escapes, not clean lines. For reliable automation, prefer Claude’s -p --output-format stream-json or Codex’s --full-auto mode. The patterns here target the text content after ANSI stripping for cases where interactive mode is used.

Aider uses a traditional line-oriented interface (prompt_toolkit), making it the most amenable to PTY pattern matching.

Structs§

DetectedPrompt
A detected prompt with its kind and the matched text.
PromptPatterns
Compiled prompt detection patterns for a specific agent.

Enums§

PromptKind
What kind of prompt was detected in the agent’s output.

Functions§

strip_ansi
Strip ANSI escape sequences from PTY output.