Headless Mode
Updated
RightNow Agent, the terminal coding agent, is paused. Its guides stay online as reference.
Headless mode runs one prompt, writes the result to standard output, and exits.
Build from source
The reference below describes a build from the pinned agent source.
Run a prompt
Check the active provider, model, and credential with rightnow auth status --json. The shipped default provider is RunInfra (Providers).
--print is an alias of -p, and --cwd sets the working directory:
Prompt input
Pass exactly one of -p, --prompt-json, or --prompt-file. Piped standard input is not read.
Save content blocks as prompt.json:
Any file that does not end in .json is sent as plain text.
Output formats
- plain
- Final text (default). A run with verified effects ends with a
Headless completed with verified effects:line. - json
- One object with
text,stopReason,sessionId, andrequestId, plusoutcomeandeffects,thought, usage fields, andstructuredOutput(orstructuredOutputError) when present. - streaming-json
- One RightNow Agent event per line for text, thoughts, tool calls, usage, plans, completion, and errors.
- streaming-messages-json
- Messages API
stream-jsonlines, from asysteminit record to a finalresultrecord.
--json-schema takes a JSON object and returns the parsed reply in structuredOutput.
Windows (PowerShell)
macOS (zsh)
Linux (bash)
Permissions
Headless mode never opens an approval prompt. A tool call that still needs a human decision fails closed with exit code 20.
Add a narrow --allow rule or use --permission-mode auto.
--always-approve and its aliases approve every offered tool call. Use them only in a trusted workspace and host; deny rules, hooks, and administrator locks still take precedence.
Exit codes
- 0
- Completed. An action request also needs at least one completed action tool call.
- 1
- Startup, configuration, authentication (including failures during a prompt), output, or another unclassified failure.
- 2
- CLI usage or argument error, or startup refused by managed requirements.
- 20
- Refused, cancelled, or blocked by permission policy.
- 21
- An action request produced no completed actionable tool, or human input was required.
- 22
- An executable tool failed without recovery, execution stayed incomplete, or a turn, loop, model-call, spend, or time limit was reached.
- 23
- The model backend or ACP initialization failed, or an established ACP connection closed before the turn completed.
- 101
- The CLI thread could not be joined.
- 129
- Unix shell status for SIGHUP (terminal hangup).
- 130
- Unix shell status after SIGINT (Ctrl+C).
- 143
- Unix shell status after SIGTERM.
Retry notices go to standard error for plain and json output. Streaming formats emit structured retry events. Without an environment or model override, the generic retry budget allows at most 14 retries after the first attempt, with about 5.5 minutes of backoff. An interrupted run does not roll back file changes.
Options
Prompt
- -p, --single, --print <PROMPT>
- Send one prompt, print the result, and exit.
- --prompt-json <JSON>
- Provide a nonempty array of ACP content blocks, or an ACP wrapper object.
- --prompt-file <PATH>
- Read UTF-8 input from a file;
.jsonfiles are parsed as ACP content blocks. - --verbatim
- Send the prompt as written, without
<user_query>wrapping or large-prompt truncation.
Model and instructions
- -m, --model <MODEL>
- Select a model-entry ID from the catalog, or use
provider/.model - --reasoning-effort, --effort <EFFORT>
- Set the reasoning effort for a reasoning model.
- --rules, --append-system-prompt <TEXT>
- Append extra rules to the system prompt.
- --system-prompt-override, --system-prompt <PROMPT>
- Replace the system prompt.
Output
- --output-format <FORMAT>
- Choose
plain,json,streaming-json, orstreaming-messages-json. - --include-partial-messages
- Add incremental
stream_eventrecords only withstreaming-messages-json. - --json-schema <SCHEMA>
- Constrain the response with a JSON Schema;
plainoutput changes tojson.
Tools and agents
- --agent <NAME>
- Select an agent name or definition file.
- --agents <JSON>
- Supply inline subagent definitions as JSON.
- --tools <TOOLS>
- Limit the built-in tool set to a comma-separated list.
- --disallowed-tools <TOOLS>
- Remove built-in tools from a comma-separated list.
- --disable-web-search
- Disable both web search and web fetch tools.
- --max-turns <N>
- Limit agent turns to a positive integer.
Permissions
- --permission-mode <MODE>
- Choose
default,acceptEdits,auto,dontAsk,bypassPermissions, orplan. - --allow, --allowedTools <RULE>
- Add comma-separated permission allow rules.
- --deny, --disallowedTools <RULE>
- Add comma-separated permission deny rules.
- --always-approve, --yolo, --dangerously-skip-permissions
- Approve offered tool permissions automatically.
- --sandbox <PROFILE>
- Select a filesystem and network sandbox profile; also configurable with
RIGHTNOW_SANDBOX.
Sessions
- -r, --resume <ID_OR_TITLE>
- Continue a stored session. Each run starts a new session otherwise.
- -c, --continue
- Continue the most recent session for the working directory.
- -s, --session-id <UUID>
- Start a new session with this unused UUID; with
-ror-cit needs--fork-session. - --fork-session
- With
-ror-c, write the history to a new session ID.
Directory and background work
- --cwd <PATH>
- Use PATH as the working directory.
- --no-wait-for-background
- Return after the first turn instead of waiting for background work.
- --background-wait-timeout <SECS>
- Wait for background work for at most this many seconds (default 600; minimum 1). Conflicts with
--no-wait-for-background.
Ignored by headless
- --no-plan, --no-subagents
- Interactive only; not passed to headless execution.
- --experimental-memory, --no-memory
- Not applied; memory follows
config.tomlandRIGHTNOW_MEMORY. - --no-alt-screen, --minimal, --fullscreen
- Interactive display only; headless output is unchanged.
- -w, --worktree [NAME]
- Does not create a worktree; prepare the directory first.
Script against evidence
Treat the exit code and the structured output as the result, not a confident sentence from the model. For action prompts, json and streaming output list the observed effects.
The diagnostic log lives at <RIGHTNOW_HOME>/ inside the effective product home (Configuration).
Continue with Troubleshooting, Sessions, Permissions and Safety, Receipts, or Agent Mode for ACP clients.
Next task
Verify the recorded file effects before relying on an automated run.