Provides a multi-model CLI orchestration layer for parallelizing AI reviews and cross-examinations using Codex, Gemini, and Claude.
- GitHub stars
- 21
- Files
- 13
- Last commit
- Nov 5, 2026
- License
- MIT
- Allowed tools
- —
What does the dispatch skill do?
dispatch provides a multi-model CLI orchestration layer for parallelizing AI reviews and cross-examinations using Codex, Gemini, and Claude.
Summary generated from the skill's SKILL.md.
About the dispatch skill
Developers building automated code review workflows can use this infrastructure to orchestrate parallel AI evaluations across multiple models. It serves as the underlying engine for the adv-review agent, managing the execution of Codex, Gemini, and Claude through a unified command-line interface. By utilizing specialized scripts like preflight.sh and run-phase.sh, the system can resolve git scopes—ranging from specific commit ranges to full repository manifests—and dispatch tasks to different models simultaneously.
The system handles complex workflows such as parallel review phases where different models are assigned to specific tasks like quality or documentation, and cross-examination phases where models debate findings. It includes built-in resilience through fallback logic, automatically switching to alternative models if quota limits are reached or errors occur. The infrastructure produces structured JSON outputs containing token usage, model identities, and execution durations, ensuring that orchestrators can track the performance and cost of multi-model operations.
What an agent can do with it
- 1Parallelize multi-model code reviewsAssign different AI models to specific review tasks like testing or implementation to run them all at once.
- 2Perform AI cross-examinationsRun a second round of analysis where multiple engines evaluate each other's findings to reach a verdict.
- 3Resolve git repository scopesIdentify exactly which files or commits should be analyzed, including uncommitted changes or specific pull requests.
- 4Automate model fallback on errorsEnsure review processes continue even if a primary model hits a quota limit by automatically switching to a fallback model.
Written from the skill's SKILL.md. Every use case is checked against a quote from it.
How to install the dispatch skill
Each command copies the skill folder into the client's skills directory. Restart the client or start a new session to load it.Install the dispatch skill in Plugin
/plugin marketplace add andisab/swe-marketplace /plugin install adv@swe-marketplace
Install the dispatch skill in Claude Code
~/.claude/skills/dispatch/SKILL.md
$ npx degit andisab/swe-marketplace/plugins/adv/skills/dispatch ~/.claude/skills/dispatchInstall the dispatch skill in Claude Code (project)
.claude/skills/dispatch/SKILL.md
$ npx degit andisab/swe-marketplace/plugins/adv/skills/dispatch .claude/skills/dispatchInstall the dispatch skill in Codex
~/.agents/skills/dispatch/SKILL.md
$ npx degit andisab/swe-marketplace/plugins/adv/skills/dispatch ~/.agents/skills/dispatchInstall the dispatch skill in Gemini CLI
~/.gemini/skills/dispatch/SKILL.md
$ npx degit andisab/swe-marketplace/plugins/adv/skills/dispatch ~/.gemini/skills/dispatchInstall the dispatch skill in Claude.ai
npx degit andisab/swe-marketplace/plugins/adv/skills/dispatch dispatch && zip -r dispatch.zip dispatch # claude.ai → Customize → Skills → + → Create skill → Upload a skill → dispatch.zip
Automated checks
Ran Nov 14, 2026Full report →Passed our automated checks. That is not a security audit: read the scripts before you let an agent run them. How checks work · What to fix for more points
- Source repository linked and reachableandisab/swe-marketplace/plugins/adv/skills/dispatch is public and reachablegithub.com/andisab/swe-marketplace/tree/HEAD/plugins/adv/ski ↗Pass
- Open source license (OSI)MITspdx.org/licenses/MIT.html ↗Pass
- Commit or release in the last yearLast commit 2026-11-05github.com/andisab/swe-marketplace/commits ↗Pass
- No download-and-run or credential theft in scripts5 scripts read; no download-and-run, remote eval, base64 execution or credential uploadPass
- No hidden instructions in SKILL.mdNo override phrases, safeguard switches, credential requests or hidden charactersgithub.com/andisab/swe-marketplace/blob/HEAD/plugins/adv/ski ↗Pass
- Pre-approved tools are scopedNo pre-approved tools; the agent asks before using onegithub.com/andisab/swe-marketplace/blob/HEAD/plugins/adv/ski ↗Pass
- SKILL.md follows the Agent Skills formatthe description does not say when to use the skillgithub.com/andisab/swe-marketplace/blob/HEAD/plugins/adv/ski ↗Finding
SKILL.md
View on GitHubDispatch Infrastructure
This skill provides shared infrastructure for multi-model CLI dispatch. It is NOT user-invocable — it exists as reference material for the adv-review orchestrator agent and the adv-* commands.
Available Engines
| Engine | CLI | Non-Interactive Flags | Sandbox Flag |
|---|---|---|---|
| codex | codex exec |
--skip-git-repo-check -C <cwd> --json (--full-auto was removed in Codex CLI 0.163) |
-s read-only |
codex (--codex-review) |
codex review |
-c model="..." when a model is set; run from <cwd> (no -C, -m or --json in 0.163); the prompt names the git scope, because the scope flags can't be combined with a prompt |
-c sandbox_mode="read-only" |
| gemini | gemini |
-p <prompt> --skip-trust -o json (--skip-trust is required for headless runs since Gemini CLI 0.65) |
--approval-mode plan (read-only; --sandbox broke API calls on macOS in 0.65) |
| claude | claude |
--print --output-format json |
N/A (always sandboxed) |
No model flag is passed unless the caller sets one. Each CLI then uses its own current default. Every engine is asked for JSON, which is where the text, the model that answered and the token counts live: Codex exec --json prints JSONL events (item.completed with agent_message text or error warnings, turn.completed with usage; no event names the model, so the status line reports the --model argument or the pin in ~/.codex/config.toml), Gemini -o json prints one object (response, stats.models keyed by the model that answered, warnings, error), and claude --output-format json prints one object (result, is_error, usage, modelUsage). codex review prints a text report, which codex-review-adapter.py turns into adv's finding format. Tested with Codex CLI 0.163.0 and Gemini CLI 0.65.0 (October 2026).
Scripts
preflight.sh
Path: ${CLAUDE_PLUGIN_ROOT}/skills/dispatch/scripts/preflight.sh
Combined pre-flight check: dependency verification, engine health checks, and scope resolution in a single call.
# Smart default (uncommitted changes > last commit > full repo)
bash preflight.sh
# Explicit scope modes
bash preflight.sh --commits abc123..def456
bash preflight.sh --since HEAD~5
bash preflight.sh --full
bash preflight.sh --pr 42
Arguments:
--commits <range>— Review a specific commit range.--since <ref>— Review changes since a commit/ref.--full— Full repo file manifest.--pr <number|url>— Review a GitHub pull request's diff, read withgh pr diff; nothing is checked out. Needs theghCLI.- (no flags) — Smart default: uncommitted changes > last commit > full repo.
Output: Single JSON object to stdout:
{
"deps": {"codex": true, "gemini": true, "claude": true, "jq": true},
"engines": {
"codex": {"available": true, "error_type": "none"},
"gemini": {"available": true, "error_type": "none", "model": ""}
},
"scope": {
"type": "working",
"files_changed": 5,
"diff_lines": 120,
"untracked_files": 2,
"codex_review": "Review the uncommitted changes in this repository. Run `git diff HEAD` ...",
"pr": null,
"content_file": ".claude/reviews/.tmp/scope-content.txt"
}
}
Scope types: working (uncommitted changes), commits (commit range/since), full (file manifest), pr (a pull request's diff; scope.pr carries number, baseRefName, headRefName, headRefOid and url).
scope.codex_review is the sentence that names a local diff scope for Codex's review mode (see run-phase --codex-review). It's empty for full and pr, where Codex can't read the scope from the repository on disk.
Internally calls dispatch.sh --health-check for engine verification, including automatic Gemini flash fallback on quota errors.
run-phase.sh
Path: ${CLAUDE_PLUGIN_ROOT}/skills/dispatch/scripts/run-phase.sh
Parallel dispatch orchestrator for review and cross-examination phases. Handles dispatch, validation, and fallback in a single call.
# Review phase — dispatch 4 reviewers in parallel
bash run-phase.sh --phase review \
--assignments "quality:codex,implementation:gemini,testing:codex,documentation:gemini" \
--prompt-dir "$TMP" --output-dir "$TMP" --timeout 300
# Cross-exam phase — dispatch 2 engines in parallel
bash run-phase.sh --phase cross-exam --round 1 \
--assignments "codex,gemini" \
--prompt-dir "$TMP" --output-dir "$TMP" --timeout 300
Arguments:
--phase <review|cross-exam>— Required. Phase type.--assignments <spec>— Required. Engine assignments.- Review:
"quality:codex,implementation:gemini,testing:codex,documentation:gemini" - Cross-exam:
"codex,gemini"(just engine names)
- Review:
--prompt-dir <path>— Directory containing prepared prompt files.--output-dir <path>— Directory for output files.--timeout <seconds>— Timeout per dispatch (default: 300).--round <N>— Cross-exam round number (required for cross-exam phase).--gemini-model <model>— Override the Gemini model. By default no model is passed and the CLI uses its own current default.--codex-review <scope>— Review phase only. Runs the Codex reviewers throughcodex reviewinstead ofcodex exec.<scope>is preflight'sscope.codex_reviewsentence; run-phase writesprompt-<reviewer>.codex-review.mdfrom the reviewer template with that sentence in place of the diff, and Codex reads the changes from the repository itself. A Codex reviewer that falls back to Claude usesprompt-<reviewer>.md(the diff) instead.
File naming conventions:
- Review prompts:
prompt-<reviewer>.md(e.g.,prompt-quality.md); Codex review mode addsprompt-<reviewer>.codex-review.md - Review findings:
findings-<reviewer>.md(e.g.,findings-quality.md) - Dispatch status lines:
status-<reviewer>.jsonandstatus-xr<N>-<engine>.json - Cross-exam prompts:
prompt-xr<N>.md(e.g.,prompt-xr1.md) - Cross-exam results:
xr<N>-<engine>.md(e.g.,xr1-codex.md,xr1-gemini.md)
Output: one JSON summary line on stdout (the dispatch status lines go to the status files):
{
"phase": "review",
"results": {
"quality": {"engine": "codex", "status": "success", "fallback_used": false, "model_used": "gpt-6.1-sol", "tokens_in": 18200, "tokens_out": 1900, "duration_ms": 41000}
},
"success_count": 4,
"failed": [],
"tokens": {"in": 61000, "out": 7400}
}
Cross-exam output has the same per-engine fields plus verdict counts:
{
"phase": "cross-exam",
"round": 1,
"results": {"codex": {"status": "success", "model_used": "gpt-6.1-sol", "tokens_in": 22000, "tokens_out": 2100, "duration_ms": 50000}},
"tokens": {"in": 44000, "out": 4000},
"verdicts": {"validate": 8, "dispute": 2, "amend": 1, "new_findings": 0}
}
Fallback logic (review phase only):
- If Gemini dispatch fails with quota or the model isn't found, retries with the fallback model (
ADV_GEMINI_FALLBACK_MODEL, defaultgemini-3-flash-preview) - If still failed, falls back to Claude
- Final status reported in JSON output
dispatch.sh
Path: ${CLAUDE_PLUGIN_ROOT}/skills/dispatch/scripts/dispatch.sh
Core single-model CLI dispatcher. Called internally by preflight.sh and run-phase.sh, and directly by the /adv-codex, /adv-gemini, /adv-gemini-research commands.
# Basic dispatch
bash dispatch.sh --engine codex --prompt "Review this code" --cwd /path/to/repo
# With output file and prompt file
bash dispatch.sh --engine gemini --prompt-file /path/to/prompt.md --output-file /tmp/findings.md
# Research mode (Gemini only)
bash dispatch.sh --engine gemini --research --prompt "Latest TypeScript best practices"
# Codex review mode: the prompt names the git scope, Codex reads the repository at --cwd
bash dispatch.sh --engine codex --codex-review --cwd . --prompt-file prompt-quality.codex-review.md
# Check prerequisites
bash dispatch.sh --check-deps
# Health check
bash dispatch.sh --engine codex --health-check
Arguments:
--engine <codex|gemini|claude>— Required. Target engine.--prompt <string>— The prompt text. Mutually exclusive with--prompt-file.--prompt-file <path>— Read prompt from a file.--model <model>— Model for the engine. Default: none passed, so the CLI uses its own current default;ADV_CODEX_MODEL,ADV_GEMINI_MODELandADV_CLAUDE_MODELset a default per engine.--cwd <path>— Working directory for the CLI (default: current dir).--timeout <seconds>— Max execution time (default: 300).--output-file <path>— Write response to this file.--research— Gemini only: enable grounded search.--codex-review— Codex only: runcodex reviewinstead ofcodex exec. The prompt must name the git scope (Codex's own scope flags can't be combined with a prompt). The report is rewritten bycodex-review-adapter.pyinto adv's finding blocks: paths made relative to--cwd, Codex priorities P0–P2 mapped to 🔴 Bug and P3 to 🟡 Nit, the original priority kept in the Severity line.--check-deps— Check for required CLIs and exit with report.--health-check— Quick ping to verify engine is responsive (60s timeout, minimal prompt; for Gemini, a REST probe first).
Exit Codes (classified by error type):
| Code | Meaning | Orchestrator Action |
|---|---|---|
| 0 | Success | Use response |
| 1 | General error | Log and fall back to Claude |
| 2 | Auth failure | Mark engine unavailable, fall back |
| 3 | Quota exhausted | Try the Gemini fallback model (gemini-3-flash-preview unless ADV_GEMINI_FALLBACK_MODEL is set), then fall back to Claude |
| 6 | Model not found | Same fallback as quota |
| 4 | Timeout | Mark engine unavailable, fall back |
| 5 | Empty/invalid response | Retry once, then fall back |
Output Contract:
- Response text (markdown) is written to
--output-fileif specified. - On failure, the output file contains
DISPATCH_ERROR: engine=<e> exit_code=<n> duration_ms=<ms>so the orchestrator can detect failures by reading the file. - A JSON status line is printed to stdout:
{"engine":"codex","success":true,"output_file":"/path","duration_ms":12345,"exit_code":0,"error_type":"none","model":"engine_default","model_used":"gpt-6.1-sol","tokens_in":18200,"tokens_out":1900}.modelis what was requested;model_usedis what answered (Gemini's auto mode routes per call, andclaudereports the full model id). Tokens are 0 forcodex review, whose text report has no usage. - Stderr is logged to
.claude/reviews/.tmp/dispatch.log, along with the config warnings and errors the JSON carries
API Key Resolution (Gemini):
- Checks
GOOGLE_API_KEYenv var - Falls back to
GEMINI_API_KEYenv var - If neither set and
op+~/.envavailable, wraps Gemini calls withop run --env-fileto inject from 1Password
codex-review-adapter.py
Path: ${CLAUDE_PLUGIN_ROOT}/skills/dispatch/scripts/codex-review-adapter.py
Reads a codex review report on stdin and writes adv finding blocks (### Finding: with File, Severity, Title, Description). --root <dir> makes the absolute paths relative. A report with no - [P<n>] comments (such as No findings.) passes through unchanged. dispatch.sh --codex-review runs it; it has no other caller.
scope.sh
Path: ${CLAUDE_PLUGIN_ROOT}/skills/dispatch/scripts/scope.sh
Standalone git scope resolver. Used by the ad-hoc commands. The orchestrator uses preflight.sh instead (which includes scope resolution).
# Smart default (uncommitted changes > last commit > full repo)
bash scope.sh
# Explicit modes
bash scope.sh --commits abc123..def456
bash scope.sh --since HEAD~5
bash scope.sh --full
Output: JSON to stdout with scope type and artifact paths.
Prompts
Reviewer prompt templates are in ${CLAUDE_PLUGIN_ROOT}/skills/dispatch/prompts/:
| File | Reviewer | Engine |
|---|---|---|
reviewer-quality.md |
Code quality | Codex |
reviewer-implementation.md |
Implementation correctness | Gemini |
reviewer-testing.md |
Test coverage | Codex |
reviewer-simplification.md |
Simplification opportunities | Claude |
reviewer-documentation.md |
Documentation completeness | Gemini |
cross-examine.md |
Cross-examination template | All |
synthesize.md |
Final synthesis template | Orchestrator |
Each reviewer prompt contains a {SCOPE_CONTENT} placeholder that the orchestrator replaces with the actual scope content (diff or manifest) before dispatch.
Files in this skill
13dispatch skill questions
How do I install the dispatch skill in Claude Code?
Run npx degit andisab/swe-marketplace/plugins/adv/skills/dispatch ~/.claude/skills/dispatch. Claude Code loads skills from ~/.claude/skills (all projects) or .claude/skills (one project) and uses a skill when its description matches the task.
Which clients can use the dispatch skill?
Any client that reads the Agent Skills format: Claude Code, Codex, Gemini CLI and claude.ai (upload as a ZIP). Scripts in the skill run only where the client allows code execution.
What engines does the dispatch infrastructure support?
It supports Codex, Gemini, and Claude engines for executing prompts and reviews.
How does the system handle Gemini quota or model errors?
It first attempts to retry using a fallback model (defaulting to gemini-3-flash-preview) and if that fails, it falls back to Claude.
Can I review a specific GitHub pull request using preflight.sh?
Yes, you can use the --pr flag followed by a pull request number or URL, provided the gh CLI is installed.