Skip to main content

OpenCode

OpenCode is a terminal coding agent. OpenCode runs interactively or executes one-shot tasks. Like every other harness, OpenCode installs into ~/.local rather than the image, and only when you run agro harness install opencode.

Install​

agro harness install <id> is the only door. It installs OpenCode into the already-running sandbox without a rebuild:

agro harness install opencode

Nothing installs OpenCode at boot, and no configuration key selects it. See Harnesses Overview for what the verb does and what happens when the sandbox is not running.

What the door runs​

AGRO installs the upstream npm package into the home mount as the sandbox user:

npm --prefix /home/sandbox/.local install -g opencode-ai

Verify the install inside the sandbox:

opencode --version

Authentication​

Run opencode auth login once and follow the prompts:

opencode auth login

For ChatGPT Plus and Pro users, choose OpenAI at the provider prompt to authenticate via OAuth. OpenCode stores credentials at ~/.local/share/opencode/auth.json inside the sandbox. The same flow is reachable from inside an interactive opencode session via the /connect slash command.

Provider API key environment variables are secondary. Use them when you need a non-OAuth provider or a service-account style setup.

Common usage​

# Start an interactive session
opencode

# Run a one-shot task
opencode run "Add input validation to the signup form"

Run interactive sessions in Herdr so the session survives a disconnect: agro tool install herdr, then herdr, then start opencode in a pane.

Upstream documentation​