pi-acpinator
A fast, tiny ACP (Agent Client Protocol) adapter for the
pi coding agent, written in Rust.
It speaks ACP JSON-RPC 2.0 over stdio to any ACP client (e.g. the Zed editor) and drives
pi --mode rpc underneath. Because it spawns pi rather than embedding a JS runtime, the
adapter is a small native binary — low memory, fast startup.
Status
Working today (live-verified against real pi):
initializehandshake; advertisesload_session(no auth method — pi provider keys are configured externally via the pi CLI)session/new— spawns and supervises a persistentpi --mode rpcsession; advertises pi's thinking levels (off..xhigh) as session modes and pi's models as a config optionsession/prompt— streams assistant output + reasoning asagent_message_chunk/agent_thought_chunk, coalescing delta bursts into far fewer frames; forwards image content blocks to pi- tool calls — pi tool execution maps to
tool_call/tool_call_update(kind, status, output, cwd-resolved locations);write/editsurface as structured diffs session/request_permission— a bundled pi extension gates tools viactx.ui.confirm, surfaced to the client as ACP permission requests (scope:off|mutating|all)session/set_mode— switches pi's thinking levelsession/set_config_option— switches pi's model (validated; a bad model / missing key surfaces as an error)session/load— resumes a persisted session and replays its history to the client; reuses an already-live session instead of spawning a second pisession/cancel— aborts the turn and resolves it withStopReason::Cancelled- fails a turn loudly if pi exits before completing it
Measured (deterministic bench, node scripts/bench.mjs): 1.95 MiB binary, ~3 ms cold start,
~1M deltas/s with ~45x delta coalescing, ~5.6 MiB peak RSS. Both pi stdin and the event
stream are bounded, so a slow peer applies backpressure instead of buffering without limit.
Install
# prebuilt binary via npm (no Rust toolchain needed)
# or from source
Use with an ACP client (Zed)
"agent_servers":
Or point command at a cargo build --release binary. Set PI_ACPINATOR_APPROVAL to
off | mutating (default) | all to control tool permission prompts.
Requires pi on PATH (npm install -g @earendil-works/pi-coding-agent), configured with
your model provider / API key.
Develop
RUST_LOG=debug
License
MIT