opencode_start
Spawns a new OpenCode CLI session and runs an initial task, returning a session_id and events log path. Monitor the log for session events, then read results and kill the session when done.
Instructions
Spawns a new OpenCode CLI session and starts the initial task. Returns session_id and events_log_path. After starting, use a persistent background notification watcher on to receive events (running, idle, waiting_input, done, stale, contract_violated). Call opencode_read when notified, then opencode_kill when done.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| fork | No | Fork session before continuing. | |
| task | Yes | Initial task prompt. | |
| agent | No | Agent mode to use. | |
| model | No | Model to use (e.g., 'google/gemini-3.6-flash', 'opencode/deepseek-v4-flash-free', etc.). | |
| format | No | Output format: default or raw JSON events. | |
| variant | No | Model variant (e.g., 'high', 'max', 'minimal'). | |
| workdir | No | Working directory (defaults to process.cwd()). | |
| contract | No | Optional task contract for guardrails. | |
| thinking | No | Show thinking/reasoning blocks. | |
| auto_approve | No | Auto-approve non-dangerous permissions. | |
| continue_last_session | No | Continue the previous OpenCode session. | |
| session_id_to_continue | No | Session ID to continue. |