shim-cli: Instructions file for Claude Code

AGENTS.md

shim-cli AGENTS.md is an instructions file for Claude Code, Codex, OpenCode from GetSHIM/shim-cli. It costs 2,389 tokens per session, scanned A, original, Apache-2.0.

A set of project-specific instructions for the shim-cli repository. It describes which documents to read, how to make changes, and safety rules for its local hook and network-forwarding command.

In plain words
What is it for?
Use it to guide changes to shim-cli's detector, hooks, installer, watch command, and related tests while following the project's privacy and safety checks.
Why use it?
It gives a coding agent the repository's boundaries before it edits code, including rules about network access, imports, and handling prompt-derived data. The input does not describe a general-purpose add-on beyond these instructions.

Instructions file for Claude CodeCodexOpenCode

Written for Claude Code and Codex and OpenCode: PreToolUse hook event, but also the file is AGENTS.md. Also seen: names the NotebookEdit tool; mentions Claude Code; mentions Codex.

This is GetSHIM/shim-cli's own configuration. It tells Claude Code, Codex and OpenCode how to work on shim-cli itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything shim-cli configures →

Runs only inside a plugin — its command needs a path that Claude Code sets for a plugin’s own hooks and for nothing else, and the catalogue could not identify which plugin ships it.

Reuse

Borrowing it

Nothing to install: this file belongs to GetSHIM/shim-cli. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/GetSHIM/shim-cli/main/AGENTS.md
Clone the repo
git clone --depth 1 https://github.com/GetSHIM/shim-cli

Made for: Claude Code, Codex, OpenCode.

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 shim-cli AGENTS.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/getshim/shim-cli/agents-md/github.svg)](https://agentmods.dev/instructions/getshim/shim-cli/agents-md)
Your own site
<a href="https://agentmods.dev/instructions/getshim/shim-cli/agents-md"><img src="https://agentmods.dev/badge/instructions/getshim/shim-cli/agents-md/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 shim-cli AGENTS.md

Your own site · 80×15
<a href="https://agentmods.dev/instructions/getshim/shim-cli/agents-md"><img src="https://agentmods.dev/badge/instructions/getshim/shim-cli/agents-md.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 2,389 This file is loaded in full into every session.
When invoked 2,389 The same file — it is already loaded in full.
Security scan A 0 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.02389 $0.02389
Opus 5.5 $0.00956 $0.00956
Sonnet 5.5 $0.00478 $0.00478
Haiku 4.5 $0.00239 $0.00239

Measured yesterday against content hash 07c9f32b7476, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

shim-cli AGENTS.md scanned grade A with 0 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 yesterday.

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.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

AGENTS.md · 151 lines

How it starts

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

shim-cli agent guidance

Read README.md, docs/architecture.md, docs/privacy.md, and docs/compatibility.md before changing the detector, hook protocol, installer, or shim watch.

Apply the ponytail:ponytail and code-writing-guidelines skills to every implementation and review. Prefer the smallest complete change, standard-library boundaries, direct control flow, and no speculative abstractions.

Safety boundaries

  • The hook is synchronous, local, and network-free, with no daemon. shim watch is the one component that touches the network, and only as a forwarding proxy: it runs for the length of one command, binds to loopback only, forwards bytes unchanged, and originates no request of its own. Nothing under src/shim_cli/watch/ may be imported from the hook path — the hook is a cold-start subprocess on every tool call and tests/contracts enforces it.
  • Never log or persist raw prompts, findings, or replacement values. The only prompt-derived file is one 0600 typed redaction in OS temporary storage per supported block; remove it if the block response cannot be serialized. The session spool and the opt-in ledger hold entity names and counts and a scrubbed target path — never the value that produced them, and never a shell command. shim watch keeps sizes and counts only; no request or response body reaches disk.
  • Safe hook input must produce exactly empty stdout and stderr.
  • Handled prompt errors must block with a generic native response. On Windows the hook stands down with one line and inspects nothing: that is the absence of the inspector, not a handled error, so it does not block.
  • A tool event shim cannot finish inspecting fails closed in every mode, observe included, as a prompt does. That covers the deadline, analysis failure, nesting deeper than MAX_DEPTH (64), input over 1 MB, malformed JSON, unreadable settings and a shim module that fails to import. A call (PreToolUse on Claude Code and VS Code) is denied. A Claude Code result is withheld: a built-in tool's result keeps its schema shape down to depth 64 (keys, kind words, zeroed numbers) with every other string replaced by [withheld by shim], and an MCP result is replaced whole. Where the client can do neither (PostToolUseFailure, VS Code PostToolUse, a built-in result whose shape never arrived), the user and the model are told it was not inspected and the model is told not to repeat values from it. Messages and records carry only the category (deadline, too large, settings unreadable, analysis failed), never payload text. If even the client adapter cannot load, the static answers in hook.py still deny the call, withhold an MCP result, report any other result and block the prompt. The deadline is counted from the process's start as the kernel records it: inspection stops at 20 s, and if no answer is out at 25 s a timer writes a fixed refusal for the event, exactly once, inside the 30 s every client registration uses.
  • Tool inputs are classified per client by where they go (policy.TOOLS). The input of a local built-in tool (Read, Grep, Glob, VS Code read_file, ...: the local-tool direction) is never rewritten or refused, only reported. Known network tools (WebFetch, WebSearch, VS Code fetch_webpage) are masked under enforce. An MCP tool, or any tool shim does not know, is never rewritten: under enforce a call carrying a finding is denied. Commands and local writes keep their own directions. The diet reshapes only results of network and MCP tools.
  • In every mode, and whatever else it finds, the hook refuses an agent's write to shim's settings, to a client settings file that holds or switches on shim's hooks, or to a file in the plugin folder running the hook, and an agent's shell command that runs shim with config, revert or uninstall. The reason names only the file or the subcommand. Other routes (the shell writing the file, an interpreter, sh -c, MCP tools) are not caught, and docs/privacy.md must keep saying so. If your active plugin folder (claude --plugin-dir, chat.pluginLocations, CLAUDE_PLUGIN_ROOT) is your working checkout of plugins/shim-cli, agent edits inside it are refused: point the plugin at a separate clone.
  • Placeholder write-back (D3). Every redaction shim hands the model (a masked tool event, the prompt block's redacted copy, Copilot's rewritten prompt) first records the placeholder names it issued in the session's .names store beside the spool: type and number runs only, never values or fingerprints, capped apart from the log, cleared at SessionEnd. If they cannot be recorded, nothing masked is handed on. In every mode, a Write/Edit/MultiEdit/NotebookEdit, VS Code edit or apply_patch (added lines), or any MCP or unknown tool input, whose new text holds a placeholder issued in this session is denied with a reason; an unreadable store denies it too. Placeholder-shaped text shim never issued in this session is left alone. Shell commands are not read for it.
  • Placeholder numbering (D4). Within one prompt or tool event a value always gets the same number and two values never share one, across every field, every piece of a long field and the html diet's single scan of the converted page; numbers start above any placeholder-shaped text the event already holds. The numbering lives in memory for that event only: no value fingerprint is written to disk. A masked span keeps its line breaks.
  • The plugin launcher withholds a prompt and denies a tool call when no hook can run, falls through interpreters that cannot start, and runs Python isolated (-I for the archive, -E for the package script). scripts/build_zipapp.py INCLUDED must list every module the hook imports, for write tools too; tests/plugins/test_u07_plugin_self_defense.py runs the archive through the launcher.
  • Entity settings default to every built-in type except the opt-in types in guard/entities.py; malformed or unsafe settings fail closed, and no settings field may contain prompt-derived data.
  • Never modify real user configuration in development or tests; use temporary paths.
  • Rebuild plugins/shim-cli/bin/shim.pyz only in a release commit: the plugin installs from main, so a rebuilt archive ships unreleased code to its users.
  • This repository is public and much of its documentation and corpus comes from running the tool for real. Nothing committed may carry the machine it was written on — a home directory, an editor path, a scratch directory, a provider request or organisation id. Test credentials must be obviously synthetic (0123456789abcdef, a vendor's published example key), never a plausible-looking random string: a fake that looks real trips secret scanners and costs a reviewer time. tests/contracts/test_no_local_leakage.py checks every tracked file, with the markers read from the environment so it protects whoever runs it.
  • A hook is shim's when its handler is exactly what a release wrote, whatever the interpreter: type command, the release's keys, and <python> -I -B -m shim_cli.hook (or the 0.2.0 shim_guard.hook) plus the client's argument, a shell command quoted exactly as shim quotes it. Any other hook is the user's and is never changed or removed, including one that runs shim and something else, another hook type, an extra argument or an extra key.
  • Install may create a missing client settings file. It leaves exactly one current shim group per registered event: it removes every other shim group (another installation's, a 0.2.0 group, a stray event, a duplicate) and appends its own last, preserving unrelated settings and hooks. Revert removes every shim group and retains the document even when empty.
  • Install and status run the exact isolated hook command they register on a safe and a sensitive fixture before calling it working. It is the only guard against a hook that fails open at the client, as a pip install --user shim does under -I.
  • Keep install and revert idempotent, leave Codex inline config.toml hooks untouched, preview only shim's fragment, and require manual setup for malformed, unsafe, or concurrently changed files and for a group where shim's handler sits beside another hook.
  • Do not add clients, auth, telemetry, daemons, plugin frameworks, or compatibility shims without an approved requirement. shim watch is the only approved proxy and it is opt-in per command: nothing may route a client through it automatically, and no shell profile may be edited to do so.
  • Detection may be relaxed only in the direction that drops noise, never in the direction that drops a credential. Mask through (D6): where the end of a secret value is ambiguous (PASSWORD=s3cr3tPass|next), the mask may run through trailing ;, & or | text, so a password is never partly exposed; in a list of fields, the list's separator ends the value. parity-v1.json is generated evidence and must not be regenerated to make a test pass; a deliberate difference from it goes in DELIBERATE_DIVERGENCES with its reason and its new expected result pinned as tightly as the old one.
  • A cap that turns "a lot of sensitive data" into "no protection at all" is a bug, not a safeguard. Bound work by input size, which is already bounded, and keep masking whatever was found.

Read the full file on GitHub · 151 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. yesterday First seen · 151 lines · 2,389 tokens per session scan A 07c9f32b7476

Subscribe to this mod's changes

shim-cli AGENTS.md is an instructions file published in the GitHub repository GetSHIM/shim-cli (39 stars, last pushed 12d ago), licensed Apache-2.0. It adds 2,389 tokens to every session, about $0.0096 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-11-07.

Related

shim-cli AGENTS.md compared with instructions from other repositories

shim-cli AGENTS.md next to 6 instructions from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
shim-cli AGENTS.mdGetSHIM/shim-cliInstructions file3912d agoApache-2.0A2,389Claude Code, Codex, OpenCode
vscode buildNext.instructions.mdmicrosoft/vscodeInstructions file195ktodayMITA9,719GitHub Copilot
vscode oss-third-party-notices.instructions.mdmicrosoft/vscodeInstructions file195ktodayMITA5,516GitHub Copilot
next.js AGENTS.mdvercel/next.jsInstructions file143ktodayMITA7,461Codex, OpenCode
langchain AGENTS.mdlangchain-ai/langchainInstructions file149ktodayMITA4,680Codex, OpenCode
vscode copilot-instructions.mdmicrosoft/vscodeInstructions file195ktodayMITA3,093GitHub Copilot
vscode model-prompts.instructions.mdmicrosoft/vscodeInstructions file195ktodayMITA2,022GitHub Copilot