What Exactly Is Grok Build?
Grok Build is xAI’s terminal-based AI coding agent that runs as a full-screen TUI — think Claude Code or OpenAI Codex CLI — or the Ant JS runtime I covered in a previous tutorial — but with xAI’s own spin. It understands your codebase, edits files, executes shell commands, searches the web, and manages long-running tasks. You can use it interactively, headlessly for scripts and CI pipelines, or embedded in editors through the Agent Client Protocol (ACP).
The repository that hit GitHub on July 14 contains the Rust source for the grok CLI, its TUI, and the agent runtime. It’s licensed under Apache 2.0, which means you can inspect exactly what it does, audit the tool implementations, and even build your own modified version — though external contributions aren’t accepted.
What makes this interesting isn’t just that Grok Build is open source. It’s that xAI is positioning it as a serious contender in the AI coding agent space, with backing from Grok 4.5 — the same model that powers their chat interface. The build system scored 70.8% on SWE-Bench Verified with a 256,000-token context window, and at $0.20 per million input tokens and $1.50 per million output on the API, it’s aggressively priced against Claude Code and Codex.
But enough background. Let’s get our hands dirty.

Installation: Two Paths
You have two options: grab the prebuilt binary, or build from source. Both are straightforward.
Option 1: Prebuilt Binary (Recommended for Most)
The quickest way to get Grok Build running is the official install script:
curl -fsSL https://x.ai/cli/install.sh | bash
On Windows (PowerShell):
irm https://x.ai/cli/install.ps1 | iex
After installation, verify it’s ready:
grok --version
On first run, Grok Build opens your browser for authentication. If you’re working on a headless server, set the XAI_API_KEY environment variable instead:
export XAI_API_KEY="xai-..."
grok
You can create an API key from the xAI console at console.x.ai.
Option 2: Building from Source
If you want to peek under the hood — and I mean really under the hood — building from source gives you access to the full Rust codebase. The requirements are minimal:
- Rust — the toolchain version is pinned in
rust-toolchain.toml, sorustuphandles it automatically - protoc — the build includes a dotslash launcher for proto codegen, or you can provide your own on
PATH
Building is a single command:
cargo run -p xai-grok-pager-bin
For a release binary:
cargo build -p xai-grok-pager-bin --release
The compiled binary lands at target/release/xai-grok-pager. The official installer renames it to grok, but you can symlink or alias it however you prefer.
There’s a neat structure to the codebase that’s worth noting. The repository is split into logical crates: xai-grok-pager for the TUI (scrollback, prompt, rendering), xai-grok-shell for the agent runtime, xai-grok-tools for tool implementations (terminal, file edit, search), and xai-grok-workspace for filesystem and VCS orchestration. It’s cleanly separated, which makes auditing individual components easy.
First Run: The Interactive Experience
Navigate to a project you’re working on and launch Grok Build:
cd my-project
grok
The TUI takes over your terminal with a full-screen interface. It feels similar to Claude Code or Codex CLI if you’ve used those, with a prompt bar at the bottom and the conversation history above. What surprised me was how polished it is for an open-source release — mouse interaction works out of the box, the scrollback handles long conversations gracefully, and slash commands are intuitive.
Here are a few prompts to try on your first session:
Explain this repo.
@src/main.rs Walk me through this file.
Find all the places where we handle authentication and summarize the pattern.
Write a test for the payment gateway module.
The @filepath syntax lets you reference specific files, and Grok Build reads them into context. It also automatically discovers your project’s structure — dependencies, config files, test directories — and uses that knowledge to provide better answers.
Headless Mode: For Scripts and CI
One of the things I appreciate most about Grok Build is the headless mode. You can pipe prompts directly:
grok -p "Explain the architecture of this project"
grok -p "Find any security vulnerabilities in the dependency tree"
For CI integration, the --output-format streaming-json flag gives you structured output you can parse programmatically. This opens up interesting possibilities — automated code review bots, documentation generators, or even a Slack bot that answers questions about your codebase.
I’m particularly interested in the scripting use case for my own workflow. At the ICT division, we have a set of legacy PHP applications that nobody fully understands anymore. A weekly cron job that runs Grok Build headlessly against each codebase and produces a summary of architectural patterns would save us hours of manual spelunking.
Custom Models and Configuration
Here’s where Grok Build gets really flexible. You’re not locked into xAI’s models. The config file at ~/.grok/config.toml lets you define custom model endpoints:
[model.my-local-model]
model = "llama-4"
base_url = "http://localhost:8080/v1"
name = "Local Llama 4"
env_key = "LOCAL_API_KEY"
[models]
default = "my-local-model"
After updating the config, run grok inspect to verify everything is discovered correctly. You can switch models inside the TUI with /model <name> or specify one headlessly with grok -p "Hello" -m my-local-model.
This is huge for privacy-conscious teams. If you’re working on sensitive code that you can’t send to an external API, you can point Grok Build at a local model running on your own hardware — part of the broader trend I explored in why Fortune 500 companies are ditching external AI APIs for self-hosted models. The same TUI, the same tool ecosystem, but all inference happens on your machine.
Skills, Plugins, and MCP Servers
Grok Build supports extensibility through three mechanisms: skills (reusable prompt templates), plugins (Python or shell scripts that add new commands), and MCP servers (the Model Context Protocol for integrating external tools).
Out of the box, it ships with a set of built-in skills for common tasks — code review, test generation, architectural analysis. The plugin system lets you add custom tool implementations, and since it’s all open source now, you can see exactly how the built-in tools work and write your own.
The MCP server support is particularly interesting because it means Grok Build can integrate with databases, APIs, and external services the same way Claude Code and Codex do. There’s a growing ecosystem of MCP servers for everything from PostgreSQL to Jira to GitHub Actions.
The Honest Assessment
I’ve been testing Grok Build alongside the tools I already use — primarily Claude Code and Codex CLI — and here’s my honest take.
What’s great: The TUI is genuinely polished. Mouse support, theming, and the scrollback experience are better than Codex CLI’s current offering. The custom model support is a standout feature that neither Claude Code nor Codex offers natively. And the pricing — $0.20/M input tokens for Grok 4.5 on the API — undercuts the competition significantly.
What needs work: The context window of 256K tokens is smaller than Claude Code’s 200K (though they’re comparable in practice). The agent’s ability to handle complex multi-file refactoring isn’t quite at Claude Code’s level yet based on my testing — and if you’re worried about AI agents accidentally running destructive commands, my guide on the Destructive Command Guard (dcg) covers how to add a safety net. And the SWE-Bench score of 70.8%, while respectable, trails Claude 4.5 Sonnet’s 80%+.
What to watch out for: Like any AI coding agent that sends code to an external API, there are privacy considerations — something I covered in detail in my guide on auditing AI coding assistant data privacy. The tool uploads parts of your codebase to xAI’s servers during processing. If you’re working on proprietary code, either use the custom model feature with a local LLM, or stick to the interactive review mode where you can vet every change before it’s applied.
Also worth noting: external contributions to the repo aren’t accepted, so the community can’t submit fixes or features. The source is available for audit and local modification, but the official build still comes from xAI’s internal team. That’s a limitation to keep in mind if you’re evaluating it for long-term use.
Wrapping Up
Grok Build going open source is a meaningful moment in the AI coding agent space. It’s not just another tool — it’s xAI’s bet that transparency and flexibility will win against the walled-garden approaches of Anthropic and OpenAI. Whether that bet pays off depends on how well the community adopts it and how quickly xAI iterates based on feedback.
For now, I’d recommend giving it a spin. The install is painless, the first-run experience is smooth, and the custom model support alone makes it worth exploring. Clone a side project, run grok in the directory, and see what it tells you about your own code. You might be surprised at what you learn.
If you’re already using Claude Code or Codex CLI, Grok Build makes an excellent complementary tool — especially for tasks where you want to use a local model or need that extra pair of eyes from a different AI perspective. The open-source release means you can finally see what’s actually happening under the hood, and for a developer who’s been watching the AI coding space evolve, that transparency is refreshing.