Delegate a coding task to a cheaper model
delegate_taskDelegate repetitive coding tasks like boilerplate, refactors, and tests to a cheaper subagent, keeping the primary model focused on architecture and critical decisions.
Instructions
Hand off self-contained, high-volume "grunt work" to a cheaper model running through OpenCode, so the primary agent can stay focused on architecture and critical decisions.
The subagent runs non-interactively in a real working directory and CAN read, write, and edit files and run shell commands there (auto-approved by default). Give it a complete, self-contained brief — it does not see your conversation.
Good for: writing repetitive/boilerplate code, mechanical refactors, generating tests, fixing lint/type errors, updating call sites, docstrings, simple migrations. Avoid for: architecture, security-sensitive logic, ambiguous specs, or anything where a wrong edit is costly.
Args:
task (string, required — alias:
scope, accepted for parity with delegate_tests; provide one): Complete instructions for the subagent, including acceptance criteria.directory (string): Absolute path of the repo/dir to work in. Defaults to the server's cwd or config.default_directory.
model (string): Override provider/model, e.g. "minimax-coding-plan/MiniMax-M2.5-highspeed". Defaults to config.default_model.
agent (string): OpenCode agent name to run as.
variant (string): Reasoning-effort variant, e.g. "high" | "minimal".
profile (string): Named preset from config (model/agent/variant/auto_approve).
files (string[]): Paths to attach as context.
session (string): Session id to continue a prior delegation (returned as session_id).
continue_session (boolean): Continue the last session instead of a specific id.
auto_approve (boolean): Auto-approve tool permissions (default from config, usually true).
response_format ('markdown' | 'json'): Output format (default 'markdown').
See also: delegate_tests — same shape, dedicated to test-writing; its required field is named scope instead of task.
Returns structured content: { ok, model, session_id, directory, result, error?, usage{tokens,cost}, actions[], duration_ms }.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| task | No | Complete, self-contained instructions for the subagent. Required unless `scope` is given instead. | |
| agent | No | OpenCode agent name | |
| files | No | File paths to attach as context | |
| model | No | provider/model override (see list_models) | |
| scope | No | Alias for `task` (delegate_tests uses this name) — provide one or the other | |
| profile | No | Named config profile to apply | |
| session | No | Session id to continue | |
| variant | No | Reasoning-effort variant | |
| directory | No | Absolute working directory for the subagent | |
| auto_approve | No | Auto-approve tool permissions | |
| response_format | No | Output format | markdown |
| continue_session | No | Continue the last session |