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.
npx agentmods add agents/buckeyes22/subagent-model-routing/opencode-shimgit clone --depth 1 https://github.com/Buckeyes22/subagent-model-routingWhat 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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00102 | $0.01162 |
| Opus 5 | $0.00051 | $0.00581 |
| Sonnet 5 | $0.00020 | $0.00232 |
| Haiku 4.5 | $0.00010 | $0.00116 |
Grade C, and why
opencode-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 2d 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 How it starts
The opening of the file, as written. The whole thing — 92 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:
- Find the bash command in the user's prompt (the shim invocation, usually starting
with
~/.claude/scripts/opencode-shim.sh ...). - Run it via the Bash tool, EXACTLY AS GIVEN.
- 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 opencode 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: trueon 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, orsetsidto the command itself. One foreground, blocking Bash call is the contract.
COMPLETION CHECK — before you report, Verify BOTH:
- The final stdout line is the shim sentinel
SHIM-DONE exit=<n>(fallback if the sentinel is absent on an old shim: opencode's finalassistantmessage /step_finishafter the lasttextpart). - 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 opencode child may still be running or the output was clipped. Opus should split the prompt or raise SHIM_TIMEOUT_SECS deliberately."
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.
- 2d ago First seen · 92 lines · 102 tokens per session scan C e17bd773cc18
opencode-shim is an agent published in the GitHub repository Buckeyes22/subagent-model-routing (5 stars, last pushed 6d ago), licensed MIT. It adds 102 tokens to every session and 1,162 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.
Other agents, from other repositories
orchestrator
Project coordinator that analyzes requests, discovers tech stacks, and orchestrates focused specialists in parallel. Use for multi-domain tasks.
plan
Read-only analysis and planning agent. Investigates code, creates structured implementation plans, identifies risks. Cannot modify files.
python-pro
Expert Python 3.12+ developer with mastery of uv, ruff, Pydantic v2, and modern typing. Framework-agnostic.
review-lead
Multi-lens code review coordinator. Analyzes diffs, routes to read-only domain reviewers in parallel, synthesizes findings.
ops-specialist
Linux systems, systemd services, deployment, logs, and infrastructure specialist.
_project-dev-template
TODO: Your project domain expert — knows architecture, conventions, and key files.