ACP Router
Route a plain-language request to the right ACPX harness.
Decision rules
- If the user's wording names a harness explicitly ("run this in Claude
Code", "ask Cursor to..."), use that as
harnessdirectly. - If the user wants Codex chat conversation, prefer the native Codex
binding (a separate skill); use ACPX Codex only when ACP/
/acp/acpx is named explicitly or when background spawn is needed. - Default
modetosessionso follow-up turns can be added withacp_send. Useone-shotonly when the user asked for a single non-interactive task. (Note:modeis ignored byoneshot-prompttransport agents — claude / cursor / gemini / qwen / codex — because each turn is its own fresh process. Continuity inside the child is not preserved betweenacp_sendcalls on those harnesses.)
Transport awareness
The runtime now uses three transports. acp_doctor returns each agent's
transport in details[].transport (when populated by the host) or you
can infer from the agent_id:
oneshot-prompt(claude, cursor, gemini, qwen, codex) — re-spawns the CLI fresh per turn with the prompt as a CLI argument (claude -p "<task>",codex exec "<task>", ...) and captures stdout to EOF.acp_spawnruns the first turn synchronously and returns the answer in theeventsarray; theassistant_messageevent holds the captured stdout.json-acp(tlamatini self-host) — strict JSON envelope on stdin.tui-repl(kiro, kimi, iflow, kilocode, opencode, pi, droid, copilot) — long-lived REPL over stdin.acp_spawnreturns the session_id sub-second; harvest answers viaacp_send_and_wait/acp_transcript.
Procedure
- Call
list_acp_agentsto confirm the chosen agentId isresolvable. If not, callacp_doctorand surface the doctor message to the user. - Call
acp_spawn(agent_id=harness, task=<task>, cwd=<cwd>, mode=<mode>). - Return
{session_id, agent_id, transcript_path}from the spawn result.
Failure handling
- If
acp_spawnreturnscode: AGENT_NOT_FOUND, do NOT silently fall back to a different harness. Report the missing CLI to the user, name the install instruction (e.g. "install the Claude Code CLI"), and ask whether they want to retry with a different harness. - If
acp_spawnreturnscode: PERMISSION_DENIED, the runtime is indeny-allmode. Report this to the user; do not try to bypass. - If a
oneshot-promptspawn returns events with emptyassistant_message.textand adone._synthetic == "timeout", the CLI exceeded the default 180 s hard cap. Retry with explicittimeout_seconds=300if the task warrants it; otherwise report the timeout to the user.