By datumbrain
Automatically detect and redact personally identifiable information (PII) and secrets from Claude Code prompts before they reach the AI, using conditional shell scripts triggered on every prompt.
🛡️ Prevent secrets and PII from being accidentally shared with Claude Code.
A privacy-first plugin for Claude Code that scans prompts for sensitive data and blocks them before they reach the AI.
# Add the marketplace (if not already added)
/plugin marketplace add datumbrain/claude-privacy-guard
# Install the plugin
/plugin install claude-privacy-guard
⚠️ Important: Restart Required
After installing the plugin, you must restart your Claude Code session for it to take effect. This is because hooks are registered at session startup - Claude Code doesn't dynamically load new hooks mid-session.
Simply close and reopen Claude Code, or start a new session.
Once restarted, the plugin will automatically scan all prompts before they reach Claude.
✅ Secrets
sk-..., sk-proj-...)✅ Personal Information (PII)
UserPromptSubmit hookInput:
My API key is sk-proj-abc123xyz and email is [email protected]
Result:
🛡️ Privacy Guard blocked this prompt
Found 2 sensitive item(s):
- API_KEY: sk-proj-abc123xyz...
- EMAIL: [email protected]...
Risk Score: 100/100
Secrets: 1 | PII: 1
Please remove or anonymize sensitive data before proceeding.
# Clone the repository
git clone https://github.com/datumbrain/claude-privacy-guard.git
cd claude-privacy-guard
# Install dependencies
npm install
# Build
npm run build
# Test the scanner directly
echo "test sk-proj-abc123" | node scripts/prompt-guard.js
Release:
make release
This runs an interactive flow that asks for version bump, confirms release actions, then runs build/test, creates commit+tag, and optionally pushes/publishes.
External regex dataset:
data/regex_list_1.jsoncoding-only mode (focus on keys/tokens/secrets/password/private key patterns).privacy-guard.json to control behavior:{
"externalRulesJsonPath": "./data/regex_list_1.json",
"externalRulesMode": "coding-only"
}
See docs/ for detailed architecture and integration guides.
Claude Code's hook system doesn't support transforming prompts - only blocking or adding context. Blocking ensures sensitive data never reaches the AI, which is the safest approach.
Check the debug log if you encounter issues:
cat /tmp/claude-privacy-guard.log
Contributions welcome! Please feel free to submit a Pull Request.
MIT © Datum Brain
Own this plugin?
Verify ownership to unlock analytics, metadata editing, and a verified badge. GitHub access is read-only (username + org membership).
Sign in to claimOwn this plugin?
Verify ownership to unlock analytics, metadata editing, and a verified badge. GitHub access is read-only (username + org membership).
Sign in to claimBased on adoption, maintenance, documentation, and repository signals. Not a security audit or endorsement.
npx claudepluginhub datumbrain/claude-privacy-guard --plugin claude-privacy-guardHarness-native ECC operator layer - 67 agents, 271 skills, 92 legacy command shims, reusable hooks, rules, selective install profiles, and production-ready workflows for Claude Code, Codex, OpenCode, Cursor, and related agent harnesses
Complete collection of battle-tested Claude Code configs from an Anthropic hackathon winner - agents, skills, hooks, and rules evolved over 10+ months of intensive daily use
Efficient skill management system with progressive discovery — 410+ production-ready skills across 33+ domains