Aside
Claude Code's /btw side chat for opencode - ask a one-shot question in an overlay, with no tools and nothing added to the transcript
0
295
近 7 天 43
35.1
生态多维模型
8 天前
2026-09-04
快速安装与配置
opencode.json写入当前项目的 opencode.json,只对这个仓库生效。
opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["opencode-aside@0.1.1"]
}写入 ~/.config/opencode/opencode.json,对所有项目生效。
~/.config/opencode/opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["opencode-aside@0.1.1"]
}若你要在本地改造这个插件,先装到项目里再从本地路径引用。
shell
pnpm add -D opencode-asideOpenCode 启动时会通过内嵌运行时自动加载 npm 依赖并缓存至本地目录,无需手动在全局环境执行安装。
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.
How this differs from the alternatives
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.
Install
// ~/.config/opencode/tui.json
{ "plugin": ["opencode-aside"] }
Restart opencode afterwards.
What it does
/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.
Options
{ "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. |
Notes for anyone extending it
- 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.
Running against a local single-slot model
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.
Requirements
OpenCode 1.18.18 or newer (the TUI plugin API with dialogs and session client access).
同类生态推荐
Double Ctrl C
opencode-double-ctrl-c
OpenCode TUI plugin: press ctrl+c twice to exit, replicating Claude Code and Codex CLI. One press clears the prompt; on an empty prompt it asks for a second press instead of quitting.
Session Elapsed
opencode-session-elapsed
OpenCode TUI plugin that shows session elapsed, cumulative work, and response timers in the prompt line.
Snap To Bottom
opencode-snap-to-bottom
Terminal-style snap-to-bottom for the opencode transcript