cool-solution — dev.blog
Technologies

Repo of the day: Grok Build, xAI's coding agent goes open source

We use coding agents every day, yet we see very little of how they work inside: the harness — the part that assembles context, parses model responses and routes tool calls — is almost always a closed box. On July 15, 2026 xAI made an interesting exception: it published the complete source of Grok Build, its terminal coding agent, on GitHub under the Apache 2.0 license. This is no demo project: it's the real Rust code of the agent the company ships as the `grok` binary, synced periodically from the internal monorepo. Within two weeks the repository passed 19,000 stars. I picked it as repo of the day because, beyond the model running underneath, it's one of the best ways I've seen to study the anatomy of a production agent harness — and because you can compile it yourself and point it at your own local inference.

$ claude "refactor user.service to async/await" reading src/services/user.service.ts... proposing 12 edits across 3 files ✓ tests still pass (47 / 47) applying patch...AI PAIRsupervised

🔍 What Grok Build is

Grok Build is xAI's terminal coding agent: a fullscreen, mouse-interactive TUI that reads your codebase, edits files with diff-based review, runs shell commands, searches the web and manages long-running tasks. Launched in beta in May 2026 and aimed at engineers working on large codebases, it runs in three modes: interactively in the terminal, headless for scripts and CI pipelines, and inside editors via the Agent Client Protocol (ACP), the same mechanism other agents use to integrate with IDEs.

The published repository contains the Rust source (99.6% of the code) of the CLI/TUI and the agent runtime. First-party code is under Apache 2.0; third-party parts keep their original licenses. One detail says a lot about the state of the ecosystem: the third-party notices include in-tree ports of the tool implementations from openai/codex and sst/opencode — open source harnesses are literally swapping parts with each other.

The repo's ID card
repo       xai-org/grok-build
what       xAI's terminal coding agent (harness + TUI), now open source
how        Rust 99.6% · `grok` binary · TUI, headless or editors via ACP
extensions skills, plugins, hooks, MCP servers, subagents
extra      local-first: compile it yourself, point it at your inference via config.toml
license    Apache 2.0 (first-party) · ~19,600 stars · synced from the monorepo

Official repo · xai-org/grok-build

Not a demo: it's the source of the production agent, synced periodically from the internal monorepo.

⚙️ How to try it: binary or build from source

The quick path is the prebuilt binary, published for macOS, Linux and Windows: one install script and the `grok` command is ready; on first launch it opens the browser to authenticate. That's the path for using the agent, not studying it.

The interesting path for readers of this article is the second one: building from source with Cargo. You need the Rust toolchain (pinned by `rust-toolchain.toml`, installed by `rustup` on first build), DotSlash to fetch the hermetic tools under `bin/` (notably `protoc` for proto code generation) and little else. The produced binary is named `xai-grok-pager`; official installs ship it as `grok`. macOS and Linux are the supported build hosts, Windows is best-effort.

Install and build from source
# Quick path: official binary (macOS / Linux / Git Bash)
curl -fsSL https://x.ai/cli/install.sh | bash
grok --version

# Study path: build from source
cargo install dotslash          # prerequisite for bin/protoc
git clone https://github.com/xai-org/grok-build && cd grok-build
cargo run -p xai-grok-pager-bin              # build + launch the TUI
cargo build -p xai-grok-pager-bin --release  # release binary

Official documentation · docs.x.ai

The compiled binary is named xai-grok-pager: the same one official releases ship as `grok`.

🧩 The harness anatomy: the crates that matter

What makes the repository a valuable read is the crate separation, because it mirrors the typical architecture of a modern coding agent. `xai-grok-pager` is the TUI — scrollback, prompt, modals, rendering. `xai-grok-shell` is the agent runtime, with the leader, stdio and headless entry points. `xai-grok-tools` implements the actual tools: terminal, file editing, search. `xai-grok-workspace` handles filesystem, version control, execution and checkpoints. Around them, the supporting crates: configuration, MCP, markdown, sandbox.

It's exactly the map you need to understand how an agent works: xAI's announcement states that the published source covers the agent loop (how context is assembled, how model responses are parsed, how tool calls are dispatched), the tools, the terminal UI with the inline diff viewer, and the extension system. If you work with skills, plugins, hooks or MCP servers on any agent, here you can see in black and white how each is loaded and invoked.

A prompt's round trip through the harness
  1. 01
    ContextThe agent assembles codebase, instructions and extensions into the context
  2. 02
    ModelThe model's response is parsed by the runtime (xai-grok-shell)
  3. 03
    Tool dispatchTool calls are routed to the tools (xai-grok-tools)
  4. 04
    WorkspaceFiles, VCS, execution and checkpoints go through xai-grok-workspace
  5. 05
    TUIInline diffs and plan review in the TUI (xai-grok-pager)

The crate separation mirrors the canonical pieces of a coding agent: loop, tools, workspace, interface.

🏠 Local-first: your binary, your inference

The most concrete point of the open-sourcing is that Grok Build can now run fully local-first: you compile it, point it at your own inference — even a locally served model — and drive everything from `config.toml`. For anyone with confidentiality constraints on their code, that's the difference between "I trust the vendor's pipeline" and "I know exactly what leaves my machine, because I can read it in the source".

The user guide, shipped in the repository and published on docs.x.ai, covers the rest of the surface: keyboard shortcuts, slash commands, configuration, theming, MCP servers, skills, plugins, hooks, headless mode and sandboxing. They are the same concepts anyone using Claude Code or Codex CLI already knows — the file names change, the ideas don't.

Official binary vs local-first build

Official binary

  • One-command install, managed updates
  • Authenticates with your xAI account on first launch
  • Inference on Grok models via API
  • No visibility into what the process does, beyond the docs

Compiled from source

  • Reproducible build with Cargo (pinned toolchain)
  • You can point it at your own inference, even local
  • Everything driven by config.toml
  • Behavior is verifiable by reading the code

The local-first mode is the real news of the open-sourcing: a readable harness with inference under your control.

🏢 Why it's interesting, for developers and SMBs

For developers, the value is not (just) another agent to try: it's a reference text. The questions we ask ourselves while configuring an agent — why isn't the skill being loaded? how are tool results passed back to the model? what actually goes into the context? — have a readable answer in this source, in a language, Rust, that makes module boundaries and responsibilities explicit. Even just comparing how Grok Build, Codex and opencode implement the same file-editing tool is a design lesson; the in-tree ports prove that implementations are becoming shared heritage across harnesses.

For an SMB introducing agents into its development processes, the signal is infrastructure maturing: coding agents are converging on common primitives — skills, plugins, hooks, MCP, subagents, sandboxing — and becoming inspectable components rather than opaque services. Being able to compile the harness and keep inference in-house opens scenarios for teams with strict requirements on where source code travels. It still needs a case-by-case assessment: default usage remains tied to xAI's models and account, and governance should be reasoned about as with any agent.

⚠️ Limits and caveats before adopting it

Some honesty. The first limit is its nature: this is open code, not a community project. External contributions are not accepted, the repository is a mirror synced periodically from the internal monorepo (the public history starts with a handful of commits and a `SOURCE_REV` file recording the origin SHA), and the root `Cargo.toml` is generated and should be treated as read-only. Reading yes, forking too, getting a PR merged no.

On the practical side: the build has non-trivial prerequisites for anyone new to Rust (DotSlash, protoc via hermetic tools), Windows as a build host is explicitly best-effort, and the "official" experience — authentication, models, changelog — stays attached to the xAI ecosystem. Finally, the star count is a snapshot of these days and the project is young as open source: crate structure and configuration surface may change with every sync.

  • No external contributions: read-only repository for the community, periodic sync from the monorepo.
  • Generated root Cargo.toml: edit the per-crate Cargo.toml files, not the global one.
  • Build with prerequisites: pinned Rust toolchain, DotSlash and protoc; Windows best-effort.
  • Default tied to xAI: without the local-first setup, authentication and inference go through Grok services.
  • Young as an open source project: structure and config may change between syncs.

✅ Where to start

The path I suggest starts with reading, not using: clone the repository and open `crates/codegen/xai-grok-tools` to see how the file-editing and terminal tools are implemented, then `xai-grok-shell` for the agent loop. If you already use another agent, compare the implementations with what you know: it's the fastest way to understand what your daily tool actually does. As a second step, try the Cargo build and launch the TUI; as a third, experiment with the local-first configuration pointing at your own inference.

The broader signal is the direction of the ecosystem: after Codex and opencode, xAI too has put its harness on the table, complete with declared ports of other people's implementations. Agent harnesses are becoming common, readable infrastructure — and for anyone building software with agents, knowing how to read them is becoming a baseline skill.

Frequently asked questions about Grok Build

What is Grok Build and what is it for?

It's xAI's terminal coding agent: a fullscreen TUI that reads your codebase, edits files with diff-based review, runs commands and manages long-running tasks. It works interactively, headless for scripts and CI, or inside editors via the Agent Client Protocol. Since July 15, 2026 the complete Rust source is published on GitHub under the Apache 2.0 license.

Can I use it with models other than Grok, or locally?

Yes, that's the main news of the open-sourcing: by compiling from source you can point the harness at your own inference, even a locally served model, driving everything from config.toml. The official binary, instead, authenticates with your xAI account and uses Grok models via API.

Can I contribute to the project?

No: external contributions are not accepted. The repository is a mirror of xAI's internal monorepo, synced periodically (the SOURCE_REV file records the origin commit). You can freely read, fork and compile it under Apache 2.0, but development stays inside the company.

What do I need to build it from source?

The Rust toolchain (pinned by rust-toolchain.toml, installed by rustup on first build), DotSlash for the hermetic tools under bin/ — notably protoc for code generation — and a macOS or Linux host (Windows is best-effort). The command is `cargo run -p xai-grok-pager-bin`; the produced binary is named xai-grok-pager, officially shipped as `grok`.

Let's talk

If this topic is relevant to you, write to me: comparing notes on code and AI is always time well spent.

All articles

More articles from the blog

semantic-caching-llm-dotnet-redis.mdJuly 27, 2026tips-claude-claude-md-luglio-2026.mdJuly 24, 2026claude-code-pretooluse-hook-proteggere-env-segreti-2026.mdJuly 24, 2026