xai-org/grok-build
Grok Build is xAI's terminal-based AI coding agent, shipped as a Rust CLI/TUI (binary name `grok`) that understands a codebase, edits files, runs shell commands, searches the web and manages long-running tasks. It supports interactive use, headless scripting/CI mode, and embedding in editors via the Agent Client Protocol (ACP), and its docs cover MCP servers, skills, plugins, hooks and sandboxing; the repo is synced periodically from xAI's internal monorepo and vendors tool implementations ported from openai/codex and sst/opencode.
What it claims
The repository holds the Rust source for the grok CLI/TUI and its agent runtime. Users can install a prebuilt binary or build from source. The first-party code is licensed under Apache 2.0. The project accepts no external contributions. The tree is a periodic sync from the "SpaceXAI monorepo" (the page's wording). A root SOURCE_REV file records the full monorepo commit SHA that the tree corresponds to. Use it to pin or cite an exact version.
How to use it
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 --versionOn first launch, grok opens a browser to authenticate. Plan around this for headless or CI hosts.
Building from source requires:
- Rust, pinned by
rust-toolchain.toml. rustup installs it on first build. - DotSlash on
PATH. The hermetic tools underbin/(notablybin/protoc) need it. - protoc, resolved through
bin/protocvia DotSlash. If that is unavailable, the build falls back toprotoconPATHor$PROTOC.
cargo install dotslash
/usr/bin/env dotslash --help
cargo run -p xai-grok-pager-bin # build + launch the TUI
cargo build -p xai-grok-pager-bin --release # release binary: target/release/xai-grok-pager
cargo check -p xai-grok-pager-bin # fast validationThe build produces a binary named xai-grok-pager. Official installs ship the same binary as grok.
For development, always target specific crates, because full-workspace builds are slow:
cargo check -p <crate>
cargo test -p xai-grok-config
cargo clippy -p <crate>
cargo fmt --allclippy.toml and rustfmt.toml sit at the repo root. The root Cargo.toml is generated, so treat it as read-only and edit the per-crate Cargo.toml files instead.
Documentation lives in two places:
- Online at docs.x.ai/build/overview.
- In-tree at
crates/codegen/xai-grok-pager/docs/user-guide/. This guide covers shortcuts, slash commands, configuration, theming, MCP, skills, plugins, hooks, headless mode and sandboxing.
Limits
- No external contributions. You can fork the repo, but you cannot upstream changes. Because the tree is a periodic sync from an internal monorepo, expect history to arrive in batches rather than as reviewable PRs.
- Build hosts. macOS and Linux are supported. Windows builds from this tree are "best-effort and not currently tested."
- Mixed licensing. Only the first-party code is Apache 2.0. Vendored code keeps its original licences. This includes the ports of openai/codex and sst/opencode tools, the bundled UI themes and a Mermaid stack. If you redistribute or embed the code, check all three notice files:
THIRD-PARTY-NOTICEScrates/codegen/xai-grok-tools/THIRD_PARTY_NOTICES.md, which includes an Apache §4(b) change notice for the portsthird_party/NOTICE- Install scripts pipe a remote script into a shell. Review
install.shandinstall.ps1before running them where that matters.
Technologies named here
- Grok Build
- Agent Client Protocol
- DotSlash
- protoc
- Rust toolchain
- MCP servers
- Rust
- Model Context Protocol
- Codex
Also named here
- OpenCode
Related in coding-agents
