Use the local grok CLI from inside Claude Code for code reviews or to delegate tasks to grok.
This plugin mirrors the command surface of the Codex plugin (openai/codex-plugin-cc) but is built on grok's native headless features, so it stays thin: no background broker, no app-server runtime, just grok plus a small companion script that tracks jobs across turns.
/grok:reviewfor a read-only implementation review of your local git state/grok:adversarial-reviewfor a steerable challenge review with optional focus text/grok:rescueto hand grok a write-capable fix or an investigation/grok:status,/grok:result,/grok:cancelto manage background jobs/grok:setupto check that grok is installed and authenticated
- The grok CLI, installed and logged in (
grok login). The plugin shells out to your localgrok; nothing runs in the cloud on the plugin's behalf. - Node.js 18.18 or later (the companion script is plain ESM, no dependencies).
Add the marketplace in Claude Code from GitHub:
/plugin marketplace add kwunlokng/grok-plugin-ccOr from a local checkout:
/plugin marketplace add ~/grok-plugin-ccInstall the plugin:
/plugin install grok@grok-toolsRestart Claude Code so the commands load, then run /grok:setup to confirm
grok is ready.
Read-only review of your current git state. Working tree by default, or a
branch diff with --base <ref>.
/grok:review # asks wait vs background based on size
/grok:review --wait # run in the foreground
/grok:review --background # run detached, check /grok:status
/grok:review --base main # review this branch against maingrok returns a structured verdict (approve or needs-attention), a summary,
findings with file and line references, severity, confidence, and a concrete
fix per finding. The command returns grok's output verbatim and never edits
your code.
Same target selection as /grok:review, but framed as a challenge to the
approach: what assumptions it depends on and where the design fails under
stress. Takes optional focus text after the flags.
/grok:adversarial-review --wait
/grok:adversarial-review --base main focus on the retry and idempotency pathsDelegate a task to grok. Write-capable by default (grok can edit files), or
investigation-only with --read-only.
/grok:rescue fix the failing auth test in src/auth
/grok:rescue --read-only why does the importer drop the last row?
/grok:rescue --resume # continue the most recent grok rescue in this repo
/grok:rescue --model grok-4 # pin a modelShow active and recent grok jobs for this repository as a compact table. Pass a
job id for the full record, or --all for every repository.
Show the stored final output for a finished job. Pass a job id, or omit it for
the most recent job in this repository. Includes the grok session id, so you
can pull the full transcript with grok export <session>.
Cancel a running background job (kills the tracked grok process). Pass a job id, or omit it to cancel the most recent running job in this repository.
Check that grok is installed and authenticated. If not, it tells you to run
grok login.
/grok:review --waitRead the findings, fix what matters, review again.
/grok:rescue the checkout total is off by a cent on multi-item carts, find and fix itgrok investigates and edits in place; the output comes back verbatim.
/grok:review --background
# ...keep working...
/grok:status
/grok:result <id>Everything grok can do on its own stays native:
- Reviews call
grok -p "<prompt>" --output-format json, with the review schema and the git diff embedded in the prompt. Reviews run with--disallowed-tools Write,Edit,NotebookEdit,Bash, so they cannot modify your code. - Rescue calls
grok -p "<task>" --always-approvefor a write-capable run, and--resumecontinues the most recent rescue session for the repo. - Each job is assigned a known grok session id (
--session-id), so results and transcripts (grok export <session>) are addressable.
The only thing grok cannot do by itself is track jobs across separate Claude
Code turns. That is the entire job of
plugins/grok/scripts/grok-companion.mjs:
a thin wrapper that runs grok, captures its output, and maintains a small job
log at ~/.grok/claude-jobs/ (outside any repository, so runtime state is
never committed). /grok:status, /grok:result, and /grok:cancel read that
log.
Note: grok's --json-schema flag does not hard-constrain output, so the
companion embeds the schema in the prompt and extracts and validates the JSON
itself (structured output first, then a fenced or bare JSON block from the
model's text).
npm test # node --test over tests/*.test.mjs
npm run selftest # run the companion's built-in job-log + parser checksTo iterate after installing: edit the plugin under plugins/grok/, then
claude plugin update grok@grok-tools. Claude Code runs the installed copy in
its plugin cache, not this working tree, until you update.
MIT. See LICENSE.