Stop PII before Claude Code sees it.
ClipScrub can scan typed prompt text on your Mac before Claude Code processes it.
Submitted prompt
↓
UserPromptSubmit hook
↓
clipscrub --no-llm
├── clean ─────► Claude Code receives the prompt
└── sensitive ─► block + sanitized clipboard copyWhy this can stop a prompt early
Claude Code runs UserPromptSubmit before Claude Code sends the prompt for model processing. The local command hook can block a sensitive typed prompt and erase it from Claude Code’s context.
This example cannot intercept a prompt entered in ChatGPT. ChatGPT Apps and MCP integrations use remote services after ChatGPT receives a prompt. An OpenAI API integration needs a separate ClipScrub gateway before it creates a model response.
Read this before using it
This is an experimental macOS example. It cannot prove that a prompt is safe to share. Detection can miss sensitive material. Claude Code and macOS can change hook behaviour. Review the script and test your installed configuration before you use it with real information.
Try it with synthetic data
A synthetic patient note containing an SSN is blocked. The hook copies the redacted prompt. Review it, then paste and submit it yourself.
Patient: Taylor Example
SSN: 123-45-6789
→ Patient: [NAME_1]
SSN: [SSN_1]Set up the hook
The public example includes the executable hook and a Claude Code settings fragment.
git clone git@github.com:tugboatcoding/clipscrub-core.git
cd clipscrub-core/Examples/ai-prompt-gate
chmod +x clipscrub-prompt-gate.shRead the public hook source and setup fragments.
What this covers
The hook scans typed prompt text only. It blocks every ClipScrub finding. Attachments and later file reads need separate controls.
The hook blocks on missing ClipScrub, a scan failure or a clipboard failure. A host timeout can still let a prompt continue, so keep the command short and test the installed configuration.