ag-run

A command that sends a coding task to an Antigravity worker, an external AI coding process based on Gemini. It can stream progress and use a separate Git worktree, which is an isolated copy of the repository for changes.

In plain words
What is it for?
Use it to delegate repository work, monitor the worker's status, and resume or inspect the task through its saved session.
Why use it?
It lets another coding worker handle a task while keeping its files and progress separate from the main working directory.

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/ag-run
Clone the repo
git clone --depth 1 https://github.com/rbinar/cli-dispatch
Per session 14 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,166 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.00014 $0.01166
Opus 5 $0.00007 $0.00583
Sonnet 5 $0.00003 $0.00233
Haiku 4.5 $0.00001 $0.00117

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

Security

Grade A, and why

ag-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/ag-run.md · 89 lines

How it starts

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

Delegate a task to the Antigravity worker

Task to delegate: $ARGUMENTS

The task runs via ag-stream — it launches agy under a pseudo-TTY (agy has no reliable stdout stream) and tails agy's on-disk JSONL transcript, writing the same session directory layout the DeepSeek backend uses → 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 agy conversation-id (printed on stderr).

Prerequisite: ag-agent / ag-stream installed (/cli-dispatch:setup, Antigravity backend) and agy signed in (run agy once) or GEMINI_API_KEY set.

If it's a real repo task (file changes needed) — isolate in a git worktree (this also avoids agy's per-workspace conversation-id race):

  1. Open a worktree off origin/main — either git worktree add by hand, or the bundled helper (creates the worktree, runs ag-stream in it, prints the cleanup command):

    "${CLAUDE_PLUGIN_ROOT}/scripts/ag-worktree-run.sh" <repo-path> ag-run-<branch-name> <brief-file>
    
  2. Run it (as a background task), pointing the worker at the worktree:

    ag-agent --cwd <worktree> --max-runtime 600 "$ARGUMENTS"
    

    --cwd is registered as agy's active workspace (via --add-dir) so files land there, not in agy's own scratch dir.

    Timeout caveat: agy spawns detached workers, so --max-runtime is enforced via agy's own --print-timeout (a per-model-wait cap; total wall-time can exceed it) with only a best-effort watchdog backstop — it is NOT a hard wall-clock kill like the DeepSeek backend. For a strict bound, wrap the call in timeout(1) yourself.

  3. Monitor (cost-conscious): occasionally check status.json via /cli-dispatch:watch <conv-id> (state: running→done). Do NOT tight-loop tail.

  4. When done, review the diff in the worktree (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) — as a background task:

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

No read-only mode: unlike DeepSeek (which hard-restricts tools to Read/Grep/Glob), agy has no tool-level write-deny (--sandbox restricts the terminal, not file writes — tested), so --read-only is rejected. For a no-writes guarantee, isolate in a throwaway/worktree --cwd and review the diff (the review step is your real safety boundary anyway).

Model selection:

ag-agent --model "gemini-3.6-flash-high" -q "$ARGUMENTS"    # or "Gemini 3.6 Flash (High)"

agy accepts either the slug agy models prints or the equivalent display name — both name the same model, and both must carry the reasoning effort (-high / (High)). List live models with:

agy models

agy models prints slugs as of agy 1.1.8 and display names before that; ag-stream compares the two by ignoring case and punctuation, so a config written in either format keeps working across an agy upgrade.

An unrecognized name doesn't hard-error: ag-stream only prints a stderr WARNING and agy silently falls back to its own default, so a typo quietly runs the wrong model. Omit --model to use agy's own default (or the AG_MODEL config value).

Reasoning effort:

ag-agent --effort low "$ARGUMENTS"

--effort low|medium|high attaches the effort to the model name for you, in whichever format you passed (--model "Gemini 3.5 Flash" --effort low"Gemini 3.5 Flash (Low)"; --model gemini-3.6-flash --effort lowgemini-3.6-flash-low). If --model is omitted, ag-stream picks the first agy models entry at that effort, in either listing format.

Follow-up / fix (continue the same agy conversation):

ag-agent --resume <conv-id> "<follow-up>"

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

Read the full file on GitHub · 89 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 · 89 lines · 14 tokens per session scan A c453670f6e0e

Subscribe to this mod's changes

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