How to Use Grok Build (xAI's Open-Source Terminal Coding Agent)

Read time: ~6 minutes. Key facts:

  • xAI (SpaceXAI) open-sourced Grok Build — the grok CLI — under the Apache License 2.0. It’s the Rust source for the terminal coding agent, synced from xAI’s monorepo.
  • It’s a full-screen TUI that understands your codebase, edits files, runs shell commands, searches the web, and manages long-running tasks.
  • Three ways to run it: interactive TUI, headless (scripting / CI), or embedded in editors via the Agent Client Protocol (ACP).
  • Install is one command: curl -fsSL https://x.ai/cli/install.sh | bash, then grok --version.
  • It documents MCP servers, skills, plugins, hooks, headless mode, and sandboxing — and notably ships in-tree ports of openai/codex and sst/opencode tool implementations.

Sourcing note: everything here is from xAI’s official xai-org/grok-build repository and docs.x.ai/build. The security section reflects public scrutiny of AI coding CLIs generally; treat the “audit what it sends” advice as good practice for any such tool, not a specific accusation. Confirm commands against the live repo. Links at the bottom.

xAI just put Grok Build — its terminal coding agent — on GitHub under Apache 2.0. That’s notable: a frontier lab’s actual coding-agent CLI, source and all, that you can read, self-build, and run against your own repo. If you already live in a terminal agent (Claude Code, Codex, OpenCode), here’s how Grok Build works and how to try it.


1. What Grok Build is

From the official repo: Grok Build (the grok command) is “SpaceXAI’s terminal-based AI coding agent. It runs as a full-screen TUI that understands your codebase, edits files, executes shell commands, searches the web, and manages long-running tasks.”

The repository is the Rust source for the grok CLI/TUI and its agent runtime, “synced periodically from the SpaceXAI monorepo” (a SOURCE_REV file records the exact monorepo commit). First-party code is Apache 2.0. One interesting detail from the third-party notices: Grok Build ships in-tree source ports of openai/codex and sst/opencode tool implementations — so it stands on the shoulders of the other open terminal agents.

It can run three ways:

  • Interactive — the full-screen TUI you drive by hand.
  • Headless — for scripting and CI (no TUI; feed it a task, get results).
  • Embedded — inside editors via the Agent Client Protocol (ACP).

2. Install it (one command)

Prebuilt binaries are published for macOS, Linux, and Windows:

# macOS / Linux / Git Bash
curl -fsSL https://x.ai/cli/install.sh | bash

# Windows PowerShell
irm https://x.ai/cli/install.ps1 | iex

# verify
grok --version

The binary artifact is named xai-grok-pager; the official install ships it as grok. That’s it — no build toolchain needed for the released binary.

A note on curl … | bash: piping an install script straight into a shell runs whatever the URL returns. It’s convenient and it’s what xAI documents, but if you’re security-conscious, download install.sh first and read it before running — good hygiene for any install-by-curl.


3. First launch and authentication

On first launch, grok opens your browser to authenticate (see the repo’s authentication guide). Once you’re signed in to your xAI account, the agent can talk to xAI’s Grok models. Then point it at a project directory and start giving it tasks — it’ll read your codebase, propose and make file edits, and run commands as needed.

Full docs live at docs.x.ai/build/overview, and the user guide (getting started, keyboard shortcuts, slash commands, configuration, theming) ships with the pager crate in the repo.


4. The features that matter

Grok Build’s docs cover the same surface area you’d expect from a modern terminal agent — and a few worth calling out:

  • MCP servers — connect Model Context Protocol servers to give the agent your private tools and data. (If you’ve wired MCP into another agent, the mental model is the same; mind the context cost — see our note on Claude Code token overhead, which applies to any tool-heavy agent.)
  • Skills — packaged, reusable instructions for recurring tasks.
  • Hooks — run your own commands at lifecycle points (pre/post tool use, etc.).
  • Headless mode — the key to using grok in CI or scripts: no TUI, scriptable input/output.
  • Sandboxing — a documented mode for constraining what the agent can touch on your machine. Use it (more on why in §6).

The repository layout is unusually legible for a shipped agent: separate crates for the TUI (xai-grok-pager), the agent runtime (xai-grok-shell), the tool implementations (xai-grok-tools: terminal, file edit, search…), and the workspace/execution/checkpoints layer (xai-grok-workspace). If you want to understand how a terminal coding agent is built, this is a readable reference implementation.


5. Building from source

If you want to build it yourself (to audit or modify):

# requirements: Rust (pinned via rust-toolchain.toml, installed by rustup),
# DotSlash (for hermetic bin/ tools like protoc), and protoc.
cargo install dotslash

# build + launch the TUI
cargo run -p xai-grok-pager-bin

# release binary → target/release/xai-grok-pager
cargo build -p xai-grok-pager-bin --release

macOS and Linux are supported build hosts; Windows builds are “best-effort.” Note the root Cargo.toml is generated (treat as read-only; edit per-crate Cargo.toml), and external contributions are not accepted — this is a read/build/fork repo, not a PR target.


6. The honest bit: audit what your coding CLI sends

Terminal coding agents have deep access — your files, your shell, the network. AI CLIs in general have drawn scrutiny for how much they send and where, and Grok Build is no exception to the principle that you should know what a tool with that much access does over the wire. The constructive response is built into the tool:

  • Turn on sandboxing to constrain filesystem and execution reach, especially before pointing the agent at sensitive repos.
  • Because it’s open source (Apache 2.0), you can actually read the tool implementations (xai-grok-tools) and the workspace/execution layer to see what it does — a real advantage over closed CLIs.
  • For any coding CLI, consider routing its traffic through a logging proxy once to see what leaves your machine (the same “measure at the API boundary” idea from our Claude Code token-overhead guide).

This isn’t a knock on Grok Build specifically — it’s the price of admission for any agent you give shell and network access. Open source at least means you can verify rather than trust.

The takeaway

xAI’s Grok Build is a real, Apache-2.0, Rust terminal coding agent you can install in one command (curl -fsSL https://x.ai/cli/install.sh | bash), authenticate via the browser, and run interactively, headlessly in CI, or embedded in your editor via ACP. It brings the modern agent toolkit — MCP servers, skills, hooks, sandboxing — and, being open source (with in-tree ports of Codex and OpenCode), doubles as a readable reference implementation of how a terminal agent is built. Try the released binary, turn on sandboxing before pointing it at anything sensitive, and — as with any agent that has your shell — know what it sends.

For more on living in a terminal coding agent, see Claude Code as a daily driver, cutting Claude Code’s token overhead, and why long agent sessions drift.

Sources

  • xai-org/grok-build — GitHub — Grok Build (grok), SpaceXAI’s terminal coding agent; Rust source synced from the monorepo; Apache 2.0 first-party license; install via curl -fsSL https://x.ai/cli/install.sh | bash (binary xai-grok-pager, shipped as grok); interactive / headless / ACP-embedded modes; features (MCP servers, skills, plugins, hooks, headless, sandboxing); repository layout (pager / shell / tools / workspace crates); build-from-source with Rust + DotSlash + protoc; in-tree ports of openai/codex and sst/opencode tool implementations; external contributions not accepted
  • Grok Build documentation — docs.x.ai/build — full online docs and user guide
  • x.ai/cli — product page and install
  • First-party code is Apache 2.0; vendored/third-party code retains original licenses. The security guidance applies to AI coding CLIs generally. Verified July 18, 2026 — confirm commands and features against the live repo, which syncs periodically from xAI’s monorepo.