/vibe:codex-fleet-monitorfrom vibe
Monitors multiple Codex/vibe sessions and PRs, flagging IDLE, STALLED, FAILED(LIMIT) states, new PR comments, merge conflicts, and more. Resumes sessions after transient provider errors.
Ships in vibe. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
One background command polls every watched Codex thread and PR and exits with a diff when any line changes; act on it, then re-arm. Waiting costs no model tokens.
It also resumes a turn that failed with a transient provider error after a backoff (Recovery); the supervisor does the same on each host when no orchestrator is awake.
A Codex turn that hits a usage limit stays open and stops producing items, so "is a turn active" reports it running forever. The monitor reads each thread's last turn (status, error, newest item) and flags a turn whose newest item has not changed for STALL_SECONDS as STALLED. It never loads a thread's history (one full read passed 1 GB of RSS): thread/read without turns, thread/turns/list for the newest turn, and thread/items/list for its newest item, with a full read only on an App Server too old for thread/turns/list.
scripts/liveness.mjs (Node built-ins only) starts the managed App Server with codex app-server daemon start and connects through codex app-server proxy; scripts/ratelimit.mjs (the plugin's one usage reader, also imported by vibe's codex-usage.mjs), scripts/recover.mjs and scripts/supervise.mjs reuse its client.codex, node, jq, gh (authenticated) on this machine; codex and node on the remote host, reachable through REMOTE_SHELL.Use fleet-orchestrator's fleet home (its active program; scripts/work-dir.mjs resolves it and derives the state dirs) or a dir of your own per orchestration, and create:
config.env
LOCAL_STATE_DIR=/path/to/local/state/files # only for two-column sessions
REMOTE_HOST=user@host # omit when there are no remote sessions
REMOTE_STATE_DIR=/path/on/remote # remote scratch dir; also holds state files for two-column sessions
# REMOTE_FLEET_HOME=/path/on/remote # in a fleet home, replaces REMOTE_STATE_DIR and REMOTE_REQUESTS_DIR
REMOTE_SHELL="zsh -lic" # login shell so node/codex are on PATH (default)
STALL_SECONDS=720 # no new thread items for this long means STALLED (default 12m)
# CLAUDE_USAGE=0 # turn off the claude-usage line; CLAUDE_USAGE_SECONDS=600 sets how often it is read
# QUESTION_SECONDS=900 # an idle writer's question unanswered this long is QUESTION-UNANSWERED (default 15m)
# STALE_PR_SECONDS=2700 # a PR needing its writer with no push this long is STALE-PR (default 45m)
# HEARTBEAT_SECONDS=1800 # with no change, watch.sh exits with HEARTBEAT after this long (default 30m)
WATCH_NEW_PR_REPOS="owner/repo" # open PRs here that PR_SEARCH lists or WATCH_PR_AUTHOR opened join the watch set
# WATCH_PR_AUTHOR=@me # author whose open PRs are watched on any branch prefix (default the gh account)
PR_SEARCH="head:feature/" # optional: search filter for that list
BOT_LOGIN_REGEX="vercel|codex|github-actions|copilot|bot" # authors not counted as human feedback
# USAGE_HIGH_PERCENT=80 # usage below this prints one band (default MOVE_AT_PERCENT, else 80)
# USAGE_STALE_SECONDS=1800 # status flags the last good reading after this age (default 30m)
# CODEX_MODEL=<model> # with CODEX_EFFORT, a thread on another model or effort gets a MODEL(...) word
# CODEX_EFFORT=high
RECOVERY_BACKOFF_SECONDS="120 300 600" # wait before each resume of a transient failure; one retry per value
# CONTINUE_PROMPT_FILE=/path/to/continue.md # replaces the built-in continue prompt (REMOTE_CONTINUE_PROMPT_FILE on REMOTE_HOST)
# AUTO_RESTART_DAEMON=1 # allow restarting the App Server daemon for threads stuck in systemError; off by default
# RESTART_COOLDOWN_SECONDS=1800 # at most one automatic restart per host in this window
# MY_GH_LOGIN=me # your own comments are not counted; defaults to `gh api user`
# PASS_TIMEOUT_SECONDS=300 # a recovery pass running longer is abandoned with a pass-timeout event
# LOG_MAX_BYTES=1048576 # events.log and supervisor.log rotate to <file>.1 at this size
# SUPERVISOR_RSS_CAP_MB=300 # a supervisor heartbeat over this RSS is RSS-HIGH
REQUESTS_DIR=/path/to/requests # optional: local dir where sessions drop delegated-work request files
REMOTE_REQUESTS_DIR=/path/on/remote/requests # optional: the same on REMOTE_HOST
sessions.txt: one line per Codex session, in either form:
local|remote <label> <threadId>: the thread id directly.local|remote <name>: reads <stateDir>/<name>.json, which must contain a threadId field (LOCAL_STATE_DIR or REMOTE_STATE_DIR). Use this when another tool already writes per-session state files.The label is what appears in the output lines.
prs.txt: the watch set, one line per PR, owner/repo <number> [<writer>]. The snapshot adds open PRs from WATCH_NEW_PR_REPOS on any branch, except one in prs-ignore.txt or another program's prs.txt (another chat owns it), and drops a merged or closed PR after reporting it once; add the writer column when you assign a PR so STALE-PR names whom to nudge. A Claude pane writer has no turn state to read, so STALE-PR on its PR is its liveness signal.
scripts/watch.sh <workDir> [intervalSeconds]
Start it as its own run_in_background call, never with & (a second copy exits 3). When it exits, handle every line, then start it again; it only watches while running. An IDLE line carries the writer's final message tail, also once the thread is unloaded (notLoaded), and says NEEDS-REPLY when any line asks a question or for permission, authorization or approval. Before ending any turn that handled an event, node scripts/watcher.mjs <workDir> must print watcher ok; re-arm on MISSING. sessions.txt and prs.txt edits take effect on the next re-arm; scripts/snapshot.sh <workDir> prints the state once.
| Line | Meaning | Usual action |
|---|---|---|
HEARTBEAT ... | nothing changed for HEARTBEAT_SECONDS | read every teammate message and idle writer question, then re-arm |
session <where> <name> RUN | turn in progress and producing items | none |
session ... IDLE | turn completed; the session is waiting for you | read its last message, give it the next turn |
session ... IDLE QUESTION-UNANSWERED(15m+) ... | the writer asked something and has waited QUESTION_SECONDS (15 minutes) | answer it now, or tell it to proceed on its default |
session ... MODEL(<model>/<effort>!=<want>) | the thread runs on another model or effort than CODEX_MODEL and CODEX_EFFORT | restart it on the configured one; other models were far slower |
session ... STALLED(...) | turn open but silent | check for a usage limit or a hung command; tell the user if it needs them |
session ... FAILED(LIMIT) | turn errored on a usage limit | tell the user right away; a reset or second account is theirs to do |
session ... FAILED(TRANSIENT) | turn errored on a transient provider failure: model at capacity, rate limit, 5xx or a dropped connection | none; recovery resumes it after the backoff (watch the recovery line) |
session ... FAILED(SYSTEM-ERROR) | the App Server holds the thread in systemError; resume and new turns fail until the daemon restarts | recovery handles it after the retries when AUTO_RESTART_DAEMON=1; otherwise act on its ALERT |
session ... FAILED(ERROR) / STOPPED(...) / READFAIL | turn errored, was interrupted, or the thread or state file is unreadable | inspect the thread; restart or resume |
recovery <local|remote> <count> <last event> | a recovery action ran on that machine; the log is <stateDir>/.fleet-recovery/events.log | read the new events; act on ALERT and gave-up (below) |
supervisor <local|remote> ok | that machine's supervisor wrote its heartbeat within 3 of its intervals, under the RSS cap | none |
supervisor ... STALE(>Ns) / MISSING / UNREADABLE | no heartbeat for 3 intervals (a hung or dead supervisor), the lock exists with no heartbeat, or the heartbeat cannot be parsed | read supervisor.log there; restart the supervisor |
supervisor ... RSS-HIGH(>NMB) | the supervisor's RSS is over SUPERVISOR_RSS_CAP_MB | read its hourly summary lines; restart it and report the leak |
session remote <host> UNREACHABLE | ssh failed | check the host |
codex-usage <local|remote> under80% ok resets=<n> / HIGH(<band>%) | Codex usage on that machine: one band below USAGE_HIGH_PERCENT (80 here), then the used percent floored to 10; resets counts available limit resets | on HIGH, warn the user at once with the band and resets (applying one is theirs); if they are away, move the busiest writers to Claude writers |
claude-usage local session=<band> week=<band> | Claude usage from claude -p "/usage" on the same bands (read at most every CLAUDE_USAGE_SECONDS, 600) | on HIGH, warn the user at once with its resets= time; if they are away, move the busiest Claude writers to Codex writers |
usage <runtime> <machine> ... STALE last-good=<time> | The last successful reading is older than USAGE_STALE_SECONDS, or no successful reading exists | run a fresh read before any runtime or machine routing decision; if it fails, ask the operator |
codex-usage ... LIMIT / LIMIT-STOPPED | usage limit reached; LIMIT means ordinary usage is still allowed, LIMIT-STOPPED means sessions cannot run | tell the user right away; a reset or second account is theirs to do |
codex-usage ... LIMIT-SPENDING-CREDITS | limit reached and turns are now consuming paid credits | tell the user at once and stop sending turns unless they approve paid credits |
codex-usage ... unknown / unreadable READFAIL | the App Server answered without rate limits, or it or the remote host could not be read | check codex on that machine |
HOOK-APPROVAL <local|remote> vibe <v> vibe-core <v>: ... | that machine's Codex vibe or vibe-core changed version and Codex's hooks/list says a vibe-core hook needs approval (or vibe-core is missing, or approval could not be checked); it stays unchanged until the answer changes and goes away once approved | tell the user at once, the line word for word (it names the approval steps); approving is theirs to do |
requests <local|remote> <count> <newest file> / requests ... UNREADABLE | a session dropped (or you removed) a delegated-work request file | hand the new request to a Claude worker, then steer its result back to the session that asked |
board UNACKED-SCOPE, SCOPE-NOT-STARTED, UNACKED, QUESTION-UNANSWERED, UNREADY-COMMIT, PUSH-READY-UNKNOWN | a fleet-orchestrator board.json flag | act as fleet-orchestrator says |
open-prs <repo> <numbers> | open PR list changed | add it to prs.txt; observe automatically started checks and reviews |
pr ... BLOCKED(unresolved threads) | unresolved review threads (threads=<n>) block the merge even when approved with auto-merge armed | route each thread to the owning writer now; it is not a missing approval |
pr ... STALE-PR(...) | an open PR with unresolved threads, a conflict, a draft flag or a failed check has had no push for STALE_PR_SECONDS (45 minutes) | ask its writer for an ETA, unblock it, or reassign it, however busy the writer looks |
pr ... <state> <head> <reviewDecision> <mergeable> comments= reviews= inline= threads= checks= | any field changed | new head: re-review; count up: read the feedback; CONFLICTING: tell the owning session to merge the base branch; checks: act on failures (counts change only once settled, with (running) meanwhile) |
Surface everything that needs a human to the user immediately: limits, paid-credit spending, stalls, failures, and new human review comments.
Every usage line includes read=<ISO time> and source=<reader>. Each actual probe, including READFAIL, updates <workDir>/usage-readings.json through an atomic replacement. The file retains the latest reading, latest good reading and 100 recent readings per runtime and machine. Run node scripts/usage-state.mjs status <workDir> for one latest-reading report per runtime and machine with ages and stale flags. The watcher ignores only changing read= and source= fields when deciding whether to emit an EVENT; band changes and stale-state transitions still wake it.
Each watcher tick runs scripts/recover.mjs on every machine that has sessions (unless that machine's supervisor is running, which owns recovery there). For a session whose last turn failed with a transient provider error:
RECOVERY_BACKOFF_SECONDS value, reloads the thread (thread/resume) and starts a turn with the continue prompt, which tells the session to check its real state (git, merges, background jobs, locks, last push) and not redo finished steps. Retries reset once a turn completes.systemError after the last retry needs the App Server daemon restarted. With AUTO_RESTART_DAEMON=1 it prints !!! RESTARTING, runs codex app-server daemon restart (at most once per RESTART_COOLDOWN_SECONDS), records each session's before-restart state, and resumes only sessions whose turn was active or failed; idle ones stay idle. With the switch off it prints one ALERT ... daemon-restart-needed line.systemError print one gave-up line. A usage limit or any other error is never resumed; those stay yours.If no answer by <ISO time>: <default> (vibe's session-questions.mjs) is told to go ahead on the default once that time passes (proceeded-on-default).Every action is an EVENT recovery ... line in the events log, which the recovery snapshot line reports, so you see what happened when you wake.
| Event | Usual action |
|---|---|
<label> transient-failure ... / resumed ... / recovered ... | none; read the session's last message when convenient |
<label> proceeded-on-default ... | nobody answered by the deadline; answer now if the default is wrong |
<label> resume-failed ... | none while retries remain |
pass-timeout after <N>s ... | a pass outlasted PASS_TIMEOUT_SECONDS, usually a daemon that stopped answering; its connections were closed and the next pass runs on schedule |
pass-failed: ... (supervisor log) | a pass could not connect or read |
<label> gave-up ... | inspect the thread; resume it yourself or tell the user |
ALERT <host> daemon-restart-needed ... | with the user's agreement run codex app-server daemon restart on that host, then resume each session there |
!!! RESTARTING ... / <label> before-restart ... / resumed-after-restart ... / left-idle-after-restart | tell the user it happened; check each resumed session's next message |
ALERT <host> restart-cooldown ... / daemon-restart-failed | tell the user; a second restart is theirs to decide |
scripts/supervise.sh <workDir> [intervalSeconds] runs on the host that owns the Codex sessions, with no Claude session involved: a recovery pass over the local lines of <workDir>/sessions.txt every interval (default 60 seconds, or SUPERVISE_INTERVAL_SECONDS), with state and events in LOCAL_STATE_DIR (the work dir when unset).
FLEET_SUPERVISOR_LOCK (default ~/.codex/fleet-supervisor.lock), and a second one exits with status 3. A lock left by a dead process is taken over.sessions.txt lists that host's sessions as local and whose LOCAL_STATE_DIR is the REMOTE_STATE_DIR the watcher uses, so the watcher's recovery remote line reads the same log.PASS_TIMEOUT_SECONDS (default 300) gets a pass-timeout event, its connections are closed and the loop goes on.<stateDir>/.fleet-recovery/heartbeat.json (time, pid, interval, passes, last duration and error, RSS), which the watcher's supervisor line reads, and logs a supervise: hourly summary each hour.<workDir>/supervisor.log (or SUPERVISOR_LOG), rotated to supervisor.log.1 at LOG_MAX_BYTES (1 MB), as events.log is.templates/codex-fleet-supervisor.plist (launchd) or templates/codex-fleet-supervisor.service (systemd user unit); each says how to load it. On macOS restart it with launchctl bootout then launchctl bootstrap, never launchctl kickstart -k, which hung the calling shell.mergeable keeps its last known value while GitHub reports UNKNOWN, so it does not flap.<workDir>/last-snapshot.txt, so a change between an exit and the re-arm is still reported; delete it for a fresh base. Delete <workDir>/item-history.txt to reset stall timers. A PR's state files go once it leaves prs.txt.<REMOTE_STATE_DIR>/.fleet-monitor/ on every snapshot.gh read repeats that field's last value, so an API blip is not an event.agents/openai.yaml (opens in a new tab)scripts/classify.sh (opens in a new tab)scripts/claude-usage.mjs (opens in a new tab)scripts/hook-approval.mjs (opens in a new tab)scripts/liveness.mjs (opens in a new tab)scripts/ratelimit.mjs (opens in a new tab)scripts/recover.mjs (opens in a new tab)scripts/snapshot.sh (opens in a new tab)scripts/supervise.mjs (opens in a new tab)scripts/supervise.sh (opens in a new tab)scripts/thread-sidebar.mjs (opens in a new tab)scripts/usage-state.mjs (opens in a new tab)scripts/watch.sh (opens in a new tab)scripts/watcher.mjs (opens in a new tab)scripts/work-dir.mjs (opens in a new tab)templates/codex-fleet-supervisor.plist (opens in a new tab)templates/codex-fleet-supervisor.service (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub closedloop-ai/claude-plugins --plugin vibe17 skills in this plugin
/cl-analyzeAnalyze one ClosedLoop feature ticket from a URL or FEA slug before execution. Use when asked to assess ticket complexity, feasibility, readiness, applicable requirements PRDs and missing PRD links, UI design guidance, human UI plan approval needs, blockers, legacy split lineage, merge-batch compatibility, nonsensical or obsolete scope, product versus engineering routing, or whether a ticket can safely be worked before invoking $cl-execute. Keep engineering and operational concerns private; recommend a company-visible ticket comment only for a genuine Product decision under cl-policy or when the user explicitly requests the exact comment. Keep every issue as its single ticket; do not recommend $cl-split. Do not implement the ticket./cl-executeDraft and upload ClosedLoop implementation plans with Mermaid scope flowcharts, then execute one ClosedLoop feature ticket or a parent-approved coherent multi-ticket feature end to end on Codex Desktop or as a leased Codex CLI ticket worker after all readiness, legacy split-lineage, complexity, risk, requirements, batch, and UI guidance gates. Plan, implement, run the required two-pass coordinated review sequence, validate, open and remediate the feature's single PR, maintain the author-owned feature manual-QA plan and evidence, hand passive monitoring to $cl-sweep or a detached standalone monitor, use protected-queue or human UI merge policy, and reconcile every included ticket. In CLI sweeps, the ticket worker may directly manage bounded read-only support lanes and returns compact CL_SWEEP_EVENT v1/CL_SWEEP_RESULT v1 routing summaries./cl-find-related-ticketsInspect the relevant code first to map the implementation blast area, then find ClosedLoop issue tickets related to a product area, behavior, requirement, incident, ticket, or pull request and give a brief evidence-based reason for each match. Use when auditing scope, finding potentially conflicting or missing work across projects and assignees, checking whether a freeze covers every relevant ticket, comparing discoveries with an approved ticket set, or looking for direct changes, dependencies, shared contracts, tests, and open-PR collisions. This is a read-only discovery skill and does not update tickets, comments, statuses, code, or pull requests./cl-policyShared ClosedLoop access and routing policy for local ClosedLoop automation skills. Use when cl-analyze, cl-split, cl-sweep, or cl-execute needs to discover ClosedLoop tools, select a safe MCP/CLI/API access fallback, resolve product contacts or engineering attention contacts, apply comment tagging and first-person communication rules, load local overrides, or interpret legacy personal-name memory fields./cl-splitSplit one top-level high-complexity ClosedLoop feature ticket into smaller executable child tickets when safe. Use when $cl-analyze or $cl-sweep determines a top-level ticket is HIGH complexity but potentially splittable, or when asked to decompose a FEA-* ticket before execution. Keep engineering/split automation details private; recommend a company-visible comment only for a genuine Product decision under cl-policy or when the user explicitly requests the exact comment. Enforce one split level only; do not split existing split children. Do not implement code./cl-sweepReport or coordinate ClosedLoop work assigned to the user in one project. Use read-only report mode for a complete project-wide inventory grouped into product-feature context with dependency and reassignment guidance. For execution, recover active work first, then run each selected complete page or capability as one owner, branch, plan, PR, and manual-QA unit while preserving every ticket's independent readiness and acceptance gates. Supports Codex Desktop and a fail-closed CLI root with durable state, private leases, callbacks, and passive PR monitoring.Other plugins' skills for the same job