OpenCode Config शेयर: Default Agent, Plugins और Provider

canxin द्वारा3 मिनट पढ़ने का समय


विषय सूची

साझा करें

विषय सूची

  1. 1. वर्तमान कॉन्फ़िगरेशन
  2. 2. Merge precedence
  3. 3. Top-level fields
  4. 4. default_agent = cx-local का स्रोत
  5. 5. Plugin stack (मुख्य भाग)
    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 उपयोग सुझाव
  6. 6. Provider और model routing

1. वर्तमान कॉन्फ़िगरेशन

{
  "$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 layer long-term defaults के लिए उपयुक्त है: default_agent, model, small_model, shared providers और shared plugins.

3. Top-level fields

FieldCurrent valueभूमिकानोट
$schemahttps://opencode.ai/config.jsonJSON validation + autocompleteरखना चाहिए
autoupdatefalseAuto update बंदStability-first workflow
compaction.autotrueलंबे sessions auto compactRecommended
compaction.prunetrueपुराने tool output pruneContext bloat कम करता है
default_agentcx-localDefault agentPlugin द्वारा उपलब्ध (0.2.0 से recommended)
modelopenai/gpt-5.3-codexMain modelPrimary path
small_modelopenai/gpt-5.1-codex-miniLightweight modelHelper path / cost
plugin[]4 npm pluginsCapability extensionCross-machine reuse आसान
provider.*.optionsbaseURL + apiKeyProvider connection settingsEnvironment variables उपयोग

4. default_agent = cx-local का स्रोत

cx-local को opencode-cx-agents plugin register करता है; local config में manual agent block की जरूरत नहीं होती।

यह plugin canonical agents देता है: cx-explore, cx-local, cx-global

प्रभाव:

  1. Global config compact रहती है।
  2. Plugin load fail होने पर default agent register नहीं होता।

5. Plugin stack (मुख्य भाग)

5.1 Plugin list (npm names)

"plugin": [
  "opencode-planpilot",
  "opencode-workbench",
  "opencode-web-preview",
  "opencode-cx-agents"
]

GitHub repositories:

5.2 opencode-planpilot

भूमिका: complex tasks के लिए structured execution.
Core capabilities:

उपयुक्त परिदृश्य: multi-stage लंबे tasks जिनमें progress tracking जरूरी हो।

5.3 opencode-workbench

भूमिका: branch/worktree आधारित parallel orchestration.
Core capabilities:

उपयुक्त परिदृश्य: एक ही repo में parallel task execution.

5.4 opencode-web-preview

भूमिका: local frontend preview session management.
Core capabilities:

उपयुक्त परिदृश्य: UI changes की तेज validation.

5.5 opencode-cx-agents

भूमिका: reusable preset agents और permission baseline प्रदान करना।
Core capabilities:

उपयुक्त परिदृश्य: multiple repos में consistent agent strategy और risk-based write defaults रखना।

5.6 उपयोग सुझाव

  1. safe default के रूप में default_agent = cx-local रखें।
  2. cross-directory auto-write की स्पष्ट जरूरत हो तभी cx-global चुनें।
  3. startup के बाद cx-explore / cx-local / cx-global visibility verify करें।

6. Provider और model routing

वर्तमान layout: एक gateway domain, provider-specific routes.

ProviderbaseURLविवरण
anthropichttps://gateway.example.com/v1Anthropic-compatible route
googlehttps://gateway.example.com/v1betaGemini-compatible route
openaihttps://gateway.example.com/v1OpenAI-compatible route

टिप्पणियां