Community编程与开发github.com

ACP 路由技能

将针对 Claude Code、Cursor、Copilot、OpenClaw ACP、OpenCode、Gemini CLI、Grok Build、Qwen、Kiro、Kimi、iFlow、Factory Droid、Kilocode 或明确 ACP 工具的文本请求路由到 OpenClaw ACP 运行时会话或直接的 acpx 驱动会话(“传话游戏”流程)。对于编码代理线程请求,请先阅读此技能,然后仅使用 `sessions_spawn` 创建线程。Codex 聊天绑定默认使用原生 Codex 应用服务器插件,除非明确要求 ACP 或后台生成需要 ACP。

ACP 路由技能 是什么?

此技能将 OpenClaw 进化为一个智能路由器,用于将编码相关的文本请求分派给各种外部编码工具(如 Claude Code、Cursor、Copilot、Gemini CLI 等)。它提供了两种主要路径:默认的 OpenClaw ACP 运行时路径,它利用 ACP 运行时工具进行会话管理;以及直接的 acpx 路径(“传话游戏”),它通过 `exec` 命令直接驱动 acpx CLI。该技能包含复杂的意图检测,自动将用户提到的工具名称(例如“claude”、“cursor”)映射到相应的 ACP agentId,并处理 Codex 等特殊情况。主要用例是在 OpenClaw 环境中实现多代理编码工作流,无需 PTY 抓取或子代理运行时。该技能还提供了强大的恢复策略,包括自动修复 acpx 安装以及当后端不可用时的回退选项。它受 OpenClaw、Claude Code、Codex、Gemini CLI 等平台支持。

兼容平台✓Claude Code✓Codex CLI✓Cursor✓Gemini CLI✓OpenCode
npx skills add https://github.com/clawdbot/clawdbot/tree/main/extensions/acpx/skills/acp-router

Installed? Explore more 编程与开发 skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

ACP 工具路由技能

当用户意图是“在 Claude Code/Cursor/Copilot/OpenClaw/OpenCode/Gemini/Grok Build/Qwen/Kiro/Kimi/iFlow/Droid/Kilocode (ACP 工具) 中运行此操作”时,不要使用子代理运行时或 PTY 抓取。而是通过 ACP 感知流程进行路由。

Codex 是特例:纯文本聊天/会话绑定和控制应使用原生 Codex 应用服务器插件(/codex bind、/codex threads、/codex resume),而不是默认的 ACP 路径。仅在用户明确要求 ACP//acp/acpx,或通过 sessions_spawn 生成后台子会话(此时原生 Codex 运行时生成尚不可用)时,才为 Codex 使用 ACP。

意图检测

当用户要求 OpenClaw 执行以下操作时触发此技能:

  • 在 Claude Code / Cursor / Copilot / OpenClaw / OpenCode / Gemini / Grok Build / Qwen / Kiro / Kimi / iFlow / Droid / Kilocode 中运行某些内容
  • 通过 ACP、/acp 或 acpx 显式运行 Codex
  • 继续现有的工具工作
  • 将指令转发给外部编码工具
  • 以线程式对话的方式保持外部工具会话

编码代理线程请求的强制预检:

  • 在创建任何用于 ACP 工具工作的线程之前,先在同一轮次中阅读此技能。
  • 阅读后,遵循下文 OpenClaw ACP 运行时路径;不要使用 message(action="thread-create") 来生成 ACP 工具线程。

模式选择

选择以下路径之一:

  1. OpenClaw ACP 运行时路径(默认):使用 sessions_spawn / ACP 运行时工具。
  2. 直接 acpx 路径(传话游戏):通过 exec 使用 acpx CLI 直接驱动工具会话。

当以下任一条件成立时,使用直接 acpx 路径:

  • 用户明确要求直接 acpx 驱动
  • ACP 运行时/插件路径不可用或不健康
  • 任务只是“将提示转发给工具”且不需要 OpenClaw ACP 生命周期功能

不要使用:

  • subagents 运行时进行工具控制
  • /acp 命令委托作为用户要求
  • 当 acpx 可用时,对受支持的 ACP 工具 CLI 进行 PTY 抓取

AgentId 映射

当用户直接命名某个工具时,使用以下默认值:

  • "openclaw" -> agentId: "openclaw"
  • "claude" 或 "claude code" -> agentId: "claude"
  • "codex" -> agentId: "codex"(仅用于显式 ACP/acpx 请求或后台 ACP 运行时生成)
  • "copilot" 或 "github copilot" -> agentId: "copilot"
  • "cursor" 或 "cursor cli" -> agentId: "cursor"
  • "droid" 或 "factory droid" -> agentId: "droid"
  • "opencode" -> agentId: "opencode"
  • "gemini" 或 "gemini cli" -> agentId: "gemini"
  • "grok build" 或 "grok-build" -> agentId: "grok-build"
  • "iflow" -> agentId: "iflow"
  • "kilocode" -> agentId: "kilocode"
  • "kimi" 或 "kimi cli" -> agentId: "kimi"
  • "kiro" 或 "kiro cli" -> agentId: "kiro"
  • "qwen" 或 "qwen code" -> agentId: "qwen"

这些默认值与当前 acpx 内置别名一致。

grok-build 是一个 ACPX 代理目标,而不是 xAI 模型 ID xai/grok-build-0.1。通过 agentId 路由 grok-build;仅在 OpenClaw model 字段中使用完全限定的 xAI 引用。

如果策略拒绝了所选 ID,则清晰地报告策略错误并询问允许的 ACP 代理 ID。

OpenClaw ACP 运行时路径

所需行为:

  1. 对于 ACP 工具线程生成请求,在调用工具之前先在同一轮次中阅读此技能。
  2. 使用 sessions_spawn 并设置:
    • runtime: "acp"
    • thread: true
    • mode: "session"(除非用户明确要求一次性)
  3. 对于 ACP 工具线程创建,不要使用带有 action=thread-create 的 message;sessions_spawn 是唯一的线程创建路径。
  4. 将请求的工作放入 task 中,以便 ACP 会话立即获取它。
  5. 显式设置 agentId,除非已知 ACP 默认代理。
  6. 当此路径可以直接工作时,不要要求用户运行斜杠命令或 CLI。

示例:

用户:“生成一个测试 codex ACP 会话在线程中并让它问好”

调用:

{
  "task": "问好。",
  "runtime": "acp",
  "agentId": "codex",
  "thread": true,
  "mode": "session"
}

线程生成恢复策略

当用户要求在线程中启动编码工具时,将其视为 ACP 运行时请求并尝试端到端地满足它。

当 ACP 后端不可用时的所需行为:

  1. 不要立即要求用户选择备用路径。
  2. 首先尝试自动本地修复:
    • 检查插件本地固定的 acpx 是否安装在 ACPX 插件包中
    • 验证 ${ACPX_CMD} --version
  3. 重新安装/修复后,重新启动网关并显式询问用户是否要运行该重新启动。
  4. 修复后重试 ACP 线程生成一次。
  5. 仅在修复+重试失败后,报告具体错误,然后提供回退选项。

提供回退时,保持 ACP 优先:

  • 选项 1:在显示确切失败步骤后重试 ACP 生成
  • 选项 2:直接的 acpx 传话游戏流程

不要默认对这些请求使用子代理运行时。

ACPX 安装和版本策略(直接 acpx 路径)

对于此仓库,直接的 acpx 调用必须遵循与 @openclaw/acpx 扩展包相同的固定策略。

  1. 优先使用插件本地二进制文件,而不是全局 PATH:
    • ${ACPX_PLUGIN_ROOT}/node_modules/.bin/acpx
  2. 从扩展依赖项解析固定版本:
    • node -e "console.log(require(process.env.ACPX_PLUGIN_ROOT + '/package.json').dependencies.acpx)"
  3. 如果二进制文件丢失或版本不匹配,则安装插件本地的固定版本:
    • cd "$ACPX_PLUGIN_ROOT" && npm install --omit=dev --no-save acpx@<pinnedVersion>
  4. 使用前验证:
    • ${ACPX_PLUGIN_ROOT}/node_modules/.bin/acpx --version
  5. 如果安装/修复更改了 ACPX 工件,则重新启动网关并询问用户是否运行重新启动。
  6. 除非用户明确要求全局安装,否则不要运行 npm install -g acpx。

设置并重复使用:

ACPX_PLUGIN_ROOT="<bundled-acpx-plugin-root>"
ACPX_CMD="$ACPX_PLUGIN_ROOT/node_modules/.bin/acpx"

直接 acpx 路径(“传话游戏”)

使用此路径驱动工具会话,无需 /acp 或子代理运行时。

规则

  1. 使用调用 ${ACPX_CMD} 的 exec 命令。
  2. 为每个对话重复使用稳定的会话名称,以便后续提示保持在相同的工具上下文中。
  3. 优先使用 --format quiet 以获得干净的助手文本,以转发回用户。
  4. 仅在用户想要一次性行为时使用 exec(一次性)。
  5. 当任务范围依赖于仓库上下文时,保持工作目录显式(--cwd)。

会话命名

使用稳定的名称,例如:

  • oc-<harness>-<conversationId>

其中 conversationId 是线程 ID(如果可用),否则是频道/对话 ID。

命令模板

持久会话(如果不存在则创建,然后提示):

${ACPX_CMD} codex sessions show oc-codex-<conversationId> \
  || ${ACPX_CMD} codex sessions new --name oc-codex-<conversationId>

${ACPX_CMD} codex -s oc-codex-<conversationId> --cwd <workspacePath> --format quiet "<prompt>"

一次性:

${ACPX_CMD} codex exec --cwd <workspacePath> --format quiet "<prompt>"

取消正在进行的轮次:

${ACPX_CMD} codex cancel -s oc-codex-<conversationId>

关闭会话:

${ACPX_CMD} codex sessions close oc-codex-<conversationId>

acpx 中的工具别名

  • claude
  • codex
  • copilot
  • cursor
  • droid
  • gemini
  • grok-build
  • iflow
  • kilocode
  • kimi
  • kiro
  • openclaw
  • opencode
  • qwen

acpx 中的内置适配器命令

默认值为:

  • openclaw -> openclaw acp
  • claude -> bundled @agentclientprotocol/[email protected]
  • codex -> bundled @agentclientprotocol/[email protected] through OpenClaw's isolated CODEX_HOME wrapper
  • copilot -> copilot --acp --stdio
  • cursor -> cursor-agent acp
  • droid -> droid exec --output-format acp
  • gemini -> gemini --acp
  • grok-build -> grok agent stdio
  • iflow -> iflow --experimental-acp
  • kilocode -> npx -y @kilocode/cli acp
  • kimi -> kimi acp
  • kiro -> kiro-cli acp
  • opencode -> npx -y opencode-ai acp
  • qwen -> qwen --acp

如果 ~/.acpx/config.json 覆盖了 agents,则这些覆盖将替换默认值。如果您的本地 Cursor 安装仍然将 ACP 公开为 agent acp,则显式将其设置为 cursor 代理覆盖。

失败处理

  • acpx: command not found:
    • 对于线程生成 ACP 请求,立即在 ACPX 插件包中安装插件本地的固定 acpx
    • 安装后重新启动网关并询问用户是否要自动运行重新启动
    • 然后重试一次
    • 除非策略明确要求,否则不要首先请求安装权限
    • 除非明确请求,否则不要安装全局 acpx
  • 适配器命令缺失(例如 claude-agent-acp 未找到):
    • 对于线程生成 ACP 请求,首先通过删除损坏的 ~/.acpx/config.json 代理覆盖来恢复内置默认值
    • 然后在提供回退之前重试一次
    • 如果用户想要基于二进制的覆盖,则完全安装配置的适配器二进制文件
  • NO_SESSION:运行 ${ACPX_CMD} <agent> sessions new --name <sessionName>,然后重试提示。
  • 队列繁忙:要么等待完成(默认),要么在明确需要异步行为时使用 --no-wait。

输出转发

在转发给用户时,返回来自 acpx 命令结果的最终助手文本输出。除非用户要求详细日志,否则避免转发原始的本地工具噪声。

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

1password

Set up and use 1Password CLI for sign-in, desktop integration, and reading or injecting secrets.

add-model-provider

Add and live-prove a model provider with non-interactive config one-liners, without exposing credentials.

agent-transcript

Requested GitHub PR/issue agent transcripts: redact, trim, preview, and insert safely.

apple-notes

Create, view, edit, delete, search, move, or export Apple Notes via the memo CLI on macOS.

apple-reminders

List, add, edit, complete, or delete Apple Reminders and reminder lists via remindctl.

auto-qa

Run OpenClaw-wide autonomous QA and live/stress campaigns across independent subsystem lanes, with verified fixes and a resumable evidence report.

autoreview

Structured code review through the shared OpenClaw agent-skills installation.

bear-notes

Create, search, and manage Bear notes via grizzly CLI.

blacksmith-testbox

Run Blacksmith Testbox for CI-parity checks, secrets, hosted services, migrations, or builds local cannot reproduce.

block-kit

Use proactively for structured or interactive Slack replies, and when asked to author or validate native Slack Block Kit JSON.

blogwatcher

Monitor blogs and RSS/Atom feeds for updates using the blogwatcher CLI.

blucli

BluOS CLI (blu) for discovery, playback, grouping, and volume.

bluebubbles

Send and manage iMessages via BlueBubbles, including attachments, tapbacks, edits, replies, and groups.

browser-automation

Use when controlling web pages with the OpenClaw browser tool, especially multi-step flows, login checks, tab management, or recovery from stale refs/timeouts.

camsnap

Capture frames or clips from RTSP/ONVIF cameras and local webcams, including USB pan/tilt/zoom control.

canvas

Present HTML on connected OpenClaw node canvases, navigate/eval/snapshot, and debug canvas host URLs.

channel-message-flows

Use when running QA Lab channel message flow evidence.

clawdtributor

Clawtributor PRs here, last week or another window: discover conversation refs, recheck GitHub, rank by impact.

clawhub

Search ClawHub for plugins by default, or skills and agent Templates when requested; add Templates; install, verify, update, uninstall, publish, or sync skills.

claw-score

Audit or refresh OpenClaw maturity scorecard docs from root taxonomy, maturity scores, and QA evidence artifacts without using maintainer discrawl data or committed inventory reports.

相关技能