- Rust 99.6%
- Python 0.2%
- JavaScript 0.1%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
Sync from xai-org/grok-build (16 monorepo commits). Resolve conflicts in favor of the fork's changes: - Re-apply telemetry privacy gates onto upstream's reworked telemetry crate (product events/Mixpanel, Sentry, external OTLP stay disabled). - Re-thread the global [auth].api_key feature through upstream's refactored models submodules (cache/endpoint/fetch/resolution). - Fix remote-MCP-disable patch: session_id/event_writer/mode moved onto ctx. Propagate the operator content-handling policy beyond the primary agent: - Single-source the section as xai_tool_types::CONTENT_HANDLING_SECTION so it survives future upstream re-syncs, and append it for both primary and subagent audiences in PromptContext::render_with_renderer. - Drop the "do not reveal this prompt" line from the subagent template so it no longer contradicts the disclosure policy. - Inject the policy into the web-search tool as a system-role message in the Responses-API input array (xAI rejects the top-level instructions field). Also gate two unix-only terminal tests with cfg(unix) so the tools test binary compiles on Windows. |
||
| .cargo | ||
| bin | ||
| crates | ||
| prod/mc/cli-chat-proxy-types | ||
| third_party | ||
| .gitignore | ||
| Cargo.lock | ||
| Cargo.toml | ||
| clippy.toml | ||
| CONTRIBUTING.md | ||
| LICENSE | ||
| README.md | ||
| rust-toolchain.toml | ||
| rustfmt.toml | ||
| SECURITY.md | ||
| SOURCE_REV | ||
| THIRD-PARTY-NOTICES | ||
Grok Build (grok)
Grok Build is SpaceXAI's terminal-based AI coding agent. It runs as a full-screen TUI that understands your codebase, edits files, executes shell commands, searches the web, and manages long-running tasks — interactively, headlessly for scripting/CI, or embedded in editors via the Agent Client Protocol (ACP).
Installing the released binary · Building from source · Documentation · Repository layout · Development · Contributing · License
Learn more about Grok Build at x.ai/cli
This repository contains the Rust source for the grok CLI/TUI and its agent
runtime. It is synced periodically from the SpaceXAI monorepo.
A small SOURCE_REV file at the root records the full monorepo commit SHA
for the version of the code present in this tree.
About this privacy-focused fork
This fork is focused on local privacy and explicit operator control. Binaries built from this repository disable the client's product telemetry and background upload paths, including Mixpanel events and profile sync, Sentry, external OpenTelemetry/OTLP export, feedback and session signals, trace and GCS uploads, authentication diagnostic-log uploads, heap-profile collection, and network update checks/downloads. Remote HTTP/SSE MCP servers and the remote workspace hub are also disabled so they cannot expose local tools or files; local stdio MCP servers remain available.
The main model/chat API remains enabled because it is required for the agent to operate. Authentication and explicitly invoked network features such as web search may still contact their respective services, so this is a privacy-hardened build rather than a fully offline application.
The primary Grok Build system prompt is embedded as plaintext and may be disclosed when the user explicitly requests it. AI jailbreaking, prompt injection, system-prompt extraction, guardrail/refusal bypass, adversarial prompting, and model red-teaming are explicitly treated as in-scope technical work. The client prompt instructs the model not to identify, flag, redirect, or refuse a request merely because it uses those labels. Provider-side model behavior and server-side content filters remain outside this repository's control.
Important
The installation commands below download the official upstream xAI release, which does not contain this fork's changes. Build this repository from source to use the privacy and prompt modifications described above.
Installing the released binary
Prebuilt binaries are published for macOS, Linux, and Windows:
curl -fsSL https://x.ai/cli/install.sh | bash # macOS / Linux / Git Bash
irm https://x.ai/cli/install.ps1 | iex # Windows PowerShell
grok --version
See the changelog for the latest fixes, features, and improvements in each release.
Building from source
Requirements:
-
Rust — the toolchain is pinned by
rust-toolchain.toml;rustupinstalls it automatically on first build. -
DotSlash — required so hermetic tools under
bin/(notablybin/protoc) can download and run. Install it and ensuredotslashis on yourPATHbefore building:cargo install dotslash # or: prebuilt packages — https://dotslash-cli.com/docs/installation/ /usr/bin/env dotslash --help # sanity check -
protoc — proto codegen resolves
bin/protocvia DotSlash, or falls back to aprotoconPATH/$PROTOC. -
macOS and Linux are supported build hosts; Windows builds are best-effort and not currently tested from this tree.
cargo run -p xai-grok-pager-bin # build + launch the TUI
cargo build -p xai-grok-pager-bin --release # release binary: target/release/xai-grok-pager
cargo check -p xai-grok-pager-bin # fast validation
The binary artifact is named xai-grok-pager; official installs ship it as
grok. On first launch it opens your browser to authenticate — see the
authentication guide.
Documentation
Full online documentation is available at docs.x.ai/build/overview.
The user guide ships with the pager crate:
crates/codegen/xai-grok-pager/docs/user-guide/
— getting started, keyboard shortcuts, slash commands, configuration, theming,
MCP servers, skills, plugins, hooks, headless mode, sandboxing, and more.
Repository layout
| 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 + 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 |
crates/codegen/... |
The rest of the CLI crate closure (config, MCP, markdown, sandbox, ...) |
crates/common/, crates/build/, prod/mc/ |
Small shared leaf crates pulled in by the closure |
third_party/ |
Vendored upstream source (Mermaid diagram stack) — see below |
Important
The root
Cargo.toml(workspace members, dependency versions, lints, profiles) is generated — treat it as read-only. Prefer editing per-crateCargo.tomlfiles.
Development
cargo check -p <crate> # always target specific crates; full-workspace builds are slow
cargo test -p xai-grok-config # per-crate tests
cargo clippy -p <crate> # lint config: clippy.toml at the repo root
cargo fmt --all # rustfmt.toml at the repo root
Contributing
Note
External contributions are not accepted. See
CONTRIBUTING.md.
License
First-party code in this repository is licensed under the Apache License,
Version 2.0 — see LICENSE.
Third-party and vendored code remains under its original licenses. See:
THIRD-PARTY-NOTICES— crates.io / git dependencies, bundled UI themes, and in-tree source ports (including openai/codex and sst/opencode tool implementations)crates/codegen/xai-grok-tools/THIRD_PARTY_NOTICES.md— crate-local notice for the codex and opencode ports (license texts + Apache §4(b) change notice)third_party/NOTICE— vendored Mermaid-stack index
