設定
Oh My OpenAgent 完整設定參考 — 設定檔位置、智慧代理調優、類別對應、模型回退、Hooks、MCP 伺服器與背景任務並行度設定。
本頁內文若連結到尚未提供繁體版本的頁面(例如 /ecosystem/plugins/、/news/),會開啟英文原頁;導覽與頁尾標有 EN 的項目即為這類頁面。
有主見的預設值,如果你堅持可以調整。
設定檔位置
| 級別 | 路徑 | 優先順序 |
|---|---|---|
| 專案 | .opencode/oh-my-openagent.json[c] | 最高 |
| 全域 | ~/.config/opencode/oh-my-openagent.json[c] | 較低 |
相容層同時辨識 oh-my-openagent.json[c] 和舊的 oh-my-opencode.json[c] 檔名。現有安裝仍常使用舊的檔名。
支援 JSONC — 註解和尾隨逗號都可以使用。
智慧代理設定
覆寫任何智慧代理的模型、溫度、提示詞和權限:
{
"agents": {
"sisyphus": {
"model": "claude-opus-4-6",
"temperature": 0.7
},
"hephaestus": {
"model": "gpt-5.4"
},
"prometheus": {
"model": "claude-opus-4-6",
"temperature": 0.6
}
}
}
每個智慧代理的選項:
model— 使用哪個 LLMtemperature— 取樣溫度prompt_append— 追加到智慧代理系統提示詞的額外指令system_prompt_override— 取代整個系統提示詞max_tokens— 最大回應長度file://提示詞 — 從檔案載入提示詞文字
類別對應
Sisyphus 依類別委派。你可以定義對應到特定模型的自訂類別:
{
"categories": {
"visual-engineering": { "model": "claude-opus-4-6" },
"deep": { "model": "gpt-5.4" },
"quick": { "model": "kimi-k2.5" },
"ultrabrain": { "model": "gpt-5.4", "reasoning_effort": "xhigh" },
"business-logic": { "model": "claude-opus-4-6" },
"custom": { "model": "glm-5" }
}
}
內建類別:visual-engineering、deep、quick、ultrabrain。新增你需要的任何自訂類別。
模型回退
設定回退模型以確保可靠性:
{
"fallback_models": {
"default": ["claude-opus-4-6", "kimi-k2.5"],
"hephaestus": [
"gpt-5.4",
{ "model": "claude-opus-4-6", "reasoning_effort": "high" }
]
}
}
在同一個陣列中混合純模型字串和逐一回退物件。系統會依序嘗試每個回退,直到成功。
內建技能
設定內建技能:
| 技能 | 描述 | 預設 |
|---|---|---|
playwright | 瀏覽器自動化 | 啟用 |
git-master | 原子提交、rebase 精細操作 | 啟用 |
frontend-ui-ux | 設計優先的 UI | 啟用 |
停用技能:
{
"skills": {
"playwright": { "enabled": false }
}
}
新增自訂技能:
- 專案層級:
.opencode/skills/*/SKILL.md - 全域層級:
~/.config/opencode/skills/*/SKILL.md
Hooks
25 個以上的內建 hooks,全部可設定。停用特定 hooks:
{
"disabled_hooks": [
"comment-checker",
"auto-format"
]
}
Hooks 在各個生命週期節點執行:
- Pre-task:智慧代理執行前
- Post-task:智慧代理完成後
- On-error:發生錯誤時
- On-agent-switch:切換智慧代理時
內建 MCP 設定
三個 MCP 預設始終在線:
| MCP | 用途 | 可設定 |
|---|---|---|
websearch (Exa) | 網路搜尋 | API 金鑰、搜尋深度 |
context7 | 官方文件查詢 | 啟用/停用 |
grep_app (Grep.app) | GitHub 程式碼搜尋 | 啟用/停用 |
可以依標準 OpenCode MCP 設定格式新增自訂 MCP 伺服器。
後台任務並行
控制並行執行的智慧代理數量:
{
"background_tasks": {
"max_concurrent": 5,
"per_provider": {
"anthropic": 3,
"openai": 5,
"google": 2
}
}
}
依你的 API 頻率限制和訂閱層級進行調整。
LSP 設定
{
"lsp": {
"enabled": true,
"servers": {
"typescript": {
"command": "typescript-language-server",
"args": ["--stdio"]
}
}
}
}
實驗性功能
{
"experimental": {
"aggressive_truncation": true,
"auto_resume": true
}
}
- aggressive_truncation — 更激進地截斷上下文,以維持在限制內
- auto_resume — 從錯誤和上下文視窗限制自動恢復
完整設定範例
{
// 智慧代理模型
"agents": {
"sisyphus": {
"model": "claude-opus-4-6",
"temperature": 0.7
},
"hephaestus": {
"model": "gpt-5.4"
}
},
// 類別路由
"categories": {
"visual-engineering": { "model": "claude-opus-4-6" },
"deep": { "model": "gpt-5.4" },
"quick": { "model": "kimi-k2.5" },
"ultrabrain": { "model": "gpt-5.4", "reasoning_effort": "xhigh" }
},
// 回退模型
"fallback_models": {
"default": ["claude-opus-4-6", "kimi-k2.5"]
},
// 技能
"skills": {
"playwright": { "enabled": true },
"git-master": { "enabled": true },
"frontend-ui-ux": { "enabled": true }
},
// Hooks
"disabled_hooks": [],
// 後台任務
"background_tasks": {
"max_concurrent": 5,
"per_provider": {
"anthropic": 3,
"openai": 5
}
},
// LSP
"lsp": {
"enabled": true
},
// 實驗性
"experimental": {
"aggressive_truncation": true,
"auto_resume": true
}
}
驗證
執行 doctor 來驗證你的設定:
bunx oh-my-opencode doctor
它會檢查外掛註冊、設定語法、模型可用性與環境設定。