svkozak/pi-acp

ACP adapter for pi coding agent

What it solves

pi-acp is an adapter that allows the pi coding agent to be used within editors and clients that support the Agent Client Protocol (ACP), such as the Zed editor. It bridges the gap between the pi agent's internal RPC and the ACP standard, enabling a headless or editor-integrated experience for a tool originally designed for the terminal.

How it works

The adapter communicates via JSON-RPC 2.0 over standard input/output (stdio) to the ACP client. It spawns the pi agent in RPC mode (pi --mode rpc) and translates requests and events between the client and the agent. Key translations include:

  • Tool Execution: Maps pi tool calls to ACP tool_call and tool_call_update events, resolving relative file paths to absolute paths so the editor can follow along.
  • Streaming: Streams assistant responses as ACP agent_message_chunk events.
  • Session Management: Maps ACP session loading and creation to pi's own session persistence files.
  • Context Tracking: Reports pi's real-time context occupancy and token usage to the client via usage_update events.

Who it’s for

Developers who use the pi coding agent and want to integrate it directly into their IDE (specifically Zed) rather than using a separate terminal window.

Highlights

  • Zed Editor Integration: Full support for session history, startup info, and tool location surfacing.
  • Structured Diffs: Attempts to infer line numbers and emit structured diffs (oldText/newText) for file edits.
  • Slash Command Support: Supports file-based prompts, built-in commands (like /compact and /export), and skill commands.
  • Session Persistence: Allows sessions to be resumed across different ACP clients and the pi terminal agent.
  • Terminal Auth: Supports Terminal Authentication for the ACP Registry to handle agent setup and login.

Related

  • Project
  • Project
  • Project
  • Project
  • Project