LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

grok-build

xAI's official terminal-native agentic coding CLI

TLDR

Start an interactive session in the current directory
$ grok
copy
Run a one-off command and exit (headless mode)
$ grok -p "[prompt]"
copy
Stream structured output for scripting
$ grok -p "[prompt]" --output-format streaming-json
copy
Inspect what Grok discovers in the current directory
$ grok inspect
copy
Select a specific model in headless mode
$ grok -m [model-id]
copy
Provide xAI credentials via environment variable
$ export GROK_CODE_XAI_API_KEY="xai-..."
copy

SYNOPSIS

grok [options] [prompt]grok inspect

DESCRIPTION

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.

PARAMETERS

-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.

CONFIGURATION

AGENTS.md

Project-level instructions for the agent, loaded automatically from the working directory. Compatible with Claude Code's CLAUDE.md.
GROK_CODE_XAI_API_KEY
Environment variable holding the xAI API key. Used when not authenticated via the browser flow.
Custom model config
Models can be defined in the user config with a model id, base URL, display name, and env-key reference, then selected as the default or via /model in the TUI.

SLASH COMMANDS

/model name

Switch the active model from within the TUI.

CAVEATS

Grok Build is in early beta and is available to SuperGrok Heavy subscribers. Expect rough edges: commands that don't yet work, incomplete error handling, and occasional regressions in subagent coordination. For production CI/CD pipelines, prefer mature tools until Grok Build hits general availability; for exploration and side projects, beta is fine. First launch opens a browser for authentication unless an API key is set via environment variable.

HISTORY

xAI launched Grok Build as an early beta in May 2026, entering the agentic-CLI space alongside Claude Code and Codex CLI. It is installed with a single curl-pipe-bash script from x.ai/cli/install.sh, ships with plan mode, parallel subagents with worktree integration, MCP support, and Anthropic-Skills compatibility, and is positioned as xAI's terminal-native counterpart to its web-based Grok coding tools.

SEE ALSO

grok(1), claude(1), copilot(1), gh(1)

Copied to clipboard
Kai