npx skills add https://github.com/s-hiraoku/synapse-a2a --skill opencode-expertOpenCode 开源 AI 编码助手的综合指南。
| 任务 | 命令/操作 |
|---|---|
| 启动 TUI | opencode |
| 继续会话 | opencode -c 或 opencode --continue |
| 非交互式运行 | opencode run "消息" |
| 启动无头服务器 | opencode serve |
| Web 界面 | opencode web |
Comprehensive guide for OpenCode - the open-source AI coding agent.
| Task | Command/Action |
|---|---|
| Start TUI | opencode |
| Continue session | opencode -c or opencode --continue |
| Run non-interactive | opencode run "message" |
| Start headless server | opencode serve |
| Web interface |
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
| 切换代理 | Tab 键 |
| 文件搜索 | @ 然后输入文件名 |
| 撤销更改 | /undo |
| 重做更改 | /redo |
| 分享对话 | /share |
| 初始化项目 | /init |
| 配置 API 密钥 | /connect |
OpenCode 有两个主要代理,可使用 Tab 键切换:
ask 模式)使用 @ 提及来调用子代理:
| 按键 | 操作 |
|---|---|
Tab | 在构建代理和计划代理之间切换 |
@ | 模糊文件搜索 |
Ctrl+C | 取消当前操作 |
| 命令 | 描述 |
|---|---|
/connect | 配置 LLM 提供商的 API 密钥 |
/init | 初始化项目并创建 AGENTS.md |
/undo | 撤销最近的更改(可堆叠) |
/redo | 恢复已撤销的更改 |
/share | 创建可分享的对话链接 |
# 在当前目录启动 TUI
opencode
# 在特定项目中启动
opencode /path/to/project
# 继续之前的会话
opencode --continue
opencode -c
# 使用特定会话
opencode --session <id>
opencode -s <id>
# 使用特定模型启动
opencode --model <model>
opencode -m <model>
# 使用特定代理启动
opencode --agent build
opencode --agent plan
# 运行单次提示
opencode run "修复 auth.py 中的错误"
# 附带文件运行
opencode run "审查这个" --file README.md
opencode run "审查这个" -f README.md
# 运行并分享结果
opencode run "解释这段代码" --share
# 运行特定命令
opencode run --command "npm test"
# 启动无头 API 服务器
opencode serve
# 使用自定义端口
opencode serve --port 3000
# 使用 mDNS 发现
opencode serve --mdns
# Web 界面
opencode web
# 认证
opencode auth login
opencode auth list
opencode auth logout
# 模型
opencode models # 列出可用模型
opencode models --refresh # 刷新模型缓存
# 代理
opencode agent create # 创建自定义代理
opencode agent list # 列出代理
# MCP 服务器
opencode mcp add <server>
opencode mcp list
opencode mcp auth
opencode mcp debug
# 会话
opencode session list
opencode session list -n 10 # 最近 10 个会话
# 统计
opencode stats
opencode stats --days 7
opencode stats --tools
opencode stats --models
# 导出/导入
opencode export <sessionID>
opencode import <file>
# 升级
opencode upgrade
opencode upgrade <version>
OpenCode 为代理提供以下工具:
| 工具 | 描述 |
|---|---|
| read | 读取文件内容(可选行范围) |
| write | 创建新文件或覆盖现有文件 |
| edit | 使用精确字符串替换修改文件 |
| patch | 应用补丁文件 |
| grep | 使用正则表达式搜索文件内容 |
| glob | 按模式查找文件(**/*.js) |
| list | 列出文件和目录 |
| bash | 执行 shell 命令 |
| lsp | 语言服务器协议集成(实验性) |
| todowrite | 创建/更新任务列表 |
| todoread | 读取当前待办事项状态 |
| skill | 将技能文件加载到对话中 |
| webfetch | 获取并读取网页 |
| question | 向用户询问澄清性问题 |
技能从以下位置发现(按顺序):
.agents/skills/<name>/SKILL.md(项目,与 Codex 共享).claude/skills/<name>/SKILL.md(Claude 兼容项目)~/.config/opencode/skills/<name>/SKILL.md(全局)~/.claude/skills/<name>/SKILL.md(Claude 兼容全局)---
name: my-skill
description: 描述此技能的作用以及何时使用它。
---
# 技能内容
说明和文档写在这里...
--).opencode/ 或 opencode.json~/.config/opencode/| 变量 | 描述 |
|---|---|
OPENCODE_CONFIG | 自定义配置路径 |
OPENCODE_PERMISSION | 权限模式 |
OPENCODE_SERVER_PASSWORD | 服务器认证密码 |
OPENCODE_DISABLE_AUTOUPDATE | 禁用自动更新 |
OPENCODE_EXPERIMENTAL | 启用实验性功能 |
OPENCODE_ENABLE_EXA | 启用 Exa 搜索 |
通过 opencode agent create 创建代理,或在以下位置定义:
opencode.json~/.config/opencode/agents/.opencode/agents/代理配置选项:描述、温度、模型、工具权限、系统提示。
在更改之前,切换到计划代理(Tab)以审查实施策略。
在提示中使用 @filename 进行模糊搜索和引用文件。
自由使用 /undo - 更改是可堆叠的,并且可以使用 /redo 恢复。
使用 --continue 或 -c 来恢复之前的会话并保持上下文。
详细文档请参阅:
references/cli.md - 完整的 CLI 参考references/tools.md - 工具详情和权限references/agents.md - 代理配置指南每周安装数
274
代码仓库
首次出现
2026年1月24日
安全审计
安装于
opencode264
gemini-cli242
codex238
github-copilot234
kimi-cli222
amp222
opencode web| Switch agent | Tab key |
| File search | @ then type filename |
| Undo changes | /undo |
| Redo changes | /redo |
| Share conversation | /share |
| Initialize project | /init |
| Configure API keys | /connect |
OpenCode has two primary agents, switchable with Tab:
ask mode)Invoke subagents with @ mention:
| Key | Action |
|---|---|
Tab | Switch between Build and Plan agents |
@ | Fuzzy file search |
Ctrl+C | Cancel current operation |
| Command | Description |
|---|---|
/connect | Configure LLM provider API keys |
/init | Initialize project and create AGENTS.md |
/undo | Revert recent changes (stackable) |
/redo | Restore undone changes |
/share | Create shareable conversation link |
# Start TUI in current directory
opencode
# Start in specific project
opencode /path/to/project
# Continue previous session
opencode --continue
opencode -c
# Use specific session
opencode --session <id>
opencode -s <id>
# Start with specific model
opencode --model <model>
opencode -m <model>
# Start with specific agent
opencode --agent build
opencode --agent plan
# Run single prompt
opencode run "Fix the bug in auth.py"
# Run with file attachment
opencode run "Review this" --file README.md
opencode run "Review this" -f README.md
# Run and share result
opencode run "Explain this code" --share
# Run specific command
opencode run --command "npm test"
# Start headless API server
opencode serve
# With custom port
opencode serve --port 3000
# With mDNS discovery
opencode serve --mdns
# Web interface
opencode web
# Authentication
opencode auth login
opencode auth list
opencode auth logout
# Models
opencode models # List available models
opencode models --refresh # Refresh model cache
# Agents
opencode agent create # Create custom agent
opencode agent list # List agents
# MCP servers
opencode mcp add <server>
opencode mcp list
opencode mcp auth
opencode mcp debug
# Sessions
opencode session list
opencode session list -n 10 # Last 10 sessions
# Statistics
opencode stats
opencode stats --days 7
opencode stats --tools
opencode stats --models
# Export/Import
opencode export <sessionID>
opencode import <file>
# Upgrade
opencode upgrade
opencode upgrade <version>
OpenCode provides these tools to agents:
| Tool | Description |
|---|---|
| read | Read file contents with optional line ranges |
| write | Create new files or overwrite existing |
| edit | Modify files using exact string replacements |
| patch | Apply patch files |
| grep | Search file contents with regex |
| glob | Find files by pattern (**/*.js) |
| list | List files and directories |
| bash | Execute shell commands |
| lsp | Language Server Protocol integration (experimental) |
| todowrite | Create/update task lists |
| todoread | Read current todo state |
| skill | Load skill files into conversation |
| webfetch | Fetch and read web pages |
| question | Ask user clarifying questions |
Skills are discovered from (in order):
.agents/skills/<name>/SKILL.md (project, shared with Codex).claude/skills/<name>/SKILL.md (Claude-compatible project)~/.config/opencode/skills/<name>/SKILL.md (global)~/.claude/skills/<name>/SKILL.md (Claude-compatible global)---
name: my-skill
description: Description of what this skill does and when to use it.
---
# Skill Content
Instructions and documentation here...
--).opencode/ or opencode.json~/.config/opencode/| Variable | Description |
|---|---|
OPENCODE_CONFIG | Custom config path |
OPENCODE_PERMISSION | Permission mode |
OPENCODE_SERVER_PASSWORD | Server auth password |
OPENCODE_DISABLE_AUTOUPDATE | Disable auto-updates |
OPENCODE_EXPERIMENTAL | Enable experimental features |
OPENCODE_ENABLE_EXA | Enable Exa search |
Create agents via opencode agent create or define in:
opencode.json~/.config/opencode/agents/.opencode/agents/Agent config options: description, temperature, model, tool permissions, system prompts.
Switch to Plan agent (Tab) to review implementation strategy before making changes.
Use @filename to fuzzy search and reference files in prompts.
Use /undo liberally - changes are stackable and reversible with /redo.
Use --continue or -c to resume previous sessions and maintain context.
For detailed documentation, see:
references/cli.md - Complete CLI referencereferences/tools.md - Tool details and permissionsreferences/agents.md - Agent configuration guideWeekly Installs
274
Repository
First Seen
Jan 24, 2026
Security Audits
Installed on
opencode264
gemini-cli242
codex238
github-copilot234
kimi-cli222
amp222
React 组合模式指南:Vercel 组件架构最佳实践,提升代码可维护性
106,200 周安装
OpenAI Agents SDK:构建文本/语音AI智能体、多智能体工作流与防护栏应用
359 周安装
Expo应用设计指南:使用Expo Router和NativeWind构建跨平台React Native移动应用
359 周安装
Autoresearch:自主实验循环工具,自动化代码优化与性能改进
564 周安装
LangChain4j RAG实现模式:构建文档对话与知识增强AI应用指南
381 周安装
Next.js 智能体技能编写指南:创建、优化与管理 AI 技能文件
432 周安装
OpenClaw 自动更新器技能 - 保持网关持续更新的自动化解决方案
483 周安装