$npx -y skills add SafeAI-Lab-X/ClawKeeper --skill acp-routerRoute plain-language requests for Pi, Claude Code, Codex, OpenCode, Gemini CLI, or ACP harness work into either OpenClaw ACP runtime sessions or direct acpx-driven sessions ("telephone game" flow). For coding-agent thread requests, read this skill first, then use only `sessions_s
| 1 | # ACP Harness Router |
| 2 | |
| 3 | When user intent is "run this in Pi/Claude Code/Codex/OpenCode/Gemini/Kimi (ACP harness)", do not use subagent runtime or PTY scraping. Route through ACP-aware flows. |
| 4 | |
| 5 | ## Intent detection |
| 6 | |
| 7 | Trigger this skill when the user asks OpenClaw to: |
| 8 | |
| 9 | - run something in Pi / Claude Code / Codex / OpenCode / Gemini |
| 10 | - continue existing harness work |
| 11 | - relay instructions to an external coding harness |
| 12 | - keep an external harness conversation in a thread-like conversation |
| 13 | |
| 14 | Mandatory preflight for coding-agent thread requests: |
| 15 | |
| 16 | - Before creating any thread for Pi/Claude/Codex/OpenCode/Gemini work, read this skill first in the same turn. |
| 17 | - After reading, follow `OpenClaw ACP runtime path` below; do not use `message(action="thread-create")` for ACP harness thread spawn. |
| 18 | |
| 19 | ## Mode selection |
| 20 | |
| 21 | Choose one of these paths: |
| 22 | |
| 23 | 1. OpenClaw ACP runtime path (default): use `sessions_spawn` / ACP runtime tools. |
| 24 | 2. Direct `acpx` path (telephone game): use `acpx` CLI through `exec` to drive the harness session directly. |
| 25 | |
| 26 | Use direct `acpx` when one of these is true: |
| 27 | |
| 28 | - user explicitly asks for direct `acpx` driving |
| 29 | - ACP runtime/plugin path is unavailable or unhealthy |
| 30 | - the task is "just relay prompts to harness" and no OpenClaw ACP lifecycle features are needed |
| 31 | |
| 32 | Do not use: |
| 33 | |
| 34 | - `subagents` runtime for harness control |
| 35 | - `/acp` command delegation as a requirement for the user |
| 36 | - PTY scraping of pi/claude/codex/opencode/gemini/kimi CLIs when `acpx` is available |
| 37 | |
| 38 | ## AgentId mapping |
| 39 | |
| 40 | Use these defaults when user names a harness directly: |
| 41 | |
| 42 | - "pi" -> `agentId: "pi"` |
| 43 | - "claude" or "claude code" -> `agentId: "claude"` |
| 44 | - "codex" -> `agentId: "codex"` |
| 45 | - "opencode" -> `agentId: "opencode"` |
| 46 | - "gemini" or "gemini cli" -> `agentId: "gemini"` |
| 47 | - "kimi" or "kimi cli" -> `agentId: "kimi"` |
| 48 | |
| 49 | These defaults match current acpx built-in aliases. |
| 50 | |
| 51 | If policy rejects the chosen id, report the policy error clearly and ask for the allowed ACP agent id. |
| 52 | |
| 53 | ## OpenClaw ACP runtime path |
| 54 | |
| 55 | Required behavior: |
| 56 | |
| 57 | 1. For ACP harness thread spawn requests, read this skill first in the same turn before calling tools. |
| 58 | 2. Use `sessions_spawn` with: |
| 59 | - `runtime: "acp"` |
| 60 | - `thread: true` |
| 61 | - `mode: "session"` (unless user explicitly wants one-shot) |
| 62 | 3. For ACP harness thread creation, do not use `message` with `action=thread-create`; `sessions_spawn` is the only thread-create path. |
| 63 | 4. Put requested work in `task` so the ACP session gets it immediately. |
| 64 | 5. Set `agentId` explicitly unless ACP default agent is known. |
| 65 | 6. Do not ask user to run slash commands or CLI when this path works directly. |
| 66 | |
| 67 | Example: |
| 68 | |
| 69 | User: "spawn a test codex session in thread and tell it to say hi" |
| 70 | |
| 71 | Call: |
| 72 | |
| 73 | ```json |
| 74 | { |
| 75 | "task": "Say hi.", |
| 76 | "runtime": "acp", |
| 77 | "agentId": "codex", |
| 78 | "thread": true, |
| 79 | "mode": "session" |
| 80 | } |
| 81 | ``` |
| 82 | |
| 83 | ## Thread spawn recovery policy |
| 84 | |
| 85 | When the user asks to start a coding harness in a thread (for example "start a codex/claude/pi/kimi thread"), treat that as an ACP runtime request and try to satisfy it end-to-end. |
| 86 | |
| 87 | Required behavior when ACP backend is unavailable: |
| 88 | |
| 89 | 1. Do not immediately ask the user to pick an alternate path. |
| 90 | 2. First attempt automatic local repair: |
| 91 | - ensure plugin-local pinned acpx is installed in `extensions/acpx` |
| 92 | - verify `${ACPX_CMD} --version` |
| 93 | 3. After reinstall/repair, restart the gateway and explicitly offer to run that restart for the user. |
| 94 | 4. Retry ACP thread spawn once after repair. |
| 95 | 5. Only if repair+retry fails, report the concrete error and then offer fallback options. |
| 96 | |
| 97 | When offering fallback, keep ACP first: |
| 98 | |
| 99 | - Option 1: retry ACP spawn after showing exact failing step |
| 100 | - Option 2: direct acpx telephone-game flow |
| 101 | |
| 102 | Do not default to subagent runtime for these requests. |
| 103 | |
| 104 | ## ACPX install and version policy (direct acpx path) |
| 105 | |
| 106 | For this repo, direct `acpx` calls must follow the same pinned policy as the `@openclaw/acpx` extension package. |
| 107 | |
| 108 | 1. Prefer plugin-local binary, not global PATH: |
| 109 | - `./extensions/acpx/node_modules/.bin/acpx` |
| 110 | 2. Resolve pinned version from extension dependency: |
| 111 | - `node -e "console.log(require('./extensions/acpx/package.json').dependencies.acpx)"` |
| 112 | 3. If binary is missing or version mismatched, install plugin-local pinned version: |
| 113 | - `cd extensions/acpx && npm install --omit=dev --no-save acpx@<pinnedVersion>` |
| 114 | 4. Verify before use: |
| 115 | - `./extensions/acpx/node_modules/.bin/acpx --version` |
| 116 | 5. If install/repair changed ACPX artifacts, restart the gateway and offer to run the restart. |
| 117 | 6. Do not run `npm install -g acpx` unless the user explicitly asks for global install. |
| 118 | |
| 119 | Set and reuse: |
| 120 | |
| 121 | ```bash |
| 122 | ACPX_CMD="./extensions/acpx/node_modules/.bin/acpx" |
| 123 | ``` |
| 124 | |
| 125 | ## Direct a |