// instruments for OpenCode

Give OpenCode the instruments it does not ship with.

A tool call has to finish. A dev server does not, and neither does the context window filling up behind you. Cockpit is the instrument panel: things your agent can use, and things that tell you what it is doing. One package per capability, one switch each.

$opencode plugin opencode-cockpit --global
1daemon, shared by every window9agent tools35watch presets14statusline segments
01What is fitted

Two instruments today. One switch each.

Every bay is its own npm package with a switch in config. They share the daemon, the config file and the keys, so the second costs nothing and moving between them changes nothing you have already set up.

02 Background terminals

Shell

A tool call has to finish. A dev server does not — so your agent either blocks on it, or backgrounds it and loses the output. Shell gives it terminals with a real PTY that outlive the turn, wait for a port or a pattern, and hand back the part that matters.

agent Terminals that keep running you A panel that reports its own health

  • Waits on a port, a pattern, silence or exit
  • Watchers report transitions, not noise
  • Three views: agent log, your screen, raw replay
  • Search the scrollback from the console
  • Time and idle limits, with the reason recorded
  • Reuses a finished shell instead of piling up

tapes/session.ts · a real model turn, start to finish

Why not just bash

A tool call is the wrong shape for work that keeps going.

Everything long-running hits the same wall: the call either blocks until the process dies, or backgrounds it into the dark. Cockpit changes the shape of the call.

Bash in a tool callA Cockpit shell
01Blocks the turn until the server is killed Returns the moment the port actually answers
02Backgrounded with & and lost with the session Outlives the turn, the session and the window
03"Is it ready?" answered by sleeping and hoping Waits on a port, a pattern, silence or exit
04A crash nobody notices until the next command A process that dies is reported as a failure
05The whole log re-read every turn, in tokens Reads forward from a cursor, greps before it costs

03 The session, at a glance

Statusline

How full is the context? Where did the tokens go? What has changed? OpenCode answers the first in a corner and the rest not at all. The statusline answers them where you are already looking, and every part of it is a segment you can reshape, recolour or write yourself.

you What the session is costing you

  • A capacity bar that means something at a glance
  • Tokens split into cache, input and output
  • Fourteen segments, or your own in TypeScript
  • Your Claude Code statusline script runs unchanged
  • Colours follow whatever theme you run
  • Silent about anything the host already says better
The statusline under an OpenCode conversation: a context bar at 40 per cent, the token total with its cache, input and output parts, the session diff, and elapsed time
the default line · no configuration written at all
04The platform

What every capability inherits.

A bay never re-solves process ownership, configuration or interface plumbing. It declares what it needs and gets the rest from the airframe.

A daemon that outlives the session

OpenCode's interface and server run in separate threads that cannot share memory, and neither survives a restart. cockpitd owns the state: shared by every window, self-upgrading, reaping what crashes leave behind, exiting when idle.

One config for both halves

Agent plugins are configured in opencode.json, interface plugins in tui.json. Cockpit reads a single file — global, then project, then plugin entry — and ignores a broken one rather than failing.

Real estate in the interface

A docked panel, a full-screen console, a sidebar section, a keymap namespace. A bay asks for the slot it needs and inherits the chrome, the theme and the keybind conventions.

A typed wire between them

JSON-RPC over a private socket, schemas shared by client and daemon, versioned at protocol 1.3. A bay adds methods and events without the others knowing, and a mismatch is reported instead of guessed at.

05What is next

One bay at a time, and only what can be built.

Nothing is listed here that cannot be built with what OpenCode already exposes. One bay at a time, shipped before the next is announced.

Review

next up

A pull request in the terminal. Comment on a line, comment on a file, mark a file read, suggest the change instead of describing it — and none of it reaches the chat until you submit, when it arrives as one message instead of six interruptions.

session.diff carries each file's before and after in full; session.revert undoes one part.

Doctor

after that

One command that checks your setup and tells you how to fix it.

06Install

Two minutes, then ask it to start something.

$opencode plugin opencode-cockpit --global

All bays, each with a switch: { "features": { "shell": true } }. New bays arrive with an update and stay off until you turn them on.

01Run the command above — it writes both plugin entries for you.
02Restart OpenCode. The daemon starts on first use and exits when idle.
03Optional: put kinds, watch presets and defaults in ~/.config/opencode-cockpit/config.json.

Stop babysitting your terminal.

OpenCode 1.18+ on macOS and Linux. MIT licensed, every bay its own package.