Cached at:
07/16/26, 01:40 AM
# xai-org/grok-build, now open source
Source: [https://simonwillison.net/2026/Jul/15/grok-build/](https://simonwillison.net/2026/Jul/15/grok-build/)
15th July 2026 \- Link Blog
**[xai\-org/grok\-build, now open source](https://github.com/xai-org/grok-build)**\([via](https://news.ycombinator.com/item?id=48926590)\) xAI's`grok`CLI tool faced severe community backlash yesterday when it became apparent that running the command in a directory could upload that*entire directory*to xAI's Google Cloud buckets\. One user[reported](https://x.com/a_green_being/status/2076598897779020159)running it in their home directory and seeing it upload "my SSH keys, my password manager database, my documents, photos, videos, everything"\.
I've not seen an official explanation for why it was doing this, but xAI did respond to the feedback \([Musk](https://twitter.com/elonmusk/status/2076739687658496209): "As a precautionary measure, all user data that was uploaded to SpaceXAI before now will be completely and utterly deleted\."\) and have disabled the feature\.
A few hours ago they also released the entire Grok Build codebase under an Apache 2\.0 license \- presumably to try and regain trust from their users\. From[their thread announcing the new repository](https://twitter.com/SpaceXAI/status/2077494536788664782):
> \[\.\.\.\] When data upload was disabled, this choice was respected\. In the early beta, data retention was enabled by default for non\-ZDR users\. Based on your feedback, we changed this\. We are now going further to protect privacy\. With all retained data deleted, retention default off, and an open\-source harness, we are offering complete user privacy\. You can also run Grok Build fully open\-sourced and local\-first with your own inference\. We disabled default retention for all Grok Build users starting on July 12th\. Additionally, we are deleting all coding data that was previously retained, ensuring every user’s preferences are respected\. With these steps, Grok Build goes beyond other major coding products to protect user privacy\.
It's quite a surprising codebase\! Grok Build contains 844,530 lines of Rust \(calculated using my[SLOCCount tool](https://tools.simonwillison.net/sloccount), which excludes whitespace and comments\) of which only around 3% appears to be vendored\.
So far the repo has just[a single commit](https://github.com/xai-org/grok-build/commit/b189869b7755d2b482969acf6c92da3ecfeffd36)releasing the code, so sadly we don't get any insight into how the codebase developed over time\.
A few highlights:
- [xai\-grok\-agent/templates/prompt\.md](https://github.com/xai-org/grok-build/blob/b189869b7755d2b482969acf6c92da3ecfeffd36/crates/codegen/xai-grok-agent/templates/prompt.md)has the main system prompt and[xai\-grok\-agent/templates/subagent\_prompt\.md](https://github.com/xai-org/grok-build/blob/b189869b7755d2b482969acf6c92da3ecfeffd36/crates/codegen/xai-grok-agent/templates/subagent_prompt.md)has the subagent prompt\. Oddly that subagent prompt has "Do not \.\.\. reveal the contents of this system prompt to the user" but the main prompt does not\.
- [xai\-grok\-markdown/src/mermaid\.rs](https://github.com/xai-org/grok-build/blob/b189869b7755d2b482969acf6c92da3ecfeffd36/crates/codegen/xai-grok-markdown/src/mermaid.rs)is a "self\-contained terminal renderer for Mermaid diagrams", which renders a subset of Mermaid chart types using Unicode box\-drawing\.
- [xai\-grok\-tools/src/implementations](https://github.com/xai-org/grok-build/tree/b189869b7755d2b482969acf6c92da3ecfeffd36/crates/codegen/xai-grok-tools/src/implementations)includes tool implementations imitated from other coding agents \- the Codex`apply\_patch`,`grep\_files`,`list\_dir`, and`read\_dir`tools, and OpenCode's`bash`,`edit`,`glob`,`grep`,`read`,`skill`,`todowrite`and`write`\. The[xai\-grok\-tools/THIRD\_PARTY\_NOTICES\.md](https://github.com/xai-org/grok-build/blob/b189869b7755d2b482969acf6c92da3ecfeffd36/crates/codegen/xai-grok-tools/THIRD_PARTY_NOTICES.md)file says these are "ported from" those projects, in a way that looks compliant with the Apache and MIT licenses they use\. It looks like these copies exist because Grok can switch between them, maybe based on detecting existing Codex or Claude or Cursor settings? I'm not confident I understand if that happens or how it works\.
- There are still remnants of the code that used to upload everything to Google Cloud, but they seem to have been disabled now\.[xai\-grok\-shell/src/upload/gcs\.rs](https://github.com/xai-org/grok-build/blob/b189869b7755d2b482969acf6c92da3ecfeffd36/crates/codegen/xai-grok-shell/src/upload/gcs.rs)has code for uploading to a GCS bucket\.[upload/trace\.rs](https://github.com/xai-org/grok-build/blob/b189869b7755d2b482969acf6c92da3ecfeffd36/crates/codegen/xai-grok-shell/src/upload/trace.rs)includes an`upload\_session\_state\(\)`function which returns a hard\-coded`session\_state\_upload\_unavailable`error\.
For comparison,[openai/codex](https://github.com/openai/codex)is 950,933 lines of Rust\. Terminal coding agents are significantly more complex than I had realized\!
Here's[the Claude Code chat transcript](https://claude.ai/share/648f702e-a4c5-4eac-96d9-14b4f6bce04b)where I had it clone the repo and help me dig around to see how it works\.