grok-plugin-cc
Bring xAI's Grok Build CLI (grok) into Claude Code as a set of /grok:* slash commands plus a Grok-backed MCP server — for an outside-model second opinion and first-class live web/X search mid-task.
Unofficial. Not affiliated with or endorsed by xAI. "Grok" and "Grok Build" are xAI's.
License: MIT.
What it is
A personal, fully-local Claude Code plugin. It wraps headless grok -p --output-format json (no ACP, no daemon) and renders Grok's answers inline. Everything is plain .mjs with zero runtime dependencies and no build step, so it's trivial to fork and hand-edit.
/grok:ask — one-shot question to Grok, with live web/X search on by default (the headline feature).
/grok:review — read-only review of your working tree or a branch diff, as an outside model.
/grok:status · /grok:result · /grok:cancel — lightweight control for background jobs.
/grok:setup — doctor: checks the CLI, auth, and resolved config.
- MCP tools —
grok_search and grok_ask, so Claude can consult Grok (especially live search) on its own mid-task.
Install
1. Install Grok Build and authenticate:
curl -fsSL https://x.ai/cli/install.sh | bash
Then authenticate — either set XAI_API_KEY, or sign in (SuperGrok / X Premium+). The plugin needs Node 18+ (developed against Node 22).
2. Install the plugin from GitHub:
/plugin marketplace add trevoraspencer/grok-plugin-cc
/plugin install grok@grok-plugin-cc
Or, to fork and hand-edit, clone first and add the local path:
git clone https://github.com/trevoraspencer/grok-plugin-cc
/plugin marketplace add ./grok-plugin-cc
/plugin install grok@grok-plugin-cc
For a one-session try without installing (from a local clone):
claude --plugin-dir ./grok-plugin-cc
(There is no bare /plugin install <path> — use the marketplace add + install pair, or the one-session --plugin-dir flag.)
Run /grok:setup to confirm everything is wired up.
Command reference
| Command | What it does | Key flags |
|---|
/grok:ask <question> | Ask Grok one-shot; live search follows config and defaults on | --model <slug>, --no-search, --search, --max-turns <n>, --effort <level>, --reasoning-effort <level>, --thought, --background, --print-args |
/grok:review | Read-only review of the diff; live search defaults off | --model <slug>, --base <ref>, --scope auto|working-tree|branch, --search, --thought, --background, --print-args |
/grok:status [job-id] | List background jobs, or one job's detail | — |
/grok:result <job-id> | Print a finished job's captured output | — |
/grok:cancel <job-id> | Cancel a running background job | — |
/grok:setup | Diagnose CLI, auth, and resolved config | --json |
/grok:review is strictly read-only — it never edits files or applies patches.
For ask, --max-turns overrides the configured max_turns for that call. --effort and --reasoning-effort are forwarded to the Grok CLI; whether they affect a response depends on the selected model. For both ask and review, --thought appends Grok's returned reasoning in a collapsed details block, and --print-args prints the exact CLI argv without invoking Grok. --print-args takes precedence over --background.
Review scope (--scope, default auto):
auto — the working tree if it has uncommitted changes; otherwise a branch diff against the detected default branch (main / master / trunk / origin/HEAD).
working-tree — always the uncommitted changes (staged + unstaged + untracked).
branch — a branch diff; pass --base <ref> to pick the base, otherwise the default branch is detected.
An empty diff prints Nothing to review. and exits 0. A --base ref that doesn't exist — or --scope branch when no base can be detected — is reported as an error (exit 1) rather than a misleading "nothing to review". Running the command outside a git repository is likewise an error (exit 1).
Working-tree review includes staged, unstaged, and untracked files. Untracked files larger than 24 KiB and binary files are represented by a skip marker, and the diff payload inside the review prompt is capped at 100 Ki UTF-16 code units. Review does not use live search unless --search is passed.
Background jobs
ask and review can run through Claude Code's background Bash support. The dispatcher writes a transient JSON record and captured output under the OS temporary directory, records both the dispatcher and Grok child PIDs, and exposes them through status, result, and cancel. Dead dispatcher processes are reconciled to failed when read, and cancellation terminates both recorded processes. This is local process plumbing, not a durable database or a kept project artifact.
MCP tools