Overview
OpenCode is being added as a community AI assistant provider for Archon. This issue tracks the implementation progress and serves as a central reference for the two open PRs.
Related PRs
Motivation
Users have requested the ability to use OpenCode as an alternative to Claude Code within Archon workflows (see closed issue #1151). The adapters pattern allows Archon to remain CLI-agnostic while keeping Claude Code as the default.
Architecture (from PR #1372 design doc)
OpenCode is a client/server AI coding agent (unlike Claude Code/Codex which are monolithic CLIs). The provider:
- Lazy-starts an OpenCode Server (
opencode serve) on first use with lifecycle management
- Connects via
@opencode-ai/sdk using createOpencodeClient
- Bridges SSE events to Archon's
MessageChunk async generator contract
- Manages session lifecycle (create/resume/abort) via SDK
Key files
packages/providers/src/community/opencode/
├── provider.ts # OpenCodeProvider class
├── capabilities.ts # OPENCODE_CAPABILITIES
├── config.ts # parseOpencodeConfig
├── server-manager.ts # OpenCode Server lifecycle
├── event-bridge.ts # SSE Event → MessageChunk
├── registration.ts # registerOpencodeProvider()
├── index.ts # Public exports
├── provider.test.ts # Tests
└── config.test.ts # Config tests
Event Bridge Mapping
| OpenCode Event |
Archon MessageChunk |
message.part.updated (text delta) |
assistant |
message.part.updated (reasoning) |
thinking |
message.part.updated (tool call) |
tool |
message.part.updated (tool result) |
tool_result |
message.updated (assistant complete) |
result (with tokens) |
session.error |
result (isError: true) |
What's Implemented
| Capability |
Status |
Notes |
| sessionResume |
✅ |
Session IDs persisted by OpenCode Server |
| mcp |
✅ |
Native MCP support via OpenCode |
| skills |
✅ |
Injected via systemPrompt |
| toolRestrictions |
✅ |
allowed_tools / denied_tools mapped to SDK |
| structuredOutput |
✅ |
SDK-native JSON Schema support |
| envInjection |
✅ |
Per-request env vars |
| effortControl |
✅ |
Via reasoning effort |
| thinkingControl |
✅ |
Via reasoning toggle |
| agents |
✅ (via #1384) |
|
| hooks |
❌ |
Archon hooks ≠ OpenCode plugins |
| costControl |
❌ |
No cost limit API |
| fallbackModel |
❌ |
No automatic fallback |
| sandbox |
❌ |
No sandbox support |
Configuration
# .archon/config.yaml
assistants:
opencode:
model: anthropic/claude-sonnet-4
hostname: 127.0.0.1
port: 4096
autoStartServer: true
Reference: OpenCode Repo Structure
The OpenCode provider connects to anomalyco/opencode which has:
- SDK:
packages/sdk/js/ — createOpencodeClient factory, v2 client
- Provider system:
packages/opencode/src/provider/ — auth, models, schema
- ACP (Agent Communication Protocol):
packages/opencode/src/acp/ — agent, session, types
- MCP server support, skill system, and agent interface already built in
Next Steps
Overview
OpenCode is being added as a community AI assistant provider for Archon. This issue tracks the implementation progress and serves as a central reference for the two open PRs.
Related PRs
feat: add OpenCode community provider #1372 —
feat: add OpenCode community provider(bychoufeng)@opencode-ai/sdkfeat(providers): add OpenCode community provider with agents support #1384 —
feat(providers): add OpenCode community provider with agents support(bycropse)nodeConfig.agentsto OpenCode's runtime APIMotivation
Users have requested the ability to use OpenCode as an alternative to Claude Code within Archon workflows (see closed issue #1151). The adapters pattern allows Archon to remain CLI-agnostic while keeping Claude Code as the default.
Architecture (from PR #1372 design doc)
OpenCode is a client/server AI coding agent (unlike Claude Code/Codex which are monolithic CLIs). The provider:
opencode serve) on first use with lifecycle management@opencode-ai/sdkusingcreateOpencodeClientMessageChunkasync generator contractKey files
Event Bridge Mapping
message.part.updated(text delta)assistantmessage.part.updated(reasoning)thinkingmessage.part.updated(tool call)toolmessage.part.updated(tool result)tool_resultmessage.updated(assistant complete)result(with tokens)session.errorresult(isError: true)What's Implemented
allowed_tools/denied_toolsmapped to SDKConfiguration
Reference: OpenCode Repo Structure
The OpenCode provider connects to
anomalyco/opencodewhich has:packages/sdk/js/—createOpencodeClientfactory, v2 clientpackages/opencode/src/provider/— auth, models, schemapackages/opencode/src/acp/— agent, session, typesNext Steps