Start an OpenCode run
opencode_run_startStart or continue an OpenCode run under a configured read-only role, send a brief, and optionally target a session, forked copy, directory, or model.
Instructions
Start an OpenCode run under a role whose policy is read-only, or continue one, and send it a brief. role is a role the person configured; opencode_service_read method status lists them, and a role of the other policy starts with opencode_run_start_write. brief is the message that starts the run, 1 to 100000 characters. directory starts a new session there: an absolute path, the top level of a Git worktree, and the call's working directory when left out. session continues the session of an earlier start instead, which takes the role's agent, ruleset and model; give one of the two, not both. fork true with session starts on a copy of that session instead: the copy is set up as a continued session is, so its role may differ from the source's, and session is the copy, forked_from the source, and new true. The source must be idle and stays as it was; a start that fails after the copy was made removes the copy. model runs this role on another model than its own, written <provider>/<model> with an optional #<variant>: one opencode_service_read method models lists without a provider, or the role's own model or alternate. It is checked before anything is created or changed, and stays this role's choice on the session and its forks until another is named; another role never runs on it. Naming the model the role runs on without a choice takes the choice away, so the role follows the settings again. Left out, the role's choice on the session applies, else the role's model, else the agent's own, else the service's default: model_from says which. A session that something else moved to another model since these tools last set one stays on it (model_from moved), unless model is given or the role resolves to another model. A run is refused on a model its caller answers with (finding callers_model), however the model was resolved, unless the role's caller_model is allow: name another model. The run has no edit tools and is denied the git commands that write; it keeps its shell. The call returns once the brief is admitted and does not wait for the turn: opencode_run_read waits for it and reads the result. A session that is running is refused: a start needs it idle. The session is read back before any brief is sent, and nothing is sent when it differs from what was set up. state is running once the brief is admitted. It is unknown when its admission could not be confirmed: the brief may have been taken, so read the session before anything else, and send nothing again. note says where the operating note went: an instruction entry of the session, or the head of the brief. The call starts the service when it is not running; service_started says when it did. A call ends within the wait_seconds setting of its start, 50 seconds unless set.
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": {
"role": "<role>",
"brief": "<brief>"
},
"name": "opencode_run_start"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| fork | No | With `session`: start on a copy of that session instead of continuing it; the session stays as it was. | |
| role | Yes | The name of a configured role, as `opencode_service_read` method `status` lists it. | |
| brief | Yes | The message that starts or continues the run: 1 to 100000 characters, not blank. | |
| model | No | The model to run this role on instead of its own, written `<provider>/<model>` with an optional `#<variant>`: one that `opencode_service_read` method `models` lists without a provider, or the role's own model or alternate. It stays the role's choice on the session. Naming the model the role would run on anyway takes its choice away. | |
| session | No | The id of a session an earlier start returned, to continue it. Not with `directory`. | |
| directory | No | A new session: the absolute path of the top level of a Git worktree; left out, the call's working directory. Not with `session`. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| new | Yes | True for a session this call created, a copy of another included, false for one it continued. | |
| note | Yes | Where the operating note went: `entry` an instruction entry, `prompt` the head of the brief. | |
| role | Yes | ||
| agent | Yes | The OpenCode agent the role runs. | |
| model | Yes | The model the session is on for this turn, written `<provider>/<model>`, with `#<variant>` when it has a variant. | |
| state | Yes | `running` once the brief is admitted; `unknown` when its admission could not be confirmed: the brief may have been taken. | |
| branch | Yes | The worktree's branch; null on a detached HEAD. | |
| policy | Yes | ||
| message | No | State `unknown`: what to do. | |
| session | Yes | The run's session: the copy, for a start on a fork. | |
| directory | Yes | The session's directory, the top level of its worktree. | |
| model_from | Yes | Where `model` comes from: `named` this call's `model`, `choice` one an earlier start named for this role, `role` the role's own, `agent` the agent's own, `default` the service's default, `moved` the model something other than these tools moved the session to, which it keeps. | |
| forked_from | No | A start on a fork: the session that was copied, which stays as it was. | |
| choice_dropped | No | The role's choice on the session that no longer passed the checks and was dropped, when there was one. | |
| service_started | Yes | True when this call found no service running and started one. |