Skip to main content

Module grok

Module grok 

Source
Expand description

Grok agent runner.

Headless Grok (grok -p) does not read the prompt from stdin. The task message is --prompt-file. The system prompt is passed with --system-prompt-override. Output is streaming-messages-json, the Messages API NDJSON shape, so parsing delegates to the Claude runner.

grok --output-format streaming-messages-json \
  --permission-mode bypassPermissions \
  --sandbox off \
  --deny 'Bash(rm *)' \
  --system-prompt-override "$(cat "{sys_file}")" \
  --prompt-file "{msg_file}"

--sandbox workspace only writes the cwd. A worktree’s git dir lives outside that cwd, and the CLI has no extra-dir flag, so task runs use --sandbox off. Orch still isolates the agent in the worktree and denies rm and git push. Control sessions (deny_read_only) use read-only.

Structs§

GrokRunner
Runner for the grok CLI

Functions§

find_grok_result
streaming-messages-json result, plus Grok’s cost and stop reason