zerohead
Get started

Agents

OpenCode

Run OpenCode as a zerohead agent, with its settings and how its tools work, though it has not yet run for real.

The source is not public yet. It will be published under MIT. The pages under Contributing describe working on it once it is.

The OpenCode adapter starts the OpenCode command-line tool once for each run.

OpenCode has never run for real through zerohead. The adapter was written from OpenCode's help text and documentation. Its output format is assumed, not observed.

What you install

Install OpenCode yourself and connect a provider to it. Its own opencode auth login command does that. You can also give a provider's API key to the agent in its Environment setting. Check OpenCode's documentation for the variable your provider uses.

Settings

Choose OpenCode as the Adapter.

SettingWhat it does
CommandA program name or path to run instead of opencode.
ModelIn provider/model form. Empty means OpenCode's own default.
OpenCode agentThe name of an OpenCode agent to run.
Approve permissions automaticallyOn by default. Permissions that are not explicitly denied are approved, so a run is not left waiting for you.
EnvironmentVariables the program starts with, such as an API key. Values are kept private.

How it runs

zerohead runs opencode run --standalone --format json, with --auto when Approve permissions automatically is on. The prompt goes on the command line, so a prompt that starts with - is refused. Standard input is closed.

How zerohead's tools reach it

For each run zerohead writes OpenCode's configuration for the zerohead tool server into a private temporary folder, and points OpenCode at it with XDG_CONFIG_HOME. The config names the token variable, not the token. The token goes in the environment variable ZEROHEAD_MCP_TOKEN. The folder is removed when the run ends. Your own OpenCode data folder is left as it is, so saved sign-ins still work.

What it can do without asking

With automatic approval on, OpenCode approves every permission that is not explicitly denied. To limit it, turn that off, or deny tools in an OpenCode agent and name it in OpenCode agent. What OpenCode does with a permission question when automatic approval is off has not been tried.

How results are read

OpenCode's JSON event format is not published. zerohead reads the fields it recognises. Lines it does not recognise are kept as plain text in the run log. The exit code decides success, except that an explicit error event fails a run even when the exit code is 0.

Sessions

Each run starts a fresh session.

zeroheadHomeMIT license