codex-shim

codex-shim is an agent for Claude Code from Buckeyes22/subagent-model-routing. It costs 175 tokens per session (1,232 once invoked), scanned D, original, MIT.

A transport agent that runs one shell command through a Codex command-line script and returns the command's output unchanged. It is intended to be the approved path for sending a request to a GPT or Codex model.

In plain words
What is it for?
Use it when another agent needs to run a single Codex command through the configured shell script. The available model and optional overrides come from the local Codex configuration.
Why use it?
It keeps model dispatch limited to one defined route and preserves the command output for the calling assistant to inspect. It does not modify or interpret the command.

Agent for Claude Code

Written for Claude Code: shipped in a Claude Code plugin. Also seen: model in frontmatter; reads .claude/ paths; mentions subagents.

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

Good fit Use it when another agent needs to run a single Codex command through the configured shell script. The available model and optional overrides come from the local Codex configuration.

Compare 6 agents from other repositories ↓
Install with agentmods
npx agentmods add agents/buckeyes22/subagent-model-routing/codex-shim
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.

Clone the repo
git clone --depth 1 https://github.com/Buckeyes22/subagent-model-routing

Made for: Claude Code.

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 codex-shim

README.md
[![agentmods](https://agentmods.dev/badge/agents/buckeyes22/subagent-model-routing/codex-shim/github.svg)](https://agentmods.dev/agents/buckeyes22/subagent-model-routing/codex-shim)
Your own site
<a href="https://agentmods.dev/agents/buckeyes22/subagent-model-routing/codex-shim"><img src="https://agentmods.dev/badge/agents/buckeyes22/subagent-model-routing/codex-shim/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for codex-shim

Your own site · 80×15
<a href="https://agentmods.dev/agents/buckeyes22/subagent-model-routing/codex-shim"><img src="https://agentmods.dev/badge/agents/buckeyes22/subagent-model-routing/codex-shim.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 175 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,232 The whole file, excluding the scripts and references it only reads on demand.
Security scan D 2 findings. A grade says what 26 rules found in the file — not that it is safe.
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.00175 $0.01232
Opus 5.5 $0.00070 $0.00493
Sonnet 5.5 $0.00035 $0.00246
Haiku 4.5 $0.00017 $0.00123

Measured 2mo ago against content hash 69586d2b3a30, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade D, and why

codex-shim scanned grade D with 2 findings 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 2mo 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` so that opencode (which also reads this file when it is copied into ~/.opencode/agents/) does not reject the schema (opencode wants `tools: {...object...}`, Claude Code

Reads agent configuration directoriesmediumAgent snooping

.claude/, .codex/, .gemini/ hold keys, settings and other credentials a mod has no legitimate need for.

one-shot prompt to the codex CLI (model default is whatever ~/.codex/config.toml
plugins/subagent-model-routing-claude/agents/codex-shim.md · 94 lines

How it starts

The opening of the file, as written. The whole thing — 94 lines — stays where its author put it; the contents beside it link to each section on GitHub.

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 (the shim invocation, usually starting with ~/.claude/scripts/codex-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, no quoting tweaks.
  • Return the FULL stdout, verbatim. Do NOT truncate, summarize, paraphrase, or interpret.
  • 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 the Bash tool to run the shim command, ALWAYS pass the tool's timeout parameter set to 1200000 (ms = 20 minutes) — the configured BASH_MAX_TIMEOUT_MS in this environment. If the harness rejects that value, retry once at the largest value it accepts. This is a TOOL parameter, not a change to the command. Without it the Bash tool falls back to a shorter default, and codex is an agentic loop whose deep reasoning / multi-file work routinely exceeds it — the run then gets cut off mid-flight, reported "completed" with NOTHING written.

NEVER background the work:

  • NEVER set run_in_background: true on the Bash tool call. A backgrounded call returns immediately while the CLI child keeps running detached — you would then report success on a job that has not finished. This is the known false-success failure mode.
  • 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 the shim sentinel SHIM-DONE exit=<n> (fallback if the sentinel is absent on an old shim: codex's own terminal event turn.completed).
  2. The Bash call returned a real exit code.

If both hold, return the full stdout verbatim (sentinel included). If either is missing — timeout, killed call, sentinel absent — do NOT report success. Return whatever partial output exists plus the literal line: "INCOMPLETE/TIMEOUT — no completion sentinel; the codex child may still be running or the output was clipped. Opus should split the prompt or raise SHIM_TIMEOUT_SECS deliberately."

Read the full file on GitHub · 94 lines

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. 2mo ago First seen · 94 lines · 175 tokens per session scan D 69586d2b3a30

Subscribe to this mod's changes

codex-shim is an agent published in the GitHub repository Buckeyes22/subagent-model-routing (5 stars, last pushed 2mo ago), licensed MIT. It adds 175 tokens to every session and 1,232 once invoked, about $0.0007 per session on Opus 5.5. A static security scan graded it D with 2 findings (hidden instructions, reads agent configuration directories). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.