← 返回命令列表

Linux command

grok-build 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Start an interactive session

grok

Run a one-off command

grok -p "[prompt]"

Stream structured output

grok -p "[prompt]" --output-format streaming-json

Inspect what Grok discovers

grok inspect

Select a specific model

grok -m [model-id]

Provide xAI credentials

export GROK_CODE_XAI_API_KEY="xai-..."

说明

Grok Build is xAI's first-party command-line coding agent, built for professional software engineering, app development, and workflow automation. It runs as a terminal TUI by default and can also operate headlessly for automation. It ships with plan mode, where the agent proposes a full plan that can be approved, commented on, or rewritten before any execution begins. Once approved, every change appears as a clean diff. For larger tasks, Grok Build delegates work to parallel subagents, optionally launched in their own git worktrees. Grok Build is ACP-first and deliberately compatible with the Anthropic Skills format, so skills written for Claude Code work with little or no modification. It supports MCP out of the box, so existing servers (database connectors, GitHub integrations, custom tools) work without changes.

参数

-p, --prompt _text_
Run in headless mode: execute a single prompt and exit. Useful inside scripts, CI/CD pipelines, GitHub Actions, or cron jobs.
-m, --model _model_
Select the model used for the session.
--output-format _format_
Set the response format (e.g. _streaming-json_) for machine-readable output in headless mode.

FAQ

What is the grok-build command used for?

Grok Build is xAI's first-party command-line coding agent, built for professional software engineering, app development, and workflow automation. It runs as a terminal TUI by default and can also operate headlessly for automation. It ships with plan mode, where the agent proposes a full plan that can be approved, commented on, or rewritten before any execution begins. Once approved, every change appears as a clean diff. For larger tasks, Grok Build delegates work to parallel subagents, optionally launched in their own git worktrees. Grok Build is ACP-first and deliberately compatible with the Anthropic Skills format, so skills written for Claude Code work with little or no modification. It supports MCP out of the box, so existing servers (database connectors, GitHub integrations, custom tools) work without changes.

How do I run a basic grok-build example?

Run `grok` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -p, --prompt _text_ do in grok-build?

Run in headless mode: execute a single prompt and exit. Useful inside scripts, CI/CD pipelines, GitHub Actions, or cron jobs.