Skip to content
Agent Orchestration
Skill

/external-tools

Delegate implementation and review tasks to external AI CLI tools (Codex, Gemini) with cross-model adversarial review

From plugin
metaswarm
43214 skills23 agents16 commands2 hooks

Claude Code

$ npx -y skills add dsifry/metaswarm --skill external-tools --agent claude-code

SKILL.md

external-tools.SKILL.md
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 session

Models 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
done

Health 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
@dsifry
Ships withmetaswarm

A self-improving multi-agent orchestration framework for Claude Code, Gemini CLI, and Codex CLI.

43214 skills23 agents
Get the whole plugin

Stars on GitHub

Momentum

stars in total
432
Star history of dsifry/metaswarm on GitHub, a chart by star-history.com

Other skills on metaswarm.

brainstorming-extension

brainstorming-extensio…

Loads the assumption ledger and misreadings checklist at the start of brainstorming, and enforces the design review gate when a…

@dsifry@dsifryInstall Skill
create-issue

create-issue

Create comprehensive GitHub issues with TDD plans, acceptance criteria, and agent instructions for autonomous PR lifecycle…

@dsifry@dsifryInstall Skill
design-review-gate

design-review-gate

Automatic review gate that runs when brainstorming commits a project-sized design doc - spawns PM, Architect, Designer, Security,…

@dsifry@dsifryInstall Skill
handling-pr-comments

handling-pr-comments

Address PR review feedback systematically — fetch inline comments, review bodies, handle outside-diff-range comments, resolve…

@dsifry@dsifryInstall Skill
handoff

handoff

Analyze the current session and write a self-contained handoff document so a fresh agent can resume the work with full context —…

@dsifry@dsifryInstall Skill
migrate

migrate

Migrate from npm-installed metaswarm to the marketplace plugin — removes redundant files with safety checks

@dsifry@dsifryInstall Skill

More skills from other plugins.

1password

1password

Set up and use 1Password CLI for sign-in, desktop integration, and reading or injecting secrets.

openclaw3d395k
@steipete@steipeteInstall Skill
jira-tickets

jira-tickets

Read and update Jira tickets through Orca's saved Jira connections. Use when a task comes from Jira or the user asks for Jira…

orca1d128k
@stablyai@stablyaiInstall Skill
agentmail

agentmail

Use your assigned AgentMail inbox to read email tasks, explicitly send or reply, and check delivery. Provided automatically by…

paperclip2d114k
@paperclipai@paperclipaiInstall Skill
adr-create

adr-create

Create a new Architecture Decision Record with sequential numbering and AgentDB registration

@ruvnet@ruvnetInstall Skill

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.