On July 15, 2026, SpaceXAI published the full source code for Grok Build under the Apache 2.0 license. The repository lives at github.com/xai-org/grok-build and has already crossed 11,000 stars. The release exposes the agent loop, the terminal user interface, the tool implementations, and the extension system that power the grok coding CLI.

This is not a partial dump or a trimmed sample. It is the production harness behind a coding agent that launched in beta on May 25, 2026 and now runs on Grok 4.5. SpaceXAI says the repo will be synced periodically from its internal monorepo, so the public branch should track upstream development going forward.

What Grok Build Actually Is

A coding agent needs more than a model. It needs scaffolding that assembles context, sends prompts, parses responses, and dispatches tool calls. That scaffolding is called a harness. Grok Build is SpaceXAI's harness, written entirely in Rust.

The agent understands your codebase. It edits files, executes shell commands, searches the web, and manages long-running tasks. You interact with it through three surfaces. The first is a full-screen, mouse-interactive TUI. The second is a headless mode for scripts and CI pipelines. The third is the Agent Client Protocol (ACP), which lets editors like VS Code embed the agent directly.

The announcement page is live at x.ai/news/grok-build-open-source. Full documentation sits at docs.x.ai/build/overview.

What the Repository Contains

The README lays out four published areas: the agent loop, the tools, the terminal UI, and the extension system. Each maps to a named Rust crate in the workspace.

The agent loop lives in crates/codegen/xai-grok-shell. This crate handles context assembly, response parsing, and tool-call dispatch. It also provides the leader, stdio, and headless entry points. If you want to understand how a production agent thinks, start here.

The tools live in crates/codegen/xai-grok-tools. This crate covers terminal execution, file editing, search, and every other capability the agent can invoke. Reading this code tells you exactly what the agent can do to your filesystem.

The TUI lives in crates/codegen/xai-grok-pager. It handles scrollback, prompt rendering, modals, and the inline diff viewer where you review proposed changes before accepting them.

The workspace layer lives in crates/codegen/xai-grok-workspace. It manages the host filesystem, version control integration, command execution, and checkpoints. Checkpoints matter because they let you roll back agent changes that broke something.

The extension system spans skills, plugins, hooks, MCP servers, and subagents. The user guide inside the repo covers all of these in detail at crates/codegen/xai-grok-pager/docs/user-guide/.

The composition root sits in crates/codegen/xai-grok-pager-bin, which builds the xai-grok-pager binary. Official installs ship this binary as grok.

One important note from the README: the root Cargo.toml is auto-generated. Developers should treat it as read-only and edit per-crate Cargo.toml files instead.

Running It Local-First

The open-source release means you can compile Grok Build yourself and point it at any model endpoint. Configuration lives in ~/.grok/config.toml (or %USERPROFILE%\.grok\config.toml on Windows).

[model.my-model]
model = "model-id"
base_url = "https://api.example.com/v1"
name = "Display Name"
env_key = "API_KEY"

[models]
default = "my-model"

After writing your config, run grok inspect to see what the harness discovered. That command prints config sources, instructions, skills, plugins, hooks, and MCP servers for the current directory. You can then pick your custom model in headless mode or switch inside the TUI with /model <name>.

This is the part that matters for air-gapped environments. You can compile locally, set base_url to an internal endpoint, and never touch api.x.ai. The agent runs on your infrastructure with your model.

Installation

Prebuilt binaries cover 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 --version

Building from source requires Rust and protoc. The toolchain is pinned via rust-toolchain.toml, so rustup handles it automatically on first build.

cargo run -p xai-grok-pager-bin              # build and launch the TUI
cargo build -p xai-grok-pager-bin --release  # release binary
cargo check -p xai-grok-pager-bin            # fast validation

The release binary lands at target/release/xai-grok-pager. On first launch, it opens your browser for authentication. For non-browser environments, set XAIAPIKEY as an environment variable instead.

Headless Mode for CI and Scripting

Headless mode turns the agent into a pipeline step. You pass a prompt with -p and get structured output back.

grok -p "Explain the architecture" --output-format streaming-json

This is where the open-source license pays off. You can fork the harness, wire it into your CI, and run code reviews or documentation generation on every pull request. The streaming JSON format means downstream tools can parse agent output without scraping a terminal.

How It Compares

Grok Build enters a crowded field. Here is how it stacks up against other coding agents.

Agent License Fork and Modify Model Choice External PRs
Grok Build Apache 2.0 Yes Any via config.toml Not accepted
Codex CLI (OpenAI) Apache 2.0 Yes OpenAI models Open PR queue
OpenCode MIT Yes 75+ providers Community project
Claude Code Proprietary No Anthropic models N/A

The Apache 2.0 license matches OpenAI's Codex CLI. The model flexibility matches OpenCode. The key difference is that SpaceXAI will not accept external pull requests. The repo is a publication channel, not a community project. You can fork it and modify it for internal use, but upstream contributions flow one way.

The README notes that the tools crate includes ports of code from OpenAI's Codex and the OpenCode project. Third-party notices are documented in THIRD-PARTY-NOTICES at the repo root and in crates/codegen/xai-grok-tools/THIRDPARTYNOTICES.md.

Practical Use Cases

Four scenarios stand out for developers evaluating this release.

Audit before adoption. Read xai-grok-tools before letting the agent run shell commands in a regulated repository. The source is right there. You can verify exactly what the agent does when it executes a command, writes a file, or searches your codebase.

Fork for an internal harness. Apache 2.0 permits forking without obligation. Companies that want their own agent harness can start from this codebase, swap in a different model, and ship a customized tool. SpaceXAI will not merge your changes upstream, but you do not need them to.

Air-gapped runs. Compile locally, point base_url at an internal inference server, and skip every external API call. This is the configuration path for regulated industries that cannot send code to a third party.

CI automation. Headless mode outputs structured JSON. Pipe that into your pipeline and you have automated code review, test generation, or documentation drafting on every commit.

What the Codebase Tells Us About Agent Architecture

Reading the crate layout reveals how a production agent is structured. The separation between shell (the loop), tools (the capabilities), pager (the UI), and workspace (the filesystem layer) is clean. Each crate has a single responsibility.

The workspace crate handling checkpoints is notable. Checkpoints mean the agent can snapshot your filesystem state before making changes. If an edit goes wrong, you roll back. This is not a theoretical feature. It is baked into the workspace layer and shipped in the first release.

The extension system covers skills, plugins, hooks, MCP servers, and subagents. That is five different extension mechanisms. Skills are reusable prompt templates. Plugins add new tools. Hooks let you intercept agent events. MCP servers expose external resources. Subagents let the main agent spawn focused workers for specific tasks.

This is the same architecture pattern showing up across the industry. The harness handles the loop. Tools handle the actions. Extensions handle the customization. Grok Build's contribution is doing all of this in Rust with a first-class TUI and a clean crate separation.

What Is Missing

The release does not include the model weights for Grok 4.5. You still need an API key to use the default model. The repo is the harness, not the brain.

External pull requests are not accepted. SpaceXAI syncs from its monorepo periodically. If you find a bug, you can file an issue, but the code changes flow one way.

Windows builds from source are best-effort and not currently tested from this tree. macOS and Linux are the supported build hosts.

The root Cargo.toml is generated. Full-workspace builds are slow. The README explicitly says to target specific crates with cargo check -p and cargo test -p rather than building everything at once.

Why This Matters

Open-sourcing a production agent harness gives the developer community a reference implementation. Codex CLI did this first. OpenCode did it with broader model support. Grok Build does it in Rust with a TUI that many developers already prefer over web-based alternatives.

The Rust choice matters. Rust gives you memory safety, fast startup, and a single binary to distribute. It also makes the codebase harder to contribute to for developers unfamiliar with the language. The crate structure helps by isolating concerns, but the learning curve is real.

The local-first story matters more. Being able to point the harness at any model endpoint, including one running on your own hardware, removes a major adoption barrier. Companies that could not justify sending proprietary code to a third-party API can now run the same agent infrastructure internally.

The one-way contribution model will frustrate some developers. But it is honest. SpaceXAI ships code on their schedule. You take it or leave it. For teams that need a starting point for their own agent harness, that trade is fair.

Getting Started

Clone the repo and build a specific crate to explore the codebase:

git clone https://github.com/xai-org/grok-build.git
cd grok-build
cargo check -p xai-grok-shell   # the agent loop
cargo check -p xai-grok-tools   # the tool implementations
cargo check -p xai-grok-pager   # the TUI

Read the user guide at crates/codegen/xai-grok-pager/docs/user-guide/ for the full feature tour. Check the changelog for what shipped in each release.

The source is open. The license is permissive. The architecture is clean. If you build coding agents, this is required reading.


Sources:


Suggested title: Grok Build Open-Sourced: xAI Releases Its Rust Agent Harness, TUI, and Tool Layer

Word count: ~1,250

Fact-check notes:

  • Confirmed Apache 2.0 license from GitHub README.
  • Confirmed repo has 11K stars from GitHub page metadata.
  • Confirmed July 15, 2026 announcement date from x.ai news page URL.
  • Confirmed beta launch date of May 25, 2026 from MarkTechPost coverage.
  • Confirmed crate layout from GitHub README directly.
  • Confirmed config.toml local-first path from both GitHub README and official docs.
  • Confirmed external PRs not accepted from MarkTechPost comparison table.
  • Confirmed Grok 4.5 powers Grok Build from official docs page.
  • Could not independently verify the May 25 beta date from the primary x.ai source due to Cloudflare blocking. MarkTechPost is a secondary source for that date.
  • Could not access the full x.ai announcement page due to Cloudflare blocking. Used search snippet and secondary coverage for announcement details.