name: oh-my-opencode-config description: Oh My OpenCode 模型配置管理 - 查看和修改 agent 模型配置。触发词:"配置模型"、"切换模型"、"model config"、"agent 配置"
Oh My OpenCode Config
管理 Oh My OpenCode 插件的 agent 模型配置。
触发条件
- "配置模型"、"切换模型"、"更换模型"
- "model config"、"agent config"
- "查看 agent 配置"、"显示模型配置"
- 提及 oh-my-opencode 配置
配置文件
位置:~/.config/opencode/oh-my-opencode.json
{
"$schema": "https://raw.githubusercontent.com/code-yeongyu/oh-my-opencode/master/assets/oh-my-opencode.schema.json",
"agents": {
"Sisyphus": { "model": "provider/model-name" },
"sisyphus-junior": { "model": "provider/model-name" },
"oracle": { "model": "provider/model-name" },
"librarian": { "model": "provider/model-name" },
"explore": { "model": "provider/model-name" },
"multimodal-looker": { "model": "provider/model-name" },
"prometheus": { "model": "provider/model-name" },
"metis": { "model": "provider/model-name" },
"momus": { "model": "provider/model-name" },
"atlas": { "model": "provider/model-name" },
"build": { "model": "provider/model-name" },
"plan": { "model": "provider/model-name" },
"frontend-ui-ux-engineer": { "model": "provider/model-name" },
"document-writer": { "model": "provider/model-name" }
}
}
Agent 说明
| Agent | 用途 | 推荐模型 |
|---|---|---|
| Sisyphus | 主编排 agent,处理所有用户交互 | claude-opus-4.5, gpt-5.2 |
| sisyphus-junior | 轻量级子 agent,处理简单任务 | claude-sonnet-4, glm-4.7 |
| oracle | 高级技术顾问,架构决策 | gpt-5.2, claude-opus-4.5 |
| librarian | 文档/代码搜索,外部资源查找 | glm-4.7, gemini-2.5-flash |
| explore | 代码库探索,内部搜索 | glm-4.7, gemini-2.5-flash |
| multimodal-looker | 图片/PDF 分析 | claude-opus-4.5, gemini-2.5-pro |
| prometheus | 规划 agent,任务分解 | gpt-5.2, claude-opus-4.5 |
| metis | 规划咨询,策略建议 | claude-sonnet-4, glm-4.7 |
| momus | 规划审查,质量把控 | claude-sonnet-4, glm-4.7 |
| atlas | 地图导航,项目结构理解 | claude-sonnet-4, glm-4.7 |
| build | 构建 agent,编译部署 | claude-sonnet-4, glm-4.7 |
| plan | 规划 agent,任务规划 | gpt-5.2, claude-opus-4.5 |
| frontend-ui-ux-engineer | 前端 UI/UX 开发 | gemini-3-pro, claude-sonnet-4 |
| document-writer | 文档编写 | glm-4.7, gemini-2.5-flash |
| data-analyst | 数据分析,K线/技术指标 | claude-sonnet-4, glm-4.7 |
| financial-risk-auditor | 风控审计,策略风险评估 | gpt-5.2, claude-opus-4.5 |
| quant-trading-engineer | 量化交易代码开发 | claude-sonnet-4, glm-4.7 |
可用 Provider
从 opencode.json 配置的 provider:
| Provider | 说明 |
|---|---|
| github-copilot | GitHub Copilot(需要订阅) |
| deerapi | DeerAPI 代理服务 |
| zhipuai-coding-plan | 智谱 AI 编程套餐 |
| anthropic | Anthropic 官方 |
| openai | OpenAI 官方 |
操作命令
查看可用模型
脚本会自动调用 opencode models 获取可用模型列表:
# 查看所有 provider 及模型数量
python scripts/configure.py --list-models
# 查看指定 provider 的模型
python scripts/configure.py --list-models github-copilot
# 查看 provider 配置
python scripts/configure.py --show-providers
模型名称验证
配置模型时会自动验证名称是否有效。如果无效,会提供相似建议:
# 错误的模型名会被拦截
$ python scripts/configure.py --agent oracle --model "github-copilot/claude-opus-4-5"
Error: Model 'github-copilot/claude-opus-4-5' not found in available models.
Did you mean one of these?
- github-copilot/claude-opus-4.5
- github-copilot/claude-opus-41
- github-copilot/claude-haiku-4.5
# 跳过验证(强制设置)
python scripts/configure.py --agent oracle --model "custom/model" --force
查看当前配置
python scripts/configure.py --show
修改单个 agent
python scripts/configure.py --agent Sisyphus --model "github-copilot/claude-opus-4.5"
批量修改(使用预设)
# 顶配模式:最高配置
python scripts/configure.py --preset ultra
# 高性能模式:所有 agent 使用顶级模型
python scripts/configure.py --preset high-performance
# 经济模式:使用成本较低的模型
python scripts/configure.py --preset budget
# 混合模式:主 agent 用顶级,辅助 agent 用经济
python scripts/configure.py --preset hybrid
预设配置
ultra (顶配)
{
"Sisyphus": "github-copilot/claude-sonnet-4.5",
"sisyphus-junior": "github-copilot/claude-sonnet-4",
"oracle": "github-copilot/gpt-5.2",
"librarian": "github-copilot/claude-sonnet-4",
"explore": "github-copilot/claude-sonnet-4",
"multimodal-looker": "github-copilot/claude-opus-4.5",
"prometheus": "github-copilot/gpt-5.2",
"metis": "github-copilot/claude-sonnet-4",
"momus": "github-copilot/claude-sonnet-4",
"atlas": "github-copilot/claude-sonnet-4",
"build": "github-copilot/claude-sonnet-4",
"plan": "github-copilot/gpt-5.2",
"frontend-ui-ux-engineer": "github-copilot/gemini-3-pro-preview",
"document-writer": "github-copilot/claude-sonnet-4",
"data-analyst": "github-copilot/claude-sonnet-4",
"financial-risk-auditor": "github-copilot/gpt-5.2",
"quant-trading-engineer": "github-copilot/claude-sonnet-4"
}
high-performance
{
"Sisyphus": "github-copilot/claude-opus-4.5",
"sisyphus-junior": "github-copilot/claude-sonnet-4",
"oracle": "github-copilot/gpt-5.2",
"librarian": "github-copilot/claude-sonnet-4",
"explore": "github-copilot/claude-sonnet-4",
"multimodal-looker": "github-copilot/claude-opus-4.5",
"prometheus": "github-copilot/gpt-5.2",
"metis": "github-copilot/claude-sonnet-4",
"momus": "github-copilot/claude-sonnet-4",
"atlas": "github-copilot/claude-sonnet-4",
"build": "github-copilot/claude-sonnet-4",
"plan": "github-copilot/gpt-5.2",
"frontend-ui-ux-engineer": "github-copilot/claude-sonnet-4",
"document-writer": "github-copilot/claude-sonnet-4",
"data-analyst": "github-copilot/claude-sonnet-4",
"financial-risk-auditor": "github-copilot/gpt-5.2",
"quant-trading-engineer": "github-copilot/claude-sonnet-4"
}
budget
{
"Sisyphus": "zhipuai-coding-plan/glm-4.7",
"sisyphus-junior": "zhipuai-coding-plan/glm-4.7",
"oracle": "zhipuai-coding-plan/glm-4.7",
"librarian": "zhipuai-coding-plan/glm-4.7",
"explore": "zhipuai-coding-plan/glm-4.7",
"multimodal-looker": "zhipuai-coding-plan/glm-4.7",
"prometheus": "zhipuai-coding-plan/glm-4.7",
"metis": "zhipuai-coding-plan/glm-4.7",
"momus": "zhipuai-coding-plan/glm-4.7",
"atlas": "zhipuai-coding-plan/glm-4.7",
"build": "zhipuai-coding-plan/glm-4.7",
"plan": "zhipuai-coding-plan/glm-4.7",
"frontend-ui-ux-engineer": "zhipuai-coding-plan/glm-4.7",
"document-writer": "zhipuai-coding-plan/glm-4.7",
"data-analyst": "zhipuai-coding-plan/glm-4.7",
"financial-risk-auditor": "zhipuai-coding-plan/glm-4.7",
"quant-trading-engineer": "zhipuai-coding-plan/glm-4.7"
}
hybrid (推荐)
{
"Sisyphus": "github-copilot/claude-opus-4.5",
"sisyphus-junior": "zhipuai-coding-plan/glm-4.7",
"oracle": "github-copilot/gpt-5.2",
"librarian": "zhipuai-coding-plan/glm-4.7",
"explore": "zhipuai-coding-plan/glm-4.7",
"multimodal-looker": "github-copilot/claude-opus-4.5",
"prometheus": "github-copilot/gpt-5.2",
"metis": "zhipuai-coding-plan/glm-4.7",
"momus": "zhipuai-coding-plan/glm-4.7",
"atlas": "zhipuai-coding-plan/glm-4.7",
"build": "zhipuai-coding-plan/glm-4.7",
"plan": "github-copilot/gpt-5.2",
"frontend-ui-ux-engineer": "github-copilot/claude-sonnet-4",
"document-writer": "zhipuai-coding-plan/glm-4.7",
"data-analyst": "zhipuai-coding-plan/glm-4.7",
"financial-risk-auditor": "github-copilot/gpt-5.2",
"quant-trading-engineer": "zhipuai-coding-plan/glm-4.7"
}
执行流程
- 识别意图 - 用户想查看还是修改配置
- 读取配置 - 加载当前 oh-my-opencode.json
- 执行操作 - 显示/修改配置
- 验证 - 确保 JSON 格式正确
- 反馈 - 告知用户结果
本地预设管理
你可以保存、复制和管理自定义预设:
# 保存当前配置为本地预设
python scripts/configure.py --save-preset my-config
# 复制内置预设到本地(可进一步修改)
python scripts/configure.py --copy-preset hybrid my-hybrid
# 应用本地预设
python scripts/configure.py --preset my-config
# 删除本地预设
python scripts/configure.py --delete-preset my-config
# 查看所有预设(包括本地预设)
python scripts/configure.py --list-presets
本地预设保存在 scripts/local_presets.json(已在 .gitignore 中忽略)。
注意事项
- 修改后需要重启 opencode 生效
- model 格式为
provider/model-name - 确保 provider 已在 opencode.json 中配置
禁用配置 (disabled_*)
可以禁用不需要的功能模块,节省资源或避免干扰。
配置格式
{
"disabled_agents": ["oracle", "multimodal-looker"],
"disabled_skills": ["playwright", "git-master"],
"disabled_hooks": ["comment-checker", "agent-usage-reminder"],
"disabled_mcps": ["websearch", "context7"],
"disabled_commands": ["init-deep", "start-work"]
}
字段说明
| 字段 | 作用 | 示例值 |
|---|---|---|
disabled_agents |
禁用特定 subagent | ["oracle"] - 省钱(oracle 很贵) |
disabled_skills |
禁用技能 | ["playwright"] - 不需要浏览器自动化 |
disabled_hooks |
禁用钩子(自动触发逻辑) | ["comment-checker"] - hook 太烦人 |
disabled_mcps |
禁用 MCP 服务 | ["websearch", "context7"] - 离线环境 |
disabled_commands |
禁用斜杠命令 | ["init-deep"] - 不需要某些命令 |
使用场景
| 场景 | 建议配置 |
|---|---|
| 省钱 | disabled_agents: ["oracle"] |
| 离线环境 | disabled_mcps: ["websearch", "context7"] |
| 不需要浏览器 | disabled_skills: ["playwright"] |
| Hook 干扰工作 | disabled_hooks: ["对应hook名"] |
| 临时禁用有问题的功能 | 对应的模块名称 |
操作命令
# 禁用 agent
python scripts/configure.py --disable-agent oracle
# 禁用 skill
python scripts/configure.py --disable-skill playwright
# 禁用 hook
python scripts/configure.py --disable-hook comment-checker
# 禁用 MCP
python scripts/configure.py --disable-mcp websearch
# 禁用命令
python scripts/configure.py --disable-command init-deep
# 重新启用(移除禁用)
python scripts/configure.py --enable-agent oracle
python scripts/configure.py --enable-skill playwright
# 查看所有禁用项
python scripts/configure.py --show-disabled
建议
默认不禁用任何东西,除非:
- 某功能明确干扰你的工作流
- 想省钱(禁用 oracle)
- 特定功能在你环境里有问题
- 离线环境需要禁用网络依赖功能