Skip to content
pi-c Print mode and JSON
Login

Print mode and JSON

Print mode follows Pi's: -p (or --print) takes the prompt as its next argument unless that starts with @ or - (--- excepted), and runs it as pic ask does; exit 0 on an answer, 1 on a failed or cut-short request or an unreadable @file. Piped stdin (when stdin is not a terminal) is trimmed and put first, then the @file blocks, then the first message, with nothing between them; further messages continue the conversation. -c (or --continue) runs the prompt in the latest conversation and --session ID in that one, before or after -p; an ID that names no conversation is an error (exit 1, no session ID) and nothing is admitted. --session-id ID joins the conversation with exactly that ID, or starts one under it. --no-session keeps nothing. --mode json is -p --json and --mode text the default. -- ends the options.

pic -p "list the TODOs"
git diff | pic -p "review this"
pic -p @notes.md @shot.png "summarize"

--system-prompt and --append-system-prompt work here too; see prompts and skills.

JSON events

--json writes Pi's JSON events to stdout, one per line, as Pi's JSON mode does; the event reference lists them. --stream streams the reply even when stdout is piped. With --json, --commands reads Pi's RPC command lines on stdin to steer the running request (steer, follow_up, clear_queue, abort, set_steering_mode, set_follow_up_mode). For a whole session driven over stdin, use RPC mode.