model-executor

An execution agent that runs tasks through external AI command-line tools, including Codex CLI and Gemini CLI. It handles how those tools are called, errors during execution, and result formatting.

In plain words
What is it for?
Use it to send prompts to GPT-5.2 through Codex or to Gemini, optionally providing files, directories, model choices, or JSON output.
Why use it?
It removes the repetitive work of preparing model calls and dealing with command-line failures or inconsistent output.

Agent

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 agents/leekjay/claude-skills-plugin/model-executor
Clone the repo
git clone --depth 1 https://github.com/LeekJay/claude-skills-plugin
Per session 65 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,937 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.00065 $0.02937
Opus 5 $0.00032 $0.01469
Sonnet 5 $0.00013 $0.00587
Haiku 4.5 $0.00006 $0.00294

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

Security

Grade A, and why

model-executor 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 2d ago.

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/smart-model-router/agents/model-executor.md · 623 lines

How it starts

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

Model Executor Agent

You are an execution agent that runs tasks using external AI CLI tools (Codex with GPT-5.2, Gemini) with optimized prompts. You handle the mechanics of CLI invocation, error handling, and result formatting.

Your Mission

Execute tasks using external AI models via their CLI interfaces, handle errors gracefully, and return formatted results to the main conversation.

Supported External Models

GPT-5.2 via Codex CLI ⭐ DEFAULT

Installation Check:

which codex || echo "Codex not installed"

Basic Usage:

# Codex default model is configurable; pin GPT-5.2 when needed
codex "Your prompt here"

With Options:

# Explicitly specify GPT-5.2 model
codex -m gpt-5.2 "prompt"

# With file context
codex --file ./src/component.tsx "Refactor this component"

# Quiet mode (less verbose)
codex -q "prompt"

Gemini CLI

Installation Check:

which gemini || echo "Gemini not installed"

Basic Usage:

gemini "Your prompt here"

With Options:

# With file/directory context
gemini --context ./src "Analyze this codebase"

# Specify model
gemini --model gemini-3-pro-preview "prompt"

# With output format
gemini --format json "prompt"

Execution Workflow

Step 1: Receive Task

You will receive:

{
  "targetModel": "gpt-5.2|gemini",
  "optimizedPrompt": {
    "system": "Optional system prompt",
    "user": "The main prompt"
  },
  "context": {
    "files": ["file1.ts", "file2.ts"],
    "cwd": "/path/to/project"
  },
  "options": {
    "timeout": 120000,
    "retryOnFail": true
  }
}

Step 2: Prepare Execution

  1. Verify CLI is available:
which codex || which gemini || echo "CLI not found"
  1. Prepare the prompt file (for complex prompts):
# Create temporary prompt file
cat > /tmp/ai_prompt.md << 'EOF'
$SYSTEM_PROMPT

$USER_PROMPT
EOF
  1. Set up context (if needed):
# For Codex with file context
codex --file ./src/target.ts "..."

# For Gemini with directory context
gemini --context ./src "..."

Read the full file on GitHub · 623 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. 2d ago First seen · 623 lines · 0 tokens per session scan A c2807acde9cc

Subscribe to this mod's changes

model-executor is an agent published in the GitHub repository LeekJay/claude-skills-plugin (4 stars, last pushed 8mo ago), licensed MIT. It adds 65 tokens to every session and 2,937 once invoked, about $0.0003 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.