Artifact f69c5b182309192f6926b6c8ad8d1ce729558959461784fab153fab9ff4acfe6:
- File docs/manual/rpc.md — part of check-in [d66dc3f8af] at 2026-11-21 11:05:58 on branch docs-reorg — docs: short README; manual, reference, dev, design and archive under docs/; AGENTS.md; docs.sh checks docs against code; changelog.inc built at build time (user: dmestas, size: 1582) [annotate] [blame] [check-ins using] [more...]
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.