@virtengine/codex-monitor
v0.23.0
Published
AI-powered orchestrator supervisor — manages AI agent executors with failover, auto-restarts on failure, analyzes crashes with Codex SDK, creates PRs via Vibe-Kanban API, and sends Telegram notifications. Supports N executors with weighted distribution, m
Downloads
139
Maintainers
Readme
@virtengine/codex-monitor
Autonomous supervisor for AI coding workflows.
codex-monitor watches task execution, routes work across agent executors, handles retries/failover, automates PR lifecycle, and keeps you in control through Telegram (with optional WhatsApp and container isolation).
Why codex-monitor
AI coding agents are fast, but unattended loops are expensive:
- silent failures
- repeated retries with no progress
- stale worktrees and merge drift
- disconnected notifications
codex-monitor is the control plane that keeps delivery moving:
- task routing and executor failover
- monitored orchestration and auto-recovery
- conflict/PR lifecycle automation
- live bot control (
/status,/tasks,/pause,/resume, etc.)
Install
npm install -g @virtengine/codex-monitorRequires:
- Node.js 18+
- git
- Linux, macOS, and Windows are fully supported
- Shell runtime for your selected orchestrator wrapper:
- Bash for
.shwrappers - PowerShell (
pwsh) for.ps1wrappers
- Bash for
- GitHub CLI (
gh) recommended
Quick start
cd your-repo
codex-monitorFirst run launches setup automatically.
You can also run setup directly:
codex-monitor --setupSetup modes (new)
The setup wizard now starts with two modes:
Recommended
- prompts only for important decisions (project identity, executor preset/model profile, AI provider, Telegram, board/execution mode)
- keeps advanced knobs on proven defaults
- writes a standardized
.envbased on.env.exampleso all options remain documented - auto-generates repository
.vscode/settings.jsonwith Copilot agent/subagent/MCP/autonomous defaults
Advanced
- full control over repository layout, failover/distribution, hook targets/overrides, orchestrator path, VK wiring details, and optional channels
How codex-monitor can run
1) Standard foreground supervisor
codex-monitor2) Daemon mode
codex-monitor --daemon
codex-monitor --daemon-status
codex-monitor --stop-daemon3) Startup service (auto-start on login)
codex-monitor --enable-startup
codex-monitor --startup-status
codex-monitor --disable-startup4) Interactive shell mode
codex-monitor --shell5) Sentinel companion mode (Telegram watchdog)
codex-monitor --sentinel
codex-monitor --sentinel-status
codex-monitor --sentinel-stopExecution architecture modes
Configured by EXECUTOR_MODE:
internal(recommended)- tasks run through internal agent pool in monitor process
vk- task execution delegated to VK orchestrator flow
hybrid- internal + VK behavior for mixed/overflow scenarios
Task board backend (KANBAN_BACKEND):
internal- local task-store source of truth (default)vk- Vibe-Kanban adaptergithub- GitHub Issues with shared state persistencejira- Jira Issues with status/shared-state parity
Sync policy (KANBAN_SYNC_POLICY):
internal-primary- internal task-store remains source of truth (default)bidirectional- external status changes may update internal tasks
Autonomous runtime defaults:
- Copilot shell runs with experimental mode + allow-all + no-ask-user by default
- Codex config enforces critical feature flags (
child_agents_md,memory_tool, collaboration) - Setup configures common MCP servers automatically (
context7,sequential-thinking,playwright,microsoft-docs)
Experimental autonomous backlog replenishment:
INTERNAL_EXECUTOR_REPLENISH_ENABLED=true|falseINTERNAL_EXECUTOR_REPLENISH_MIN_NEW_TASKS=1|2INTERNAL_EXECUTOR_REPLENISH_MAX_NEW_TASKS=1..3PROJECT_REQUIREMENTS_PROFILE=simple-feature|feature|large-feature|system|multi-system
GitHub adapter enhancements: The GitHub Issues adapter now supports multi-agent coordination via structured state persistence:
- Claim tracking with
codex:claimed,codex:working,codex:stalelabels - Heartbeat mechanism to detect stale/abandoned claims
- Task exclusion via
codex:ignorelabel - Structured comments with JSON state for agent coordination
See KANBAN_GITHUB_ENHANCEMENT.md for details.
GitHub Projects v2 backend (Phase 1 + 2)
codex-monitor now supports GitHub Projects v2 as a first-class kanban source and sync target:
- Phase 1 (read): read tasks directly from a Projects v2 board (
GITHUB_PROJECT_MODE=kanban) - Phase 2 (write): sync task status updates back to the board
Statusfield - Bidirectional mapping between codex statuses and project status options
- Safe fallback to issues mode when project metadata is missing or unavailable
Enable with env config:
KANBAN_BACKEND=github
GITHUB_PROJECT_MODE=kanban
GITHUB_PROJECT_OWNER=your-org-or-user
GITHUB_PROJECT_NUMBER=3
GITHUB_PROJECT_AUTO_SYNC=trueStatus mapping overrides (optional):
GITHUB_PROJECT_STATUS_TODO=Todo
GITHUB_PROJECT_STATUS_INPROGRESS=In Progress
GITHUB_PROJECT_STATUS_INREVIEW=In Review
GITHUB_PROJECT_STATUS_DONE=Done
GITHUB_PROJECT_STATUS_CANCELLED=CancelledProjects v2 docs:
- GITHUB_PROJECTS_V2_QUICKSTART.md
- GITHUB_PROJECTS_V2_API.md
- GITHUB_PROJECTS_V2_MONITORING.md
- GITHUB_PROJECTS_V2_IMPLEMENTATION_CHECKLIST.md
Jira adapter parity config: Jira supports the same codex-monitor status vocabulary and shared-state fields, with explicit mapping via env vars:
KANBAN_BACKEND=jira
JIRA_BASE_URL=https://your-domain.atlassian.net
[email protected]
JIRA_API_TOKEN=***
JIRA_STATUS_TODO=To Do
JIRA_STATUS_INPROGRESS=In Progress
JIRA_STATUS_INREVIEW=In Review
JIRA_STATUS_DONE=Done
JIRA_STATUS_CANCELLED=Cancelled
JIRA_CUSTOM_FIELD_OWNER_ID=customfield_10042
JIRA_CUSTOM_FIELD_ATTEMPT_TOKEN=customfield_10043
JIRA_CUSTOM_FIELD_ATTEMPT_STARTED=customfield_10044
JIRA_CUSTOM_FIELD_HEARTBEAT=customfield_10045
JIRA_CUSTOM_FIELD_RETRY_COUNT=customfield_10046
JIRA_CUSTOM_FIELD_IGNORE_REASON=customfield_10047Setup wizard note: running codex-monitor --setup and selecting Jira will
open the Atlassian API token page (opt-in), list projects, and guide you
through project/issue type selection interactively.
See JIRA_INTEGRATION.md for full configuration and examples.
Channels and control surfaces
Telegram (primary control channel)
Core controls include:
/help(inline keyboard)/status,/tasks,/agents,/threads,/worktrees/pause,/resume,/restart,/retry/executor,/sdk,/kanban,/maxparallel
Telegram Mini App (Control Center)
A full interactive web UI that runs inside Telegram as a Mini App. Enable it with two env vars:
TELEGRAM_MINIAPP_ENABLED=true
TELEGRAM_UI_PORT=3080Once enabled, the server auto-detects your LAN IP and sets the bot menu button. Access the Mini App from Telegram via:
/appcommand — sends an inline button to open the Control Center- Menu button — tap the bot's menu button (set automatically)
- Browser — open
http://<your-lan-ip>:3080directly
The Mini App provides 7 tabs: Dashboard, Tasks, Agents, Infra, Control, Logs, and Settings — all with real-time WebSocket updates, haptic feedback, and native Telegram theming.
For public/remote access, set up a tunnel (ngrok, Cloudflare Tunnel) and configure:
TELEGRAM_UI_BASE_URL=https://your-tunnel-domain.example.comFor local browser testing (without Telegram auth):
TELEGRAM_UI_ALLOW_UNSAFE=trueWhatsApp (optional)
Enable in env and authenticate:
codex-monitor --whatsapp-auth
# or
codex-monitor --whatsapp-auth --pairing-codeTelegram status commands include:
/whatsapp/container
Container isolation (optional)
container-runner can isolate agent executions with:
- Docker
- Podman
- Apple Container (
container) on macOS
Key env vars:
CONTAINER_ENABLED=1CONTAINER_RUNTIME=auto|docker|podman|containerCONTAINER_IMAGE=node:22-slimMAX_CONCURRENT_CONTAINERS=3
Configuration model
Load order (highest priority first):
- CLI flags
- environment variables
.envcodex-monitor.config.json- built-in defaults
Files
.env— runtime/environment settingscodex-monitor.config.json— structured config (executors, failover, repos, profiles).codex-monitor/agents/*.md— prompt templates scaffolded by setup
SDK transport defaults
codex-monitor supports explicit transport selectors per SDK shell:
CODEX_TRANSPORT=sdk|auto|cliCOPILOT_TRANSPORT=sdk|auto|cli|urlCLAUDE_TRANSPORT=sdk|auto|cli
Setup now defaults all three to sdk for predictable persistent-session behavior.
auto remains available when you intentionally want endpoint/CLI auto-detection.
Recommended profile split
- Local development profile:
DEVMODE=trueDEVMODE_MONITOR_MONITOR_ENABLED=true*_TRANSPORT=sdk
- End-user stability profile:
DEVMODE=falseDEVMODE_MONITOR_MONITOR_ENABLED=false*_TRANSPORT=sdk
Recommended configuration path
If you want a strong baseline with minimal decisions:
- Run
codex-monitor --setup - Pick Recommended mode
- Choose executor preset that matches your token budget and speed goals
- Configure AI provider credentials
- Configure Telegram
- Keep defaults for hooks/VK/orchestrator unless you already have a custom flow
This gives you a standardized .env with full inline documentation and sane defaults.
Advanced configuration path
Use Advanced mode when you need:
- custom multi-repo topology
- custom failover/distribution behavior
- manual orchestrator path/args
- custom hook policy and event overrides
- explicit VK URL/port and wiring behavior
- explicit optional channel/runtime tuning
Key config examples
Executor config (codex-monitor.config.json)
{
"$schema": "./codex-monitor.schema.json",
"projectName": "my-project",
"executors": [
{
"name": "copilot-claude",
"executor": "COPILOT",
"variant": "CLAUDE_OPUS_4_6",
"weight": 50,
"role": "primary",
"enabled": true
},
{
"name": "codex-default",
"executor": "CODEX",
"variant": "DEFAULT",
"weight": 50,
"role": "backup",
"enabled": true
}
],
"failover": {
"strategy": "next-in-line",
"maxRetries": 3,
"cooldownMinutes": 5,
"disableOnConsecutiveFailures": 3
},
"distribution": "weighted"
}Env shorthand for executors
EXECUTORS=COPILOT:CLAUDE_OPUS_4_6:50,CODEX:DEFAULT:50Minimal local env
PROJECT_NAME=my-project
GITHUB_REPO=myorg/myrepo
KANBAN_BACKEND=internal
KANBAN_SYNC_POLICY=internal-primary
EXECUTOR_MODE=internal
INTERNAL_EXECUTOR_REPLENISH_ENABLED=false
PROJECT_REQUIREMENTS_PROFILE=feature
VK_BASE_URL=http://127.0.0.1:54089
VK_RECOVERY_PORT=54089
MAX_PARALLEL=6
TELEGRAM_BOT_TOKEN=
TELEGRAM_CHAT_ID=For full variable documentation see .env.example.
Useful commands
codex-monitor --help
codex-monitor --setup
codex-monitor --doctor
codex-monitor --update
codex-monitor --no-update-check
codex-monitor --no-auto-update
codex-monitor --no-telegram-bot
codex-monitor --telegram-commands
codex-monitor --no-vk-spawn
codex-monitor --vk-ensure-interval 60000
codex-monitor --script ./my-orchestrator.sh
codex-monitor --args "-MaxParallel 6"--doctor validates effective config (.env + config JSON + process env overrides), reports actionable fixes, and exits non-zero when blocking issues are found.
Validation and tests
From scripts/codex-monitor:
npm run syntax:check
npm run testFocused tests (example):
npx vitest run tests/whatsapp-channel.test.mjs tests/container-runner.test.mjs tests/telegram-buttons.test.mjsNotes on generated .env
The setup wizard now standardizes .env generation by applying your selected values onto .env.example.
Benefits:
- all options stay documented in your generated file
- chosen values are explicitly activated/uncommented
- unchosen options remain visible as commented documentation
- easier upgrades over time as new options are added
Troubleshooting quick checks
codex-monitor --helpfor supported flagscodex-monitor --setupto re-run configuration safely- verify
.env+codex-monitor.config.jsonare in your config directory - verify
gh auth statusfor PR operations - verify Telegram token/chat id with
codex-monitor-chat-id
License
Apache 2.0
