shim-cli · Open source
See what your coding agent sends. Mask what you can.
shim-cli runs on your machine next to Claude Code, Codex, Copilot CLI and VS Code. It finds secrets and personal data in what your agent sends, masks them where the client allows it, and shows what each Claude Code session sent and cost.
- Apache-2.0
- v1.2.1
- macOS and Linux
- Python 3.10 or newer
Install
uv · in your terminal, adds shim to ~/.local/bin
uv tool install --python 3.12 --compile-bytecode shimUsing an AI agent?Get instructions for it
Instructions for your agent
Paste this into any coding agent that can run commands. It sets shim-cli up for Claude Code, Codex, Copilot CLI or VS Code, and stops if you use another agent. Read it first: it tells your agent to show every command before running it and to ask before changing a setting.
Set up shim-cli 1.2.1 on this machine for me, then show me that it works. shim-cli is an open source CLI (Apache-2.0). It finds secrets and personal data in what my coding agent sends to the model, and masks them where the client allows it. Read first: https://github.com/GetSHIM/shim-cli/tree/v1.2.1 and https://github.com/GetSHIM/shim-cli/blob/v1.2.1/llms.txt How to work: - Before each command, show it to me and wait for my OK. - Use --json where a command offers it. Branch on "code" and do what "fix" says. - Never add --yes until I have seen the --dry-run output and said yes. - Change settings only through shim commands. Do not edit a client's settings file yourself. - Do not use sudo, curl piped to a shell, or any flag that skips permissions or hook trust. - Do not open, print or scan my real .env files or secrets. To list the names in a .env without values, use: shim keys .env --json - If anything here disagrees with the README at that tag, follow the README and tell me. Steps: 1. Check the OS. shim-cli runs on macOS and Linux. On Windows outside WSL, stop and tell me. 2. Install it with uv, or with pipx if uv is missing: uv tool install --python 3.12 --compile-bytecode shim pipx install --python python3.12 --fetch-missing-python shim 3. Ask me which agent I use: claude, codex or copilot. For VS Code, follow the README section "VS Code" instead. If I use an agent shim-cli does not support (for example Cursor, Windsurf or Gemini CLI), stop and tell me so. Do not install anything. 4. Show me what shim catches, on a made-up sentence. It installs nothing: shim demo <client> Show me its before and after lines. 5. Preview the hook and show me the target file and the fragment: shim install <client> --dry-run --json After my yes: shim install <client> --yes --json Tell me the next_step it prints. 6. Check it: shim doctor <client> --json For every check that is not PASS, show me its code and its fix. 7. If I use Codex, tell me to open /hooks in Codex and enable the shim entry. 8. Do not report success until I have started a new session of my client. Then tell me what shim will do there, as the README's "Supported clients" table says for my client. Only if I ask: shim audit counts what my past Claude Code sessions already sent, without printing any value.
For shim-cli 1.2.1 · Also at getshim.tech/agent/shim-cli/1.2.1.md
SHA-256 32fb263e384a9debc289c2ea36b810d4214ef678e6fb62a96c07d46053bfe466
To compare: curl -s https://getshim.tech/agent/shim-cli/1.2.1.md | shasum -a 256
- If your agent runs with auto-approve on, it will not stop to ask you. Turn that off for this.
- We count copy clicks only. The text and what your agent does with it stay with you.
Try it first
Runs the detector on a made-up sentence and shows it masked. Installs nothing.
shim demo claudeWhat it does
Two commands, two questions
Mask in every session, or measure one session to see where your tokens and data actually went.
shim install claudeMask sensitive data, every session
Installs a native hook in your agent. When the agent reads a file or a tool result holding a key, an IBAN or an email, the model gets a placeholder like <SECRET_1> instead of the value.
shim watch -- claudeSee what a session sent and cost
Runs a local proxy for one command and reports tokens, spend and every secret or personal value that went past. It changes nothing, writes no request to disk and leaves nothing behind.
Before you install
See what already went out
Claude Code keeps every session on your disk. shim audit reads that history and counts what reached the model, by kind, by project and by the way it came in.
shim auditIt prints no value, keeps nothing and sends nothing. It reads Claude Code's history only, and only when you run it.
shim audit: Claude Code history, 3 sessions in 2 projects, 2026-09-28 to 2026-09-30 reached the model SECRET 10 in 2 sessions @.env 5 · failed Bash 5 EMAIL 3 in 3 sessions @.env 1 · failed Bash 1 · your prompt 1 DB_URI 2 in 2 sessions @.env 1 · failed Bash 1 by project ~/work/kasa-mutabakat SECRET 10, DB_URI 2, EMAIL 2 · last 2026-09-30 ~/work/site EMAIL 1 · last 2026-09-29 already masked by shim 3 values in 1 session model output 2 EMAIL (written by the model; it may repeat values it was given) scanned 3 sessions, 5 KB, in 0.0 s. Nothing was changed, written or sent.
Quickstart
Install, try it, connect your agent
Pick your coding agent. Nothing here needs an account, an API key or a network call to shim.
Install the CLI
uv tool install --python 3.12 --compile-bytecode shimUse pipx instead
pipx install --python python3.12 --fetch-missing-python shimWhen
python3 --versionalready says 3.10 or newer, this is enough:pipx install shimSee what it catches
shim demo claudeRuns the detector on a made-up sentence and shows it before and after masking. It installs nothing.
Connect it to Claude Code
Preview the change first, then install the hook.
shim install claude --dry-runshim install claude
Start a new session and check it
Start a new Claude Code session and run /hooks: shim is listed.
shim doctor claudeThen use Claude Code as you normally do. Masks secrets and personal data in the files and tool results your agent reads, before the model sees them.
Prefer a plugin?
Install from the Claude Code marketplace instead of running shim install. Use one method, not both.
/plugin marketplace add GetSHIM/shim-cli/plugin install shim-cli@shim-cli
Install the CLI
uv tool install --python 3.12 --compile-bytecode shimUse pipx instead
pipx install --python python3.12 --fetch-missing-python shimWhen
python3 --versionalready says 3.10 or newer, this is enough:pipx install shimSee what it catches
shim demo codexRuns the detector on a made-up sentence and shows it before and after masking. It installs nothing.
Connect it to Codex
Preview the change first, then install the hook.
shim install codex --dry-runshim install codex
Start a new session and check it
Start a new Codex session, open /hooks, review the shim entry and trust it. Codex skips a hook until you do.
shim doctor codexThen use Codex as you normally do. Reports what it found in your prompt and lets it through. Switch to enforce mode to block it instead.
Use shim install, not the Codex plugin
Current Codex installs the plugin and lists it as enabled, but does not load its hook: /hooks shows nothing, and prompts reach the model uninspected.
Install the CLI
uv tool install --python 3.12 --compile-bytecode shimUse pipx instead
pipx install --python python3.12 --fetch-missing-python shimWhen
python3 --versionalready says 3.10 or newer, this is enough:pipx install shimSee what it catches
shim demo copilotRuns the detector on a made-up sentence and shows it before and after masking. It installs nothing.
Connect it to Copilot CLI
Preview the change first, then install the hook.
shim install copilot --dry-runshim install copilot
Start a new session and check it
Start a new Copilot CLI session. It has no trust step.
shim doctor copilotThen use Copilot CLI as you normally do. Replaces the prompt the model receives with the redacted text, so the original values never reach it.
Get the plugin
Clone the release to a folder you keep. The
shimpackage does not carry the plugin.git clone --depth 1 --branch v1.2.1 https://github.com/GetSHIM/shim-cli ~/.local/share/shim-cliPoint VS Code at it
Add it to your user settings.json, with the absolute path that echo ~/.local/share/shim-cli/plugins/shim-cli prints. Workspace settings do not apply to this key.
"chat.pluginLocations": { "/Users/you/.local/share/shim-cli/plugins/shim-cli": true }There is no
shim install vscode. The plugin is the whole route. Then use VS Code as you normally do. In VS Code it reports, and with enforcement on it stops a prompt or denies a tool call before it runs. A result that has already reached the model is reported, never masked.
What it detects
Found locally, checked where it can be
IBANs and Turkish IDs are verified by checksum, so a mistyped number is not reported. Add your own project names or host formats as patterns.
- Email addresses
- Phone numbers
- Credit cards
- IBANs
- Turkish national IDs
- Turkish tax IDs
- API keys and secrets
- Passwords in config and commands
- Database URIs
- IP addresses
- MAC addresses
- US SSNs
- Turkish licence plates, opt-in
- Your own patterns
What you see
A summary at the end of the turn
A real Claude Code session on a customer file. Every value was replaced before the model saw it, and a document trying to give the agent orders was flagged.
masked 60 EMAIL (Read customers.csv)
60 IBAN (Read customers.csv)
60 PHONE (Read customers.csv)
60 TR_NATIONAL_ID (Read customers.csv)
flagged 1 INSTRUCTION_OVERRIDE (Read runbook.md)
1 HIDDEN_TEXT (Read runbook.md)
overhead 62 ms median, 119 ms p95How it is verified
Measured on the released build
- tests run on every release
- 2,300+tests run on every release
- median hook cost, interpreter start included
- 70 msmedian hook cost, interpreter start included
- detector cases, graded on exact output
- 727detector cases, graded on exact output
- accounts, API keys or telemetry added by shim
- 0accounts, API keys or telemetry added by shim
Before you rely on it
What shim-cli does not do
- A prompt you type into Claude Code or Codex is not masked: neither client lets a hook rewrite it. shim reports it, or stops it under enforce mode. Copilot CLI is the exception: the model gets the masked prompt.
- Codex and Copilot CLI tool traffic is not inspected at all.
- VS Code masks nothing: it reports, and under enforce mode stops a prompt or a tool call before it runs. A tool result can only be reported, and a file the agent reads is never seen.
- In Claude Code, shell commands and file writes are reported or denied, not masked. The output of a failed command and a file attached with @ are reported, not masked.
- Windows is not supported. macOS and Linux are; WSL is not yet verified.
- Detection is best-effort and can miss a value. It narrows exposure, it is not a data-loss prevention boundary.
- shim watch supports Claude Code only for now.
Free, open source, yours to read
The whole CLI is on GitHub under Apache-2.0. Read the detector, run the tests, open an issue or send a pull request.
For your whole team
Need this for your applications too?
The AI Gateway does the same detection in front of the AI calls your products make, with audit, budgets and roles on Enterprise.
Explore Enterprise