Use Grok Build from inside Claude Code for code reviews or to delegate tasks to Grok.
This plugin is for Claude Code users who want an easy way to start using Grok Build from the workflow they already have.
/grok:reviewfor a normal read-only Grok review/grok:adversarial-reviewfor a steerable challenge review/grok:rescue,/grok:transfer,/grok:status,/grok:result, and/grok:cancelto delegate work, hand off sessions, and manage background jobs
- Grok account (browser login) or
XAI_API_KEY.- Usage follows your Grok / xAI plan limits.
- Node.js 18.18 or later
- Grok Build CLI (
grok) installed on your PATH
Add the marketplace in Claude Code (when published), or install from a local checkout:
/plugin marketplace add <owner>/grok-plugin-ccInstall the plugin:
/plugin install grok@xai-grokReload plugins:
/reload-pluginsThen run:
/grok:setup/grok:setup will tell you whether Grok is ready. If Grok is missing, it can offer to install the CLI for you.
If you prefer to install Grok yourself:
curl -fsSL https://x.ai/cli/install.sh | bashIf Grok is installed but not logged in yet, run:
!grok loginOr set an API key:
export XAI_API_KEY="xai-..."After install, you should see:
- the slash commands listed below
- the
grok:grok-rescuesubagent in/agents
One simple first run is:
/grok:review --background
/grok:status
/grok:resultEvery command below can be typed as a slash command, and Claude can also reach for it on its own. Asking "have Grok review this" or "get Grok to fix the failing test" routes to the right command without you naming it.
Runs a normal Grok review on your current work.
Note
Code review especially for multi-file changes might take a while. It's generally recommended to run it in the background.
Use it when you want:
- a review of your current uncommitted changes
- a review of your branch compared to a base branch like
main
Use --base <ref> for branch review. It also supports --wait and --background. It is not steerable and does not take custom focus text. Use /grok:adversarial-review when you want to challenge a specific decision or risk area.
Examples:
/grok:review
/grok:review --base main
/grok:review --backgroundThis command is read-only and will not perform any changes. When run in the background you can use /grok:status to check on the progress and /grok:cancel to cancel the ongoing task.
Runs a steerable review that questions the chosen implementation and design.
It can be used to pressure-test assumptions, tradeoffs, failure modes, and whether a different approach would have been safer or simpler.
It uses the same review target selection as /grok:review, including --base <ref> for branch review.
It also supports --wait and --background. Unlike /grok:review, it can take extra focus text after the flags.
Examples:
/grok:adversarial-review
/grok:adversarial-review --base main challenge whether this was the right caching and retry design
/grok:adversarial-review --background look for race conditions and question the chosen approachThis command is read-only. It does not fix code.
Hands a task to Grok through the grok:grok-rescue subagent.
Use it when you want Grok to:
- investigate a bug
- try a fix
- continue a previous Grok task
- take a faster or cheaper pass with a smaller model
Note
Depending on the task and the model you choose these tasks might take a long time and it's generally recommended to force the task to be in the background or move the agent to the background.
It supports --background, --wait, --resume, and --fresh. If you omit --resume and --fresh, the plugin can offer to continue the latest rescue session for this repo.
Examples:
/grok:rescue investigate why the tests started failing
/grok:rescue fix the failing test with the smallest safe patch
/grok:rescue --resume apply the top fix from the last run
/grok:rescue --model grok-4.5 --effort medium investigate the flaky integration test
/grok:rescue --model build fix the issue quickly
/grok:rescue --background investigate the regressionYou can also just ask for a task to be delegated to Grok:
Ask Grok to redesign the database connection to be more resilient.
Notes:
- if you do not pass
--modelor--effort, Grok chooses its own defaults. - if you say
buildorfast, the plugin maps that togrok-4.5 - follow-up rescue requests can continue the latest Grok task in the repo
Creates a Grok session seeded from the current Claude Code session and prints a grok --resume <session-id> command.
Use it when you started a debugging or implementation conversation in Claude Code and want to continue that context in Grok.
Examples:
/grok:transfer
/grok:transfer --source ~/.claude/projects/-Users-me-repo/<session-id>.jsonlThe plugin's existing SessionStart hook supplies the current transcript path automatically; --source is available as a manual override. Transfer seeds context into a new Grok headless session (Grok does not natively import Claude JSONL). The source must be under ~/.claude/projects.
Shows running and recent Grok jobs for the current repository.
Examples:
/grok:status
/grok:status task-abc123Shows the final stored Grok output for a finished job.
When available, it also includes the Grok session ID so you can reopen that run with grok --resume <session-id>.
Examples:
/grok:result
/grok:result task-abc123Cancels an active background Grok job.
Examples:
/grok:cancel
/grok:cancel task-abc123Checks whether Grok is installed and authenticated. If Grok is missing, it can offer to install the CLI for you.
You can also use /grok:setup to manage the optional review gate.
/grok:setup --enable-review-gate
/grok:setup --disable-review-gateWhen the review gate is enabled, the plugin uses a Stop hook to run a targeted Grok review based on Claude's response. If that review finds issues, the stop is blocked so Claude can address them first.
Warning
The review gate can create a long-running Claude/Grok loop and may drain usage limits quickly. Only enable it when you plan to actively monitor the session.
/grok:review/grok:rescue investigate why the build is failing in CI/grok:adversarial-review --background
/grok:rescue --background investigate the flaky testThen check in with:
/grok:status
/grok:resultThe plugin wraps the Grok Build headless CLI (grok -p). It uses the global grok binary installed in your environment and applies the same configuration as interactive Grok.
If you want to change the default model that gets used by the plugin, define that in your user-level or project-level config. For example, to prefer grok-4.5 for a project, add the following to ~/.grok/config.toml or project config:
[models]
default = "grok-4.5"Your configuration will be picked up based on:
- user-level config in
~/.grok/config.toml - project-level overrides discovered by Grok for the working directory
Delegated tasks and any stop gate run can also be resumed inside Grok by running grok --resume with the session ID from /grok:result or /grok:status.
If you are already signed into Grok on this machine, that account should work immediately here too. This plugin uses your local Grok CLI authentication.
If you only use Claude Code today and have not used Grok yet, sign in with !grok login or set XAI_API_KEY. Run /grok:setup to check readiness.
No. This plugin delegates through your local Grok Build CLI on the same machine using headless mode (grok -p).
That means:
- it uses the same Grok install you would use directly
- it uses the same local authentication state
- it uses the same repository checkout and machine-local environment
Yes. If you already use Grok, the plugin picks up the same configuration.
Yes. Set XAI_API_KEY or use grok login. The plugin inherits that auth for headless runs.
This project is licensed under the Apache License, Version 2.0.
It is a derivative work of OpenAI's Codex plugin for Claude Code, which is also licensed under Apache License 2.0. The original copyright notices are retained in NOTICE. This repository's modifications retarget that plugin to the Grok Build CLI; see NOTICE for a summary of those changes.
OpenAI, Codex, and related marks are trademarks of their respective owners. This project is not affiliated with or endorsed by OpenAI.