class LittleGhost::Harnesses::OpenCode

Runs OpenCode with opencode run --format json --agent build.

In :isolated mode every tool permission is granted without prompting and the provider’s API key is the placeholder. In :native_guards mode OpenCode may read and edit files in the working directory, every other permission, including shell commands, web access, and directories outside the working directory, is denied, and OpenCode authenticates from the inherited environment. Project configuration in the working directory is ignored, automatic updates and sharing are disabled, the harness adds only the request’s mcp_servers, and OpenCode’s XDG directories live under home. OpenCode merges this configuration over its global configuration, so MCP servers or other settings in a persistent home still apply.

defaults accepts:

:provider

OpenCode provider identifier, such as "openrouter". Requests name models as provider/model.

:base_url

Base URL for that provider, for example a Network::Facade address.

:api_key

Placeholder API key for that provider in :isolated mode. A gateway replaces it.

:model

Model used when the request does not name one.

:config

Additional OpenCode configuration merged into the generated configuration.

OpenCode has no reasoning effort option, so it ignores a request’s effort.

OpenCode reports cost and token usage after each step, so run stops it when cost exceeds budget_usd. Each finished step counts toward max_turns.