CLI Agent Runner
Delegate tasks to an external CLI agent from within Claude Code. Supports three providers plus Claude's explicit fable model alias:
- codex — OpenAI Codex CLI (
codex exec ...)
- gemini — Google Antigravity CLI (
agy -p ...)
- claude — Claude Code CLI (
claude -p ...)
- fable — Claude Code CLI with explicit model alias (
claude --model fable -p ...)
Provider Selection
Pick the provider in this order:
- User says "fable" / "Fable" / "fableに相談" / "Fableに聞いて" / asks to delegate or consult Claude Fable →
claude with --model fable
- User says "gemini" / "ジェミニ" / asks to delegate to Gemini →
gemini
- User says "claude" / "クロード" / asks to delegate to Claude →
claude
- User says "codex" / "コーデックス" →
codex
- No explicit provider mentioned (default) →
codex
The first argument is treated as a provider only if it is exactly codex, gemini, or claude. If the first argument is exactly fable, use the claude provider with --model fable and treat the remaining arguments as the task prompt. Otherwise the entire argument string is the task prompt and codex is used. Do NOT ask the user which provider to use — pick codex and proceed.
The remaining arguments form the task prompt. For consultation phrasing such as "fableに相談して X" or "Fableに聞いて X", remove the consultation phrase and use X as the task prompt. Convert the user's request into a clear, self-contained prompt and include relevant file paths/context. If the user provides a literal prompt, pass it through directly.
Common Notes (all providers)
- Always use the shell command tool with a 10-minute timeout; delegated tasks can take time.
- Do NOT hardcode model names as defaults — let each CLI's own default handle it so it stays current. Pass
--model fable only when the user explicitly requests Fable.
- Output streams to stdout; capture or display results directly.
- For long-running tasks, warn the user that the delegate may take time.
- If the delegate fails, report the error and suggest the user run it interactively (
codex / gemini / claude).
Quick Reference
Codex
codex exec "<PROMPT>"
For image input, model override, resume, configuration details, and more examples, read references/codex.md.
Gemini
Before the first agy -p of the session, read references/gemini.md. It contains the mandatory preflight, sandbox, and headless-mode requirements.
agy --sandbox --disable-slash-commands -p "<PROMPT>"
For execution modes, structured output, model override, troubleshooting, and more examples, read references/gemini.md.
Claude
Before the first claude -p of the session, read references/claude.md. It contains the non-interactive invocation rules and permission-mode guidance.
claude -p "<PROMPT>"
# With explicit Fable model alias
claude --model fable -p "<PROMPT>"
For permission modes, model override, structured output, troubleshooting, and more examples, read references/claude.md.