Hey folks — I’ve been hitting a limitation with RPC mode being tied to stdio lifecycle.
Right now, if a host process dies or restarts, the existing pi --mode rpc process may still be alive, but there’s no way for a new host process to reconnect to it. Since RPC mode treats stdin EOF / transport loss as process death from the host’s point of view, the usual recovery path is to spawn a fresh pi, which can lead to duplicate runtimes for the same session.
I put together a small POC for a reconnectable Unix-socket RPC mode: pi --mode rpc --rpc-socket /tmp/pi.sock
Same JSONL protocol, but the transport is a Unix socket, pi stays alive across client disconnects, and a new client can reconnect later. Single client at a time for now, no event replay — reconnecting clients are expected to resync via get_state / get_messages.
I know Mario is already working on proper server mode for pi, so this is just a POC / possible stepping stone. Would appreciate any feedback on whether this direction seems useful or if it’s solving the wrong layer.
Add a Unix-socket transport for RPC mode via --rpc-socket. Socket mode keeps pi alive across client disconnects, accepts one client at a time, and preserves the existing JSONL protocol so hosts can...
Recent Announcements
Continue the conversation
Join the Discord to ask follow-up questions and connect with the community