OpenCode Config شیئر: Default Agent، Plugins اور Provider

canxin کی جانب سے3 منٹ کا مطالعہ


فہرستِ مضامین

  1. 1. موجودہ configuration
  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. موجودہ 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 layer طویل مدتی defaults کے لئے موزوں ہے: default_agent، model، small_model، مشترک providers اور 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 / کم لاگت
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

کردار: پیچیدہ کام کے لئے structured execution۔
Core capabilities:

موزوں استعمال: multi-stage لمبے tasks جہاں progress tracking درکار ہو۔

5.3 opencode-workbench

کردار: branch/worktree بنیاد پر parallel orchestration۔
Core capabilities:

موزوں استعمال: ایک ہی repo میں متعدد tasks کو متوازی چلانا۔

5.4 opencode-web-preview

کردار: local frontend preview session management۔
Core capabilities:

موزوں استعمال: UI تبدیلیوں کی فوری validation۔

5.5 opencode-cx-agents

کردار: reusable preset agents اور permission baseline فراہم کرنا۔
Core capabilities:

موزوں استعمال: کئی repos میں consistent agent strategy اور risk-based write defaults برقرار رکھنا۔

5.6 استعمال کی تجاویز

  1. safe default کے طور پر default_agent = cx-local رکھیں۔
  2. صرف تب cx-global منتخب کریں جب cross-directory auto-write واقعی ضروری ہو۔
  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

تبصرے