An OpenCode V2 TUI plugin that lists the open session's sub-agents in the sidebar (role, model, status, run time, tokens, cost) and lets you open or stop them.
An expanded sub-agent, with its task, status, run time, tokens, and the Open and Stop buttons:
- OpenCode V2, run as the terminal UI. Built and tested with OpenCode 2.4.2; other versions are untested.
- Tested on Linux (WSL 2) only. macOS and native Windows are untested.
- Git, to download the plugin.
Nothing else: the plugin has no dependencies of its own and uses the copies
of solid-js and @opentui that OpenCode ships. Bun is needed only to run
the tests (see Development).
-
Download the plugin to a folder of your choice:
git clone https://github.com/ptitan/opencode-subagents-panel.git ~/opencode-plugins/subagents-panel -
Open OpenCode's CLI settings file,
~/.config/opencode/cli.json($XDG_CONFIG_HOME/opencode/cli.jsonifXDG_CONFIG_HOMEis set). If it does not exist, create it with this content:{ "$schema": "https://opencode.ai/v2/cli.json" } -
Add the plugin to the
pluginsarray, with the absolute path of the folder (no~). Keep the entries already there. For example, if the file has:{ "$schema": "https://opencode.ai/v2/cli.json", "theme": { "name": "opencode", "mode": "dark" }, "plugins": ["-opencode.notifications"] }it becomes:
{ "$schema": "https://opencode.ai/v2/cli.json", "theme": { "name": "opencode", "mode": "dark" }, "plugins": [ "-opencode.notifications", { "package": "/home/you/opencode-plugins/subagents-panel", "options": {} } ] }If there is no
pluginsarray, add one.optionstakes the settings of the table below;{}keeps the defaults. -
Start OpenCode (or wait a moment if it is already running: valid edits to
cli.jsonreload while the TUI runs).
- Press
ctrl+pand typeSub-agents: the palette lists Sub-agents: settings (and, inside a session, Sub-agents: list and Sub-agents: stop all). Opening Sub-agents: settings shows the settings menu. - Press
ctrl+pand open Plugins:local.subagents-panelis listed. - The panel itself stays hidden as long as the open session has no
sub-agent. It appears in the sidebar once the session has started one (the
sidebar must be shown:
session.sidebaris nothide, and the terminal is wide enough).
- Click a line to expand or collapse its block: task, status, run time, tokens, background tasks, cost, and the Open and Stop buttons.
- Open goes to the sub-agent's session; OpenCode's Go to parent
session key (
upwhen the prompt is not focused) comes back. - Stop stops the sub-agent and everything it started (nested sub-agents, background shells and jobs), after a confirmation. The parent session and other sessions are not touched.
- The status symbol is
•: orange while running, red on error, dim when finished; a bold?means the sub-agent waits for you (permission or form) and comes first. +N more(when more sub-agents exist than rows) opens the full list.
Commands, in the palette (ctrl+p) and as slash commands in the prompt:
| Command | Palette entry | Effect |
|---|---|---|
/subpanel-list |
Sub-agents: list | Every sub-agent, with its task, status, time, and tokens. enter opens one, ctrl+d stops the selected one, alt+d stops all. |
/subpanel-stop-all |
Sub-agents: stop all | Stops every running sub-agent of the open session, after a confirmation. |
/subpanel-settings |
Sub-agents: settings | The settings menu. |
Use /subpanel-settings: the menu lists each setting with its value and
where it comes from (menu, cli.json, or default). A change applies at
once. Menu values are saved by OpenCode for the TUI (not in cli.json) and
win over cli.json; Reset to defaults clears them.
cli.json options are an alternative, for example to share a setup: put
them in the plugin entry's options. Invalid values are ignored.
| Menu entry | cli.json option |
Default | Values |
|---|---|---|---|
| Role labels | labels |
none | Label per agent ID, shown in capitals instead of the agent's name. In the menu: pick an agent, type a label; empty text goes back to the default. Labels with emoji, wide, or control characters are refused. |
| Show provider | showProvider |
false |
Prefix the model with its provider. |
| Max model length | maxModel |
15 |
6 to 80 columns for the model on a block's line. |
| Max rows | maxRows |
6 |
1 to 50 sub-agents shown in the panel; the rest go to +N more. |
| Start expanded | startExpanded |
false |
New blocks start expanded. |
| Show cost | showCost |
true |
Show costs. |
| Confirm before stop | confirmStop |
true |
Ask before Stop (stop all always asks). |
| Hide finished | hideFinished |
false |
Show only running or waiting sub-agents (and their parents). |
| Position | position |
"top" |
"top" or "bottom" of the sidebar's content. |
| — | width |
42 |
Maximum line width (the sidebar's width applies if narrower). cli.json only. |
Without a label, the role is the agent's name as OpenCode reports it, in
capitals (EXPLORE), else its ID. Example with every kind of option:
{
"package": "/home/you/opencode-plugins/subagents-panel",
"options": {
"labels": { "general": "Gen", "explore": "Scout" },
"position": "bottom",
"maxRows": 8,
"width": 40
}
}Keyboard shortcuts: with OpenCode 2.4.2, these commands cannot be bound
to a key through keybinds in cli.json. The plugin API lets a plugin
declare a binding (bind); this plugin declares bind: false.
git -C ~/opencode-plugins/subagents-panel pullThe TUI reloads the plugin when its files change; restart OpenCode if it does not.
- Remove the plugin's entry from the
pluginsarray ofcli.json. - Delete the plugin folder.
- Optional: delete the saved menu values,
~/.local/state/opencode/latest/tui/plugin.local.subagents-panel.settings.json($XDG_STATE_HOME/opencode/…ifXDG_STATE_HOMEis set), or use Reset to defaults before removing the plugin.
- No panel: it shows only for a session that has sub-agents, in the
sidebar. Check that the commands are in the palette (see Check that it
works). If they are not, check the path in
cli.json: absolute, pointing to the folder that holdspackage.json. A wrong path shows no error message; the plugin is simply not loaded. - A label is shown as the agent's name instead: the label contains a character that is not one column wide (emoji, wide or control character) and is ignored.
- Shows up to three levels of nested sub-agents. For a session reopened from history, older nested levels are loaded within a bounded number of requests and may be incomplete.
- Stopping checks the sub-agent's subtree again for about two seconds; something that wakes it up later is not stopped. Stops beyond 500 sessions in a subtree are not guaranteed (a message says so).
- A resumed sub-agent shows the duration of its latest run only.
- The commands cannot be bound to a key through
keybinds(see Settings).
Details: docs/DETAILS.md.
Type-checking dependencies live in dev/, outside the plugin's resolution
path, so that at runtime the plugin keeps using OpenCode's solid-js and
@opentui (two Solid instances would break reactivity).
(cd dev && bun install)
bun run typecheck
bun run test # pure logic, on made-up data; reads nothing from the machineFiles: src/tui.tsx (OpenCode wiring, menu, panel), src/rows.ts (layout),
src/settings.ts (settings), src/stop.ts (stopping a subtree).



