/external-tools
Delegate implementation and review tasks to external AI CLI tools (Codex, Gemini) with cross-model adversarial review
Claude Code
$ npx -y skills add dsifry/metaswarm --skill external-tools --agent claude-code
Codex
$ npx skills add dsifry/metaswarm --skill external-tools -a codex -y
Cursor
$ npx skills add dsifry/metaswarm --skill external-tools -a cursor -y
Gemini CLI
$ npx skills add dsifry/metaswarm --skill external-tools -a gemini-cli -y
GitHub Copilot
$ npx skills add dsifry/metaswarm --skill external-tools -a github-copilot -y
OpenCode
$ npx skills add dsifry/metaswarm --skill external-tools -a opencode -y
Windsurf
$ npx skills add dsifry/metaswarm --skill external-tools -a windsurf -y
SKILL.md
external-tools.SKILL.mdname: external-tools
description: Delegate implementation and review tasks to external AI CLI tools (Codex, Gemini) with cross-model adversarial review
auto_activate: false
triggers:
- "use external tools"
- "delegate to codex"
- "delegate to gemini"
- "cross-model review"
External Tools Skill
Purpose
This skill delegates implementation and review tasks to external AI CLI tools (OpenAI Codex CLI, Google Gemini CLI), enabling cost savings through cheaper models and cross-model adversarial review that eliminates single-model blind spots. Three core principles govern every interaction: **one job per invocation** (an external tool implements OR reviews, never self-validates), **minimal permissions** (sandboxed execution scoped to the task's working directory with only the tool's own API key), and **the orchestrator verifies independently** (external tools report facts only, the orchestrator judges pass/fail).
---
Prerequisites
Required Tools
| Tool | Install | Auth | |------|---------|------| | OpenAI Codex CLI | `npm i -g @openai/codex` | API key or ChatGPT subscription | | Google Gemini CLI | `npm i -g @google/gemini-cli` | Google login (free 1K req/day) or API key |
Neither tool is strictly required. The skill adapts based on what is available (see Escalation Model below).
Configuration
Per-project config at `.metaswarm/external-tools.yaml` (optional -- if absent, external tools are not used):
adapters:
codex:
enabled: true
timeout_seconds: 300
sandbox: docker # docker | platform | none
gemini:
enabled: true
timeout_seconds: 300
sandbox: docker
routing:
default_implementer: "cheapest-available"
escalation_order: ["codex", "gemini", "claude"]
budget:
per_task_usd: 2.00 # circuit breaker per task
per_session_usd: 20.00 # circuit breaker per sessionModels are not set here. Set them per role in `.metaswarm/models.yaml` under `roles.<role>.codex` or `roles.<role>.gemini`, and pass `--role <role>` to the adapter. The model resolves in this order: `.metaswarm/models.yaml`, then the adapter's built-in default (`gpt-5.3-codex` for Codex, `pro` for Gemini). A legacy `adapters.<tool>.model` in this file is no longer read (removed in 0.14.0); the adapter warns on stderr if one is still present.
Fallback Behavior
- **Both tools available**: Full cross-model delegation and review
- **One tool available**: Reduced chain with mutual review between the tool and Claude
- **No tools available**: Existing metaswarm behavior unchanged; skill is a no-op
---
Quick Reference
Health Check
# Check if Codex is installed, authenticated, and reachable
adapters/codex.sh health
# Check Gemini, reporting the model for the coder role
adapters/gemini.sh health --role coder
Returns JSON with `status: "ready|degraded|unavailable"`. `--role <role>` (also accepted by `implement` and `review`) selects the model from `.metaswarm/models.yaml` `roles.<role>.<tool>`; an unknown role exits non-zero. Without `--role`, the output keys are unchanged and `model` is the built-in default. A legacy `adapters.<tool>.model` is no longer read (removed in 0.14.0), only warned about. The resolved model is passed to the CLI (`codex exec -m`, `gemini --model`). If `metaswarm-agents.sh` cannot be found, `--role` is ignored with a warning.
Implement
adapters/codex.sh implement \
--worktree "/tmp/ext-codex-task-42" \
--prompt-file "/private/tmp/xt-abc123/prompt.md" \
--role coder \
--attempt 1 \
--timeout 300
Review
adapters/gemini.sh review \
--worktree "/tmp/ext-codex-task-42" \
--rubric-file "./rubrics/external-tool-review-rubric.md" \
--spec-file "/private/tmp/xt-abc123/spec.md" \
--role adversarial-reviewer \
--timeout 300
All commands return a uniform JSON envelope with facts only (exit code, files changed, cost, duration). The orchestrator interprets results -- adapters never self-judge.
---
Workflow: Routing & Dispatch
Phase 0: Tool Discovery (Health Checks)
Before dispatching any task, the orchestrator runs health checks to determine which tools are available:
# Run health checks for all configured adapters
for adapter in adapters/*.sh; do
result=$("$adapter" health)
# Parse status: ready | degraded | unavailable
doneHealth is checked **per task dispatch**, not just at session start. Auth tokens can expire mid-session, network conditions change, and rate limits reset. A tool that was `ready` five minutes ago may now be `unavailable`.
Build the available tools list:
available_tools = [t for t in adapters if t.health() == "ready"]
Phase 1: IMPLEMENT (External Tool or Claude)
If an external tool is selected as implementer:
1. **Create worktree** -- `git worktree add "$WORKTREE_PATH" -b "external/$TOOL/$TASK_ID"` for isolation 2. **Package context** -- Gather relevant files, spec, acceptance criteria into a prompt file in a secure temp dir (mode 700, trap cleanup). Token-budget the context to fit the model's window. 3. **Invoke** -- `safe_invoke()` with timeout wrapper; capture JSON output 4. **Scope check** -- Verify all file changes are within the declared file scope; revert any out-of-scope changes 5. **Capture output** -- Facts only: exit code, files changed, diff stats, cost, duration
If Claude is selected (escalation or no external tools), use the existing `Task()` mechanism with role type `roleType("coder")` (adversarial review uses `roleType("adversarial-reviewer")`). Role types are resolved per [Role type resolution](../start/guides/agent-coordination.md#role-type-resolution).
Phase 2: VALIDATE (Always Orchestrator -- Unchanged)
The orchestrator independently runs all quality gates:
- `npm test` / `npx vitest run`
- `npx tsc --noEmit`
- `npx eslint <changed-files>`
- Coverage enforcement via `.coverage-thresholds.json`
- File scope verification via `git diff --name-only`
This
Read more
name: external-tools description: Delegate implementation and review tasks to external AI CLI tools (Codex, Gemini) with cross-model adversarial review auto_activate: false triggers: - "use external tools" - "delegate to codex" - "delegate to gemini" - "cross-model review"
External Tools Skill
Purpose
This skill delegates implementation and review tasks to external AI CLI tools (OpenAI Codex CLI, Google Gemini CLI), enabling cost savings through cheaper models and cross-model adversarial review that eliminates single-model blind spots. Three core principles govern every interaction: **one job per invocation** (an external tool implements OR reviews, never self-validates), **minimal permissions** (sandboxed execution scoped to the task's working directory with only the tool's own API key), and **the orchestrator verifies independently** (external tools report facts only, the orchestrator judges pass/fail).
---
Prerequisites
Required Tools
| Tool | Install | Auth | |------|---------|------| | OpenAI Codex CLI | `npm i -g @openai/codex` | API key or ChatGPT subscription | | Google Gemini CLI | `npm i -g @google/gemini-cli` | Google login (free 1K req/day) or API key |
Neither tool is strictly required. The skill adapts based on what is available (see Escalation Model below).
Configuration
Per-project config at `.metaswarm/external-tools.yaml` (optional -- if absent, external tools are not used):
adapters:
codex:
enabled: true
timeout_seconds: 300
sandbox: docker # docker | platform | none
gemini:
enabled: true
timeout_seconds: 300
sandbox: docker
routing:
default_implementer: "cheapest-available"
escalation_order: ["codex", "gemini", "claude"]
budget:
per_task_usd: 2.00 # circuit breaker per task
per_session_usd: 20.00 # circuit breaker per sessionModels are not set here. Set them per role in `.metaswarm/models.yaml` under `roles.<role>.codex` or `roles.<role>.gemini`, and pass `--role <role>` to the adapter. The model resolves in this order: `.metaswarm/models.yaml`, then the adapter's built-in default (`gpt-5.3-codex` for Codex, `pro` for Gemini). A legacy `adapters.<tool>.model` in this file is no longer read (removed in 0.14.0); the adapter warns on stderr if one is still present.
Fallback Behavior
- **Both tools available**: Full cross-model delegation and review
- **One tool available**: Reduced chain with mutual review between the tool and Claude
- **No tools available**: Existing metaswarm behavior unchanged; skill is a no-op
---
Quick Reference
Health Check
# Check if Codex is installed, authenticated, and reachable adapters/codex.sh health # Check Gemini, reporting the model for the coder role adapters/gemini.sh health --role coder
Returns JSON with `status: "ready|degraded|unavailable"`. `--role <role>` (also accepted by `implement` and `review`) selects the model from `.metaswarm/models.yaml` `roles.<role>.<tool>`; an unknown role exits non-zero. Without `--role`, the output keys are unchanged and `model` is the built-in default. A legacy `adapters.<tool>.model` is no longer read (removed in 0.14.0), only warned about. The resolved model is passed to the CLI (`codex exec -m`, `gemini --model`). If `metaswarm-agents.sh` cannot be found, `--role` is ignored with a warning.
Implement
adapters/codex.sh implement \ --worktree "/tmp/ext-codex-task-42" \ --prompt-file "/private/tmp/xt-abc123/prompt.md" \ --role coder \ --attempt 1 \ --timeout 300
Review
adapters/gemini.sh review \ --worktree "/tmp/ext-codex-task-42" \ --rubric-file "./rubrics/external-tool-review-rubric.md" \ --spec-file "/private/tmp/xt-abc123/spec.md" \ --role adversarial-reviewer \ --timeout 300
All commands return a uniform JSON envelope with facts only (exit code, files changed, cost, duration). The orchestrator interprets results -- adapters never self-judge.
---
Workflow: Routing & Dispatch
Phase 0: Tool Discovery (Health Checks)
Before dispatching any task, the orchestrator runs health checks to determine which tools are available:
# Run health checks for all configured adapters
for adapter in adapters/*.sh; do
result=$("$adapter" health)
# Parse status: ready | degraded | unavailable
doneHealth is checked **per task dispatch**, not just at session start. Auth tokens can expire mid-session, network conditions change, and rate limits reset. A tool that was `ready` five minutes ago may now be `unavailable`.
Build the available tools list:
available_tools = [t for t in adapters if t.health() == "ready"]
Phase 1: IMPLEMENT (External Tool or Claude)
If an external tool is selected as implementer:
1. **Create worktree** -- `git worktree add "$WORKTREE_PATH" -b "external/$TOOL/$TASK_ID"` for isolation 2. **Package context** -- Gather relevant files, spec, acceptance criteria into a prompt file in a secure temp dir (mode 700, trap cleanup). Token-budget the context to fit the model's window. 3. **Invoke** -- `safe_invoke()` with timeout wrapper; capture JSON output 4. **Scope check** -- Verify all file changes are within the declared file scope; revert any out-of-scope changes 5. **Capture output** -- Facts only: exit code, files changed, diff stats, cost, duration
If Claude is selected (escalation or no external tools), use the existing `Task()` mechanism with role type `roleType("coder")` (adversarial review uses `roleType("adversarial-reviewer")`). Role types are resolved per [Role type resolution](../start/guides/agent-coordination.md#role-type-resolution).
Phase 2: VALIDATE (Always Orchestrator -- Unchanged)
The orchestrator independently runs all quality gates:
- `npm test` / `npx vitest run`
- `npx tsc --noEmit`
- `npx eslint <changed-files>`
- Coverage enforcement via `.coverage-thresholds.json`
- File scope verification via `git diff --name-only`
This
A self-improving multi-agent orchestration framework for Claude Code, Gemini CLI, and Codex CLI.
Other skills on metaswarm.
More skills from other plugins.
agentmail
Use your assigned AgentMail inbox to read email tasks, explicitly send or reply, and check delivery. Provided automatically by…
adr-create
Create a new Architecture Decision Record with sequential numbering and AgentDB registration
Questions about external-tools.
- Which coding agents can use external-tools?
- external-tools installs in Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode and Windsurf with the skills CLI, using each agent's flag shown on this page. Flowy's auto-invocation, which fires a skill when your prompt matches, runs in Claude Code only.

