How to redirect, queue, stop or question an agent while it works, and how tools and extensions can feed it context. Each entry says when the input lands, what happens to running tools, and whether you can see it afterwards. Columns show each harness's main surface first, then its other surfaces.
| You want to | OpenCode2.x |
|---|---|
| Change direction mid-turn | TUI Enter (prompt.submit, delivery 'steer' default) / POST /api/session/:id/prompt with delivery=steer Lands before the next model call; lets running tools finish; kept in the transcript. The input is first written to the durable inbox and stays out of model-visible history until delivered. Before each step, all pending steers are delivered as one batch, in enqueue order. A pending compaction or move item stops the batch. Delivering a steer resets the agent's step allowance. Tool outcomes from the current step settle first. Shell mode, exit words and slash commands cannot be queued from the TUI. /automation and automation_* tools (2.4.0: top-level automations; 2.3.1: experimental.automations) Lands before the next model call; lets running tools finish; kept in the transcript. 2.3.1+: automations replace schedules. Prompt targets may be the creating session, another session or a new subagent; Code Mode actions may decide whether to prompt. MCP push-event triggers additionally need mcp_events. Every server starts the automation loop. The managed-only 2.2.1 finding is historical; 2.2.4 already extended scheduling to ordinary servers. Migration preserves only active/paused plain-prompt schedules without conditions/run limits and with a next due time; other old rows are dropped. No runtime firing or migration probe. |
| Queue a follow-up | TUI <leader>Enter (prompt.queue) / POST /api/session/:id/prompt with delivery=queue Waits until the turn ends; lets running tools finish; kept in the transcript. A queued item is delivered only at an idle boundary, one per idle boundary; steers still go first. <leader>q opens a 'Queued prompts' dialog: selecting an item promotes it to a steer; ctrl+d deletes it. API equivalents: PATCH /api/session/:id/inbox/:inboxID {delivery} (switching to steer wakes execution) and DELETE /api/session/:id/inbox/:inboxID. The queue cannot be reordered. A queued item is not in the transcript until it is delivered. |
| Stop it | TUI Esc twice within 5 s (session.interrupt) -> POST /api/session/:id/interrupt?resume=true Takes effect immediately; stops running tools; skips remaining tool calls; kept in the transcript. Interrupting cancels the stream and the running tool fibers. Tools fail with 'Tool execution interrupted' and the assistant message shows 'Step interrupted'. Interrupting does not delete pending inbox input. The TUI sends resume=true: pending steers (and compaction or move controls) then run straight away while queued prompts stay parked, so typing then double Esc works as interrupt-and-redirect. With resume omitted, the API is a plain cancel. Only an execution owned by this process can be interrupted; an idle session is a no-op. The composer also has ctrl+d to interrupt a subagent. |
| Ask a side question | TUI /btw <question> (command session.aside, built-in plugin opencode.btw) -> POST /api/session/:id/generate Answered separately; the main run is untouched; lets running tools finish; shown on screen only. One-shot model call over the current session context plus a no-tools instruction; the answer appears in a dialog with a copy option. Session history is not changed. Does not wait for or touch the active run. There is no docs page: https://opencode.ai/v2/docs/btw/ returns 404. Only the generate endpoint is documented. The desktop and web app also ship a btw sidebar extension. |
| Feed it context (hooks, extensions, APIs) | POST /api/session/:id/synthetic (plugin ctx.session.synthetic) Timing depends on the situation; lets running tools finish; kept in the transcript. Goes through the same inbox as prompts, with steer or queue delivery; becomes a synthetic message when delivered. resume=false records the message without waking execution; shell completion notices and the Plan plugin use this. Field fit: 'ordering' is really the inbox discipline (steers as a batch, queued items one at a time). Plugin ctx.session.hook("prompt") (v1 chat.message successor) Arrives when its event fires; lets running tools finish; kept in the transcript. Runs before durable admission; the plugin can change the prompt's text, files, agents and skills. The hook is told the delivery mode, steer or queue. Plugin ctx.session.hook("context") (v1 experimental.chat.messages/system.transform successor) Lands before the next model call; lets running tools finish; hidden from you. Runs for each primary model request; the plugin can edit system, messages, options and tools. Separate hooks exist for compaction and generate. The built-in Plan plugin splices a reminder in here and also saves it through synthetic(resume:false). Experimental API PUT/DELETE /api/experimental/session/:id/instructions/entries/:key Lands before the next model call; lets running tools finish; hidden from you. Stores durable instruction entries; changes are announced to the model at the next step boundary. Experimental. /goal <objective> (TUI and Desktop); built-in goal plugin on the experimental.idle hook Waits until the turn ends; lets running tools finish; hidden from you. 2.2.1+. When the session would go idle, a reviewer request on the same session returns done, continue, blocked, paused or wait. On continue, a synthetic continuation message keeps the same execution going; timelines hide it. Pauses after 50 rounds, 3 rounds without progress, 30 minutes waiting on background work, a failure or interrupt, or a server restart. Objectives are capped at 4,000 characters. `/goal pause`, `resume` and `clear` control it. |
Sources
OpenCode, 2.x
- opencode docs: v2/docs/api, Documentation, checked 2026-10-14
- opencode source: specs/v2/session.md, Documentation, checked 2026-10-15
- opencode source: packages/protocol/src/groups/session.ts, Source code, checked 2026-10-15
- opencode source: packages/core/src/session/runner/llm.ts, Source code, checked 2026-10-15
- opencode source: packages/core/src/session/inbox.ts, Source code, checked 2026-10-15
- opencode source: packages/tui/src/component/prompt/index.tsx, Source code, checked 2026-10-15
- opencode source: packages/tui/src/config/keybind.ts, Source code, checked 2026-10-15
- opencode source: packages/tui/src/routes/session/index.tsx, Source code, checked 2026-10-15
- opencode source: packages/core/src/session/execution.ts, Source code, checked 2026-10-15
- opencode source: packages/core/src/session/runner/step.ts, Source code, checked 2026-10-15
- opencode source: packages/tui/src/feature-plugins/prompt/btw.tsx, Source code, checked 2026-10-15
- opencode source: packages/tui/src/plugin/builtins.ts, Source code, checked 2026-10-15
- opencode source: packages/core/src/session/generate.ts, Source code, checked 2026-10-15
- opencode docs: v2/docs/build/plugins/migrate-v1, Documentation, checked 2026-10-14
- opencode source: packages/core/src/session/prompt.ts, Source code, checked 2026-10-15
- opencode source: packages/plugin/src/effect/session.ts, Source code, checked 2026-10-15
- opencode docs: v2/docs/build/plugins/effect, Documentation, checked 2026-10-14
- opencode source: packages/core/src/session/model-request.ts, Source code, checked 2026-10-15
- opencode source: packages/core/src/plugin/plan.ts, Source code, checked 2026-10-15
- OpenCode 2.2.2: packages/core/src/plugin/goal.ts, Source code, checked 2026-10-30
- OpenCode 2.2.2: packages/core/src/plugin/goal.ts, Source code, checked 2026-10-30
- OpenCode 2.2.2: packages/core/src/plugin/goal.ts, Source code, checked 2026-10-30
- OpenCode 2.2.2: packages/core/src/plugin/goal.ts, Source code, checked 2026-10-30
- OpenCode 2.2.2: packages/core/src/plugin/internal.ts, Source code, checked 2026-10-30
- OpenCode 2.2.2: packages/plugin/src/effect/session.ts, Source code, checked 2026-10-30
- OpenCode 2.2.2: packages/core/src/tool/plugin/schedule.ts, Source code, checked 2026-10-30
- OpenCode 2.2.2: packages/core/src/schedule.ts, Source code, checked 2026-10-30
- OpenCode 2.2.2: packages/server/src/process.ts, Source code, checked 2026-10-30
- OpenCode 2.2.2: packages/schema/src/config/experimental.ts, Source code, checked 2026-10-30
- opencode v2.3.2: packages/server/src/process.ts, Source code, checked 2026-11-20
- opencode v2.3.2: packages/core/src/automation.ts, Source code, checked 2026-11-20
- opencode v2.3.2: packages/schema/src/automation.ts, Source code, checked 2026-11-20
- opencode v2.3.2: packages/core/src/database/migration/20261116043204_automation.ts, Source code, checked 2026-11-20
- opencode v2.3.2: packages/schema/src/config/flag.ts, Source code, checked 2026-11-20
- opencode v2.3.2: packages/core/src/automation.ts, Source code, checked 2026-11-20
- OpenCode 2.4.0 release notes, Documentation, checked 2026-11-24