# Engine: OpenCode

The open source coding agent, **beta**: any model of a provider you have a key for. Harness runs OpenCode as it is and
does not rewrite its settings; what differs from Claude Code is listed in the box **What changes with OpenCode**
(Settings -> Engine -> OpenCode). See [Engines](engines.md) for what is common to every engine.

## Sign-in and providers

No account: a key. Put it in Settings -> Keys, then choose it in Settings -> Providers: **OpenRouter** (free models
included), **Anthropic API**, **OpenAI API**, **Mistral API**, **xAI API**, **Alibaba Cloud Model Studio**, **Moonshot AI
API**, **DeepSeek API**, and the keys of two monthly plans: **Kimi Code plan**, **Alibaba Coding Plan**. **Install** in its panel downloads the version Harness was tested with;
its data stays in Harness's own folder.

## Models

`provider/model` (`openrouter/z-ai/glm-4.6`...): the default model, a small model, and favourites picked in the list
of the providers whose key is selected (free models first). No effort levels.

## What works

Conversation, tools, files and the Changes view, memory, skills, MCP servers, Harness Browser, Devices, steer, agents,
the Sandbox mode of a topic, sandboxed agents, the small calls.

## How Harness adapts it

- **Memory**: the folder's CLAUDE.md, its imports and the levels above are given as its instructions.
- **Rules**: OpenCode has no rules Harness relies on, so they hold **inside the Sandbox only** (see
  [Engines](engines.md)). Outside it, a session runs with full access, the deny rules and "Protect the secrets" do not
  apply, and a note says so once per session. In the Sandbox, Harness's sandbox goes around the whole of OpenCode,
  with the walls Claude Code would get (the folders it may write, secrets and home folder hidden, the allowed sites
  plus its providers' APIs). Its `maxxing` commands run outside the sandbox, as with Claude Code: an agent you talk
  with changes its own schedule, a session adds a task or a notification. The Sandbox needs bubblewrap and `socat` on
  the server (`maxxing agents sandbox-setup`).
- **An agent's forbidden tools**: inside the Sandbox, writing, the web and MCP servers are enforced by the walls;
  finer rules (a forbidden command) cannot be enforced and the agent is refused with the reason. An agent that has
  forbidden tools, deny rules or its own rules while its Sandbox is off is refused too.
- **Its own features** are left as they are: its scheduler, its image and video tools. Their cost is billed by the
  provider apart from the turn's cost. To schedule work that shows in Crons with a budget and guards, use
  `maxxing cron` or an agent's schedules.
- **MCP servers in the Sandbox**: the local ones run outside its walls, as Claude Code runs them (so `npx` servers
  and the Harness Browser's "take over" work); remote ones are let through its allowed sites.
- **Skills**: the list of your skills is in its instructions.
- **MCP servers**: those of Settings -> MCP and Harness's own; a sign-in done in Claude Code is reused.
- **Cost**: in dollars, as the provider reports it.

## Limits

Refused with the reason, never run on another engine: plan mode, the Ask me mode and an agent's approvals, Add to
task, side questions, an agent's own rules. Pictures attached to a message are given as file paths. The topic's agents
are not offered to it and it cannot ask you questions in the middle of a turn. The OpenRouter credits are shown in the
sidebar instead of subscription limits. Free models are often slow or rate-limited.

## From a terminal

```
maxxing engines install opencode
maxxing engines provider openrouter OPENROUTER_API_KEY
maxxing engines use opencode
maxxing engines model opencode openrouter/z-ai/glm-4.6     (--small: its small model)
maxxing engines favorite opencode openrouter/acme/fast:free [--remove]
```
