Oh My OpenCode技能使用说明
哦,我的OpenCode
多智能体编排插件,将OpenCode转变为完整的智能体框架,具备专用智能体、后台任务执行、基于类别的模型路由和自主工作模式。
包:oh-my-opencode(通过bunx oh-my-opencode install安装)仓库:https://github.com/code-yeongyu/oh-my-opencode
架构:https://raw.githubusercontent.com/code-yeongyu/oh-my-opencode/master/assets/oh-my-opencode.schema.json

先决条件
- OpenCode已安装并配置(
opencode --version应不低于1.0.150+)curl -fsSL https://opencode.ai/install | bash # or: npm install -g opencode-ai # or: bun install -g opencode-ai - 至少有一个LLM提供商已认证(
opencode auth login) - 强烈推荐:Anthropic Claude Pro/Max 订阅(Sisyphus 使用 Claude Opus 4.5)
安装
运行交互式安装程序:
bunx oh-my-opencode install
使用供应商标志的非交互模式:
bunx oh-my-opencode install --no-tui \
--claude=<yes|no|max20> \
--openai=<yes|no> \
--gemini=<yes|no> \
--copilot=<yes|no> \
--opencode-zen=<yes|no> \
--zai-coding-plan=<yes|no>
验证:
opencode --version
cat ~/.config/opencode/opencode.json # should contain "oh-my-opencode" in plugin array
两种工作流模式
模式 1:超效工作(快速自主工作)
在你的提示中包含ultrawork或ulw即可。
ulw add authentication to my Next.js app
代理将自动:
- 探索你的代码库以理解现有模式
- 通过专门的背景代理研究最佳实践
- 按照你的约定实现功能
- 使用诊断和测试进行验证
- 持续工作直至 100% 完成
模式 2:普罗米修斯(精确计划工作)
适用于复杂或关键任务:
- 按Tab键→ 切换到普罗米修斯(规划者)模式
- 描述你的工作内容→ 普罗米修斯会对你进行访谈,在研究你的代码库时提出澄清性问题
- 确认计划→ 在以下位置查看生成的计划
.sisyphus/plans/*.md - 运行
/start-work→ 阿特拉斯协调器接管:- 将任务分发给专门的子代理
- 独立验证每项任务的完成情况
- 跨任务积累学习成果
- 跨会话跟踪进度(可随时恢复)
关键规则:切勿在未使用/start-work的情况下使用阿特拉斯。普罗米修斯和阿特拉斯是一对——必须始终一起使用。
代理
所有代理默认启用。每个代理都有默认模型和供应商优先级回退链。
| 代理 | 角色 | 默认模型 | 提供商优先级链 |
|---|---|---|---|
| 西西弗斯 | 主要协调器 | claude-opus-4-5 | anthropic → kimi-for-coding → zai-coding-plan → openai → google |
| 西西弗斯-初级 | 专注任务执行者(通过delegate_task按类别使用) | 由类别决定 | 每类别链 |
| 赫菲斯托斯 | 自主深度工作者 — 目标导向,行动前探索 | gpt-5.2-codex(中等) | openai → github-copilot → opencode(需要 gpt-5.2-codex) |
| 神谕 | 架构、调试、高智商推理(只读) | gpt-5.2 | openai → google → anthropic |
| 图书管理员 | 官方文档,开源软件搜索,远程代码库分析 | glm-4.7 | zai-coding-plan → opencode → anthropic |
| 探索 | 快速代码库grep(上下文搜索) | claude-haiku-4-5 | anthropic → github-copilot → opencode |
| 多模态查看器 | 图像/PDF/图表分析 | gemini-3-flash | google → openai → zai-coding-plan → kimi-for-coding → anthropic → opencode |
| 普罗米修斯 | 工作计划器(基于访谈的计划生成) | claude-opus-4-5 | anthropic → kimi-for-coding → openai → google |
| 墨提斯 | 预规划顾问(模糊性/失败点分析) | claude-opus-4-5 | anthropic → kimi-for-coding → openai → google |
| 摩摩斯 | 计划审查员(清晰度、可验证性、完整性) | gpt-5.2 | openai → anthropic → google |
| Atlas | 计划编排器(通过/start-work执行Prometheus计划 | )k2p5/ | claude-sonnet-4-5 |
| kimi-for-coding → opencode → anthropic → openai → google | OpenCode-Builder | 默认构建代理(当Sisyphus激活时默认禁用) | 系统默认 |
系统默认
代理调用代理通过delegate_task()或--agentCLI标志调用——而非使用@
// Invoke a specific agent
delegate_task(subagent_type="oracle", prompt="Review this architecture...")
// Invoke via category (routes to Sisyphus-Junior with category model)
delegate_task(category="visual-engineering", load_skills=["frontend-ui-ux"], prompt="...")
// Background execution (non-blocking)
delegate_task(subagent_type="explore", run_in_background=true, prompt="Find auth patterns...")
前缀。
opencode --agent oracle
opencode run --agent librarian "Explain how auth works in this codebase"
命令行界面:
| 何时使用哪个代理 | 代理 |
|---|---|
| 通用编码任务 | 西西弗斯(默认) |
| 自主目标导向的深度工作 | 赫菲斯托斯(需要gpt-5.2-codex) |
| 架构决策,两次以上失败后的调试 | 神谕 |
| 查找库文档,寻找开源示例 | 图书馆员 |
| 在您的代码库中查找代码模式 | 探索 |
| 分析图像、PDF、图表 | 多模态查看器 |
| 需要计划的复杂多日项目 | 普罗米修斯 + 阿特拉斯(通过选项卡 →/开始工作) |
| 预规划范围分析 | 墨提斯 |
| 审查生成的计划以查找漏洞 | 摩墨斯 |
| 快速单文件更改 | 使用delegate_task快速类别 |
类别
类别通过delegate_task()将任务路由给Sisyphus-Junior,并使用领域优化的模型。
| . | 类别 | 默认模型 | 变体 | 提供商优先级链 |
|---|---|---|---|---|
最适合 | 视觉工程 | gemini-3-pro | — | google → anthropic → zai-coding-plan |
前端、UI/UX、设计、样式、动画 | 超脑 | gpt-5.2-codex | 极高 | openai → google → anthropic |
深度逻辑推理、复杂架构 | 深度 | gpt-5.2-codex | openai → anthropic → google | 目标导向的自主问题解决(赫菲斯托斯风格) |
艺术性 | gemini-3-pro | 最大 | google → anthropic → openai | 创造性/新颖的方法,非常规的解决方案 |
快速 | claude-haiku-4-5 | — | anthropic → google → opencode | 琐碎任务,单文件更改,拼写错误修正 |
未指定-低 | claude-sonnet-4-5 | — | anthropic → openai → google | 一般任务,低工作量 |
未指定-高 | claude-opus-4-5 | 最大 | anthropic → openai → google | 一般任务,高工作量 |
写作 | gemini-3-flash | — | google → anthropic → zai-coding-plan → openai | 文档、散文、技术写作 |
类别使用
delegate_task(category="visual-engineering", load_skills=["frontend-ui-ux"], prompt="Create a dashboard component")
delegate_task(category="ultrabrain", load_skills=[], prompt="Design the payment processing flow")
delegate_task(category="quick", load_skills=["git-master"], prompt="Fix the typo in README.md")
delegate_task(category="deep", load_skills=[], prompt="Investigate and fix the memory leak in the worker pool")
关键点:模型解析优先级
类别**不会**使用其内置默认值,除非已配置。解析顺序如下:
- 用户配置的模型(在
oh-my-opencode.json中)—— 最高优先级 - 类别的内置默认值(如果该类别已在配置中)
- 系统默认模型(来自
opencode.json)—— 后备方案
要使用最优模型,请将类别添加到您的配置中。请参阅references/configuration.md。
内置技能
| 技能 | 用途 | 用法 |
|---|---|---|
playwright | 通过 Playwright MCP 进行浏览器自动化(默认浏览器引擎) | load_skills=["playwright"] |
agent-browser | Vercel 的 agent-browser CLI,具备会话管理功能 | 通过以下方式切换browser_automation_engine配置 |
git-master | Git 专家:原子提交、变基/压缩、历史搜索 | load_skills=["git-master"] |
frontend-ui-ux | 设计师转开发者,打造惊艳的 UI/UX | load_skills=["frontend-ui-ux"] |
技能通过以下方式注入子代理delegate_task(load_skills=[...])。
斜杠命令
| 命令 | 描述 |
|---|---|
/init-deep | 初始化分层式 AGENTS.md 知识库 |
/开始工作 | 使用Atlas编排器执行Prometheus计划 |
/ralph循环 | 启动自指开发循环,直至完成 |
/ulw循环 | 启动超工作循环 — 持续运行直至完成 |
/取消-ralph | 取消活动的Ralph循环 |
/重构 | 使用LSP、AST-grep、架构分析、TDD进行智能重构 |
/停止延续 | 停止所有延续机制(ralph循环、待办事项延续、boulder) |
进程管理
后台代理
并行启动多个代理以进行探索和研究:
// Launch background agents (non-blocking)
delegate_task(subagent_type="explore", run_in_background=true, prompt="Find auth patterns in codebase")
delegate_task(subagent_type="librarian", run_in_background=true, prompt="Find JWT best practices")
// Collect results when needed
background_output(task_id="bg_abc123")
// Cancel all background tasks before final answer
background_cancel(all=true)
并发配置
{
"background_task": {
"defaultConcurrency": 5,
"staleTimeoutMs": 180000,
"providerConcurrency": { "anthropic": 3, "google": 10 },
"modelConcurrency": { "anthropic/claude-opus-4-5": 2 }
}
}
优先级:模型并发数>提供商并发数>默认并发数
Tmux 集成
在独立的 tmux 窗格中运行后台代理,以实现可视化的多代理执行:
{
"tmux": {
"enabled": true,
"layout": "main-vertical",
"main_pane_size": 60
}
}
需要在 tmux 会话中以服务器模式运行 OpenCode:
tmux new -s dev
opencode --port 4096
布局选项:主窗格垂直排列(默认),主窗格水平排列,平铺排列,均匀水平排列,均匀垂直排列
并行执行模式
模式 1:探索者 + 图书管理员(研究阶段)
// Internal codebase search
delegate_task(subagent_type="explore", run_in_background=true, prompt="Find how auth middleware is implemented")
delegate_task(subagent_type="explore", run_in_background=true, prompt="Find error handling patterns in the API layer")
// External documentation search
delegate_task(subagent_type="librarian", run_in_background=true, prompt="Find official JWT documentation and security recommendations")
// Continue working immediately — collect results when needed
模式 2:基于类别的委托(实施阶段)
// Frontend work → visual-engineering category
delegate_task(category="visual-engineering", load_skills=["frontend-ui-ux"], prompt="Build the settings page")
// Quick fix → quick category
delegate_task(category="quick", load_skills=["git-master"], prompt="Create atomic commit for auth changes")
// Hard problem → ultrabrain category
delegate_task(category="ultrabrain", load_skills=[], prompt="Design the caching invalidation strategy")
模式 3:会话连续性
// First delegation returns a session_id
result = delegate_task(category="quick", load_skills=["git-master"], prompt="Fix the type error")
// session_id: "ses_abc123"
// Follow-up uses session_id to preserve full context
delegate_task(session_id="ses_abc123", prompt="Also fix the related test file")
CLI 参考
核心命令
opencode # Start TUI
opencode --port 4096 # Start TUI with server mode (for tmux integration)
opencode -c # Continue last session
opencode -s <session-id> # Continue specific session
opencode --agent <agent-name> # Start with specific agent
opencode -m provider/model # Start with specific model
非交互模式
opencode run "Explain closures in JavaScript"
opencode run --agent oracle "Review this architecture"
opencode run -m openai/gpt-5.2 "Complex reasoning task"
opencode run --format json "Query" # Raw JSON output
身份验证与提供商管理
opencode auth login # Add/configure a provider
opencode auth list # List authenticated providers
opencode auth logout # Remove a provider
opencode models # List all available models
opencode models anthropic # List models for specific provider
opencode models --refresh # Refresh models cache
会话管理
opencode session list # List all sessions
opencode session list -n 10 # Last 10 sessions
opencode export <session-id> # Export session as JSON
opencode import session.json # Import session
opencode stats # Token usage and cost statistics
opencode stats --days 7 # Stats for last 7 days
插件与 MCP 管理
bunx oh-my-opencode install # Install/configure oh-my-opencode
bunx oh-my-opencode doctor # Diagnose configuration issues
opencode mcp list # List configured MCP servers
opencode mcp add # Add an MCP server
服务器模式
opencode serve --port 4096 # Headless server
opencode web --port 4096 # Server with web UI
opencode attach http://localhost:4096 # Attach TUI to running server
内置 MCP
Oh My OpenCode 默认包含以下 MCP 服务器:
| MCP | 工具 | 用途 |
|---|---|---|
| Exa | web_search_exa | 提供适用于大语言模型的纯净内容进行网络搜索 |
| Context7 | resolve-library-id,query-docs | 查询官方库/框架文档 |
| Grep.app | searchGitHub | 从公共 GitHub 仓库中搜索真实代码示例 |
钩子
所有钩子默认启用。可通过disabled_hooks配置禁用特定钩子:
| 钩子 | 用途 |
|---|---|
待办事项延续强制执行器 | 强制代理在中途退出后继续执行 |
上下文窗口监视器 | 监控和管理上下文窗口的使用情况 |
会话恢复 | 崩溃后恢复会话 |
会话通知 | 在会话事件时发出通知 |
注释检查器 | 防止AI添加过多的代码注释 |
grep输出截断器 | 截断大型grep输出 |
工具输出截断器 | 截断大型工具输出 |
目录代理注入器 | 从子目录注入AGENTS.md(在OpenCode 1.1.37+版本上自动禁用) |
目录README注入器 | 注入README.md上下文 |
空任务响应检测器 | 检测并处理空任务响应 |
思考模式 | 扩展的思考模式控制 |
anthropic-context-window-limit-recovery | 从Anthropic上下文限制中恢复 |
rules-injector | 注入项目规则 |
background-notification | 后台任务完成时通知 |
auto-update-checker | 检查oh-my-opencode更新 |
startup-toast | 显示启动通知(auto-update-checker的子功能) |
keyword-detector | 检测关键词如ultrawork/ulw以触发模式 |
agent-usage-reminder | 提醒使用专用代理 |
non-interactive-env | 处理非交互式环境 |
interactive-bash-session | 管理交互式bash/tmux会话 |
compaction-context-injector | 在压缩期间注入上下文 |
thinking-block-validator | 验证思维区块 |
claude-code-hooks | Claude Code 兼容性钩子 |
ralph-loop | Ralph 循环延续机制 |
preemptive-compaction | 在上下文溢出前触发压缩 |
auto-slash-command | 自动触发斜杠命令 |
sisyphus-junior-notepad | Sisyphus-Junior 子代理记事本 |
edit-error-recovery | 从编辑错误中恢复 |
delegate-task-retry | 重试失败的任务委派 |
prometheus-md-only | 强制 Prometheus 仅输出 Markdown 格式 |
start-work | 处理 /start-work 命令 |
阿特拉斯 | 阿特拉斯编排器钩子 |
最佳实践
应执行
- 使用
ULW处理快速自主任务——只需在提示中包含关键词 - 使用普罗米修斯+
/start-work处理复杂项目——基于访谈的规划能带来更好的结果 - 为供应商配置类别——确保最优模型选择,而非回退至系统默认
- 并行启动探索/图书管理员智能体——始终使用
run_in_background=true - 使用会话连续性——传递
session_id用于与同一子智能体的后续交互 - 让智能体进行委派— 西西弗斯是协调者,而非单打独斗的执行者
- 运行
bunx oh-my-opencode doctor以诊断问题
不要
- 不要在没有
/start-work的情况下使用 Atlas - — Atlas 需要一个 Prometheus 计划不要为每个代理手动指定模型
- — 回退链会处理此事
不要禁用待办事项强制执行器 - — 这是确保代理完成工作的关键不要为西西弗斯使用 Claude Haiku
- — 强烈推荐 Opus 4.5不要同步运行探索/图书管理员任务
— 务必在后台运行它们
- 何时使用此技能
- 安装或配置 oh-my-opencode 时
- 理解代理角色与委派模式时
- 为可视化多智能体执行设置tmux集成
- 配置成本优化类别
- 理解ultrawork与Prometheus工作流的选择
何时不应使用此技能
- 与oh-my-opencode插件功能无关的通用OpenCode用法
- 提供商认证问题(直接使用
opencode auth) - OpenCode核心配置(使用OpenCode文档:https://opencode.ai/docs/)
智能体规则
- 包名称为
oh-my-opencode——而非@anthropics/opencode或其他任何名称 - 使用
bunx(官方推荐)——而非npx来执行oh-my-opencode CLI命令 - 代理调用使用
--agent标志或delegate_task()— 而非@agent前缀 - 切勿更改模型设置或禁用功能除非用户明确要求
- Sisyphus 强烈推荐使用 Opus 4.5— 使用其他模型会显著降低体验
- 类别除非配置否则不使用内置默认值— 始终通过
bunx oh-my-opencode doctor --verbose - 进行验证Prometheus 和 Atlas 总是成对出现
- — 切勿在没有 Prometheus 计划的情况下使用 Atlas
后台代理应始终使用run_in_background=true - — 切勿在探索时阻塞会话 ID 应被保留并重复使用
- 使用Ollama时,请设置
stream: false——这是避免JSON解析错误所必需的
任务完成自动通知
后台任务完成时会通过background-notification钩子自动通知。无需轮询——系统会推送完成事件。仅在需要读取结果时使用background_output(task_id="...")
参考文档
配置参考
- ——包含所有代理、类别、提供者链、钩子和选项的完整配置故障排除指南
- ——常见问题及解决方案— Common issues and solutions


微信扫一扫,打赏作者吧~