Run long-running coding agents (Codex, Claude Code, etc.) in tmux sessions that survive orchestrator restarts, with automatic resume on interruption.
Long-running coding agent tasks are vulnerable to interruption. This skill decouples the coding agent process from the orchestrator using tmux, with auto-resume.
tmux new-session -d -s codex-<task-name>
tmux send-keys -t codex-<task-name> 'cd <project-dir> && codex exec --full-auto --json "<prompt>" | tee /tmp/codex-<task-name>.events.jsonl && echo "__TASK_DONE__"' Enter
tmux new-session -d -s claude-<task-name>
tmux send-keys -t claude-<task-name> 'cd <project-dir> && claude -p "<prompt>" && echo "__TASK_DONE__"' Enter
tmux has-session -t <session> 2>/dev/null && echo "running" || echo "finished"
tmux capture-pane -t <session> -p -S -200
Run the monitor script for long tasks:
./scripts/monitor.sh codex-<task-name> codex
# or: ./scripts/monitor.sh claude-<task-name> claude
Checks every 3 min. Doubles interval on consecutive failures. Stops after 5h.
# Codex
tmux send-keys -t codex-<task> 'codex exec resume <session-id> "Continue"' Enter
# Claude Code
tmux send-keys -t claude-<task> 'claude --resume' Enter
<agent>-<task-name>: codex-refactor-auth, claude-review-pr-42
tmux capture-pane on requestControl Philips Hue lights and scenes via the OpenHue CLI.