OpenCode Config Share: Default Agent, Plugins, and Providers
By canxin • 3 minutes read •
Table of Contents
- 1. Current configuration
- 2. Merge precedence
- 3. Top-level fields
- 4. Where default_agent = cx-local comes from
- 5. Plugin stack (focus)
- 6. Provider and model routing
1. Current configuration
{
"$schema": "https://opencode.ai/config.json",
"autoupdate": false,
"compaction": {
"auto": true,
"prune": true
},
"default_agent": "cx-local",
"model": "openai/gpt-5.3-codex",
"small_model": "openai/gpt-5.1-codex-mini",
"plugin": [
"opencode-planpilot",
"opencode-workbench",
"opencode-web-preview",
"opencode-cx-agents"
],
"provider": {
"anthropic": {
"options": {
"apiKey": "{env:CLAUDE_API_KEY}",
"baseURL": "https://gateway.example.com/v1"
}
},
"google": {
"options": {
"apiKey": "{env:GEMINI_API_KEY}",
"baseURL": "https://gateway.example.com/v1beta"
}
},
"openai": {
"options": {
"apiKey": "{env:OPENAI_API_KEY}",
"baseURL": "https://gateway.example.com/v1",
"setCacheKey": true
}
}
}
}2. Merge precedence
OpenCode precedence (low -> high):
- Remote
.well-known/opencode - Global
~/.config/opencode/opencode.json OPENCODE_CONFIG- Project
opencode.json .opencodedirectories (agents/commands/plugins)OPENCODE_CONFIG_CONTENT
Global config is best for durable defaults: default_agent, model, small_model, shared providers, and shared plugins.
3. Top-level fields
| Field | Current value | Purpose | Note |
|---|---|---|---|
$schema | https://opencode.ai/config.json | JSON validation and completion | Keep enabled |
autoupdate | false | Disable auto-updates | Stability-first |
compaction.auto | true | Auto-compacts long sessions | Recommended |
compaction.prune | true | Prunes old tool output | Reduces context bloat |
default_agent | cx-local | Default runtime agent | Provided by plugin (recommended from 0.2.0) |
model | openai/gpt-5.3-codex | Primary model | Main path |
small_model | openai/gpt-5.1-codex-mini | Lightweight model | Helper path / cost control |
plugin[] | 4 npm plugins | Capability extensions | Easy cross-machine reuse |
provider.*.options | baseURL + apiKey | Provider connection settings | Uses environment variables |
4. Where default_agent = cx-local comes from
cx-local is registered by the opencode-cx-agents plugin, not hand-written in a local agent block.
The plugin currently exposes canonical agents: cx-explore, cx-local, and cx-global.
Effects:
- Global config stays compact.
- If plugin loading fails, the default agent is not registered.
5. Plugin stack (focus)
5.1 Plugin list (npm names)
"plugin": [
"opencode-planpilot",
"opencode-workbench",
"opencode-web-preview",
"opencode-cx-agents"
]GitHub repositories:
5.2 opencode-planpilot
Role: structured execution for complex work.
Core capabilities:
- unified model:
plan -> step -> goal - explicit
ai / humanexecutor split - auto-continue when the next step executor is
ai
Typical use: long multi-stage tasks that need clear progress tracking.
5.3 opencode-workbench
Role: parallel orchestration with branches/worktrees.
Core capabilities:
- explicit session-to-worktree binding
- task routing per worktree for parallel development
- branch/task context traceability
Typical use: concurrent tasks in the same repository.
5.4 opencode-web-preview
Role: local frontend preview session management.
Core capabilities:
- discover available preview sessions
- start/stop local preview hosts
- check preview status for regression verification
Typical use: quick UI verification loops.
5.5 opencode-cx-agents
Role: provides reusable preset agents and permission baselines.
Core capabilities:
- canonical agents:
cx-explore,cx-local,cx-global - write permission tiers:
cx-local: workspace-first,external_directory: askcx-global: cross-directory writes,external_directory: allow
- works alongside
opencode-planpilot,opencode-workbench, andopencode-web-previewwhile keeping tool visibility
Typical use: consistent agent strategy across repositories with risk-based write defaults.
5.6 Usage suggestions
- Use
default_agent = cx-localas the safe default. - Switch to
cx-globalonly when cross-directory writes are explicitly needed. - After startup, verify that
cx-explore / cx-local / cx-globalare visible.
6. Provider and model routing
Current provider layout: single gateway domain with provider-specific routes.
| Provider | baseURL | Notes |
|---|---|---|
anthropic | https://gateway.example.com/v1 | Anthropic-compatible route |
google | https://gateway.example.com/v1beta | Gemini-compatible route |
openai | https://gateway.example.com/v1 | OpenAI-compatible route |
Comments