OpenCode Config शेयर: Default Agent, Plugins और Provider
canxin द्वारा • 3 मिनट पढ़ने का समय •
विषय सूची
- 1. वर्तमान कॉन्फ़िगरेशन
- 2. Merge precedence
- 3. Top-level fields
- 4. default_agent = cx-local का स्रोत
- 5. Plugin stack (मुख्य भाग)
- 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):
- Remote
.well-known/opencode - Global
~/.config/opencode/opencode.json OPENCODE_CONFIG- Project
opencode.json .opencodedirectories (agents/commands/plugins)OPENCODE_CONFIG_CONTENT
Global layer long-term defaults के लिए उपयुक्त है: default_agent, model, small_model, shared providers और shared plugins.
3. Top-level fields
| Field | Current value | भूमिका | नोट |
|---|---|---|---|
$schema | https://opencode.ai/config.json | JSON validation + autocomplete | रखना चाहिए |
autoupdate | false | Auto update बंद | Stability-first workflow |
compaction.auto | true | लंबे sessions auto compact | Recommended |
compaction.prune | true | पुराने tool output prune | Context bloat कम करता है |
default_agent | cx-local | Default agent | Plugin द्वारा उपलब्ध (0.2.0 से recommended) |
model | openai/gpt-5.3-codex | Main model | Primary path |
small_model | openai/gpt-5.1-codex-mini | Lightweight model | Helper path / cost |
plugin[] | 4 npm plugins | Capability extension | Cross-machine reuse आसान |
provider.*.options | baseURL + apiKey | Provider connection settings | Environment 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।
प्रभाव:
- Global config compact रहती है।
- 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:
- unified model:
plan -> step -> goal ai / humanexecutor split- next executor
aiहोने पर auto-continue
उपयुक्त परिदृश्य: multi-stage लंबे tasks जिनमें progress tracking जरूरी हो।
5.3 opencode-workbench
भूमिका: branch/worktree आधारित parallel orchestration.
Core capabilities:
- session-to-worktree explicit binding
- worktree-wise task routing
- branch/task context traceability
उपयुक्त परिदृश्य: एक ही repo में parallel task execution.
5.4 opencode-web-preview
भूमिका: local frontend preview session management.
Core capabilities:
- available preview sessions detect करना
- local preview host start/stop
- preview status check
उपयुक्त परिदृश्य: UI changes की तेज validation.
5.5 opencode-cx-agents
भूमिका: reusable preset agents और permission baseline प्रदान करना।
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
opencode-planpilot,opencode-workbench, औरopencode-web-previewके साथ compatible रहते हुए tool visibility बनाए रखना
उपयुक्त परिदृश्य: multiple repos में consistent agent strategy और risk-based write defaults रखना।
5.6 उपयोग सुझाव
- safe default के रूप में
default_agent = cx-localरखें। - cross-directory auto-write की स्पष्ट जरूरत हो तभी
cx-globalचुनें। - startup के बाद
cx-explore / cx-local / cx-globalvisibility verify करें।
6. Provider और model routing
वर्तमान layout: एक gateway domain, provider-specific routes.
| Provider | baseURL | विवरण |
|---|---|---|
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 |
टिप्पणियां