# RPC commands
The commands `pic --mode rpc` reads on stdin, one JSON object per line, with Pi's fields, responses
and errors (Pi's `docs/rpc.md` and `docs/rpc-commands.md`). How the mode behaves is in [RPC
mode](../manual/rpc.md).
| Command | What it does |
|---|---|
| `prompt` | send a message (with `images` and `streamingBehavior`) |
| `steer` | steer the running request |
| `follow_up` | queue a message for after the running request |
| `abort` | stop the running request |
| `clear_queue` | drop queued steering and follow-ups |
| `new_session` | start a new conversation |
| `get_state` | the session's state |
| `get_messages` | the conversation's messages |
| `set_model` | switch model; applies from the next request; `persist: true` also saves it as the model new conversations start on; pic's `credential`: a key label of the model's provider, used from the next request (saved too with `persist`) |
| `cycle_model` | the next model |
| `get_available_models` | models whose provider has a key, then the saved endpoints' models, which carry `endpoint` |
| `set_thinking_level` | set the thinking level; applies from the next request |
| `cycle_thinking_level` | the next thinking level |
| `get_available_thinking_levels` | the model's supported levels |
| `set_steering_mode` | how steering is delivered |
| `set_follow_up_mode` | how follow-ups are delivered |
| `compact` | compact now, outside any request |
| `set_auto_compaction` | the `compaction.enabled` setting |
| `set_auto_retry` | saved as Pi's `retry.enabled` |
| `abort_retry` | stop waiting for a retry |
| `bash` | run a command and journal it |
| `abort_bash` | stop the running bash command |
| `get_session_stats` | tokens and cost |
| `export_html` | the conversation as an HTML page |
| `switch_session` | continue another conversation: a conversation id, or a file `pic export --pi` wrote, as `sessionPath` |
| `fork` | fork from an entry |
| `clone` | duplicate the conversation |
| `rewind` | pic's: `entryId` (a user message), `mode` (both, conversation, files), `forcePartial`; or `undo` |
| `get_fork_messages` | the messages a fork can start from |
| `get_entries` | the conversation's own path |
| `get_tree` | the conversation's own path, as a tree |
| `get_last_assistant_text` | the last reply's text |
| `set_session_name` | name the conversation |
| `get_commands` | prompt templates and skills; pic adds a template's `argumentHint` and, given `contextWindow`, `skillsWarning`: what the skill listing's budget cuts |
| `extension_ui_response` | answered with an error: pic has no extensions |
| `login` | `provider`: its subscription sign-in in the browser; messages on stderr, the redirect completes it; a locked store is opened with `unlock` first |
| `logout` | `provider`: remove its stored sign-in or key, or pic's `label`: that key; `data.removed` |
| `unlock` | pic's: `passphrase`: open the credential store (RPC never asks on a terminal); a store with no passphrase yet is made with it, and `data.created` is true |
| `get_credentials` | pic's: `provider` (optional); `data.credentials`, each key's `provider`, `label`, `kind`, `active`, `state` (ok, invalid, credit, limited, unknown) and, when known, `status`, `until`, `checked`, `remaining` with `currency`, `probed` (the last free check), `reason`, `left` (what is left: `kind` money or none, `amount`, `currency`, `source`, `as_of`, `stale`), `expires_at`, `days_left`, `expiry_source`, `expired`, `rotated_at`; never a value; and `data.bindings`, each rule's `pattern`, `provider`, `label` |
| `set_credential` | pic's: `provider`, `label`: this RPC process's requests to the provider use that key from the next one; `persist: true` also saves it as `pic auth use` does; `data.provider`, `label`, `persist`, `changed` |
| `add_credential` | pic's: `provider`, `label` (optional: the provider's own), `key`, `use` (optional: also make it the provider's), `expires_at` (optional): store an API key, sealed; the same key again changes nothing; `data.provider`, `label`, `kind`, `changed`, `active`; never the key |
| `set_credential_expiry` | pic's: `provider`, `label`, `expires_at` (a date, an RFC 3339 time, `30d`, or null for none): record when that key expires; `data.expires_at`, `expiry_source` |
| `set_model_credential` | pic's: `pattern`, `label` (null removes it): a saved rule, the models `pattern` matches use that key of their provider; `data.pattern`, `provider`, `label`, `changed` |
| `check_credentials` | pic's: `provider`, `active` (optional): run the free checks now; `data.checked` and `get_credentials`'s `credentials` |
| `get_auth_status` | each stored credential's `provider`, `type`, `label`, `createdAt`, `lastUsedAt`; never a value |
| `get_providers` | pic's: `data.providers`, every provider pic knows |
| `get_endpoints` | pic's: `data.endpoints`, each saved endpoint's `name`, `url`, `hasKey`, `models` (`id`, `owned_by`), `fetchedAt` and the last failed fetch's `error` |
| `add_endpoint` | pic's: `name`, `url` (and `key`, sealed under the name): save it and fetch its models; `data.count`, or `data.error` when the fetch failed (the endpoint is kept) |
| `remove_endpoint` | pic's: `name`: forget it and its key; `data.removed` |
| `refresh_endpoints` | pic's: `name` (optional: every one): fetch the lists again; `data.endpoints`, each `name`, `count` and `error` (null when it worked; a failure keeps the old list) |
| `get_context_files` | pic's: `data.files`, the instruction files every request reads |
| `list_files` | pic's: `dir` (the workspace), `maxEntries` (20000), `maxDepth` (8); `data.entries`, each `[path, isFolder, depth]`, breadth first, without what the ignore files leave out |
| `get_help` | pic's: `topic` (optional); `data.topics` and the topic's `text` (null when there is none) |
| `get_changelog` | pic's: `data.text`, the changelog |
| `get_compaction_settings` | pic's: `model` (optional); `data.compaction` and `data.branchSummary` as the settings apply |
| `get_setting` | pic's: `key`; `data.value`, or null when unset |
| `set_setting` | pic's: `key` and `value` (null removes it), or `key`, `path` and `json` for one field of a JSON setting; a key in the settings list takes only what it allows (a field by its dotted name too), others pass |
| `get_settings` | pic's: `since`, `setting` (optional); `data.version` and `data.settings`, each row's `id`, `key`, `field`, `group`, `name`, `kind` (choice, number, text, picker), `values` and `labels` or `min` and `max`, `unit`, `default`, `defaultLabel`, `description`, `applies`, `stored`, `value` and `valid`; `data.unchanged` true when `version` still equals `since` |
| `get_trust` | pic's: `path`; `data.trusted`: 1, 0, or -1 undecided |
| `set_trust` | pic's: `path`, `trusted` |
| `get_scoped_models` | pic's: `data.patterns`, Ctrl+P's scope |
| `set_scoped_models` | pic's: `patterns` replaces the scope; `[]` clears it |
| `get_recent_models` | pic's: `limit` (10); `data.models`, each `model` and `usedMs`, the latest use first, from the journals of the workspaces used last |
| `report_bug` | pic's: `description` (and `workspace`, `session`, `model`); kept on this machine; `data.id` |
| `get_remote_phones` | pic's: `data.count`, the phones paired for remote control |
| `get_hooks` | pic's: `data.configured`, whether any hook is configured |
| `proc_start` | pic's: `kind`, `command`, `pid` (and `pgid`, `workspace`, `session`): records a process a client started, for `pic ps`; `data.id` |
| `proc_end` | pic's: `id`, `exitCode`, `signal`: marks it ended |
| `get_wakes` | pic's: `session` (the conversation; `all` for the journal's), `fire` (fire what is due first, and start its requests); `data.wakes`, each `id`, `name` (`L1`), `kind`, `session`, `prompt`, `everyMs`, `state`, `why`, `creator`, `fires`, `dueMs`, `firedMs`, `createdMs`, `expiresMs`, `cost`, `tokens`, `waiting`, `late`; `data.fired`, `data.nextDueMs`, `data.nowMs` ([loops](../manual/loops.md)) |
| `create_wake` | pic's: `prompt`, `every` (`5m`; none: 10 minutes), `session` (none: a new, empty conversation); the loop starts now; `data.wake`, `data.session`, `data.wakes` |
| `pause_wake` | pic's: `id` (`L1`); `data.wake`, `data.wakes` |
| `resume_wake` | pic's: `id`; it keeps its due time, so one paused past it runs at once |
| `stop_wake` | pic's: `id`; it ends for good |
| `pause_wakes` | pic's: `session`: every loop of the conversation paused (`/stop`); `data.paused`, `data.wakes` |