codex-autopilot
Skill2 starsChanged 7 months agoMITView on GitHub
Multi-model AI coding automation system with intelligent task routing and built-in CI/CD. Watchdog-driven loop that orchestrates Codex (backend) and Gemini (frontend) sessions in tmux, auto-routes tasks by type, manages context compaction, runs incremental code reviews, dispatches tasks from a priority queue, and includes a test-agent that auto-detects failures, enqueues fixes, and ratchets coverage. v0.8.0 adds GitClaw workspace backup, PR/review monitoring, Codex session health monitoring via watch-codex.sh, and production-friendly OpenClaw/Hermes agent integration hooks. Recommended unattended Codex setup uses `codex --yolo`. Use when managing multiple concurrent AI coding sessions, automating development workflows, orchestrating parallel AI-assisted coding across projects, routing frontend vs backend tasks to different models, tracking tmux Codex health, following up on upstream PR/CI activity, or running continuous testing with auto-fix. Triggers: autopilot, watchdog, codex automation, tmux codex, multi-project codex, auto-nudge codex, codex session management, gemini frontend, multi-model routing, ai task routing, ci cd, test agent, coverage ratchet, gitclaw, workspace backup, pr monitor, ci fix, watch codex, codex health, hermes.
- Installs packages
1 other project uses a version of this.
Adopted by
Most recently taken up by
- YOSSII812001/claude-code-jarvistheir own version, first seen Oct 9, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- YOSSII812001/claude-code-jarvis★ 1same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 1 is distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 61
If you prefer explicit invocation per session, use command codex --yolo directly instead of the alias.
- Very specific: line 65
Use install.sh to register the launchd plist:
- Distinctive: line 222
Start a Codex CLI session in a named tmux window:
- Very specific: line 228
Add the project path to config.yaml under project_dirs
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Codex Autopilot
Multi-model AI coding orchestration via tmux + launchd on macOS.
Overview
Codex Autopilot runs a watchdog loop that orchestrates multiple AI coding sessions in tmux. It features intelligent task routing — frontend tasks (UI, components, H5) are routed to Gemini CLI (1M context window, superior design aesthetics), while backend tasks (API, database, deployment) go to Codex CLI. The watchdog detects idle sessions, auto-nudges them, handles permission prompts, dispatches tasks from a priority queue, and sends notifications via Discord/Telegram. The same stack can be driven by an OpenClaw or Hermes-style orchestration layer for queue dispatch, PR follow-up, and workspace maintenance.
Multi-Model Architecture
| Role | Model | Strengths |
| Backend coding | Codex (GPT-5.4) | API, database, deployment, refactoring |
| Frontend development | Gemini CLI | UI, components, pages, styles, 1M context |
| Orchestration | Claude / OpenClaw | Task routing, code review, project management |
Tasks are automatically classified by keywords and routed to the appropriate model. Frontend tasks fall back to Codex if Gemini is unavailable.
Installation
git clone https://github.com/imwyvern/AIWorkFlowSkill.git ~/.autopilot
cd ~/.autopilot
cp config.yaml.example config.yaml
# Edit config.yaml with your project paths, Telegram bot token, and Discord channelsDependencies
- macOS with launchd (for scheduled execution)
- tmux — session multiplexer for Codex windows
- Codex CLI (
codex) — OpenAI's coding agent - python3 — for state cleanup and PRD verification scripts
- yq — YAML processor for config parsing
- jq — JSON processor for state management
- bash 4+ — for associative arrays in scripts
Install dependencies via Homebrew:
brew install tmux yq jqRecommended Codex Alias
For unattended tmux sessions, the production default is a full-permission Codex invocation:
echo "alias codex='command codex --yolo'" >> ~/.zshrc
source ~/.zshrcIf you prefer explicit invocation per session, use command codex --yolo directly instead of the alias.
launchd Setup
Use install.sh to register the launchd plist:
./install.shThis creates a LaunchAgent that runs the watchdog on a configurable interval.
Core Components
watchdog.sh
Main loop engine. On each tick:
- Iterates through configured project tmux windows
- Captures current Codex output via
codex-status.sh - Determines if session is active, idle, or stuck
- Dispatches appropriate action (nudge, permission grant, task from queue)
- Enforces cooldowns, daily send limits, and loop detection
codex-status.sh
Captures and analyzes tmux pane content. Detects:
- Codex activity state (working / idle / waiting for permission)
- Permission prompts requiring approval
- Context compaction signals
- Error states and crashes
tmux-send.sh
Sends keystrokes or text to a specific tmux window. Handles:
- Typing text into Codex prompt
- Pressing Enter/keys for permission approval
- Verification polling to confirm send succeeded
autopilot-lib.sh
Shared function library used by all scripts:
- Telegram notification helpers
- File locking primitives
- Timeout and retry logic
- Logging utilities
- State file read/write
autopilot-constants.sh
Defines status constants used across scripts (e.g., STATUS_ACTIVE, STATUS_IDLE, STATUS_PERMISSION).
task-queue.sh
Task queue manager. Supports:
- Enqueuing tasks for specific projects
- Dequeueing next task based on priority
- Task status tracking (pending/running/done/failed)
discord-notify.sh
Sends formatted notifications to Discord channels via webhook. Supports project-channel routing defined in config.yaml.
test-agent.sh
Built-in CI/CD that runs on every commit. Evaluates test suites, tracks coverage, and auto-enqueues bugfix tasks when tests fail.
commit → watchdog detects → test-agent evaluate
├─ all pass → review clean → enqueue coverage tasks for low-coverage files
└─ failures → parse log → auto-enqueue "fix(test): ..." bugfix task
└─ 1h cooldown per file (prevents retry loops)Triggers:
on_commit_evaluate— every new commiton_review_clean— after code review passesnightly— scheduled full evaluation (default 02:30)
Coverage ratchet: global coverage must not regress; weekly +1% target, capped at 90%.
Other Scripts
| Script | Purpose |
auto-nudge.sh | Nudge logic for idle Codex sessions |
auto-check.sh | Periodic health check across all projects |
watch-codex.sh | Monitor a tmux Codex session until it returns to idle, needs approval, or times out |
codex-monitor.sh | Monitor long-running Codex rollout files and emit completion hints |
poll-codex-done.sh | Cron-friendly polling helper that notifies when a tracked Codex task finishes |
permission-guard.sh | Auto-approve or flag permission prompts |
incremental-review.sh | Run code review on recent changes |
monitor-all.sh | Dashboard: show status of all monitored projects |
pr-monitor.sh | Track new upstream reviews/comments/merge events to drive PR follow-up and CI fix dispatch |
status-sync.sh | Sync state to status.json for external consumption |
rotate-logs.sh | Log rotation and cleanup |
cleanup-state.py | Remove stale entries from state.json |
claude-fallback.sh | Fallback handler when Codex is unavailable |
gitclaw-backup.sh | Backup the local GitClaw/OpenClaw workspace files to a GitHub repo |
track-mediaclaw-codex.sh | Example project-specific tracker for a long-running Codex tmux window |
xhs_monitor.py | Playwright-based XiaoHongShu monitor used by heartbeat-style automation |
prd-audit.sh | Audit PRD completion status |
prd-verify.sh / prd_verify_engine.py | Verify PRD items against codebase |
codex-token-daily.py | Track daily token usage |
coverage-collect.sh | Collect and merge coverage reports |
Configuration
Edit config.yaml (copy from config.yaml.example). Key sections:
Timing Thresholds
active_threshold: 120 # seconds — Codex considered "working"
idle_threshold: 360 # seconds — Codex considered "idle", triggers nudge
cooldown: 120 # minimum seconds between sends to same projectSafety Limits
max_daily_sends_total: 200 # global daily send cap
max_daily_sends: 50 # per-project daily cap
max_consecutive_failures: 5 # pause project after N failures
loop_detection_threshold: 3 # detect repeated output loopsMulti-Project Scheduler
scheduler:
strategy: "round-robin" # or "priority"
max_sends_per_tick: 1
inter_project_delay: 5 # seconds between project sendsProject Directories
project_dirs:
- "~/project-alpha"
- "~/project-beta"Gemini Frontend Routing
gemini:
default_window: "gemini-h5" # Default tmux window for frontend tasks
project_windows:
youxin: "gemini-youxin" # Per-project Gemini window overridesFrontend task detection keywords: 页面, 组件, 样式, UI, 前端, H5, 小程序, 界面, frontend, component, style, page, layout
Discord Channel Routing
discord_channels:
my-project:
channel_id: "123456789"
tmux_window: "my-project"
project_dir: "/path/to/project"Telegram Notifications
telegram:
bot_token: "YOUR_BOT_TOKEN"
chat_id: "YOUR_CHAT_ID"
status_interval: 1800Usage
Adding a Project
- Start a Codex CLI session in a named tmux window:
tmux new-window -t autopilot -n my-project # In the new window, cd to project and run codex - Add the project path to
config.yamlunderproject_dirs - Optionally create
projects/my-project/tasks.yamlfor task queue:project: name: "My Project" dir: "~/my-project" enabled: true priority: 1 tasks: - id: "feature-x" name: "Implement feature X" prompt: | Implement feature X per the spec in docs/feature-x.md
Manual Operations
# Check status of all projects
./scripts/monitor-all.sh
# Manually nudge a specific project
./scripts/auto-nudge.sh my-project
# Send a command to a tmux window
./scripts/tmux-send.sh my-project "codex exec 'fix the tests'"
# Enqueue a backend task (routes to Codex)
./scripts/task-queue.sh add my-project "Refactor auth module"
# Enqueue a frontend task (routes to Gemini)
./scripts/task-queue.sh add my-project "重构登录页面组件" normal --type frontend
# Run the watchdog once (for testing)
./scripts/watchdog.sh
# Watch a Codex session until it goes idle again
./scripts/watch-codex.sh autopilot:my-project 60
# Check whether upstream PRs need follow-up
./scripts/pr-monitor.sh
# Backup local workspace state to GitHub
./scripts/gitclaw-backup.shPR Follow-up and Heartbeat Docs
scripts/pr-monitor.shbatches review/comment checks for upstream PRs and is designed to be called from cron, OpenClaw, or Hermes agents.scripts/watch-codex.shis the lightweight completion detector used after task dispatch when you need a reliable "notify me when idle again" primitive.docs/HEARTBEAT.mdcontains a production heartbeat checklist for PR follow-up, skill updates, and other operational loops.
Python Autopilot (Alternative)
autopilot.py provides a Python-based alternative with richer state management:
python3 autopilot.py --once # single pass
python3 autopilot.py --daemon # continuous loopDirectory Structure
~/.autopilot/
├── SKILL.md # This file
├── config.yaml # Local config (not in git)
├── config.yaml.example # Config template
├── scripts/ # All automation scripts
├── projects/ # Per-project task definitions
├── docs/ # Additional documentation and heartbeat playbooks
│ └── HEARTBEAT.md # Example production heartbeat checklist
├── code-review/ # Code review templates
├── development/ # Development workflow templates
├── doc-review/ # Doc review templates
├── doc-writing/ # Doc writing templates
├── requirement-discovery/ # Requirement discovery templates
├── testing/ # Testing templates
├── tests/ # Test suite
├── state/ # Runtime state (gitignored)
├── logs/ # Runtime logs (gitignored)
├── task-queue/ # Task queue data (gitignored)
└── archive/ # Deprecated filesDoes it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

