Skip to content
pi-c RPC mode
Login

RPC mode

pic --mode rpc speaks Pi's RPC protocol (Pi's docs/rpc.md and docs/rpc-commands.md): one JSON command per line on stdin, each answered by a response line with its id, command, success and data or error, with Pi's JSON events in between. -c (or --continue) continues the latest conversation and --session ID that one; otherwise a new one starts. --model and --thinking set where it starts. Closing stdin ends the process; SIGTERM, SIGHUP and SIGINT cancel what runs first.

Every Pi command is there with Pi's fields, responses and errors: the RPC command reference lists them, and differences from Pi says where pic's answers differ.

The journal

The process holds the journal only while it works: for one command when idle, and for the length of a request, a compaction or a bash command, so other pic commands can use the journal in between. While a request runs, steering, queries and setting changes are answered at once; compact, new_session, switch_session, fork and clone abort the request first (journaled as Ctrl-C's cancel is) and run once it has stopped; anything else waits its turn. compact then compacts at once, outside any request: the compaction and its summary request belong to the conversation's latest request and commit together, so a crash leaves either the compaction or a failed attempt. A crash mid-request recovers as any pic run's (pic run, or the next request). Steering sent while idle is held for the next prompt, as Pi's is.