A port of Claude Code's /btw for opencode: ask a question about the session you are in,
get the answer in an overlay, and have none of it enter the transcript.
The command is /btw, with /aside as an alias. The package is named opencode-aside
because opencode-btw is taken by an unrelated package.
Several plugins cover nearby ground. The distinction that matters is whether your side question forks a session and whether anything persists:
| Forks? | Persists? | Tools? | |
|---|---|---|---|
| opencode-aside (this) | no | no — the child session is deleted | no |
opencode-bytheway |
yes, forks and switches you into it | until you /btw-end or /btw-merge |
yes |
opencode-sidechat |
no | yes — a panel with history | yes |
Claude Code's own /btw is a side chain: no tools, nothing persisted, gone when you close
it, main transcript untouched. This plugin matches that. Pick bytheway if you actually
want to branch and merge text back; pick sidechat if you want a persistent panel.
Restart opencode afterwards.
/btw opens a dialog, then:
- snapshots recent text and tool activity from the current session
- opens a hidden child session (
parentID= current) with tools denied - asks once and renders the answer in an overlay
- deletes the child session
The parent transcript is never written to.
It deliberately does not fork. Forking is the heavyweight case — use a real fork when
you want to branch, use /btw when you just want to ask.
{ "plugin": [["opencode-aside", { "context_chars": 12000 }]] }| Option | Default | Meaning |
|---|---|---|
context_chars |
6000 |
How much recent transcript text to include. Trimmed from the front, so the tail always survives. |
tool_chars |
600 |
Per-tool-call cap on command + output text. |
system |
see source | Override the side-question system prompt. |
model |
session's model | {providerID, modelID} to answer with. |
- opencode's slash mechanism dispatches commands with no arguments
(
dispatchCommand(name)), so/btw your questionis impossible. Hence the dialog. - Most of a session lives in tool parts, not text parts. A shell-mode (
!cmd) session's only text part issynthetic: trueboilerplate; the real content ispart.state.input/part.state.output. Reading only text parts yields empty context. api.ui.DialogPrompt/DialogAlertcan be called as plain functions insidedialog.replace(() => …), which avoids needing a JSX build step.- Tools are disabled with
tools: { "*": false }, which opencode turns into deny-all permission rules for the child session. - The model is inherited from the session's most recent assistant message, which matters on a swap-based backend where naming a different model forces a reload.
Irrelevant on a hosted API. On a local llama.cpp-style server with --parallel 1,
requests serialise, so a /btw is served as soon as the current in-flight call finishes —
usually in the gap while the agent runs tools — rather than waiting for the whole run.
It delays the agent's next call by its own duration and will not preempt a generation
already in flight.
Measured on one such setup, an interleaved /btw did not cost the agent its prompt
cache (a long prompt still hit cache afterwards: 1.1s, versus 9.5s cold). That depends on
server version and cache settings, so re-check it on your own hardware if it matters.
OpenCode 1.18.18 or newer (the TUI plugin API with dialogs and session client access).