Grok WorldGrok Build CLI field station

GROK BUILD CLI / 13

Use single-turn prompts and bounded output

Single-turn mode is useful automation only when the working directory, authority, output contract, and failure path are all explicit.

CHANNELBOUNDED AUTOMATION / INTERMEDIATE / 11 MIN
SOURCES CHECKED2026-07-31
ORIGINOFFICIAL DOCS / PRIMARY

Choose the one-shot surface

The released CLI uses -p or --single to run a prompt, print the result, and exit. Supply the prompt as text, from --prompt-file, or as JSON content blocks with --prompt-json; choose one input contract per job.

Use --max-turns to bound agent work and --output-format when a machine, rather than a person, consumes the result. The shared release manifest confirms text, json, and stream-json output formats.

grok -p "Summarize the staged changes" --output-format json --max-turns 4

Preserve the execution boundary

Run in the intended repository and state whether changes are allowed. Select approval, sandbox, tool, and subagent settings before the job starts; non-interactive operation does not make broad authority safe.

Keep provider and deployment credentials outside repository-controlled code. A pull request job should not inherit a token merely because the prompt says to avoid it.

  • Pin or record the Grok Build release.
  • Set a timeout outside the model turn cap.
  • Treat non-zero exit, malformed output, and missing evidence as failure.

Validate the result, not the tone

Parse the selected format according to its actual contract. JSON is one result; stream-json is an event stream and must be processed incrementally.

Before merging or publishing, inspect the diff and run the repository’s real tests. A well-formed response can still describe a failed or incomplete change.