# opencode

> For the complete documentation index, see [llms.txt](https://docs.ringleader.dev/llms.txt).


> The OpenCode CLI, installed globally with npm.


Installs the OpenCode CLI (`opencode`) as the global npm package `@opencode/cli`.

```yaml
devtools:
  - name: nodejs
  - name: opencode
```

That is the whole install. Ringleader turns off OpenCode's automations and update offer, as
[OpenCode defaults](https://docs.ringleader.dev/workstations/coding-agents/coding-agent-setup/#opencode-defaults)
describes. To set a model or other settings, add an
[`opencode` toolconfig](https://docs.ringleader.dev/reference/tools/tool-configuration/opencode/). To sign in, see
[Sign in to a coding agent](https://docs.ringleader.dev/workstations/coding-agents/coding-agent-setup/#sign-in-to-a-coding-agent).

## Version behavior

| `version` | Result |
|-----------|--------|
| omitted | the release Ringleader installs by default, `2.4.0` today |
| `2.4.0` | that exact npm version |

A workstation where `opencode` runs keeps the release it has. A changed `version` replaces that
release on the next configuration pass. If `opencode` is on the PATH but fails to run,
Ringleader installs it again.

### OpenCode 1.x

OpenCode 1.x came from another npm package, `opencode-ai`. Ringleader does not replace it, so a
workstation that still has OpenCode 1.x keeps it, and OpenCode fails to install if you set `version`.
To move to a release in the table, remove the old package on the workstation:

```bash
sudo npm uninstall -g opencode-ai
```

The next configuration pass then installs OpenCode from `@opencode/cli`.

## Updates

With `updatePolicy: latest` and no `version`, OpenCode moves to the release Ringleader installs
by default when an update to Ringleader raises it, by the
[Ringleader default route](https://docs.ringleader.dev/reference/tools/devtools/#update-routes). It installs from npm, beside the old release, so an
OpenCode session that is already running keeps its release.

## Node.js

The recipe needs npm. [Node.js for coding agents](https://docs.ringleader.dev/reference/tools/devtools/nodejs/#nodejs-for-coding-agents)
says which Node.js OpenCode runs on and what Ringleader installs when you declare none.

## Example

Node 24, OpenCode, and a default model:

```yaml
devtools:
  - name: nodejs
    version: "24"
  - name: opencode
toolconfigs:
  - name: opencode
    config:
      settings:
        model: anthropic/claude-sonnet-4-5
```

## Notes

- Ringleader's two OpenCode defaults are in the
  [OpenCode defaults](https://docs.ringleader.dev/workstations/coding-agents/coding-agent-setup/#opencode-defaults).
  Apart from them, only what you declare in the toolconfig is written.
- The binary lands on the system PATH.
- Works on Debian, Ubuntu, and Alpine.

