From subtask
Delegate a task to the optimal AI model based on quota pressure and routing rules
How this skill is triggered — by the user, by Claude, or both
Slash command
/subtask:delegateThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Delegate a task to the best available AI model. The routing strategy is auto-loaded at session start — it tells the agent when and where to delegate.
Delegate a task to the best available AI model. The routing strategy is auto-loaded at session start — it tells the agent when and where to delegate.
External CLIs: codex (OpenAI) · codex review (separate quota) · gemini (Google) · agent (Cursor, manual-only)
All CLI flags MUST come from cached --help output. Never hardcode flags.
/subtask:delegate <task description>
Model hints can appear anywhere in the input:
Research caching best practices in Firebase — auto-routesReview the auth changes using codex — CodexUse gemini to analyze performance — Geminiwith codex, implement retry logic — CodexCreate a Linear ticket for the billing bug — Claude (needs MCP)Analyze this with grok — Agent (Grok only available there)Apply the least access that satisfies the task. Derive flags from cached --help.
| Level | Access | Use When |
|---|---|---|
| 1. Pipe | No filesystem | Self-contained: summarize, parse, generate from provided context |
| 2. Read-only | Read, no writes | Reviews, analysis, advisory needing codebase context |
| 3. Working dir | Read + scoped writes | Implementation within a worktree or temp sandbox |
| 4. Full access | Read + write beyond working dir | Needs config outside worktree (still sandboxed) |
⛔ NEVER use elevated-permission flags. This is a hard constraint, not a guideline. ⛔
If a task cannot be completed within a sandbox, DO NOT delegate it. Fall back to Claude (native subagent) or abandon the delegation entirely. An unsandboxed external CLI invocation is never acceptable — not for any task, any provider, any reason.
| CLI | Banned flags |
|---|---|
codex | --dangerously-bypass-approvals-and-sandbox |
gemini | -y / --yolo, --approval-mode yolo |
agent | -f / --force, --sandbox disabled |
This covers any flag — present or future — that bypasses permission prompts, auto-approves all actions, or disables the sandbox.
If the ideal sandbox level fails on a CLI, try a more relaxed sandbox on the same CLI if safe. If no sandboxed invocation works, do not delegate — use Claude (native subagent) instead.
All steps are silent — only the final result is shown to the user.
Extract task description and model hint (if any). Match hints case-insensitively: using <model>, use <model>, with <model>. Model names can include variants (e.g., "Codex 5.3 High"). Specific model names (e.g., "grok", "gpt-5.2") resolve by family (OpenAI → codex, Google → gemini). Models without a native CLI → agent if supported.
<cli> --help for the selected CLI and cache outputagent, also run agent --list-models and cacheModel hint present → use that provider unconditionally.
No model hint → classify the task and route per the Quota-pressure routing table (loaded at session start), which defines fallback chains and sandbox levels per task type. Tasks requiring MCP tools (Linear, Slack, Notion, etc.) stay on Claude (native subagent).
If the task maps to an agent role in .claude/agents/*.md, read the matching definition and compose it into the prompt. Otherwise skip.
Native subagent (routed to Claude): spawn with persona + task description.
External CLI: derive flags for non-interactive mode, prompt, and sandbox level from cached --help. Additional rules:
run_in_background: true)Poll output silently. Kill the process if fatal patterns appear with no new output for ~10s:
denied by policy, permission error, permission deniedquota exhausted, exhausted your capacityerror executing tool, crash, panic, fatalIf output stalls without error patterns, ask the user before killing — it may be legitimately slow.
On failure:
subtask model: codex · reason: code review · sandbox: read-only
[model output here — fenced for external CLI, plain markdown for native subagent]
On failure, add a status line: **status:** error — <reason>.
npx claudepluginhub pocketconservatory/plugins --plugin subtaskDelegates implementation and review tasks to external AI CLI tools (Codex, Gemini) with cross-model adversarial review for cost savings and improved accuracy.
Delegates tasks to GitHub Copilot CLI non-interactively with multi-model support (Claude, GPT, Gemini), permission controls, output sharing, and session resume. Useful for Copilot delegation requests, model comparisons, or programmatic runs.
Routes tasks to Haiku, Sonnet, or Opus based on complexity to optimize cost and quality. Use for intelligent model selection and tiered routing.