nicobailon/pi-interactive-shell
Pi coding agent extension that allows Pi to autonomously control interactive CLIs in an observable overlay. Full PTY emulation, no tmux, token efficient. User can take over anytime.
What it solves
Pi Interactive Shell allows AI coding agents to run and interact with command-line interfaces (CLIs) that require real-time interaction, such as text editors (vim), REPLs, database shells (psql), or long-running processes (npm run dev). It bridges the gap between static command execution and interactive terminal sessions by providing an observable TUI overlay where both the agent and the human user can monitor, control, and hand off the session.
How it works
The project provides a tool called interactive_shell that the AI agent invokes to launch subprocesses. It supports four distinct operational modes:
- Interactive: Launches a shell where the agent and user can both send input and monitor status.
- Hands-free: Designed for long-running builds or servers; the agent polls for updates while the user watches.
- Dispatch: A "fire-and-forget" mode where the agent is notified only upon completion or a specific exit condition.
- Monitor: An event-driven mode that wakes the agent when specific triggers (regex, literal strings, or file changes) are detected in the output stream.
Users can take over any session by typing directly into the overlay, and return control to the agent using Ctrl+G.
Who it’s for
Developers using the Pi coding agent (or compatible agents like Codex, Claude, and Cursor) who need their AI assistants to handle complex CLI tasks, manage sub-agents, or monitor system logs and tests autonomously.
Highlights
- Dual Control: Real-time TUI overlay allowing seamless hand-off between AI agent and human user.
- Event-Driven Monitoring: Ability to wake agents based on stream triggers, poll-diffs, or file-system watchers.
- Structured Spawning: Native support for launching other AI agents (Pi, Codex, Claude, Cursor) as sub-processes.
- Flexible Input: Supports raw text, named keys (e.g.,
Ctrl+C), bracketed paste, and hex bytes for complex TUI navigation. - Auto-Exit: Intelligent cancellation of local supervision after a period of output silence (quiet detection).
- Recoverable Output: Opt-in capability to retain and query specific failing test details or logs from headless sessions.
Related
- Project
- Project
- Project
- Project
- Project