richkuo/rk-skills/cli-dispatch
Claude Code and agent skill by richkuo/rk-skills
- community
Checking that the SKILL.md file is still in the repository.
Required dispatch procedure for running a build, fix pass, or validate pass on an external coding CLI — the Codex CLI (`codex exec`) or the Cursor CLI (`agent -p`) — when an issue's Execution block stamps that harness as the Build model or the Validate model. Preflight, the shims, the prompt-as-data rule, the background run and its limits, result parsing, the substitution check, attribution, the snapshot guard, and the failure table. Load BEFORE dispatching any Codex CLI or Cursor CLI build or…
Install
npx vskill@latest install richkuo/rk-skills/cli-dispatchSKILL.md
CLI dispatch
For an issue stamped Build model: <Name> (Codex CLI) or <Name> (Cursor CLI). The caller owns the task prompt and the result. Never fall back to a Claude build. A run on another model is a substitution: always report it and never present it as the stamped build.
1. Preflight
Before writing any file, check only the stamped CLI: command -v codex && codex login status or command -v agent && agent status. A missing binary or signed-out status blocks that issue (name which); the caller runs the rest of the milestone.
2. Model id and effort
Luna (Codex CLI)isgpt-5.6-luna,Astra (Codex CLI)isgpt-6-astra,Grok (Cursor CLI)iscursor-grok-4.6-<effort>. Use an explicit id (Luna (Codex CLI, gpt-5.6-luna)) verbatim. Any other name without an id blocks; never guess an id.- Codex takes
low,medium,high,xhigh,maxas-c model_reasoning_effort=<tier>. Cursor puts the tier in the id suffix; the caller normalizesmaxtoxhighwith a log line. agent --list-models(agentiscursor-agent) prints the ids Cursor accepts; run it when an explicit id looks unfamiliar. A-fastvariant needs an explicit id.- A model id is shell data. Accept only
^[A-Za-z0-9][A-Za-z0-9._:-]*$, else block; single-quote it in the shim.
3. The prompt file
Write it outside the repository (session scratchpad, else mktemp -d). Append a line telling the CLI agent to read work-on-issue (fix pass: fix-pr-review) at the first existing of ~/.codex/skills/<skill>/SKILL.md, ~/.cursor/skills/<skill>/SKILL.md, ~/.claude/skills/<skill>/SKILL.md (write the resolved absolute path yourself), then the section 7 attribution rules, with its footer bullet copied in full: the footer line, its scope of every commit message, PR body, issue body, and comment, the --- line on its own directly above the first footer line, and the fix-pass verbs.
- Build: the task prompt verbatim plus a line: the driver handles every review trigger and cycle, so the CLI agent stops once the PR is open and verified.
- Fix pass: names the PR and review comment, carries the caller's constraints verbatim, and says the CLI agent must not trigger, post, or wait for any re-review and stops after pushing the fixes and posting the disposition comment.
- Never interpolate the prompt into the command line. Codex reads the file on stdin. Cursor reads no stdin: pass
"$(cat "$PROMPT")"as one positional argument, expanded once, with no--before it. Every Cursor prompt file, fix prompts included, starts with the lineTask for the Cursor CLI agent:, so the argument never starts with-.
4. The two shims
Run from the repository root with REPO, PROMPT, RESULT, EVENTS, and STDERR as absolute paths.
- The Cursor shim has no write boundary.
--forceruns any shell command unprompted and--trustaccepts the workspace (a headless run stalls without both);--workspaceand--sandbox enabledlimit nothing. Only the section 8 snapshot diff guards a Cursor build, which holds the driver's full shell rights. - Keep Cursor on
--output-format stream-json;jsonwrites only at the end and trips the stall limit. - Never add
--dangerously-bypass-approvals-and-sandbox,--yolo(use its alias--force), or any flag this section does not name. - Background run and limits. Never run a shim in the foreground. Keep control files in a directory
RUNoutside the repository, beside the prompt file. Write$RUN/launch.sh: setREPO,PROMPT,RESULT,EVENTS,STDERR, andRUNto absolute paths, then:
- Run
bash "$RUN/launch.sh". A retry reruns this launcher and never retakes thebeforesnapshot. If$RUN/exitthen exists, the shim ended: go to section 5. Otherwiseps -o pgid= -p "$(cat "$RUN/pid")"must print the same id; a different id means no limit can end the run, so end what it started and block. Nothing printed and no$RUN/exitis a non-zero exit. - Poll with short calls about every 5 minutes, never back to back, with a bounded wait of at most 5 minutes between (a background sleep or the host's wait tool). When
cat "$EVENTS" "$RESULT" "$STDERR" 2>/dev/null | wc -cdiffers from$RUN/bytes, write it there anddate +%sto$RUN/changed.$RUN/exitmeans ended. Stalled: 30 minutes with no new byte. Cap: 4 hours after$RUN/startfor a build, 2 hours for a fix or validate pass. - On a stall or cap, write the reason to
$RUN/limitand sendkill -TERM -- -"$(cat "$RUN/pid")"; on a poll at least 30 seconds later,kill -KILLthe group whilekill -0 -- -"$(cat "$RUN/pid")"succeeds. A killed run (limit file, no exit file), or a gone group with neither file, is a non-zero exit under section 5, landed-work check first; name any limit in the blocker.
5. Parse the result
Sections 5 and 6 run after every run; a zero exit never skips the result read, the substitution comparison, or the model unverified record.
- Codex:
$RESULTis the final message;$EVENTShas one JSON event per line. Cursor:$RESULThas one JSON event per line; the final text is theresultfield of the lasttyperesultline (none means no final message), and thetypesysteminit line'smodelis the serving model's display name. A model the output names is the record; an output naming none (the usual Codex case) recordsmodel unverified. - A non-zero exit is a failure. Before any retry, check for landed work: build, a
<prefix>/issue-<N>-*remote branch or an open PR closing the issue; fix pass, a head commit newer than the pre-run head or a new disposition comment. Landed work is a completed pass: verify it (section 8) and never re-run. Else retry once with the same inputs; a second failure blocks, quoting the last lines of$STDERR.
6. Substitution check
Compare the output's model with the requested id; compare a Cursor display name with the name agent --list-models prints beside the id (cursor-grok-4.6-low - Grok 4.6 Low). A different model is a substituted work product: adopt it only with the substitution named in the summary, flags, and footer, and never present it as the stamped model's build. No named model: record model unverified beside the requested id.
7. Attribution
- Branch prefix
codex/orcursor/(CLAUDE.md Git Workflow). - PR title bracket
[C<score>, <Name>, <tier>], e.g.[C33, Luna, max]; append, planwhen the caller says a plan stage drove the build (CLAUDE.md PR title convention), never for a failed plan stage. - Footer
Created with LLM: <Name> | <tier> | Harness: CodexorHarness: Cursor, as the final lines of every commit message, PR body, issue body, and comment, with a---line on its own directly above the first footer line (the CLI agent does not load the global CLAUDE.md that defines this shape, and a repo check such as go-trader'spr-metadatafails a commit without the separator, which only a history rewrite can repair); on a fix pass the commit usesUpdated, while a new comment or issue the pass posts usesCreatedper CLAUDE.md.<Name>is the stamped display name, or the output's model after a section 6 substitution.
8. Dispatch hygiene, every caller
- (a) Snapshot diff, every pass. Write this script to
$RUN/snapshot.sh. Before dispatch, runsh "$RUN/snapshot.sh" "$REPO" > "$RUN/before"; after the run ends or is killed, run it to$RUN/afterand readdiff "$RUN/before" "$RUN/after".
- It records every ref and, for every worktree
git worktree list --porcelainlists, itsHEADand branch, porcelain status with untracked and ignored paths, and a content hash (missingwhen the directory is gone); the main checkout skips.claude/worktrees/. It takes no index lock and writes no object. - Flag rules, build or fix pass. Exclude the issue's own worktree and its branch's
refs/heads/andrefs/remotes/origin/refs: build, the worktree whose branch starts with<prefix>/issue-<N>-; fix pass, the one whose branch equals the PR'sheadRefName. Every other changedhead,status, orhashline (main checkout or another worktree) and every changedrefline outsiderefs/remotes/is a stray change: flag it with worktree path and branch, and leave it for the user. A concurrent track's own work looks the same; the flag names the branch and the reader decides. - Note a worktree that appears during the run, with its new branch ref, in the summary without flagging it. Flag a worktree whose lines vanish or turn
missingas removed during the run and not attributable; never drop that flag, and never recreate or prune it. Note any otherrefs/remotes/change in the summary. - Reach. The guard sees the repository, its worktrees, and its refs; an ignored directory such as
node_modules/is one!!line. It cannot see an edit or new file inside an ignored directory, an edit inside an existing ignored file, a write outside the repository, a push, or a GitHub write. - (b) PR check, build only. Verify the PR with
ghas a Claude builder would: number, head ref, head commit. A zero exit with no PR is a blocker; never open a PR for the CLI agent. - (c) Head check, fix pass only. Check
gh pr view <num> --json headRefName,headRefOid; a zero exit with neither a new head commit nor a disposition comment is a blocker. - (d) Review cycles, build and fix pass. The driver owns every read and write of GitHub review state (the standing review, the stop decision, the cycle-1 trigger and every re-trigger the caller's routing selects, the Actions run, the verdict) and forwards each fix pass to the same shim with the section 3 fix-pass file. The CLI agent runs
fix-pr-reviewthrough its disposition comment and never posts a trigger; when the caller forbids re-triggering (subagent review mode), the driver posts nothing.
Failure modes
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/cli-dispatch/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/richkuo/rk-skills/cli-dispatch)