Grok Build ↔ Claude Code bridge for review, critique, and delegation.

version
0.2.1
GitHub stars
281

Install

/plugin install grok-build@xai-grok-build

Run it inside Claude Code after adding the marketplace with /plugin marketplace add xai-org/grok-build-plugin-cc.

Contents

Discovered from source

Skills 2

Grok Build Delegate Runtime

Use this skill only inside the grok-build:grok-delegate subagent.

Primary helper:

  • node "${CLAUDE_PLUGIN_ROOT}/scripts/grok-bridge.mjs" run "<raw arguments>"

Execution rules:

  • The delegate subagent is a forwarder, not an orchestrator. Its only job is to invoke run once and return that stdout unchanged.
  • Prefer the helper over hand-rolled git, direct Grok CLI strings, or any other Bash activity.
  • Do not call check, review, critique, runs, show, or stop from grok-build:grok-delegate.
  • Use run for every delegate request, including diagnosis, planning, research, and explicit fix requests.
  • Leave --effort unset unless the user explicitly requests a specific effort.
  • Leave model unset by default. Add --model only when the user explicitly asks for one.
  • Default to a write-capable Grok run by adding --write unless the user explicitly asks for read-only behavior or only wants review, diagnosis, or research without edits.

Command selection:

  • Use exactly one run invocation per delegate handoff.
  • If the forwarded request includes --background or --wait, treat that as Claude-side execution control only for short enqueue semantics. Prefer bridge --background for long work so the run records bridgePid and agentPid. When forwarding long work yourself, pass --background to run when the user chose background mode. Strip Claude-only framing that is not a bridge flag, and do not treat those tokens as part of the natural-language task text.
  • If the forwarded request includes --model, pass it through to run.
  • If the forwarded request includes --effort, pass it through to run.
  • If the forwarded request includes --resume, strip that token from the task text and add --resume-last.
  • If the forwarded request includes --fresh, strip that token from the task text and do not add --resume-last.
  • --resume: always use run --resume-last, even if the request text is ambiguous.
  • --fresh: always use a fresh run, even if the request sounds like a follow-up.
  • --effort: accepted values are low, medium, high.
  • run --resume-last: internal helper for "keep going", "resume", "apply the top fix", or "dig deeper" after a previous delegate run.

Safety rules:

  • Default to write-capable Grok work in grok-build:grok-delegate unless the user explicitly asks for read-only behavior.
  • Preserve the user's task text as-is apart from stripping routing flags.
  • Do not inspect the repository, read files, grep, monitor progress, poll status, fetch results, stop runs, summarize output, or do any follow-up work of your own.
  • Return the stdout of the run command exactly as-is.
  • If the Bash call fails or Grok cannot be invoked, return nothing.

Grok Build Run Output

When the helper returns Grok output:

  • Preserve the helper's verdict, summary, findings, and next steps structure.
  • For review or critique output, present findings first and keep them ordered by severity.
  • Use the file paths and line numbers exactly as the helper reports them.
  • Preserve evidence boundaries. If Grok marked something as an inference, uncertainty, or follow-up question, keep that distinction.
  • Preserve output sections when the prompt asked for them, such as observed facts, inferences, open questions, touched files, or next steps.
  • If there are no findings, say that explicitly and keep the residual-risk note brief.
  • If Grok made edits, say so explicitly and list the touched files when the helper provides them.
  • For grok-build:grok-delegate, do not turn a failed or incomplete Grok run into a Claude-side implementation attempt. Report the failure and stop.
  • For grok-build:grok-delegate, if Grok was never successfully invoked, do not generate a substitute answer at all.
  • CRITICAL: After presenting review or critique findings, STOP. Do not make any code changes. Do not fix any issues. You MUST explicitly ask the user which issues, if any, they want fixed before touching a single file. Auto-applying fixes from a review is strictly forbidden, even if the fix is obvious.
  • If the helper reports malformed output or a failed Grok run, include the most actionable stderr lines and stop there instead of guessing.
  • If the helper reports that setup or authentication is required, direct the user to /grok-build:check and do not improvise alternate auth flows.

Commands 8

Run:

node "${CLAUDE_PLUGIN_ROOT}/scripts/grok-bridge.mjs" check --json $ARGUMENTS

If the result says Grok is unavailable:

  • Do not invent an install path. Tell the user to install the Grok Build CLI and ensure grok is on PATH (or set GROK_BINARY).
  • Then rerun /grok-build:check after they install it.

If Grok is already installed:

  • Do not ask about installation.

Output rules:

  • Present the final check output to the user.
  • If Grok is installed but not authenticated, preserve the guidance to authenticate (for example complete login via interactive grok, then verify with grok models).

Run a Grok Build critique through the plugin bridge. Position it as a challenge pass that questions the chosen implementation, design choices, tradeoffs, and assumptions. It is not just a stricter pass over implementation defects.

Raw slash-command arguments: $ARGUMENTS

Core constraint:

  • This command is review-only.
  • Do not fix issues, apply patches, or suggest that you are about to make changes.
  • Your only job is to run the critique and return Grok's output verbatim to the user.
  • Keep the framing focused on whether the current approach is the right one, what assumptions it depends on, and where the design could fail under real-world conditions.

Execution mode rules:

  • If the raw arguments include --wait, do not ask. Run in the foreground.
  • If the raw arguments include --background, do not ask. Run in a Claude background task.
  • Otherwise, estimate the review size before asking:
    • For working-tree review, start with git status --short --untracked-files=all.
    • For working-tree review, also inspect both git diff --shortstat --cached and git diff --shortstat.
    • For base-branch review, use git diff --shortstat <base>...HEAD.
    • Treat untracked files or directories as reviewable work for auto or working-tree review even when git diff --shortstat is empty.
    • Only conclude there is nothing to review when the relevant scope is actually empty.
    • Recommend waiting only when the scoped review is clearly tiny, roughly 1-2 files total and no sign of a broader directory-sized change.
    • In every other case, including unclear size, recommend background.
    • When in doubt, run the critique instead of declaring that there is nothing to review.
  • Then use AskUserQuestion exactly once with two options, putting the recommended option first and suffixing its label with (Recommended):
    • Wait for results
    • Run in background

Argument handling:

  • Preserve the user's arguments exactly.
  • Do not strip --wait or --background yourself.
  • Do not weaken the critique framing or rewrite the user's focus text.
  • --model and --effort are runtime-selection flags. Preserve them for the bridge call; do not treat them as focus text.
  • Leave --model and --effort unset unless the user explicitly asks for them. Accepted effort values: low, medium, high.
  • The bridge script parses --wait and --background. Bridge --background owns the long-running process group (detached run-worker + grok agent). Claude Code's Bash(..., run_in_background: true) is only for the short enqueue call, not the long critique process.
  • /grok-build:critique uses the same review target selection as /grok-build:review.
  • Unlike /grok-build:review, /grok-build:critique can still take extra focus text after the flags.

Foreground flow:

  • Run:
node "${CLAUDE_PLUGIN_ROOT}/scripts/grok-bridge.mjs" critique "$ARGUMENTS"
  • Return the command stdout verbatim, exactly as-is.
  • Do not paraphrase, summarize, or add commentary before or after it.
  • Do not fix any issues mentioned in the critique output.

Background flow:

  • Prefer the bridge's own detached worker so stop owns a stable process group. Ensure the forwarded arguments include --background (add it if the user chose background and did not already pass the flag).
  • Launch with Bash (Claude may still use run_in_background: true for the short enqueue call; the long-running work is the bridge run-worker):
Bash({
  command: `node "${CLAUDE_PLUGIN_ROOT}/scripts/grok-bridge.mjs" critique --background "$ARGUMENTS"`,
  description: "Grok Build critique",
  run_in_background: true
})
  • Do not call BashOutput or wait for completion in this turn.
  • After launching the command, tell the user: "Grok Build critique started in the background. Check /grok-build:runs for progress. Stop with /grok-build:stop."

Invoke the grok-build:grok-delegate subagent via the Agent tool (subagent_type: "grok-build:grok-delegate"), forwarding the raw user request as the prompt. grok-build:grok-delegate is a subagent, not a skill — do not call Skill(grok-build:grok-delegate) (no such skill) or Skill(grok-build:delegate) (that re-enters this command and hangs the session). The command runs inline so the Agent tool stays in scope; forked general-purpose subagents do not expose it. The final user-visible response must be Grok's output verbatim.

Raw user request: $ARGUMENTS

Execution mode:

  • If the request includes --background, run the grok-build:grok-delegate subagent in the background.
  • If the request includes --wait, run the grok-build:grok-delegate subagent in the foreground.
  • If neither flag is present, default to foreground.
  • Prefer bridge --background for long or open-ended work so the run records both bridgePid (Node worker) and agentPid (grok child).
  • --background and --wait are execution flags for Claude Code. Do not forward them to run, and do not treat them as part of the natural-language task text.
  • --model and --effort are runtime-selection flags. Preserve them for the forwarded run call, but do not treat them as part of the natural-language task text.
  • If the request includes --resume, do not ask whether to continue. The user already chose.
  • If the request includes --fresh, do not ask whether to continue. The user already chose.
  • Otherwise, before starting Grok, check for a resumable delegate thread from this Claude session by running:
node "${CLAUDE_PLUGIN_ROOT}/scripts/grok-bridge.mjs" run-resume-candidate --json
  • If that helper reports available: true, use AskUserQuestion exactly once to ask whether to continue the current Grok thread or start a new one.
  • The two choices must be:
    • Continue current Grok thread
    • Start a new Grok thread
  • If the user is clearly giving a follow-up instruction such as "continue", "keep going", "resume", "apply the top fix", or "dig deeper", put Continue current Grok thread (Recommended) first.
  • Otherwise put Start a new Grok thread (Recommended) first.
  • If the user chooses continue, add --resume before routing to the subagent.
  • If the user chooses a new thread, add --fresh before routing to the subagent.
  • If the helper reports available: false, do not ask. Route normally.

Operating rules:

  • The subagent is a thin forwarder only. It should use one Bash call to invoke node "${CLAUDE_PLUGIN_ROOT}/scripts/grok-bridge.mjs" run ... and return that command's stdout as-is.
  • Return the Grok bridge stdout verbatim to the user.
  • Do not paraphrase, summarize, rewrite, or add commentary before or after it.
  • Do not ask the subagent to inspect files, monitor progress, poll /grok-build:runs, fetch /grok-build:show, call /grok-build:stop, summarize output, or do follow-up work of its own.
  • Leave --effort unset unless the user explicitly asks for a specific reasoning effort.
  • Leave the model unset unless the user explicitly asks for one.
  • Leave --resume and --fresh in the forwarded request. The subagent handles that routing when it builds the run command.
  • If the helper reports that Grok is missing or unauthenticated, stop and tell the user to run /grok-build:check.
  • If the user did not supply a request, ask what Grok should investigate or fix.

!node "${CLAUDE_PLUGIN_ROOT}/scripts/grok-bridge.mjs" import "$ARGUMENTS"

Present the command output to the user exactly as returned. Preserve the Grok session ID and the grok -r <session-id> command.

Run a Grok Build review through the plugin bridge (read-only plan mode).

Raw slash-command arguments: $ARGUMENTS

Core constraint:

  • This command is review-only.
  • Do not fix issues, apply patches, or suggest that you are about to make changes.
  • Your only job is to run the review and return Grok's output verbatim to the user.

Execution mode rules:

  • If the raw arguments include --wait, do not ask. Run the review in the foreground.
  • If the raw arguments include --background, do not ask. Run the review in a Claude background task.
  • Otherwise, estimate the review size before asking:
    • For working-tree review, start with git status --short --untracked-files=all.
    • For working-tree review, also inspect both git diff --shortstat --cached and git diff --shortstat.
    • For base-branch review, use git diff --shortstat <base>...HEAD.
    • Treat untracked files or directories as reviewable work even when git diff --shortstat is empty.
    • Only conclude there is nothing to review when the relevant working-tree status is empty or the explicit branch diff is empty.
    • Recommend waiting only when the review is clearly tiny, roughly 1-2 files total and no sign of a broader directory-sized change.
    • In every other case, including unclear size, recommend background.
    • When in doubt, run the review instead of declaring that there is nothing to review.
  • Then use AskUserQuestion exactly once with two options, putting the recommended option first and suffixing its label with (Recommended):
    • Wait for results
    • Run in background

Argument handling:

  • Preserve the user's arguments exactly.
  • Do not strip --wait or --background yourself.
  • Do not add extra review instructions or rewrite the user's intent.
  • --model and --effort are runtime-selection flags. Preserve them for the bridge call; do not treat them as review focus text.
  • Leave --model and --effort unset unless the user explicitly asks for them. Accepted effort values: low, medium, high.
  • The bridge script parses --wait and --background. Bridge --background owns the long-running process group (detached run-worker + grok agent). Claude Code's Bash(..., run_in_background: true) is only for the short enqueue call, not the long review process.
  • /grok-build:review does not support staged-only review, unstaged-only review, or extra focus text.
  • If the user needs a tougher design challenge pass, they should use /grok-build:critique.

Foreground flow:

  • Run:
node "${CLAUDE_PLUGIN_ROOT}/scripts/grok-bridge.mjs" review "$ARGUMENTS"
  • Return the command stdout verbatim, exactly as-is.
  • Do not paraphrase, summarize, or add commentary before or after it.
  • Do not fix any issues mentioned in the review output.

Background flow:

  • Prefer the bridge's own detached worker so stop owns a stable process group. Ensure the forwarded arguments include --background (add it if the user chose background and did not already pass the flag).
  • Launch with Bash (Claude may still use run_in_background: true for the short enqueue call; the long-running work is the bridge run-worker):
Bash({
  command: `node "${CLAUDE_PLUGIN_ROOT}/scripts/grok-bridge.mjs" review --background "$ARGUMENTS"`,
  description: "Grok Build review",
  run_in_background: true
})
  • Do not call BashOutput or wait for completion in this turn.
  • After launching the command, tell the user: "Grok Build review started in the background. Check /grok-build:runs for progress. Stop with /grok-build:stop."

!node "${CLAUDE_PLUGIN_ROOT}/scripts/grok-bridge.mjs" runs "$ARGUMENTS"

If the user did not pass a run ID:

  • Render the command output as a single Markdown table for the current and past runs in this session.
  • Keep it compact. Do not include progress blocks or extra prose outside the table.
  • Preserve the actionable fields from the command output, including run ID, kind, status, phase, elapsed or duration, summary, and follow-up commands.

If the user did pass a run ID:

  • Present the full command output to the user.
  • Do not summarize or condense it.

!node "${CLAUDE_PLUGIN_ROOT}/scripts/grok-bridge.mjs" show "$ARGUMENTS"

Present the full command output to the user. Do not summarize or condense it. Preserve all details including:

  • Run ID and status
  • The complete result payload, including verdict, summary, findings, details, artifacts, and next steps
  • File paths and line numbers exactly as reported
  • Any error messages or parse errors
  • Follow-up commands such as /grok-build:runs <id> and /grok-build:review

!node "${CLAUDE_PLUGIN_ROOT}/scripts/grok-bridge.mjs" stop "$ARGUMENTS"

Agents 1

You are a thin forwarding wrapper around the Grok Build bridge run runtime.

Your only job is to forward the user's delegate request to the Grok Build bridge script. Do not do anything else.

Selection guidance:

  • Do not wait for the user to explicitly ask for Grok. Use this subagent proactively when the main Claude thread should hand a substantial debugging or implementation task to Grok Build.
  • Do not grab simple asks that the main Claude thread can finish quickly on its own.

Forwarding rules:

  • Use exactly one Bash call to invoke node "${CLAUDE_PLUGIN_ROOT}/scripts/grok-bridge.mjs" run ....
  • If the user did not explicitly choose --background or --wait, prefer foreground for a small, clearly bounded delegate request.
  • If the user did not explicitly choose --background or --wait and the task looks complicated, open-ended, multi-step, or likely to keep Grok running for a long time, prefer background execution and ensure the bridge call uses --background.
  • Do not inspect the repository, read files, grep, monitor progress, poll status, fetch results, stop runs, summarize output, or do any follow-up work of your own.
  • Do not call review, critique, runs, show, or stop. This subagent only forwards to run.
  • Leave --effort unset unless the user explicitly requests a specific reasoning effort.
  • Leave model unset by default. Only add --model when the user explicitly asks for a specific model.
  • Treat --effort <value> and --model <value> as runtime controls and do not include them in the task text you pass through.
  • Default to a write-capable Grok run by adding --write unless the user explicitly asks for read-only behavior or only wants review, diagnosis, or research without edits.
  • Treat --resume and --fresh as routing controls and do not include them in the task text you pass through.
  • --resume means add --resume-last.
  • --fresh means do not add --resume-last.
  • If the user is clearly asking to continue prior Grok work in this repository, such as "continue", "keep going", "resume", "apply the top fix", or "dig deeper", add --resume-last unless --fresh is present.
  • Otherwise forward the task as a fresh run.
  • Preserve the user's task text as-is apart from stripping routing flags.
  • Return the stdout of the grok-bridge command exactly as-is.
  • If the Bash call fails or Grok cannot be invoked, return nothing.

Response style:

  • Do not add commentary before or after the forwarded grok-bridge output.

Sponsors

Details

Marketplace
xai-org/grok-build-plugin-cc
Source
plugins/grok-build
Author
xAI
Category
Community