Delegate a task to OpenCode
oc_delegateDelegate a fully briefed coding task to an autonomous OpenCode sub-agent with its own files, shell, web, and skill tools; get back the answer, tools used, changed files, and cost.
Instructions
Hand a task to an OpenCode agent (an autonomous sub-agent with its own tools: files, shell, web, MCP, skills). Creates a new session (or continues session_id), picks model/agent/skills, waits for the end and returns the answer, the tools used, the files changed and the cost. Write a complete brief: the agent cannot see your conversation.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"task": "<task>"
},
"name": "oc_delegate"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| fork | No | With session_id: fork the session (copy its history) before continuing. | |
| task | Yes | The complete brief for the task. | |
| wait | No | true (default): wait for the end and return the result. false: start in the background and return the session_id. | |
| agent | No | Primary OpenCode agent (build, plan, general, or a custom agent). See oc_catalog what=agents. | |
| files | No | File paths (or URIs) to attach to the message. | |
| model | No | Model: "provider/model", "provider/model#variant" (e.g. "opencode/claude-sonnet-5-5#high") or just an id/name ("deepseek-v4.1-flash-free"). Empty = OpenCode's default model. | |
| title | No | ||
| agents | No | Sub-agents to mention (@agent) in the message. | |
| detail | No | final = answer only; summary (default) = answer + tools + files; full = complete transcript of the turn. | |
| skills | No | Ids of OpenCode skills to attach to the message (see oc_catalog what=skills). | |
| command | No | OpenCode slash command to run instead of a free prompt (e.g. "review", "init"). `task` then becomes its arguments. | |
| directory | No | Absolute working directory (project). Default: the OpenCode service's directory. | |
| timeout_s | No | Max wait in seconds (default 900). Past it, the task keeps running and oc_wait picks it up. | |
| session_id | No | Continue an existing session instead of creating one. | |
| permissions | No | Permissions: "auto" (default, everything allowed), "readonly" (no writes, no shell), "agent" (the agent's own rules; requests surface through oc_pending) or explicit rules. |