task_pilot.py is an AI-driven task pilot that supervises an existing tmux agent session.
When the session goes idle, it analyzes the current state and decides how to keep unfinished tasks moving.
Interactive CLI agents often stop after a partial result, an interruption, or a progress-only reply. task_pilot.py adds a lightweight supervision loop on top of an existing tmux session so the task can keep moving without requiring constant manual nudges.
- Python 3.10+
tmux- one existing
tmuxsession running an interactive CLI
No third-party Python packages are required.
Start the target CLI inside tmux first:
tmux new-session -s codex_task 'codex'Then run task_pilot.py in another shell:
python3 task_pilot.py --session codex_taskAt startup, the process waits for a runtime command:
start
You can also load settings from a config file:
python3 task_pilot.py --config config.example.jsonMinimal full flow:
tmux new-session -s codex_task 'codex'
python3 task_pilot.py --session codex_task --decision-mode codex
# type: startIf you want to verify the supervision flow without sending anything back into tmux:
python3 task_pilot.py --session codex_task --decision-mode codex --dry-runstart: start automatic supervisionstop: stop automatic supervision but keep the process runningstatus: print the current runtime state
Use Ctrl+C to exit.
--config: JSON config file--session: existingtmuxsession name--decision-mode:ruleorcodex--max-continue: maximum automatic continue cycles--idle-threshold: unchanged-output duration that counts as idle--poll-interval: polling interval in seconds--history-lines: number oftmuxhistory lines captured per poll--rule-continue-prompt: fixed prompt used byrulemode--dry-run: analyze normally but never send prompts totmux
For exact defaults:
python3 task_pilot.py --helpWhen the session stays idle long enough, task_pilot.py sends the configured rule_continue_prompt back into the monitored session.
When the session stays idle long enough, task_pilot.py captures a snapshot and calls internal codex exec --json analysis.
The analyzer returns:
continue: send a follow-up prompt back into the monitored sessionwait: do not send anything; wait until the snapshot changes before analyzing again
Analyzer context is stored per monitored session under:
.task_pilot_sessions/
Each file contains the monitored session name and the analyzer session id.
- One
task_pilot.pyprocess is intended to supervise onetmuxsession. - If you want to monitor multiple sessions, run multiple
task_pilot.pyprocesses. - The tool does not create
tmuxsessions or start CLIs for you. codexmode depends on a localcodex execcommand being available.- In
--dry-runmode, continue decisions are logged but not sent to the monitored session.