SpaceXAI has open-sourced Grok Build, the terminal-based AI coding agent behind its
grok
CLI. The source landed on GitHub today. The release covers the agent harness, TUI, CLI shell, and developer tooling under the Apache 2.0 license
What is Grok Build?
A harness is the scaffolding around a model. It assembles context, calls the model, parses the reply, and dispatches tool calls.
Grok Build was launched as an early beta on May 25, 2026. It is an agent that understands your codebase, edits files, executes shell commands, and searches the web. It also manages long-running tasks. It runs as a full-screen, mouse-interactive TUI.
Three surfaces exist. There is the interactive TUI, headless mode for scripting and CI. Editors embed it through the Agent Client Protocol (ACP).
What does the published area contain?
Building on that framing, SpaceXAI lists four published areas. The agent loop covers context assembly, response parsing, and tool-call dispatch. The tools cover how the agent reads, edits, and searches code. The terminal UI covers rendering, input handling, plan review, and the inline diff viewer. The extension system covers skills, plugins, hooks, MCP servers, and subagents.
Those areas map onto named crates:
| Path | Contents |
|---|---|
crates/codegen/xai-grok-pager-bin |
Composition-root package; builds the xai-grok-pager binary |
crates/codegen/xai-grok-pager |
The TUI: scrollback, prompt, modals, rendering |
crates/codegen/xai-grok-shell |
Agent runtime plus leader/stdio/headless entry points |
crates/codegen/xai-grok-tools |
Tool implementations (terminal, file edit, search) |
crates/codegen/xai-grok-workspace |
Host filesystem, VCS, execution, checkpoints |
third_party/ |
Vendored upstream source (Mermaid diagram stack) |
Read that table as a reading order. Start at xai-grok-shell
for the loop, then xai-grok-tools
. One build note is easy to miss. The root Cargo.toml
is generated, and the README says to treat it as read-only.
How does the local-first path work?
Beyond inspection, SpaceXAI frames one practical outcome. Grok Build can now run fully local-first. Compile it yourself, point it at local inference, and drive everything from 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"
grok inspect
then prints what the harness discovered in the current directory. That covers config sources, instructions, skills, plugins, hooks, and MCP servers.
How does Grok Build compare?
| Agent | First-party license | Fork and modify | Model choice | External PRs |
|---|---|---|---|---|
Grok Build (xai-org/grok-build ) |
Apache 2.0 | Permitted | Any, via config.toml |
Not accepted |
Codex CLI (openai/codex ) |
Apache 2.0 | Permitted | OpenAI models | Open PR queue |
OpenCode (anomalyco/opencode ) |
MIT | Permitted | 75+ providers | Community project |
| Claude Code | Proprietary | Not granted | Anthropic models | n/a |
Use cases and examples
Given all of that, four uses hold up today.
Audit before adoption: Readxai-grok-tools
before letting an agent run shell commands in a regulated repo.Fork for an internal harness: Apache 2.0 permits it; upstream merge is not on offer.** Air-gapped runs**: Compile locally, setbase_url
to an internal endpoint, and skipapi.x.ai
.CI automation: Headless mode feeds structured output into a pipeline step.
curl -fsSL https://x.ai/cli/install.sh | bash
grok --version
cargo build -p xai-grok-pager-bin --release # -> target/release/xai-grok-pager
cargo check -p xai-grok-tools
cargo test -p xai-grok-config
cargo clippy -p xai-grok-shell
grok -p "Explain the architecture" --output-format streaming-json
grok inspect
grok -p "Hello" -m my-model
Check out the GitHub Repo, the announcement, and the documentation.
Michal Sutter is a data science professional with a Master of Science in Data Science from the University of Padova. With a solid foundation in statistical analysis, machine learning, and data engineering, Michal excels at transforming complex datasets into actionable insights.