OpenCode Config شیئر: Default Agent، Plugins اور Provider
canxin کی جانب سے • 3 منٹ کا مطالعہ •
فہرستِ مضامین
- 1. موجودہ configuration
- 2. Merge precedence
- 3. Top-level fields
- 4. default_agent = cx-local کا ماخذ
- 5. Plugin stack (اہم حصہ)
- 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):
- Remote
.well-known/opencode - Global
~/.config/opencode/opencode.json OPENCODE_CONFIG- Project
opencode.json .opencodedirectories (agents/commands/plugins)OPENCODE_CONFIG_CONTENT
Global layer طویل مدتی defaults کے لئے موزوں ہے: default_agent، model، small_model، مشترک providers اور 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 / کم لاگت |
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
کردار: پیچیدہ کام کے لئے 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 کے مطابق task routing
- branch/task context traceability
موزوں استعمال: ایک ہی repo میں متعدد tasks کو متوازی چلانا۔
5.4 opencode-web-preview
کردار: local frontend preview session management۔
Core capabilities:
- available preview sessions دریافت کرنا
- local preview host start/stop
- preview status check
موزوں استعمال: UI تبدیلیوں کی فوری 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کے ساتھ tool visibility برقرار رکھتے ہوئے کام کرنا
موزوں استعمال: کئی repos میں consistent agent strategy اور risk-based write defaults برقرار رکھنا۔
5.6 استعمال کی تجاویز
- safe default کے طور پر
default_agent = cx-localرکھیں۔ - صرف تب
cx-globalمنتخب کریں جب cross-directory auto-write واقعی ضروری ہو۔ - startup کے بعد
cx-explore / cx-local / cx-globalکی visibility 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 |
تبصرے