cx-run

A command that sends a task to an OpenAI Codex command-line worker and streams its progress.

In plain words
What is it for?
Use it for repository work, ideally in a separate Git worktree, when Codex is installed and signed in or an API key is configured.
Why use it?
It lets longer coding tasks run in a separate, observable, resumable session instead of blocking the current one.

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/cx-run
Clone the repo
git clone --depth 1 https://github.com/rbinar/cli-dispatch
Per session 15 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,330 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.00015 $0.01330
Opus 5 $0.00008 $0.00665
Sonnet 5 $0.00003 $0.00266
Haiku 4.5 $0.00002 $0.00133

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

Security

Grade A, and why

cx-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/cx-run.md · 91 lines

How it starts

The opening of the file, as written. The whole thing — 91 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Delegate a task to the Codex worker

Task to delegate: $ARGUMENTS

The task runs via cx-stream — it pipes codex exec --json stdout through cx-stream-parse.mjs for live progress + a rolling status.json, writing the same session directory layout the DeepSeek and Antigravity 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 codex thread-id (printed on stderr after the run completes).

Prerequisite: cx-agent / cx-stream installed (/cli-dispatch:setup, Codex backend) and codex signed in (codex login) or CODEX_API_KEY set.

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

  1. Open a worktree off origin/main (or the base stated in the task):

    WORKTREE=$(mktemp -d)
    git worktree add "$WORKTREE" -b cx-run-<branch-name> origin/main
    
  2. Run the worker (as a background task) inside the worktree:

    cx-agent --cwd "$WORKTREE" --max-runtime 600 "$ARGUMENTS"
    

    The sandbox defaults to workspace-write so file edits land in the worktree. Add --sandbox read-only or --sandbox danger-full-access (valid values: read-only | workspace-write | danger-full-access) as needed.

    Network access inside workspace-write defaults ON (matching the other backends, which have no sandbox and thus full network). Pass --no-network (or set CX_NETWORK=0 in the config) for a no-egress run. --read-only stays no-network regardless of this flag. Or 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 cx-stream in it, and prints the cleanup command:

    "${CLAUDE_PLUGIN_ROOT}/scripts/cx-worktree-run.sh" <repo-path> cx-run-<branch-name> <brief-file>
    # Windows: run this under bash (WSL or Git Bash). The PowerShell twin was removed in 4.6.0
    # (issue #125) — nothing selected it and cli-dispatch-run.ps1 requires bash for worktree runs.
    
  3. Monitor (cost-conscious): capture the thread-id from stderr, then check progress via /cli-dispatch:watch <thread-id> (state: running→done). Do NOT tight-loop tail.

  4. When done, review the diff (git -C "$WORKTREE" diff), verify independently (build/test).

  5. If all good, you handle git/commit/push/PR/merge; then clean up the worktree.

If it's pure generation (code/text, no files) — the Codex backend's headline feature:

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

Real OS-level read-only sandbox: unlike DeepSeek (tool-layer restriction) and Antigravity (no write-deny at all), --read-only passes -s read-only to codex, which activates macOS Seatbelt / Linux bwrap+seccomp — a kernel-enforced hard-block on all file writes. Use it freely for analysis tasks; no worktree needed for a genuine no-writes guarantee.

Model selection:

cx-agent --model gpt-5.4-mini --read-only -q "$ARGUMENTS"

Omit --model to use codex's own default (or the CX_MODEL config value). Current Codex models (--model <name>), top priority first: gpt-5.6-sol (latest frontier agentic coding), gpt-5.6-terra (balanced agentic coding for everyday work), gpt-5.6-luna (fast/affordable — lighter tasks & subagents). Still available but no longer top-priority: gpt-5.5, gpt-5.4, gpt-5.4-mini (fast/cheap alternative to gpt-5.6-luna), gpt-5.3-codex-spark (ultra-fast coding model). gpt-5.2 / gpt-5.3-codex have been removed from the catalog entirely. List live with /model inside codex; names move fast, so trust codex's picker over this list.

Reasoning effort:

cx-agent --effort high --model gpt-5.4-mini --read-only -q "$ARGUMENTS"

--effort low|medium|high maps directly to Codex's model_reasoning_effort config override (passed as -c model_reasoning_effort=<effort>).

Read the full file on GitHub · 91 lines

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 · 91 lines · 15 tokens per session scan A d4668b83ebea

Subscribe to this mod's changes

cx-run is a command published in the GitHub repository rbinar/cli-dispatch (5 stars, last pushed 14d ago), licensed MIT. It adds 15 tokens to every session and 1,330 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.