Community程式設計與開發github.com

ACP Harness 路由器

將 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 Harness 路由器 是什麼?

此技能作為一個智慧路由器,專門處理來自多種 AI 編碼助手(如 Claude Code、Cursor、Copilot、OpenClaw、OpenCode、Gemini、Grok Build、Qwen、Kiro、Kimi、iFlow、Droid、Kilocode)的請求。當使用者意圖是在這些外部編碼環境中執行任務時,`acp-router` 會避免使用子代理運行時或 PTY 抓取,而是透過 ACP 感知的流程進行路由。對於 Codex,它在常規聊天綁定時優先使用原生 Codex 應用伺服器外掛,僅在明確要求或需要後台生成 ACP 工作階段時才使用 ACP 路徑。此技能支援兩種主要模式:預設的 OpenClaw ACP 運行時路徑(使用 `sessions_spawn`)和直接的 `acpx` 傳話遊戲路徑(使用 `exec` 命令)。它還包含強大的故障復原策略,包括嘗試自動修復插件本機的 ACPX 安裝,然後再回退到替代方案。透過提供標準化的代理 ID 對應、工作階段命名約定和命令模板,`acp-router` 確保了在各種 ACP 相容編碼環境中進行一致且可靠的互動。

相容平台✓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 Harness 路由器 是做什麼的?

當使用者意圖是「在 Claude Code/Cursor/Copilot/OpenClaw/OpenCode/Gemini/Grok Build/Qwen/Kiro/Kimi/iFlow/Droid/Kilocode (ACP harness) 中執行此操作」時,請勿使用子代理運行時或 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
  • 繼續現有的 harness 工作
  • 將指令轉發給外部編碼 harness
  • 將外部 harness 對話保持在類似執行緒的對話中

程式碼代理執行緒請求的必備預檢:

  • 在為 ACP harness 工作建立任何執行緒之前,請在同一回合中先閱讀此技能。
  • 閱讀後,請遵循下面的「OpenClaw ACP 運行時路徑」;請勿對 ACP harness 執行緒生成使用 message(action="thread-create")。

模式選擇

選擇以下路徑之一:

  1. OpenClaw ACP 運行時路徑(預設):使用 sessions_spawn / ACP 運行時工具。
  2. 直接 acpx 路徑(傳話遊戲):透過 exec 使用 acpx CLI 直接驅動 harness 工作階段。

當以下任一條件成立時,使用直接 acpx 路徑:

  • 使用者明確要求直接 acpx 驅動
  • ACP 運行時/外掛路徑不可用或不正常
  • 任務是「僅將提示轉發給 harness」且不需要 OpenClaw ACP 生命週期功能

請勿使用:

  • subagents 運行時進行 harness 控制
  • /acp 命令委派作為使用者的要求
  • 在 acpx 可用時抓取支援的 ACP harness CLI 的 PTY 輸出

AgentId 對應

當使用者直接指定 harness 時,使用以下預設值:

  • "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。請將 grok-build 透過 agentId 路由;僅在 OpenClaw 的 model 欄位中使用完整限定的 xAI 引用。

如果策略拒絕了所選 ID,請清楚地報告策略錯誤,並詢問允許的 ACP 代理 ID。

OpenClaw ACP 運行時路徑

必要行為:

  1. 對於 ACP harness 執行緒生成請求,請在調用工具之前,先在同一回合中閱讀此技能。
  2. 使用 sessions_spawn 並附帶:
    • runtime: "acp"
    • thread: true
    • mode: "session"(除非使用者明確要求一次性)
  3. 對於 ACP harness 執行緒建立,請勿使用帶有 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"
}

執行緒生成復原策略

當使用者要求在執行緒中啟動編碼 harness 時,將其視為 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 路徑(「傳話遊戲」)

使用此路徑來驅動 harness 工作階段,而無需 /acp 或子代理運行時。

規則

  1. 使用調用 ${ACPX_CMD} 的 exec 命令。
  2. 每個對話重複使用一個穩定的工作階段名稱,以便後續提示保持在相同的 harness 上下文中。
  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 中的 Harness 別名

  • 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
  • 適配器命令遺失(例如找不到 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.

相關技能