opencode-ai (v1.14.33+). Active upstream is github.com/anomalyco/opencode (sst/opencode redirects there).
Install
Auth (BYOK across 75+ providers)
OpenCode reads provider credentials from env vars based on whichprovider/model you pick. Crewship’s apiKeyEnvVarsForAdapter("OPENCODE") accepts:
Add any of the above as a
SECRET-type credential and assign to your OpenCode agent.
Models
OpenCode requiresprovider/model namespaced strings (NOT bare IDs). Curated picker entries:
Command shape
--format json (NOT --output-format) emits JSONL events.
MCP
Configured at/output/<slug>/opencode.json:
- Top key is
mcp(NOTmcpServers) type: local(stdio) orremote(HTTP/SSE)commandis an ARRAY (binary + args together)- env field is
environment(NOTenv) - Each entry carries
"enabled": true - Env-var syntax is
{env:VAR}(NOT${VAR}) — Crewship translates standard${VAR}form on write
Crewship auto-injects two sidecar-hosted servers under
mcp (injectMemoryMCP + injectRoutinesMCP): crewship-memory and crewship-routines, both type: remote pointing at http://127.0.0.1:9119/mcp/memory/<slug> and .../mcp/routines. A user-declared server of the same name wins.Memory
AGENTS.md is OpenCode’s auto-discovered system instructions file. Crewship writes it as part of the canonical memory set. For turn-1 parity (OpenCode discovers AGENTS.md on the second invocation, not the first), the orchestrator also prepends the preamble inline with [SYSTEM]/[USER] delimiters on the first turn — turn-2+ uses the file.
Output stream
Flat JSONL perpackages/opencode/src/cli/cmd/run.ts:
type IS the part type at top level — NOT a nested message.part.updated envelope. step_finish (snake_case, NOT hyphen).
Troubleshooting
Bare model rejected — useprovider/model form (anthropic/claude-sonnet-4-6 not claude-sonnet-4-6).
MCP server uses literal ${VAR} token — Cursor/Claude ${VAR} syntax incompatible; ensure Crewship’s writer translated to {env:VAR}. Check by cat /output/<slug>/opencode.json.