Grok Build through PowerShell & the CLI

Grok Build · terminal

Grok Build through PowerShell & the CLI

Stable 1.0.46 (30 Sep 2026). Plan, Auto, and always-approve; workflows; memory; MCP; headless.

Grok Build is xAI’s terminal-native coding agent. On Windows you install it with a single PowerShell command. You work in a project directory; the agent reads your repo, proposes plans, edits files, runs tests, and shows clean diffs.

Current build

Stable channel is 1.0.46. Memory is generally available. Workflows are on by default. Grok 4.7 is the flagship; Grok 4.7 Fast is selectable inside Build (higher token rate, not the free tier, not the public API). Check grok --version and /release-notes after you install — alpha and enterprise channels move ahead of stable.

Install on Windows (PowerShell)

Open PowerShell (not cmd.exe) and run the official installer:

PowerShell installer
# Run in PowerShell (Windows)
irm https://x.ai/cli/install.ps1 | iex

# Verify
grok --version
Common Windows pitfall

Do not paste the Linux install line (curl … | bash) into PowerShell. That script is for macOS/Linux/WSL. Use the .ps1 installer on native Windows. WSL and PowerShell installs are separate — pick one and stay consistent.

Install on macOS / Linux / WSL

Unix installer
curl -fsSL https://x.ai/cli/install.sh | bash
grok --version

First run & auth

  1. cd into your project root.
  2. Run grok — interactive TUI opens.
  3. Complete OAuth in the browser (SuperGrok / SuperGrok Heavy / X Premium+ eligibility required depending on current rollout).
  4. For headless / CI: set GROK_CODE_XAI_API_KEY from console.x.ai.
Project session
cd C:\Users\you\projects\my-app
grok

# Headless one-shot (CI / scripts)
grok -p "add integration tests for the auth module"

Modes you will actually use

ModeHowWhen
NormalDefault / Shift+TabEveryday edits with per-file approval
PlanShift+Tab or /planNon-trivial features — design before code
Auto/auto or Shift+TabClassifier approves safe calls; dangerous ones still prompt
Always-approve/always-approve, Ctrl+O, or grok --always-approveSkips prompts. Deny rules and hooks still apply. Do not leave it on.
Headlessgrok -p "…"Scripts, CI, batch refactors

Plan mode (the professional default)

For complex work, start in plan mode. The agent writes a structured design document (background, constraints, approach options, risks, validation). You can approve, comment on steps, or rewrite before any file changes. After approval, every edit shows as a clean diff.

Example plan prompt
/plan Add a multi-tenant billing module with Stripe webhooks,
feature flags per org, and migration path from the legacy plan table.
Constraints: no downtime, TypeScript strict, existing Prisma schema.
Tip

Plan mode is where /design energy lives for architecture. For visual UI craft specifically, continue to the design chapter.

Subagents & worktrees

Large tasks fan out to specialized subagents in parallel. With worktree isolation, agents can edit in separate git worktrees so experiments do not clobber each other. Use this for:

  • Frontend + backend + tests in parallel
  • Exploring two implementation options side by side
  • Long research (docs scrape) while coding continues

Essential slash commands

CommandWhat it does
/plan [task]Plan doc; approve, comment, or quit before edits
/view-planReopen the current plan
/goalStart the goal planner
/design …Design skill — see the /design chapter
/effortReasoning effort on the active model
/context-windowPick a context size when the model offers one
/modelSwitch model; window choices, then effort
/autoToggle classifier auto-approval
/always-approveToggle always-approve (deny rules and hooks still win)
/create-workflowAuthor and save a workflow
/workflowLaunch, pause, resume, stop. Bare command lists runs
/workflowsWorkflow catalog
/deep-researchBackground research workflow
/loop [interval]Recurring prompt. Auto-expires (7 days) unless you stop it
/tasksBackground tasks, subagents, scheduled work
/imagineInline image
/imagine-videoInline video; Enter opens a player if the terminal cannot
/memoryBrowse memories. /remember, /dream, /flush
/compactCompact history. /context shows usage
/rewindRestore files and chat to an earlier turn (/undo)
/forkBranch this session into a peer agent
/themeGrokNight, GrokDay, TokyoNight, RosePineMoon, OscuraMidnight, or auto
/mcpsMCP tab. Token files are re-read on every request
/hooksHooks tab. /plugins, /skills, /marketplace are the same modal
/docsHow-to guides. /doctor checks terminal, tmux, clipboard
/btwSide question without derailing the turn
grok inspectWhat actually loaded: skills, hooks, MCP, AGENTS.md
grok -pHeadless one-shot for CI

Skills, plugins, hooks, MCP

Grok Build discovers instructions from your repo and home directory:

  • AGENTS.md / CLAUDE.md — project instructions (Claude-format skills are recognized for migration).
  • .grok/skills/ or ~/.grok/skills/ — reusable playbooks invoked as /skill-name.
  • Plugins via grok plugin install <name> --trust and /plugin.
  • Hooks for pre/post tool events (team policy, formatting).
  • MCP servers for external tools (email, issue trackers, etc.).
  • ACP for building your own orchestrators and bots.
Inspect what loaded
grok inspect
# Shows skills, plugins, hooks, MCP servers, instruction files

Recommended PowerShell daily workflow

  1. Open project: cd path\to\repo
  2. Start agent: grok
  3. For any multi-file feature: /plan … or cycle to Plan with Shift+Tab.
  4. For UI work: /design with screenshots/refs if you have them.
  5. Review diffs; keep auto-approve off until you trust the repo pattern.
  6. Commit yourself after a green test run — you stay the release manager.

Automation & headless

PowerShell headless example
$env:GROK_CODE_XAI_API_KEY = "xai-..."
grok -p "run the test suite, fix failures only, do not refactor unrelated code"

Headless mode is ideal for nightly refactors, dependency upgrades with auto-fix loops, and PR bots. Keep prompts narrow and assert exit criteria (“tests must pass”, “no package.json version bumps”).

Power move

Pair CLI Build with local git + your own deploy pipeline (Hostinger Cloud Startup, Vercel, etc.). The browser is for chat, connectors, and Automations. Grok Bot owns work that must keep running. Full matrix on Browser vs CLI vs Bot.