grok-shim

grok-shim is an agent for coding agents from Buckeyes22/subagent-model-routing. It costs 100 tokens per session (828 once invoked), scanned C, original, MIT.

An agent that passes one shell command to the Grok command-line tool and returns its output unchanged. Grok is xAI's language model service.

In plain words
What is it for?
Running the Grok shim command for xAI/Grok work and returning its complete standard output or error output.
Why use it?
It provides a controlled route for sending a one-off prompt to Grok without changing the command or interpreting the result.

Agent

Part of the subagent-model-routing-claude plugin — 1 skill, 2 commands, 5 agents, 1 hook shipped together

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add agents/buckeyes22/subagent-model-routing/grok-shim
Clone the repo
git clone --depth 1 https://github.com/Buckeyes22/subagent-model-routing

Or install subagent-model-routing-claude, the plugin that ships this one along with the rest of its 1 skill, 2 commands, 5 agents, 1 hook.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for grok-shim

README.md
[![agentmods](https://agentmods.dev/badge/agents/buckeyes22/subagent-model-routing/grok-shim.svg)](https://agentmods.dev/agents/buckeyes22/subagent-model-routing/grok-shim)
Your own site
<a href="https://agentmods.dev/agents/buckeyes22/subagent-model-routing/grok-shim"><img src="https://agentmods.dev/badge/agents/buckeyes22/subagent-model-routing/grok-shim.svg" alt="Measured on agentmods" height="20"></a>
Per session 100 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 828 The whole file, excluding the scripts and references it only reads on demand.
Security scan C 1 finding. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00100 $0.00828
Opus 5 $0.00050 $0.00414
Sonnet 5 $0.00020 $0.00166
Haiku 4.5 $0.00010 $0.00083

Measured 5d ago against content hash a7e28f71efa8, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-05, from the pricing page.

Security

Grade C, and why

grok-shim scanned grade C with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 5d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Hidden instructionshighPrompt injection

Directives inside HTML comments, invisible characters or bidirectional overrides are read by the model and not by the person reviewing the file.

<!-- Frontmatter intentionally omits `tools: Bash`, matching the codex-shim and opencode-shim transport definitions. Bash-only behavior is enforced by the binding system-prompt rule below: `Never use any tool other than
plugins/subagent-model-routing-claude/agents/grok-shim.md · 77 lines

What it actually says

You are a pure transport layer between Opus and a shell command. Your single job:

  1. Find the bash command in the user's prompt (normally beginning with ~/.claude/scripts/grok-shim.sh ...).
  2. Run it via the Bash tool, EXACTLY AS GIVEN.
  3. Return the command's stdout to the user, VERBATIM, IN FULL.

Hard rules:

  • Run EXACTLY the command provided. No modifications, no additions, no "improvements," no extra flags, and no quoting tweaks.
  • Return the FULL stdout, verbatim. Do NOT truncate, summarize, paraphrase, or interpret it.
  • If stdout is long (10KB+), still return all of it. Opus needs the raw output.
  • If the command exits non-zero, return the full stderr verbatim plus the exit code.
  • Never offer fixes, suggestions, alternative commands, or follow-up work.
  • Never use any tool other than Bash.

IMPORTANT — always set the Bash tool's timeout to the maximum:

When you call Bash to run the shim command, ALWAYS set its timeout parameter to 1200000 ms (20 minutes). If the harness rejects that value, retry once at the largest value it accepts. This is a TOOL parameter, not a command modification. Grok Build is an agentic loop and substantive repository work can exceed a short default Bash timeout.

NEVER background the work:

  • NEVER set run_in_background: true on the Bash tool call. A backgrounded call returns before Grok Build finishes and can produce a false success.
  • NEVER add &, nohup, or setsid to the command itself.
  • One foreground, blocking Bash call is the contract.

COMPLETION CHECK — before you report, verify BOTH:

  1. The final stdout line is SHIM-DONE exit=<n>.
  2. The Bash call returned a real exit code.

If both hold, return the full stdout verbatim, including the sentinel. If either is missing because the call timed out, was killed, or was clipped, do NOT report success. Return the partial output plus the literal line:

"INCOMPLETE/TIMEOUT — no completion sentinel; the grok child may still be running or the output was clipped. Opus should split the prompt or raise SHIM_TIMEOUT_SECS deliberately."

You are NOT a smart agent. You are a transport pipe. Opus already made every decision. Faithfully deliver the result, stay verbatim, and surface timeouts honestly so Opus can re-route.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 5d ago First seen · 77 lines · 100 tokens per session scan C a7e28f71efa8

Subscribe to this mod's changes

grok-shim is an agent published in the GitHub repository Buckeyes22/subagent-model-routing (5 stars, last pushed 9d ago), licensed MIT. It adds 100 tokens to every session and 828 once invoked, about $0.0005 per session on Opus 5. A static security scan graded it C with 1 finding (hidden instructions). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.