dsifry/metaswarm/external-tools
Claude Code and agent skill by dsifry/metaswarm
- community
Checking that the SKILL.md file is still in the repository.
Delegate implementation and review tasks to external AI CLI tools (Codex, Gemini) with cross-model adversarial review
Install
npx vskill@latest install dsifry/metaswarm/external-toolsSKILL.md
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):
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
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
Review
For a security work unit (one that meets any security-coder condition in the coder-selection rubric, whichever tier built it, or touches a security boundary), also append the contents of rubrics/security-implementation-rubric.md to the spec file and require the S1-S8 verdict block in the review; an external review without it is incomplete.
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:
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:
Phase 1: IMPLEMENT (External Tool or Claude)
If an external tool is selected as implementer:
- Create worktree --
git worktree add "$WORKTREE_PATH" -b "external/$TOOL/$TASK_ID"for isolation - 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.
- Invoke --
safe_invoke()with timeout wrapper; capture JSON output - Scope check -- Verify all file changes are within the declared file scope; revert any out-of-scope changes
- 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.
Phase 2: VALIDATE (Always Orchestrator -- Unchanged)
The orchestrator independently runs all quality gates:
npm test/npx vitest runnpx tsc --noEmitnpx eslint <changed-files>- Coverage enforcement via
.coverage-thresholds.json - File scope verification via
git diff --name-only
This phase is identical whether the implementer was an external tool or Claude. Never trust the implementer's self-report.
Phase 3: ADVERSARIAL REVIEW (Cross-Model)
The key advantage of external tools: the writer is always reviewed by a different model.
| Implementer | Reviewer 1 | Reviewer 2 | |
|---|---|---|---|
| Codex | Gemini (via adapter) | Claude (via Task) | |
| Gemini | Codex (via adapter) | Claude (via Task) | |
| Claude | Codex (via adapter) | Gemini (via adapter) |
Claude (via Task) reviewers are spawned as fresh roleType("adversarial-reviewer") instances.
Review is invoked via the adapter's review command. The orchestrator reads the reviewer's raw log and evaluates it independently -- the adapter never returns a pass/fail verdict.
Phase 4: COMMIT (Unchanged)
After passing adversarial review:
- Merge the worktree branch into the working branch
- Clean up the worktree (
git worktree remove) - Log the session for self-reflection
- Commit with DoD verification in the commit message
Escalation Model (Availability-Aware)
The orchestrator adapts its escalation chain based on which tools passed their health checks.
Scenario 1: Two External Tools Available (5 attempts max)
Worst case: A(2) + B(2) + Claude(1) = 5 attempts before user alert.
Scenario 2: One External Tool Available (3 attempts max)
Worst case: A(2) + Claude(1) = 3 attempts before user alert.
Scenario 3: No External Tools Available
No change to the current workflow. The skill is a no-op.
Routing Logic
The orchestrator selects the implementer for each task using cheapest-available selection:
Selection criteria for `cheapest()`:
- Pick the tool with lower estimated cost per invocation (based on model pricing and average token usage from session logs)
- On tie, prefer the tool with higher historical success rate for this task type
- If no historical data, prefer Gemini (free tier) over Codex
Prompt File Format
The prompt file is the key interface between the orchestrator and external tools. It must be self-contained -- the external tool has no access to BEADS, knowledge base, or conversation history.
Token budgeting rules (handled by package_context() in _common.sh):
- Estimate tokens per file using chars/4 heuristic
- Prioritize context: changed files > test files > imports > surrounding context
- Truncate to the model's context budget (configurable per adapter)
- On retry: include review feedback summary, not full prior output
- On escalation: include prior branch diff summary, not full branch
Error Handling
When an adapter returns exit_code != 0, the error_type field determines the orchestrator's response:
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/external-tools/SKILL.md
Popularity
- Repository stars
- 128
- Repository forks
- 10
- Repository npm downloads, 7 days
- 25
- 7-day trend score
- 37
Stars and forks are for the whole GitHub repository, not this skill alone. Downloads are for the repository's npm package. Refreshed 18 Mar 2026, 8 months ago.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/dsifry/metaswarm/external-tools)