@metaharness/host-opencode
v0.1.2
Published
OpenCode (sst/opencode) host adapter for agent-harness-generator. Emits .opencode/opencode.json (ADR-036).
Maintainers
Readme
@metaharness/host-opencode
OpenCode (sst/opencode) host adapter for agent-harness-generator. The 8th host adapter, per ADR-036.
What it does
Generates the config files a harness needs to run inside OpenCode, the open-source terminal AI coding agent by SST.
Emits per adapter.generateConfig(spec):
.opencode/opencode.json— the OpenCode 1.x project-scoped config:$schemaanchor,mcp.serversregistration table,mcp.permissionsallow/deny blockinstall.md— runbook foropencode auth login, model-provider selection, and the first-boot smoke
Schema (OpenCode 1.x)
{
"$schema": "https://opencode.ai/schema/opencode.json",
"mcp": {
"servers": {
"codeindex": {
"command": "node",
"args": ["./dist/mcp-server.js"],
"env": { "LOG_LEVEL": "info" }
},
"remote": {
"url": "https://example.com/mcp"
}
},
"permissions": {
"allow": ["mcp__codeindex__*"],
"deny": ["Bash(rm:*)", "Bash(git push:*)"]
}
}
}Default-deny composition
OpenCode evaluates mcp.permissions.deny before allow. This adapter
copies the harness's .harness/mcp-policy.json deny rules verbatim, so the
default-deny posture from ADR-022
wins through OpenCode's own enforcement gate — no second source of truth.
Constraints
- OpenCode 1.0+ — earlier 0.x versions had a different config layout
- A model provider configured (
opencode auth login) .opencode/opencode.jsonis re-read on:reload, not hot-edit
Programmatic use
This adapter is normally consumed via npx metaharness <name> --host opencode.
Direct programmatic use:
import { adapter } from '@metaharness/host-opencode';
const files = adapter.generateConfig!(harnessSpec);
// files === { '.opencode/opencode.json': '...', 'install.md': '...' }License
MIT — see LICENSE.
