OpenCode Config Share: Default Agent, Plugins, and Providers

By canxin3 minutes read


Table of Contents

  1. 1. Current configuration
  2. 2. Merge precedence
  3. 3. Top-level fields
  4. 4. Where default_agent = cx-local comes from
  5. 5. Plugin stack (focus)
    1. 5.1 Plugin list (npm names)
    2. 5.2 opencode-planpilot
    3. 5.3 opencode-workbench
    4. 5.4 opencode-web-preview
    5. 5.5 opencode-cx-agents
    6. 5.6 Usage suggestions
  6. 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):

  1. Remote .well-known/opencode
  2. Global ~/.config/opencode/opencode.json
  3. OPENCODE_CONFIG
  4. Project opencode.json
  5. .opencode directories (agents/commands/plugins)
  6. OPENCODE_CONFIG_CONTENT

Global config is best for durable defaults: default_agent, model, small_model, shared providers, and shared plugins.

3. Top-level fields

FieldCurrent valuePurposeNote
$schemahttps://opencode.ai/config.jsonJSON validation and completionKeep enabled
autoupdatefalseDisable auto-updatesStability-first
compaction.autotrueAuto-compacts long sessionsRecommended
compaction.prunetruePrunes old tool outputReduces context bloat
default_agentcx-localDefault runtime agentProvided by plugin (recommended from 0.2.0)
modelopenai/gpt-5.3-codexPrimary modelMain path
small_modelopenai/gpt-5.1-codex-miniLightweight modelHelper path / cost control
plugin[]4 npm pluginsCapability extensionsEasy cross-machine reuse
provider.*.optionsbaseURL + apiKeyProvider connection settingsUses 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:

  1. Global config stays compact.
  2. 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:

Typical use: long multi-stage tasks that need clear progress tracking.

5.3 opencode-workbench

Role: parallel orchestration with branches/worktrees.
Core capabilities:

Typical use: concurrent tasks in the same repository.

5.4 opencode-web-preview

Role: local frontend preview session management.
Core capabilities:

Typical use: quick UI verification loops.

5.5 opencode-cx-agents

Role: provides reusable preset agents and permission baselines.
Core capabilities:

Typical use: consistent agent strategy across repositories with risk-based write defaults.

5.6 Usage suggestions

  1. Use default_agent = cx-local as the safe default.
  2. Switch to cx-global only when cross-directory writes are explicitly needed.
  3. After startup, verify that cx-explore / cx-local / cx-global are visible.

6. Provider and model routing

Current provider layout: single gateway domain with provider-specific routes.

ProviderbaseURLNotes
anthropichttps://gateway.example.com/v1Anthropic-compatible route
googlehttps://gateway.example.com/v1betaGemini-compatible route
openaihttps://gateway.example.com/v1OpenAI-compatible route

Comments