cp-run

A command that sends a development task to a GitHub Copilot worker, an AI coding assistant that can work from the command line.

In plain words
What is it for?
Delegating repository tasks that may require file changes, using an isolated Git worktree. It also supports monitoring the worker through a small status file.
Why use it?
It lets a separate Copilot session handle a task while progress is recorded and can be monitored or resumed.

Command

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/rbinar/cli-dispatch/cp-run
Clone the repo
git clone --depth 1 https://github.com/rbinar/cli-dispatch
Per session 10 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 963 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00010 $0.00963
Opus 5 $0.00005 $0.00481
Sonnet 5 $0.00002 $0.00193
Haiku 4.5 $0.00001 $0.00096

Measured yesterday against content hash c43058f9d918, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

cp-run scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

plugins/cli-dispatch/commands/cp-run.md · 76 lines

What it actually says

Delegate a task to the GitHub Copilot worker

Task to delegate: $ARGUMENTS

The task runs via cp-stream — it pipes copilot -p ... --output-format json stdout through cp-stream-parse.mjs for live progress + a rolling status.json, writing the same session directory layout the other backends use → live, observable, resumable. Monitor progress in a cost-conscious way: read only the small status.json, never the raw transcript. The session id is the copilot session id (relocated into place once known, printed on stderr).

Prerequisite: cp-agent / cp-stream installed (/cli-dispatch:setup, GitHub Copilot backend), the copilot CLI installed/authenticated, and an active GitHub Copilot subscription. Auth is COPILOT_GITHUB_TOKEN > GH_TOKEN > GITHUB_TOKEN; cli-dispatch automatically reuses the host gh auth token as GH_TOKEN when available.

If it's a real repo task (file changes needed) — isolate in a git worktree:

  1. Use the bundled helper, which creates the worktree off origin/main, symlinks every node_modules dir of the source checkout (root + workspace packages, resolved from the repo top even when <repo-path> is a subdirectory), runs cp-stream in it, and prints the cleanup command:
    "${CLAUDE_PLUGIN_ROOT}/scripts/cp-worktree-run.sh" <repo-path> cp-run-<branch-name> <brief-file>
    
    Or run it by hand:
    WORKTREE=$(mktemp -d)
    git worktree add "$WORKTREE" -b cp-run-<branch-name> origin/main
    cp-agent --cwd "$WORKTREE" --max-runtime 600 "$ARGUMENTS"
    
  2. Monitor (cost-conscious): capture the session id from stderr, then check progress via /cli-dispatch:watch <session-id> (state: running→done). Do NOT tight-loop tail.
  3. When done, review the diff (git -C "$WORKTREE" diff), verify independently (build/test).
  4. If all good, you handle git/commit/push/PR/merge; then clean up the worktree.

If it's pure generation (code/text, no files) — as a background task:

cp-agent -q "$ARGUMENTS"   # stdout = final answer only; progress in status.json/progress.log

No sandbox — read this before trusting the output unattended: --allow-all-tools --no-ask-user (always passed by cp-stream) auto-approves tools and prevents interactive questions — a functional requirement for headless use, not a safety opt-in. GitHub Copilot has no OS-level or tool-level write-deny at all, unlike Codex's real kernel-enforced --read-only. There is no --sandbox flag here to reach for. Isolation via a git worktree + your own diff review is the ONLY safety boundary.

Model selection:

cp-agent --model gpt-5.4 -q "$ARGUMENTS"

Pass the Copilot model slug directly (examples: gpt-5.4, auto). Omit --model to use GitHub Copilot's own default (or the CP_MODEL config value). Current model list is only visible interactively via /model in the copilot TUI (auth required) or GitHub Copilot docs — slugs change over time.

Reasoning effort:

cp-agent --effort high -q "$ARGUMENTS"

--effort low|medium|high maps to Copilot's --reasoning-effort=<level> flag.

Follow-up / fix (continue the same GitHub Copilot session):

cp-agent --resume <session-id> "<follow-up>"

This passes --resume <id> to copilot.

To see all sessions (all backends), use /cli-dispatch:sessions.

The worker = GitHub Copilot; you = reviewer/merge owner. Don't trust the output until verified.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 76 lines · 10 tokens per session scan A c43058f9d918

Subscribe to this mod's changes

cp-run is a command published in the GitHub repository rbinar/cli-dispatch (5 stars, last pushed 13d ago), licensed MIT. It adds 10 tokens to every session and 963 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.