Docs

Scripting

Same agents, same threads. Replies print; cards stop the script.

Coming with the next terminal release: --wait, -p, piped input on chat send, --idempotency-key, --wait-timeout and chat follow. Today chat send sends and returns; see Commands for what ships now.

One shot

pronoia chat @ava -p "How did Sprouts do this week?"

-p is chat send --wait: it sends, waits for the reply, prints it, then exits. A bare ava reads as @ava.

Pipe in

cat orders.csv | pronoia chat @ava -p "Top 3 SKUs?"

With no text and no --message-file, piped stdin is the message. --message-file - reads stdin too, and works today.

JSON out

pronoia chat @ava -p "Recap" --json | jq -r .message.content
{
  "conversation_id": "th_8f2c01",
  "run_id": "run_41a9de",
  "state": "needs_you",
  "message": { "content": "Draft ready. Send it?" },
  "cards": [{ "kind": "send_email", "url": "https://…/t/th_8f2c01" }],
  "cost_usd": 0.031
}

state is done, needs_you or still_running. cost_usd is null until the server reports it.

Continue a thread

pronoia chat send th_8f2c01 --wait "Make it shorter"
pronoia chat follow th_8f2c01

Retry safely

pronoia chat @ava -p "Nightly recap" --idempotency-key "recap-$(date +%F)"

The same key returns the same conversation and message, so a retried script never asks twice.

CI and cron

# key from Settings → Connections → MCP
PRONOIA_TOKEN=… pronoia chat @ava -p "Nightly recap" --no-input --wait-timeout 15m

Exit codes

CodeMeansDo
0DoneRead stdout
20A card waits for a personOpen the printed link
21Needs the browserOpen the printed link and act there
22Still runningWait longer, or chat follow
1The run failedRead the error on stderr

20, 21 and 22 are not failures: branch on them. Every code: Errors, decoded.