01
What is Grok Build?
Grok Build is SpaceXAI’s coding agent for the terminal. It launched in early beta in May 2026 and has been open source under the Apache 2.0 license since July 14, 2026.
Unlike a code chatbot, it can:
- Understand your codebase
- Edit files
- Run shell commands
- Search the web
- Plan before it builds
- Delegate to parallel subagents
- Run headlessly in scripts and CI
- Work inside editors through the Agent Client Protocol
It is a coding agent, so it acts on your files. Treat it like a new teammate with access to your repository.
02
Who can use it
Grok Build opened to SuperGrok and X Premium+ subscribers on May 25, 2026. It can also use an xAI API key. Check x.ai/cli for current plans.
The docs list Grok 4.7 as the latest model. Switch models with /model, or add custom models in the config file.
03
Install it
macOS and Linux
curl -fsSL https://x.ai/cli/install.sh | bash
Windows PowerShell
irm https://x.ai/cli/install.ps1 | iex
Check the install with grok --version. On first launch, it opens your browser to sign in. Or set an API key:
export XAI_API_KEY="your-key"
Never commit API keys to your repository.
04
Know the three modes
- Plan
- Grok Build writes a plan and only edits the plan file. Start with /plan and a description.
- Auto
- A classifier approves safe tools automatically. Start with /auto.
- Always-approve
- Skips permission prompts. Start with /always-approve.
Press Shift+Tab to cycle between modes.
Use Plan for anything important. Use Always-approve only in a sandbox you can throw away.
05
Start every feature with a plan
In Plan mode, you can approve the plan, comment on individual steps, or rewrite it before anything runs. Check that the plan:
- Solves the real problem
- Touches only the files it should
- Includes tests
- Does not add unneeded dependencies
- Explains anything risky
Review it with /view-plan, then let it build.
06
Give it project context
Grok Build reads AGENTS.md files out of the box. Add one at the root of your project with:
- What the project does
- The tech stack
- How to install, run, test, and build
- Code style rules
- Folders it must not touch
- Commands it must ask before running
07
Build in small steps
- Ask for one feature or fix at a time
- Run the tests after each change
- Try the result yourself
- Commit to Git when it works
- Start a new session with /new when you switch tasks
Small, tested, committed steps make every mistake easy to undo.
08
Use subagents and workflows
Grok Build can delegate larger tasks to subagents running in parallel, with Git worktree support so their changes stay separate.
- /workflow
- Runs a saved workflow
- /create-workflow
- Creates a new workflow
- /deep-research
- Runs a research workflow on a question
Review each subagent’s changes before you merge them.
09
Extend it with skills, plugins, and MCP
- Skills you can invoke appear as slash commands
- Plugins and marketplaces add packaged features
- Hooks run your own checks at set moments
- MCP servers connect it to other tools and data
Install extensions only from sources you trust. Each one can see what the agent sees.
10
Automate with headless mode
Use the -p flag to run Grok Build inside scripts and automations, with streaming JSON output if you need it.
- Generate release notes
- Triage new issues
- Fix lint errors
- Write tests for changed files
In automations, give it the least access it needs and review every change before it reaches production.
11
Use it in your editor
Through the Agent Client Protocol, Grok Build can run inside editors and agent apps that support ACP, so you can work with it outside the terminal.
12
Learn from the July 2026 privacy incident
On July 12, 2026, a security researcher showed that Grok Build version 0.2.93 uploaded entire Git repositories, including history and secrets, to xAI-controlled cloud storage. SpaceXAI disabled the upload on its servers around July 13 and open-sourced Grok Build the next day.
Protect yourself with any coding agent:
- Keep secrets in environment variables, never in code or Git history
- Rotate any key that was ever committed
- Use a separate test key for agent work
- Review your data and training settings
- Use your company’s approved tools for client code
13
Useful commands
- /new or /clear
- Start a fresh session
- /sessions
- Manage sessions
- /model <name>
- Switch model
- /memory
- Browse memories
- /settings
- Open settings
- /imagine <prompt>
- Generate images
- /feedback
- Report issues and ideas to the team
- /quit
- Exit
14
Master Grok Build prompt
Act as a senior engineer on this project. Read AGENTS.md first.
Task: [feature or bug].
Start in plan mode: list the files you will change, the approach, the tests you will add, and any risks. Wait for my approval.
Then build one step at a time. Run the tests after each step and show me the results.
Do not add dependencies, touch [protected folders], or run destructive commands without asking. Never print or commit secrets.
15
What not to do
- Use Always-approve on your main machine
- Let it run on repositories that contain secrets
- Merge code you have not read or tested
- Install plugins or MCP servers you do not trust
- Skip Git commits between steps
- Paste API keys into the chat
The golden rule
Do not ask Grok Build to “build everything.” Ask it to plan one change, approve the plan, and test every step.
- Install
- Plan
- AGENTS.md
- Build
- Test
- Commit
- Secure
Start with one small bug in a test project. Move to real work when you understand how it behaves.