Artifact 35c51a2ac1d8f6a33063f885abf000db3a43069ec3963b44b4b9d4b85f93b430:
- File
docs/manual/print-and-json.md
— part of check-in
[37a5984f8b]
at
2026-11-22 10:54:21
on branch pi-flags
— Add Pi's session flags: -r/--resume, --session-id, --no-session, --mode json|text
The system prompt now points the model at pic help. (user: dmestas, size: 1572) [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. `--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. ```sh 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](prompts-and-skills.md). ## JSON events `--json` writes Pi's JSON events to stdout, one per line, as Pi's JSON mode does; [the event reference](../reference/events.md) 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](rpc.md).