ACP (Agent Client Protocol) adapter for pi coding agent (fka shitty coding agent).
pi-acp communicates ACP JSON-RPC 2.0 over stdio to an ACP client (e.g. Zed editor) and spawns pi --mode rpc, bridging requests/events between the two.
This is an MVP-style adapter intended to be useful today and easy to iterate on. Some ACP features may be not implemented or are not supported (see Limitations). Development is centered around Zed editor support, other clients may have varying levels of compatibility.
Expect some minor breaking changes.
- Streams assistant output as ACP
agent_message_chunk - Maps pi tool execution to ACP
tool_call/tool_call_update- For
edit,pi-acpsnapshots the file before the tool runs and emits an ACP structured diff (oldText/newText) on completion when possible
- For
- Session persistence
- pi stores its own sessions in
~/.pi/agent/sessions/... pi-acpstores a small mapping file at~/.pi/pi-acp/session-map.jsonsosession/loadcan reattach to a previous pi session file
- pi stores its own sessions in
- Slash commands
- Loads file-based slash commands compatible with pi’s conventions
- Adds a small set of built-in commands for headless/editor usage
- Supports skill commands (if enabled in pi settings, they appear as
/skill:skill-namein the ACP client)
- Skills are loaded by pi directly and are available in ACP sessions
- (Zed)
pi-acpemits “startup info” block into the session (pi version, context, skills, prompts, extensions - similar topiin the terminal). You can disable it by settingquietStartup: truein pi settings (~/.pi/agent/settings.jsonor<project>/.pi/settings.json). WhenquietStartupis enabled,pi-acpwill still emit a 'New version available' message if the installed pi version is outdated. - (Zed) Session history is supported in Zed starting with
v0.225.0. Session loading / history maps to pi's session files. Sessions can be resumed both inpiand in the ACP client.
Make sure pi is installed
npm install -g @mariozechner/pi-coding-agent- Node.js 22+
piinstalled and available on yourPATH(the adapter runs thepiexecutable)- Configure
piseparately for your model providers/API keys
Add pi-acp to your ACP client, e.g. Zed
In Zed launch the registry with zed: acp registry command and select pi ACP adapter from the list. This will automatically add the agent server configuration to your settings.json and keep it up to date:
"agent_servers": {
"pi-acp": {
"type": "registry",
},
}Add the following to your Zed settings.json:
"agent_servers": {
"pi": {
"type": "custom",
"command": "npx",
"args": ["-y", "pi-acp"],
"env": {}
}
}npm install -g pi-acp "agent_servers": {
"pi": {
"type": "custom",
"command": "pi-acp",
"args": [],
"env": {}
}
}npm install
npm run buildPoint your ACP client to the built dist/index.js:
"agent_servers": {
"pi": {
"type": "custom",
"command": "node",
"args": ["/path/to/pi-acp/dist/index.js"],
"env": {}
}
}pi-acp supports slash commands:
Loaded from:
- User commands:
~/.pi/agent/prompts/**/*.md - Project commands:
<cwd>/.pi/prompts/**/*.md
/compact [instructions...]– run pi compaction (optionally with custom instructions)/autocompact on|off|toggle– toggle automatic compaction/export– export the current session to HTML in the sessioncwd/session– show session stats (tokens/messages/cost/session file)/name <name>– set session display name/queue all|one-at-a-time– set pi queue mode (unstable feature)/changelog– print the installed pi changelog (best-effort)/steering- maps topiSteering Mode, get/set/follow-up- pats topiFollow-up Mode, get/set
Other built-in commands:
/model- maps to model selector in Zed/thinking- maps to 'mode' selector in Zed/clear- not implemented (use ACP client 'new' command)
- Skill commands can be enabled in pi settings and will appear in the slash command list in ACP client as
/skill:skill-name.
Note: Slash commands provided by pi extensions are not currently supported.
This agent supports Terminal Auth for the ACP Registry. In Zed, this will show an Authenticate banner that launches pi in a terminal. Launch pi in a terminal for interactive login/setup:
pi-acp --terminal-loginYour ACP client can also invoke this automatically based on the agent's advertised authMethods.
npm install
npm run dev # run from src via tsx
npm run build
npm run lint
npm run testProject layout:
src/acp/*– ACP server + translation layersrc/pi-rpc/*– pi subprocess wrapper (RPC protocol)
- No ACP filesystem delegation (
fs/*) and no ACP terminal delegation (terminal/*). pi reads/writes and executes locally. - MCP servers are accepted in ACP params and stored in session state, but not wired through to pi (see why). If you use pi MCP adapter it will be available in the ACP client.
- Assistant streaming is currently sent as
agent_message_chunk(no separate thought stream). - Queue is implemented client-side and should work like pi's
one-at-a-time ACP clients don't yet suport session history, but ACP sessions frompi-acpcan be/resumed in pi directly
MIT (see LICENSE).