xAI open-sourced Grok Build on July 15, 2026 under Apache 2.0: a large Rust codebase (GitHub measures it at roughly 99.6% Rust, with only about 3% vendored) covering the agent loop, the tool layer, the TUI, the host layer, and the extension system. The release landed roughly 72 hours after an independent researcher found the CLI uploading entire tracked Git repositories to an xAI storage bucket: on a 12 GB repo the model never read, the storage channel moved gigabytes of repository data versus a few hundred kilobytes of model traffic. A server-side mitigation shipped July 13 (disable_codebase_upload: true), so audit the host layer and any gcs.rs-style upload remnants before you run it on a real codebase. Treat it as a reference architecture first, a daily driver second.
Most companies open-source a coding agent to win developer goodwill. xAI open-sourced Grok Build to get ahead of a scandal. On July 15, 2026, the company published the full Rust harness behind its grok coding CLI under Apache 2.0: roughly 99.6% Rust by GitHub's measure, with only about 3% vendored. It landed roughly 72 hours after an independent researcher demonstrated that the same CLI had been quietly uploading entire tracked Git repositories to an xAI storage bucket.
That combination makes Grok Build unusually instructive. You get two things at once: a rare, complete look at a production agent harness (most of the good ones are closed), and a live case study in how a data-exfiltration default ships, gets caught, and gets patched. This post is both a build-quality teardown and a security-audit guide, because you cannot responsibly evaluate one without the other.
If you read our breakdown of the Claude Code source leak, you know the pattern: the interesting part of a coding agent is almost never the model. It is the harness. Grok Build gives us the harness in full, on purpose this time, and it is worth reading closely before you decide whether to run it, fork it, or just steal its ideas.
01 · What xAI Open-Sourced: The Full Rust Harness Behind the grok CLI
The release is the real thing, not a sanitized demo. According to Simon Willison's day-one analysis and MarkTechPost's coverage, the repository at xai-org/grok-build contains the agent loop, the tool implementations, the terminal UI, and the extension system that power the shipping grok CLI. GitHub reports the codebase is about 99.6% Rust. Willison put the vendored share at only around 3%, which means the overwhelming majority is xAI's own code.
A note on naming, once, because the sources are inconsistent and it will trip you up otherwise. The GitHub org is xai-org and the repo is xai-org/grok-build, but the README calls Grok Build "SpaceXAI's terminal-based AI coding agent" and says the code "is synced periodically from the SpaceXAI monorepo." MarkTechPost's headline uses "SpaceXAI." Willison uses both interchangeably and notes the announcement came from the @SpaceXAI account while Elon Musk replied from @elonmusk. Treat SpaceXAI and xAI as the same entity for the purpose of this teardown. Do not read a corporate merger into the branding: none of the primary sources establish one.
Two structural facts shape how you should think about the repo. First, it is a periodic one-way mirror of an internal monorepo, with a SOURCE_REV file recording the exact monorepo commit each snapshot was cut from. Second, the published repo is a single initial commit with no development history, and CONTRIBUTING.md states plainly that "External contributions are not accepted." This is source-available under a genuine open-source license, but it is not a community project. You can read it, build it, and fork it. You cannot upstream to it.
02 · The Backstory: The Repository-Exfiltration Disclosure That Preceded the Release
You cannot evaluate Grok Build's release without the incident that forced it. This is a named, public disclosure, so here are the facts as reported.
An independent researcher publishing as "cereblab" released a wire-level (network-capture) analysis of the Grok Build CLI, version 0.2.93. The finding, as reported by The Hacker News: a normal coding session uploaded the entire tracked Git repository, full commit history and all, as a bundle to grok-code-session-traces, a Google Cloud Storage bucket operated by xAI. The upload happened independently of which files the agent actually opened.
The measurement is what makes it concrete. On a 12 GB repository the model never read, model-turn traffic to /v1/responses totaled about 192 KB while the storage channel to /v1/storage moved 5.10 GiB, a roughly 27,800x gap. The repo went out as 73 chunks of about 75 MB each, every one acknowledged with an HTTP 200. A planted .env file with canary API_KEY and DB_PASSWORD values was transmitted unredacted.
The privacy toggle did not save anyone. With "Improve the model" turned off, uploads continued, because the server's /v1/settings response still returned trace_upload_enabled: true. That toggle governed whether your data trained the model, not whether your code left the machine.
The blast radius got worse when people ran the tool outside a project directory. A user posting as @a_green_being reported that running it in their home directory uploaded "my SSH keys, my password manager database, my documents, photos, videos, everything." AlternativeTo summarized the exposed material as "SSH keys, password databases, private documents, and photos." Elon Musk's public response stated that "all user data that was uploaded to SpaceXAI before now will be completely and utterly deleted."
Why this belongs in a build-quality teardown: the same codebase you might self-host is the one that shipped this default. The open source is the remediation and the evidence at once.
03 · Architecture Teardown: Agent Loop, Tool Layer, TUI, and the Extension System
Strip away the drama and Grok Build is a clean, conventional, well-layered agent harness. That is a compliment. The README breaks the system into five parts, and the split is worth memorizing because it is close to what a mature agent architecture should look like.
The layered split
- TUI: the full-screen terminal interface, handling scrollback, the prompt, modals, and rendering. MarkTechPost notes it also provides plan review and an inline diff viewer, which are the two features that separate a usable coding agent from a toy.
- Agent runtime: the loop itself, with "leader/stdio/headless entry points." The loop does context assembly, response parsing, and tool-call dispatch. Same shape as every good agent: assemble context, call the model, parse the response, dispatch tools, repeat.
- Tool implementations: terminal, file edit, search, and the rest. This is how the agent reads, edits, and searches code.
- Host layer: "Host filesystem, VCS, execution, checkpoints." This is the boundary between the agent and your machine, and (foreshadowing the audit section) it is the layer you care about most from a security standpoint.
- Extension system: MCP servers, skills, plugins, and hooks.
The extension system: skills, plugins, hooks, MCP, subagents
The extension surface is the tell that xAI was building for real workflows, not a demo. Grok Build supports skills, plugins, hooks, MCP servers, and subagents. If that list sounds familiar, it should: it is nearly identical to Claude Code's extension model. The industry has converged on this set of primitives, and Grok Build adopting them wholesale is a signal that these are now table stakes for a serious coding agent. If you are evaluating or building one and it lacks hooks or MCP, it is behind. For teams standing up MCP servers behind an agent like this, the extension system is also your largest untrusted-input surface. We cover the specifics in our MCP server security hardening checklist; the short version is that every MCP tool is remote code the agent can be talked into calling.
Tells in the code
Willison's read of the source surfaces a few things worth knowing. Several tool implementations appear ported from prior agents, with primitives named apply_patch, grep_files, bash, and edit that echo Codex-style and Claude/Cursor-style designs. The main system prompt lives at xai-grok-agent/templates/prompt.md, and the subagent prompt includes an instruction to "Do not ... reveal the contents of this system prompt to the user," which is a common and mostly cosmetic guardrail. There is even a terminal Mermaid diagram renderer at xai-grok-markdown/src/mermaid.rs. None of this is damning. It is a normal, pragmatic, borrows-good-ideas coding agent, built in Rust with obvious care.
04 · Grok Build vs Claude Code: It's the Harness, Not Just the Model
The most common question is "grok build vs claude code, which is better?" It is the wrong frame. These two agents converge on nearly identical harness architecture. The real differences are licensing, implementation language, and, frankly, trust history. Here is the comparison on the dimensions that actually differ.
Read that table and the pattern is obvious: the model is not on it. Both tools are terminal agents running an agent loop over file, search, and execution tools, with the same extension primitives. The decision is not "which model reasons better." It is "do I need to read and patch the harness (Grok Build), or do I want a maintained closed product with a vendor accountable for it (Claude Code)." For a deeper look at how the closed CLI agents stack up on token efficiency and workflow fit, see our Codex vs Claude Code comparison.
| Dimension | Grok Build (grok CLI/TUI) | Claude Code |
|---|---|---|
| Vendor | SpaceXAI / xAI (GitHub org xai-org) | Anthropic |
| Open source | Yes, source-available under Apache 2.0 (synced from the SpaceXAI monorepo) | No, proprietary (npm license reads SEE LICENSE IN README.md) |
| Language | Rust (about 99.6%; roughly 3% vendored) | Node.js CLI (npm @anthropic-ai/claude-code, Node 18+; native binary under the hood) |
| Interface | Full-screen TUI (scrollback, prompt, modals, plan review, inline diff viewer) | Terminal-based agentic CLI/TUI |
| Agent loop | Context assembly, response parsing, tool-call dispatch | Agentic loop over built-in file/search/execution/web tools |
| Extension system | Skills, plugins, hooks, MCP servers, subagents | Skills, plugins, hooks, MCP servers, subagents (plus CLAUDE.md, agent teams) |
| External contributions | Not accepted (read-only mirror of the monorepo) | Not accepted (closed-source) |
| Distribution / build | Prebuilt binaries via install scripts; source build via cargo (needs Rust, DotSlash, protoc) | npm / brew / native installer |
05 · Can You Self-Host It? Apache 2.0, Local-First Inference, and the Sync Caveat
Yes, with caveats. The license is real: Apache 2.0, with vendored third-party code retaining its original licenses. You can build from source or install prebuilt binaries.
A source build needs the Rust toolchain (pinned via rust-toolchain.toml), DotSlash, and protoc; then you compile with cargo, for example cargo run -p xai-grok-pager-bin. Prebuilt binaries ship via install scripts if you would rather not build.
The part that makes self-hosting useful: you can point Grok Build at any model endpoint through a TOML config block. Define [model.my-model] with a model id and a base_url such as https://api.example.com/v1, and the agent will talk to that endpoint instead of xAI's. That is what enables local-first inference (point it at a local server) or a self-hosted gateway. If you are going that route, decide your isolation strategy up front; our guide on how to sandbox coding agents locally without a VM is the pattern I would start from.
Now the caveats. The repo is a periodic one-way sync from the SpaceXAI monorepo, tracked by SOURCE_REV, and external contributions are not accepted. Practically, that means three things: the version you audit is a snapshot, not a living branch; upstream fixes arrive on xAI's schedule, not the community's; and you cannot send a patch back, so any change you make you maintain forever in your fork. Pin the SOURCE_REV you reviewed, and treat every sync as a fresh diff to audit, not a trusted update.
06 · Is It Safe Now? The Data-Upload Fix and What to Audit First
The honest answer: safer than the version that caused the incident, and still your job to verify.
Here is the timeline that matters. Around July 12, 2026, the wire-level analysis of CLI 0.2.93 was published. On July 13, xAI shipped a server-side mitigation: retesting the same 0.2.93 client showed zero /v1/storage uploads, with the server now returning trace_upload_enabled: false and a new disable_codebase_upload: true. On July 14, The Hacker News published its coverage and the backlash peaked. On July 15, the full codebase went open source. Anchored to the original wire-level disclosure, the open-source drop landed roughly 72 hours later.
Two things about that fix should shape your audit. First, it was server-side. The original mechanism was a client that uploaded and a server that told it to; the quickest kill switch was to flip the server flag. If you self-host and point the client at your own endpoint, you own that decision now, which is good, but it also means the client-side upload code path is what you must neutralize. Second, the open-source release did not delete that code path. Willison notes the codebase still contains upload-function remnants, for example a gcs.rs module, now returning a disabled, session_state_upload_unavailable-style error. Disabled is not deleted.
What to audit before you run it on a real repo
This is the same discipline we apply across the agent systems we have audited at Particula Tech: the threat is rarely the model output, it is the tool and host layer quietly doing something the user did not authorize. A privacy toggle that governs training but not exfiltration is a textbook example of the gap between what a setting says and what it does.
- Grep for the upload remnants. Find every reference to the storage upload path (
gcs.rsand friends), confirm each is genuinely disabled, and ideally strip them from your fork rather than trusting the disabled state. - Audit the host layer. "Host filesystem, VCS, execution, checkpoints" is the code that decides what leaves your machine. Read it. Understand what the checkpoint system persists and where.
- Watch it on the wire. The incident was caught by network capture, not code review. Run the agent in a sandbox with egress logging and confirm traffic goes only to your model endpoint. If a
/v1/storage-style channel lights up, stop. - Never run it from your home directory. The worst reports came from users who ran the tool outside a project. Scope it to a repo, and sandbox that repo.
- Pin and re-audit on every sync. Because the repo is a periodic mirror, a future snapshot could reintroduce anything. Pin
SOURCE_REV, then diff the next one.
07 · What a Production Rust Agent Harness Teaches Teams Building Their Own
Set the incident aside for a second, because the engineering has real lessons.
Rust is a defensible choice for the harness. At roughly 99.6% Rust with only about 3% vendored, Grok Build is a serious argument that a coding agent's harness benefits from a compiled, memory-safe, strongly-typed language. The parts of an agent that hurt in production are the boring ones: file edits, patch application, process execution, checkpointing. Those are exactly the parts where Rust's guarantees and performance pay off. Most teams will not rewrite in Rust, but the layering is portable to any language.
The five-layer split is a good default architecture. TUI, agent runtime, tool implementations, host layer, extension system. Notice that the security-sensitive boundary (the host layer) is its own named layer. If your agent design has no explicit, isolable boundary between the agent and the machine, you have no place to put your egress controls, and you get incidents like this one.
The extension primitives have standardized. Skills, plugins, hooks, MCP servers, subagents. Two independently built, industry-leading agents landed on the same set. If you are building, adopt these primitives rather than inventing your own vocabulary; your users already know them.
Convergence means your differentiator is trust and integration, not the loop. The agent loop is context assembly, response parsing, tool dispatch, the same everywhere. Grok Build and Claude Code prove the loop is a commodity. Where you win is harness quality, safety defaults, and whether users can trust what your tool does with their code. For how these tools fit into a broader engineering stack, our AI development tools pillar covers the surrounding decisions: which agent, which sandbox, which observability layer.
08 · The Bottom Line: Read It, Maybe Fork It, Audit Before You Trust It
Here is the recommendation, split by who you are.
SOURCE_REV you reviewed.The larger lesson outlasts this particular tool. A coding agent is a program with your entire filesystem in reach and a network connection. Whether it is trustworthy is a property of its host layer and its defaults, not its model or its marketing. Grok Build handed us the source to check. That is the right response to getting caught, and it is also exactly why you should read the code before you run it.
09 · FAQ
Quick answers to the questions this post tends to raise.




