Privacy Guard
Overview
Section titled “Overview”Privacy Guard scans prompts for sensitive data before they leave your device or reach an inference node. It operates at three layers with 22 built-in detection patterns.
Three layers
Section titled “Three layers”User prompt │ ▼[1] Client scan (local, before network) │ ▼[2] Gateway API (bootstrap, returns 422 if blocked) │ ▼[3] Per-node policy (inference node, final check)- Client scan — Runs locally before the prompt is sent. Blocks or warns depending on configuration.
- Gateway API — The bootstrap node scans forwarded prompts. Returns HTTP
422 Unprocessable Entitywith a list of matched patterns if sensitive data is detected. - Per-node policy — Each inference node can enforce its own scan before processing. Controlled by the node’s trust level setting.
Built-in patterns
Section titled “Built-in patterns”22 regex patterns organized by category:
| Category | Patterns |
|---|---|
| API keys | AWS access key, GCP key, GitHub token, Stripe key, generic sk- / key- prefixes |
| Passwords | password=, passwd:, secret:, bearer tokens |
| PII | SSN, email address, phone number, credit card, date of birth |
| Financial | IBAN, routing number, account number |
| Infrastructure | Private IP ranges, connection strings, DSN URIs |
Each pattern has a severity (block or warn) and a confidence score threshold.
Trust levels
Section titled “Trust levels”The trust setting controls how aggressively Privacy Guard enforces at each layer:
| Level | Client | Gateway | Node |
|---|---|---|---|
strict | Scan + block | Scan + 422 | Scan + reject |
relaxed | Scan + warn | Scan + 422 | Scan + log only |
honor | Scan + warn | Skip | Skip |
Set the trust level:
# CLImycellm config set privacy.trust strictIn ~/.config/mycellm/.env:
MYCELLM_PRIVACY_TRUST=strictContext exclusion
Section titled “Context exclusion”Privacy Guard skips matches that appear in obvious non-sensitive contexts. Prompts containing these markers around a match are excluded from detection:
example,test,demo,placeholderxxx,000-00-0000,1234- Code fence blocks tagged as
exampleortest
This reduces false positives when discussing API key formats or writing documentation.
Custom rules
Section titled “Custom rules”Open Settings > Privacy Guard > Custom Rules. Add a label, regex pattern, and severity (block or warn).
Add rules to ~/.config/mycellm/privacy_rules.yaml:
custom_rules: - label: "Internal project code" pattern: "PROJ-[A-Z]{2}-\\d{4}" severity: block - label: "Employee ID" pattern: "EMP\\d{6}" severity: warnReload with:
mycellm config reloadGateway bypass
Section titled “Gateway bypass”If the gateway blocks a prompt you know is safe, send the X-Privacy-Override header:
curl -X POST http://localhost:8420/v1/chat/completions \ -H "Content-Type: application/json" \ -H "X-Privacy-Override: acknowledged" \ -d '{"model": "llama-3.2-3b", "messages": [...]}'This header tells the gateway to skip its scan. The client-side scan still runs. The header value must be exactly acknowledged — it serves as an explicit opt-in.
Diagnostics
Section titled “Diagnostics”# Test a prompt against Privacy Guard without sending itmycellm privacy scan "my password is hunter2"
# View recent blocksmycellm privacy log
# List all active patternsmycellm privacy patterns