Detect and redact PII, API keys, and secrets in screenshots via OCR + regex before images reach Claude
privacy-mask
以下摘录自该仓库的 README(片段) · 在 GitHub 读完整 README →
Detect and redact sensitive information in images — 100% local, 100% offline.
> **Your images never leave your machine.** privacy-mask intercepts screenshots before they are sent to AI services, automatically detecting and masking phone numbers, ID cards, API keys, and 40+ other sensitive patterns.
**🇨🇳 中文文档 / Chinese Documentation**
---
Demo
---
Before / After
| Original | Masked |
|----------|--------|
| | |
| | |
| | |
---
Why?
When you share screenshots with AI assistants, you might accidentally expose:
- **Personal IDs** — national ID numbers, passports, social security numbers
- **Phone numbers & emails** — yours or your users'
- **API keys & tokens** — AWS, GitHub, Stripe, database credentials
- **Financial data** — bank card numbers, IBAN codes
Cloud-based redaction services require uploading your images — defeating the purpose. **privacy-mask processes everything locally before any data leaves your machine**, making it the only approach that truly protects your privacy.
This matters for compliance too: **GDPR**, **HIPAA**, and other regulations require that sensitive data be protected at the point of origin.
---
Quick Start
That's it. After privacy-mask install, every image you share with your AI coding assistant is automatically masked before upload.
---
Agent Integration
privacy-mask follows the agentskills.io SKILL.md standard and works with **20+ AI coding tools** that run locally:
| Platform | How it works |
|----------|-------------|
| **Claude Code** | pip install privacy-mask && privacy-mask install or /plugin marketplace add fullstackcrew-alpha/privacy-mask then /plugin install privacy-mask@privacy-mask |
| **Cursor** | SKILL.md auto-detected in project |
| **VS Code Copilot** | SKILL.md auto-detected in project |
| **Gemini CLI** | SKILL.md auto-detected in project |
| **OpenHands** | CLI available via shell |
| **Goose** | SKILL.md auto-detected |
| **Roo Code** | SKILL.md auto-detected |
| **aider** | CLI available via shell |
| **Cline** | SKILL.md auto-detected |
| **Windsurf** | SKILL.md auto-detected |
| **OpenClaw** | clawhub install privacy-mask or SKILL.md auto-detected |
> **Note:** privacy-mask only works with **local agents**. Web-based AI (ChatGPT Web, Gemini Web) uploads images to cloud servers before processing — local masking cannot help there. This tool is designed for agents that run on your machine.
---
Troubleshooting
UserPromptSubmit hook error
If you see this error when sending images in Claude Code, it means the privacy-mask hook **timed out** before finishing. This is a known issue — the NER engine needs time to load the GLiNER model (~170MB) on first run. The image is usually still masked successfully despite the error message.
**Fix: increase the hook timeout** in ~/.claude/settings.json:
The default timeout is 30000ms (30s). We recommend **60000ms (60s)** for NER engine, or 30000ms if you only use the regex engine.
**Alternative: switch to regex engine** for faster processing (~2-5s vs ~20-30s):
To change the default engine, edit mask_engine/data/config.json:
---
Detection Engines
privacy-mask supports two detection engines, switchable via config or CLI:
| Engine | Description | Install |