Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

prompt

What is sent to a session’s agent: prompts, steers, interrupts and context, and the turn’s cancellation.

brnr prompt send

Sends a prompt, with attachments, to one session. A prompt sent while a turn runs is held until it ends: a second prompt never goes while one runs.

brnr prompt send <session> [--steer | --interrupt | --context [--replace]]
                 [--prompt <text> | -] [--file <path>]... [--image <path>]...
                 [--wait [--timeout <s>]] [--json]
FlagMeaning
--steerPut the text into the running turn (_session/steering), where the agent advertises it. With no turn running, it is sent as a prompt. Not in strict mode, nor into an editor’s turn.
--interruptCancel the running turn, and send this ahead of the held prompts.
--contextAdd the text to the next prompt, as context. Text only.
--replaceWith --context: replace the last context entry.
--prompt <text>, --prompt -, --file <path>, --image <path>The prompt and its attachments, as for session new. One of them is needed.
--waitWait for the turn to end, and print the agent’s reply on stdout. Not with --context, which starts no turn.
--timeout <s>With --wait: give up waiting after this many seconds, exit 124. It doesn’t cancel the turn.
--jsonPrint the result as JSON.

--steer, --interrupt and --context are modes, not flags to combine: two of them are a usage error, and so is --replace without --context. With --wait, approvals and elicitations on the way are said on stderr, with how to answer them. An accepted send is not a turn that has ended: match the message id with turn_ended’s messages or message_dropped’s message.

Output (--json, without --wait):

FieldTypeMeaning
statusstringdelivered (sent now), held (until the running turn ends; context is always held), steered (into the running turn) or interrupting (the running turn is being cancelled; this goes next).
sessionstringThe session.
messagestring, optionalThe message’s id (m1), which its turn’s user_message and turn_ended carry. Not there for --context, which has none.
{
  "status": "held",
  "session": "sess-1",
  "message": "m2"
}

Output (--wait --json): one object, once the turn has ended. A command can fail before there is one.

FieldTypeMeaning
sessionstringThe session.
messagestringThe message’s id.
replystringThe agent’s messages in the turn, joined by a blank line.
stop_reasonstring or nullACP’s stop reason; null if the turn failed or the message was dropped.
errorobject or nullThe turn’s failure, {code, message}, agent_failed with the agent’s as rpc_error; null if it didn’t fail.
tokensobject or nullWhat the agent reported the turn used, as turn_ended has it; null if it reported nothing.
droppedlist of objectsEmpty, or the message, dropped before it was sent, {message, text, reason}.
{
  "session": "sess-1",
  "message": "m2",
  "reply": "done",
  "stop_reason": "end_turn",
  "error": null,
  "tokens": null,
  "dropped": []
}

Text output: delivered (message m2), held (message m2), …; with --wait, the agent’s reply.

Exit codes: 0 once sent (with --wait: once its turn has ended with end_turn); with --wait, 1 if the turn failed, stopped otherwise or its message was dropped, 124 when --timeout passes, 3 when cut off and unable to catch up; 1 if it fails; 2 for a usage error. Errors: those of a running session, input_invalid, capability_missing (steering, images), strict_mode_refused, turn_owned_by_editor, experimental_disabled, process_stopping, session_closed and agent_exited (with --wait).

brnr prompt cancel

Cancels the running turn (session/cancel). The held messages are dropped, unless --keep-held: they would otherwise start the next turn. The held context stays.

brnr prompt cancel <session> [--keep-held] [--json]
FlagMeaning
--keep-heldKeep the held messages.
--jsonPrint the result as JSON.

Output (--json):

FieldTypeMeaning
statusstringcancelling (a turn runs, and is cancelled) or idle (none runs).
sessionstringThe session.
droppedlist of objectsThe messages dropped, each {message, text, reason}, reason cancel.
dropped[].messagestringThe message’s id.
dropped[].textstringIts text.
dropped[].reasonstringcancel.
{
  "status": "cancelling",
  "session": "sess-1",
  "dropped": [
    {
      "message": "m2",
      "text": "later",
      "reason": "cancel"
    }
  ]
}

Text output: the status, then dropped m2: later for each message dropped.

Exit codes: 0; 1 if it fails. Errors: those of a running session, experimental_disabled.

brnr prompt commands

Lists the slash commands the agent has advertised (ACP’s available_commands_update). Invoke one by sending its text as a prompt.

brnr prompt commands <session> [--json]

Output (--json):

FieldTypeMeaning
sessionstringThe session.
commandslist of objectsOne for each command.
commands[].commandstringIts name, without the /.
commands[].hintstring or nullWhat its input is, as the agent says (input.hint); null if it takes none.
commands[].descriptionstringWhat it does, as the agent says.
{
  "session": "sess-1",
  "commands": [
    {
      "command": "compact",
      "hint": null,
      "description": "Compact the conversation"
    }
  ]
}

Text output: /compact Compact the conversation, one line for each.

Exit codes: 0; 1 if it fails. Errors: those of a running session.