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.
RPC mode never asks for the credential store's passphrase on a terminal, since the client owns
stdin and the terminal. When the model's key is sealed and the store is locked, a prompt fails at
once after a credential_locked event naming the provider; the client asks its user and sends
unlock with the passphrase, then the prompt again.
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.