Overview
Grok Build is the terminal-based AI coding agent published by SpaceXAI, distributed as the `grok` command. It runs as a full-screen TUI that reads your codebase, edits files, executes shell commands, searches the web and manages long-running tasks. The same binary can also run headlessly for scripting and CI, or be embedded in an editor over the Agent Client Protocol.
This repository holds the Rust source for the CLI, the TUI and the agent runtime, synced periodically from the SpaceXAI monorepo — a `SOURCE_REV` file at the root records the exact monorepo commit the tree corresponds to. The crate layout separates the concerns cleanly: the pager crate is the TUI (scrollback, prompt, modals, rendering), a shell crate holds the agent runtime and the leader, stdio and headless entry points, a tools crate implements the terminal, file-edit and search tools, and a workspace crate owns the host filesystem, version control, execution and checkpoints. A vendored Mermaid diagram stack sits under `third_party/`.
Because the source is Apache-2.0 and self-contained enough to build with cargo, pieces of it get reused outside the CLI — Simon Willison pulled the Mermaid-to-Unicode renderer out of this tree in July 2026 and compiled it to WebAssembly as a standalone browser tool. The user guide ships inside the pager crate and covers keyboard shortcuts, slash commands, configuration, theming, MCP servers, skills, plugins, hooks, headless mode and sandboxing; fuller documentation is online at docs.x.ai.
What it does
- Full-screen terminal UI with scrollback, prompt and modals, plus mouse interaction
- Codebase-aware tools: file editing, shell execution, search and web search, with checkpoints over the host workspace
- Three run modes — interactive TUI, headless for scripting and CI, and Agent Client Protocol for editor embedding
- Extensible through MCP servers, skills, plugins and hooks, all documented in the shipped user guide
- Prebuilt binaries for macOS, Linux and Windows, or a `cargo build` from the Apache-2.0 Rust source
- Sandboxing and configuration documented alongside the source rather than only online
Getting started
Most people install the released binary; building from source needs Rust plus DotSlash for the hermetic tools under bin/.
Install the released binary
Prebuilt binaries are published for macOS, Linux and Windows.
curl -fsSL https://x.ai/cli/install.sh | bash # macOS / Linux / Git Bash
irm https://x.ai/cli/install.ps1 | iex # Windows PowerShell
grok --versionInstall the build prerequisites (source builds only)
The Rust toolchain is pinned by rust-toolchain.toml and rustup installs it on first build. DotSlash must be on PATH before you build so the hermetic tools under bin/ — notably protoc — can download and run.
cargo install dotslash
/usr/bin/env dotslash --help # sanity checkBuild and launch from source
The binary artifact is named xai-grok-pager; official installs ship it as grok. On first launch it opens a browser to authenticate.
cargo run -p xai-grok-pager-bin # build + launch the TUI
cargo build -p xai-grok-pager-bin --release # target/release/xai-grok-pager
cargo check -p xai-grok-pager-bin # fast validationRead the user guide
The guide ships inside the repository at crates/codegen/xai-grok-pager/docs/user-guide/ — getting started, keyboard shortcuts, slash commands, configuration, theming, MCP servers, skills, plugins, hooks, headless mode and sandboxing. The full online docs are at docs.x.ai/build/overview.
Commands and code are distilled from the project's own documentation — always check the official repo for the latest.
When to use it
- Working in a terminal-first coding agent that edits files and runs commands against a real workspace
- Scripting agent runs headlessly in CI where there is no interactive terminal
- Embedding the agent in an editor that speaks the Agent Client Protocol
- Reading or reusing a production coding-agent runtime written in Rust, crate by crate
Grok Build in the news
- 2026-07-23MAJORGrok Build Workflows — xAI's coding CLI now fans a task across up to 1,024 parallel agents
- 2026-07-15MAJORGrok Build open-sourced — xAI ships the Rust source under Apache-2.0
- 2026-07-10MAJORGrok Build CLI ships whole repos and .env secrets to xAI — wire-level teardown
- 2026-05-14MAJORGrok Build — xAI's CLI Coding Agent Runs 8 Parallel Subagents With Plan Mode, Worktree Integration, and Local-First Privacy
From the AI/TLDR release feed — every item is source-verified when it ships.
How Grok Build compares
Grok Build alongside other open-source autonomous coding agents tools AI/TLDR tracks, ranked by GitHub stars.
| Tool | Stars | What it does |
|---|---|---|
| opencode | ★ 206k | OpenCode is an open source AI coding agent that runs in your terminal, with built-in build and plan agents and an optional desktop app. |
| Claude Code | ★ 145k | Anthropic's agentic coding tool for the terminal, IDE and GitHub: it understands your codebase, executes routine tasks, explains code and handles git workflows from natural-language commands. |
| OpenAI Codex | ★ 123k | OpenAI's cloud and CLI coding agent that writes features, fixes bugs, and proposes code changes across a repo, running tasks in parallel. |
| Gemini CLI | ★ 107k | An open-source command-line AI agent from Google that connects your terminal to Gemini models for reading code, editing files, running shell commands, and searching the web. |
| Pi | ★ 104k | Minimal terminal coding agent harness with four built-in tools, extended through TypeScript extensions, skills and prompt templates instead of forks. |
| OpenHands | ★ 87.2k | An open-source AI software-development agent that plans tasks, edits files, runs commands, and tests code, usable from a terminal CLI, a local web GUI, or a Python SDK. |
| Cline | ★ 67.8k | Open-source coding agent that runs as a VS Code or JetBrains extension, a terminal CLI, or an embeddable Node SDK, editing code and running commands with human-in-the-loop approval. |
| Grok Build | ★ 26.6k | The Rust source of the `grok` terminal coding agent — a full-screen TUI, a headless runner and an ACP server |