delegate_task
Delegate a coding task to an external model in OpenCode for agentic execution, returning a session_id to monitor or abort the run. Use for atomic tasks with a clear design.
Instructions
Delegate a coding task to an external model running in OpenCode. The delegated model runs an agentic loop with the MCP servers configured in opencode and the skills from ~/.claude/skills - it is a full worker, not a single completion call.
Monitoring is event-driven (SSE) with poll fallback and a hard ceiling (OPENCODE_MAX_POLL_MS, default 45 min) - it never waits forever. Empty responses are retried automatically; a session that ends in error comes back as an error, not as an empty success; if the opencode server is down the bridge restarts it. Run bridge_health first when in doubt.
USE IT FOR: an atomic task whose design is already decided in the prompt. AVOID IT FOR: open design decisions (the model will fill the gap with something plausible) and long build/run loops inside the agent.
TRAP: use ABSOLUTE paths for every file in the prompt, even when passing 'directory'. If the wait hits the ceiling you get an error carrying the session_id - the model MAY STILL BE RUNNING on the server: check task_progress before continue_task.
CHOOSING THE MODEL - MANDATORY: if the user did not name a model for this task, DO NOT pick one on your own. Call list_models, then propose ONE model with a one-line reason ("qwen3.7-plus: multi-file refactor, needs the bigger context") and ask the user to confirm or change it. Once they answer, reuse that choice for the following delegations in this conversation until they say otherwise. Only skip the question when the user already named the model.
RETURNS: session_id for continue_task / task_progress / abort_task / end_task.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| model | Yes | An alias from bridge.config.json (list_models shows them) or a full "provider/model", e.g. "opencode-go/gpt-5.6-luna". Ask the user when they have not chosen one. | |
| title | No | Short title for the delegation session | |
| effort | No | Reasoning effort, sent to opencode as the message "variant". Valid values are PER MODEL (list_models has the column); an unsupported value is an error, never a silent downgrade. Omit to use the alias default, then the model default. | |
| prompt | Yes | Detailed task description. Use absolute paths for every file operation. | |
| directory | No | Project root for the session (sent as ?directory= when enabled). Still: use absolute paths in the prompt. |