Artifact d42bb61be3b7ad64d1854cad3a241d9dcdc7b0184d14813af317816a011d690c:
- File docs/manual/print-and-json.md — part of check-in [1e2ad08450] at 2026-11-21 16:14:12 on branch print-session — Create new branch named "print-session" (user: dmestas, size: 1395) [annotate] [blame] [check-ins using] [more...]
Print mode and JSON
Print mode
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. -- 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.