Skills acpx
Use acpx as a headless ACP CLI for agent-to-agent communication, including prompt/exec/sessions workflows, session scoping, queueing, permissions, and output formats.
git clone https://github.com/openclaw/skills
T=$(mktemp -d) && git clone --depth=1 https://github.com/openclaw/skills "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/beelkic/acpx" ~/.claude/skills/openclaw-skills-acpx && rm -rf "$T"
T=$(mktemp -d) && git clone --depth=1 https://github.com/openclaw/skills "$T" && mkdir -p ~/.openclaw/skills && cp -r "$T/skills/beelkic/acpx" ~/.openclaw/skills/openclaw-skills-acpx && rm -rf "$T"
skills/beelkic/acpx/SKILL.mdacpx
When to use this skill
Use this skill when you need to run coding agents through
acpx, manage persistent ACP sessions, queue prompts, or consume structured agent output from scripts.
What acpx is
acpx is a headless, scriptable CLI client for the Agent Client Protocol (ACP). It is built for agent-to-agent communication over the command line and avoids PTY scraping.
Core capabilities:
- Persistent multi-turn sessions per repo/cwd
- One-shot execution mode (
)exec - Named parallel sessions (
)-s/--session - Queue-aware prompt submission with optional fire-and-forget (
)--no-wait - Cooperative cancel command (
) for in-flight turnscancel - Graceful cancellation via ACP
on interruptsession/cancel - Session control methods (
,set-mode
)set <key> <value> - Agent reconnect/resume after dead subprocess detection
- Prompt input via stdin or
--file - Config files with global+project merge and
config show|init - Session metadata/history inspection (
,sessions show
)sessions history - Local agent process checks via
status - Stable ACP client methods for filesystem and terminal requests
- Stable ACP
handshake via env/config credentialsauthenticate - Structured streaming output (
,text
,json
)quiet - Built-in agent registry plus raw
escape hatch--agent
Install
npm i -g acpx
For normal session reuse, prefer a global install over
npx.
Command model
prompt is the default verb.
acpx [global_options] [prompt_text...] acpx [global_options] prompt [prompt_options] [prompt_text...] acpx [global_options] exec [prompt_options] [prompt_text...] acpx [global_options] cancel [-s <name>] acpx [global_options] set-mode <mode> [-s <name>] acpx [global_options] set <key> <value> [-s <name>] acpx [global_options] status [-s <name>] acpx [global_options] sessions [list | new [--name <name>] | close [name] | show [name] | history [name] [--limit <count>]] acpx [global_options] config [show | init] acpx [global_options] <agent> [prompt_options] [prompt_text...] acpx [global_options] <agent> prompt [prompt_options] [prompt_text...] acpx [global_options] <agent> exec [prompt_options] [prompt_text...] acpx [global_options] <agent> cancel [-s <name>] acpx [global_options] <agent> set-mode <mode> [-s <name>] acpx [global_options] <agent> set <key> <value> [-s <name>] acpx [global_options] <agent> status [-s <name>] acpx [global_options] <agent> sessions [list | new [--name <name>] | close [name] | show [name] | history [name] [--limit <count>]]
If prompt text is omitted and stdin is piped,
acpx reads prompt text from stdin.
Built-in agent registry
Friendly agent names resolve to commands:
->codexnpx @zed-industries/codex-acp
->claudenpx @zed-industries/claude-agent-acp
->geminigemini
->opencodenpx opencode-ai
->pinpx pi-acp
Rules:
- Default agent is
for top-levelcodex
,prompt
, andexec
.sessions - Unknown positional agent tokens are treated as raw agent commands.
explicitly sets a raw ACP adapter command.--agent <command>- Do not combine a positional agent and
in the same command.--agent
Commands
Prompt (default, persistent session)
Implicit:
acpx codex 'fix flaky tests'
Explicit:
acpx codex prompt 'fix flaky tests' acpx prompt 'fix flaky tests' # defaults to codex
Behavior:
- Uses a saved session for the session scope key
- Auto-resumes prior session when one exists for that scope
- If no session exists for the scope, exits with
and prompts forNO_SESSIONsessions new - Is queue-aware when another prompt is already running for the same session
- On interrupt during an active turn, sends ACP
before force-kill fallbacksession/cancel
Prompt options:
: use a named session within the same cwd-s, --session <name>
: enqueue and return immediately when session is already busy--no-wait
: read prompt text from file (-f, --file <path>
means stdin)-
Exec (one-shot)
acpx exec 'summarize this repo' acpx codex exec 'summarize this repo'
Behavior:
- Runs a single prompt in a temporary ACP session
- Does not reuse or save persistent session state
Cancel / Mode / Config
acpx codex cancel acpx codex set-mode plan acpx codex set approval_policy conservative
Behavior:
: sends cooperativecancel
through queue-owner IPC.session/cancel
: calls ACPset-mode
.session/set_mode
: calls ACPset
.session/set_config_option
/set-mode
route through queue-owner IPC when active, otherwise reconnect directly.set
Sessions
acpx sessions acpx sessions list acpx sessions new acpx sessions new --name backend acpx sessions close acpx sessions close backend acpx sessions show acpx sessions history --limit 20 acpx status acpx codex sessions acpx codex sessions new --name backend acpx codex sessions close backend acpx codex sessions show backend acpx codex sessions history backend --limit 20 acpx codex status
Behavior:
andsessions
are equivalentsessions list
creates a fresh session for the currentnew
scope(agentCommand, cwd, optional name)
targets a named session scopenew --name <name>- when
replaces an existing open session in that scope, the old one is soft-closednew
targets current cwd default sessionclose
targets current cwd named sessionclose <name>
prints stored metadata for that scoped sessionshow [name]
prints stored turn history previews (default 20, usehistory [name]
)--limit
Global options
: raw ACP agent command (escape hatch)--agent <command>
: working directory for session scope (default: current directory)--cwd <dir>
: auto-approve all permission requests--approve-all
: auto-approve reads/searches, prompt for writes (default mode)--approve-reads
: deny all permission requests--deny-all
: output format (--format <fmt>
,text
,json
)quiet
: max wait time (positive number)--timeout <seconds>
: queue owner idle TTL before shutdown (default--ttl <seconds>
,300
disables TTL)0
: verbose ACP/debug logs to stderr--verbose
Permission flags are mutually exclusive.
Config files
Config files are merged in this order (later wins):
- global:
~/.acpx/config.json - project:
<cwd>/.acpxrc.json
Supported keys:
defaultAgent
(defaultPermissions
,approve-all
,approve-reads
)deny-all
(seconds)ttl
(seconds ortimeout
)null
(format
,text
,json
)quiet
map (agents
)name -> { command }
map (auth
)authMethodId -> credential
Use
acpx config show to inspect the resolved config and acpx config init to create the global template.
Session behavior
Persistent prompt sessions are scoped by:
agentCommand- absolute
cwd - optional session
name
Persistence:
- Session records are stored in
.~/.acpx/sessions/*.json
creates parallel named conversations in the same repo.-s/--session- Changing
changes scope and therefore session lookup.--cwd - closed sessions are retained on disk with
andclosed: true
.closedAt - auto-resume by scope skips closed sessions.
Resume behavior:
- Prompt mode attempts to reconnect to saved session.
- If adapter-side session is invalid/not found,
creates a fresh session and updates the saved record.acpx - explicitly selected session records can still be resumed via
even if previously closed.loadSession - dead saved PIDs are detected and reconnected on the next prompt.
- each completed prompt stores lightweight turn history previews in the session record.
Prompt queueing and --no-wait
--no-waitQueueing is per persistent session.
- The active
process for a running prompt becomes the queue owner.acpx - Other invocations submit prompts over local IPC.
- On Unix-like systems, queue IPC uses a Unix socket under
.~/.acpx/queues/<hash>.sock - Ownership is coordinated with a lock file under
.~/.acpx/queues/<hash>.lock - On Windows, named pipes are used instead of Unix sockets.
- after the queue drains, owner shutdown is governed by TTL (default 300s, configurable with
).--ttl
Submission behavior:
- Default: enqueue and wait for queued prompt completion, streaming updates back.
: enqueue and return after queue acknowledgement.--no-wait
during an active turn sends ACPCtrl+C
, waits briefly, then force-kills only if cancellation does not finish in time.session/cancel
sends the same cooperative cancellation without requiring terminal signals.cancel
Output formats
Use
--format <fmt>:
(default): human-readable stream with updates/tool status and done linetext
: NDJSON event stream (good for automation)json
: final assistant text onlyquiet
Example automation:
acpx --format json codex exec 'review changed files' \ | jq -r 'select(.type=="tool_call") | [.status, .title] | @tsv'
Permission modes
: no interactive permission prompts--approve-all
(default): approve reads/searches, prompt for writes--approve-reads
: deny all permission requests--deny-all
If every permission request is denied/cancelled and none approved,
acpx exits with permission-denied status.
Practical workflows
Persistent repo assistant:
acpx codex 'inspect failing tests and propose a fix plan' acpx codex 'apply the smallest safe fix and run tests'
Parallel named streams:
acpx codex -s backend 'fix API pagination bug' acpx codex -s docs 'draft changelog entry for release'
Queue follow-up without waiting:
acpx codex 'run full test suite and investigate failures' acpx codex --no-wait 'after tests, summarize root causes and next steps'
One-shot script step:
acpx --format quiet exec 'summarize repo purpose in 3 lines'
Machine-readable output for orchestration:
acpx --format json codex 'review current branch changes' > events.ndjson
Raw custom adapter command:
acpx --agent './bin/custom-acp-server --profile ci' 'run validation checks'
Repo-scoped review with permissive mode:
acpx --cwd ~/repos/shop --approve-all codex -s pr-842 \ 'review PR #842 for regressions and propose minimal patch'