Grok Build: xAI Open-Sources Its Rust Terminal Coding Agent
Open Source 6 min read intermediate

Grok Build: xAI Open-Sources Its Rust Terminal Coding Agent

On July 15, 2026, xAI open-sourced Grok Build, the Rust terminal coding agent behind its grok CLI, under Apache 2.0. The release covers the agent loop, tools, TUI, and extension system, and supports a fully local-first config.toml path pointing at self-hosted inference. External PRs aren't accepted and the model stays closed, so it's a source-transparency release, not a community project.

Marcus Rivera
Marcus Rivera
Jul 27, 2026

When xAI dropped the full source of Grok Build on GitHub on July 15, 2026, it did something the frontier labs almost never do: it handed you the harness, not just the model. The repository at xai-org/grok-build is the actual terminal agent behind the grok CLI — the agent loop, the tools, the TUI, the extension system — published under a real Apache 2.0 license. You can read it end to end, fork it, and point it at a model that has nothing to do with xAI.

That is rarer than it sounds, and it is worth understanding exactly what you are getting before you cargo build anything.

What Grok Build actually is

Grok Build launched as an early beta on May 25, 2026 as xAI's answer to Claude Code and OpenAI's Codex CLI. It is an agent that reads your codebase, edits files, runs shell commands, searches the web, and manages long-running tasks — all inside a full-screen, mouse-interactive terminal UI written in Rust.

The important word is harness. A harness is the scaffolding around a language model: it assembles context, calls the model, parses the reply, and dispatches tool calls. The model does the thinking; the harness decides what the model sees, what it is allowed to do, and how its output gets turned into edits on your disk. Open-sourcing the harness means the part that touches your files and runs your commands is now fully auditable — even though the weights behind grok remain closed.

Grok Build exposes three surfaces:

  • Interactive TUI — the default full-screen experience with scrollback, an inline diff viewer, and plan review.
  • Headless mode — for scripting and CI, emitting structured output you can pipe into a pipeline step.
  • Editor integration — editors embed the agent through the Agent Client Protocol (ACP), the same open protocol other agent frontends are converging on.

What's in the box

xAI organized the release around four areas, which map cleanly onto named Rust crates:

Crate What it does
xai-grok-shell The agent runtime — context assembly, response parsing, tool dispatch, plus the leader/stdio/headless entry points
xai-grok-tools Tool implementations: terminal execution, file editing, code search
xai-grok-pager The TUI — scrollback, prompt, modals, rendering
xai-grok-pager-bin The composition-root package that builds the binary
xai-grok-workspace Host filesystem, version control, execution, and checkpoints
third_party/ Vendored upstream source

If you're auditing rather than just using it, read them in that order: start at xai-grok-shell to understand the loop, then move to xai-grok-tools to see exactly what the agent is permitted to do to your machine. One build gotcha worth flagging: the root Cargo.toml is generated, and the README tells you to treat it as read-only.

The local-first path is the real story

Here's the feature that matters most for teams with security or compliance constraints: Grok Build can run fully local-first. Compile it yourself, point it at a self-hosted inference endpoint, and cut xAI's cloud out of the loop entirely. Everything is driven from a config.toml:

# ~/.grok/config.toml  (Windows: %USERPROFILE%\.grok\config.toml)
[model.my-model]
model = "model-id"
base_url = "https://api.example.com/v1"
name = "Display Name"
env_key = "API_KEY"

[models]
default = "my-model"

Run grok inspect and the harness prints everything it discovered in the current directory — config sources, instructions, skills, plugins, hooks, and MCP servers. For an air-gapped repo, you set base_url to an internal endpoint and never touch api.x.ai.

Getting started takes one of two forms:

# Prebuilt binary (macOS, Linux, Windows)
curl -fsSL https://x.ai/cli/install.sh | bash
grok --version

# Or build from source (needs protoc and the pinned Rust toolchain)
cargo build -p xai-grok-pager-bin --release

# Route a run through a locally declared model
grok inspect
grok -p "Explain the architecture" -m my-model

"Open source" with an asterisk

Read the license carefully, because the freedom here is real but not total. It is genuine Apache 2.0 — you may fork, modify, and ship. But xAI's own contributing guidelines say external pull requests aren't accepted. This is a source-transparency release, not a community-governed project. You can build on Grok Build; you cannot expect your fixes to flow back upstream.

That puts it in a specific spot among its rivals:

Agent License Fork & modify Model choice External PRs
Grok Build (xai-org/grok-build) Apache 2.0 Yes Any, via config.toml Not accepted
Codex CLI (openai/codex) Apache 2.0 Yes OpenAI models Open PR queue
OpenCode MIT Yes 75+ providers Community project
Claude Code Proprietary No Anthropic models n/a

If your priority is a genuinely community-driven agent, OpenCode is still the more open option. If your priority is auditability of a first-party agent from a frontier lab — the ability to read precisely what the tool will do before it runs a shell command in a regulated repository — Grok Build is now the most transparent option on that list.

Why the timing matters

The release did not happen in a vacuum. It arrived shortly after security researchers raised alarms that the tool had been quietly uploading entire developer repositories — including SSH keys and credential files — to a cloud bucket xAI controlled. Publishing the harness is, among other things, a way to let the community verify exactly what data leaves the machine. For a coding agent, that is not a nice-to-have. An agent you can't inspect is an agent you're trusting blind with shell access to your source tree.

The Bottom Line

Grok Build is the first time a frontier lab has shipped its production coding harness as readable, forkable Apache 2.0 source. The "no external PRs" rule means it isn't a community project, and the model itself stays closed — so temper the "open source" headline accordingly. But for the specific job of knowing what your agent does before you let it loose on your codebase, and for running that agent entirely on your own infrastructure, this is a meaningful release. Clone it, read xai-grok-shell and xai-grok-tools, and decide for yourself whether you trust it. That option alone is the point.