This page holds the OpenCode notes that used to be in the README. The tool and error reference is in operations.md.
Observed on a developer machine with OpenCode 2.2.7 (opencode --version), installed with bun.
The startup, the permission dialog and the OSC 7501 states were measured in live sessions
with real model turns (the dialog on OpenCode v2.2.7); Shepherd itself has not yet been
checked end to end against OpenCode. Those checks are operator-run.
- Launch with
argv: ["opencode", "--standalone"]. Without--standalone, OpenCode starts a background server (opencode serve --service) that keeps running after the TUI exits. Stop it withopencode service stop, which exits 0 and ends the process (observed on a developer machine). - Never pass
--auto, and never setsession.permissionstoautoaccept. Both approve permission prompts without a dialog. A profile whoseargvorextra_argscontains--auto, a--auto-…flag, or anautoacceptorauto-acceptspelling is refused when the config loads. This applies when the profile setsagent: "opencode", or when any argv element namesopencode(for examplenpx opencode,sh -c "opencode …", or/usr/local/bin/opencode), even with noagentfield. The check does not coverenvor OpenCode's own config file, and it does not cover a command given tostart_panethroughallow_arbitrary_command. This check prevents accidental auto-approve configuration. It matches by name (case-insensitive substringopencode) and does not defend against a deliberately renamed binary, a wrapper script, or theallow_arbitrary_commandpath. - At startup OpenCode reports
state=idle:app=opencodeover OSC 7501. This report was observed on a developer machine. The output filter removes it. Whether the native backend turns it into aget_statusresult is not yet verified. It is an open point pending a live check. - A launch profile may name
agent: "opencode", but only withpermission_modenormal: no OpenCode mode was measured, soaccept-editsandbypassare rejected. - The permission dialog was measured on OpenCode v2.2.7 in a live session (shell and file
edit). OpenCode reports
state=idle|working|blocked|clearover OSC 7501, with ST terminators and colon-separated fields, andkind=permissiononblocked. It has nodonestate: a turn endsclear, thenidle. For an OpenCode pane,wait_statusreportsdonefor anidlethat follows at least one turn, andcancelledafter a dialog thatanswer_dialogdenied. - A dialog appears only when the effective OpenCode config has an
askrule. With no rule, a shell command ran at once and the pane wentworkingtoidlewith noblocked. Shepherd then has no dialog to answer, and that turn is complete. To get a dialog, the operator must setaskrules forshellandeditin OpenCode's own config, for example in~/.config/opencode/opencode.json:"permissions": [{"action": "shell", "resource": "*", "effect": "ask"}, {"action": "edit", "resource": "*", "effect": "ask"}]. No environment variable or explicit config path that sets permissions is documented (opencode --helpand opencode.ai/docs/config were read), so Shepherd does not set one and writes no file into the working directory. answer_dialogon an OpenCode pane needs the pane to beblockedwith kindpermissionand the screen to show the whole dialog:△ Permission required, a$ <command>or→ Edit <path>line, thenAllow once,Always allow,Rejectin that order and thectrl+f fullscreenhint. Anything else is refused with no key sent.deny_oncesendsEsc, which cancels exactly likeReject(measured with marker files) and ends the turn (idle). It re-checks status and turn just before the key.allow_oncepressesEnteronly after it verifies the highlight. OpenCode draws the highlight as a background colour (no reverse video, no glyph), and the colour depends on the terminal: a 256-colour palette index withoutCOLORTERM, truecolor with it. The native backend therefore applies a relative rule to the styled screen cells (colours and the reverse attribute, used internally and never returned by a tool) and pressesEnterin the same step, under the status, kind and turn guard. It presses only when the dialog text checks pass andAllow oncehas a background that differs from both other options, while those two have the same background as each other. Colours are compared as values (default, palette index or RGB) without converting between palette and RGB, so the rule works with palette or truecolor. All three equal, the highlight on another option, any other pattern, a label with mixed backgrounds, a default background onAllow once, reverse video on any label, text that changed before the key, or a backend that cannot read colours: refused with no key sent. Measured on OpenCode v2.2.7 only; the foreground is not checked, and a theme that highlights differently is unmeasured.Always allowis never selected, andRightis never sent.
- Not measured: MCP tools (the configured server was failing), number or letter
shortcuts and
Tabin the dialog, the effect ofAlways allow, and a file write without anaskrule.