選擇 one-shot surface
已發布 CLI 使用 -p 或 --single 執行 prompt、輸出結果後離開。輸入可來自文字、--prompt-file 或 --prompt-json content blocks;每個 job 應固定一種 contract。
用 --max-turns 限制 agent work;machine consumer 則明確設定 --output-format。Grok Build 1.0.67 help 列出 plain(預設)、json、streaming-json 與 streaming-messages-json;--json-schema 會把回應限制為指定 JSON Schema,並隱含 json 輸出。
grok -p "Summarize the staged changes" --output-format json --max-turns 4 保留執行邊界
在正確 repository 執行,並說清是否允許修改。Job 開始前設定 approval、sandbox、tools 與 subagents;non-interactive 並不會讓寬權限變安全。
把 provider/deployment credentials 隔離於 repository-controlled code;不能只靠 prompt 說「不要使用」。
- 記錄 Grok Build release。
- 在 model turn cap 之外另設 timeout。
- Non-zero、malformed output、缺少 evidence 都 fail。
驗證結果,不驗證語氣
依真正 contract 解析 format:json 是單一結果;streaming-json(每行一個 ACP session update)與 streaming-messages-json(Messages API wire format 的 NDJSON)都是逐行 stream,必須增量處理;--include-partial-messages 只影響後者。
Merge/publish 前讀 diff 並跑 repository tests;well-formed response 仍可能描述失敗或不完整變更。