Skip to content

Privacy Guard

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.

User prompt
│
▼
[1] Client scan (local, before network)
│
▼
[2] Gateway API (bootstrap, returns 422 if blocked)
│
▼
[3] Per-node policy (inference node, final check)
  1. Client scan — Runs locally before the prompt is sent. Blocks or warns depending on configuration.
  2. Gateway API — The bootstrap node scans forwarded prompts. Returns HTTP 422 Unprocessable Entity with a list of matched patterns if sensitive data is detected.
  3. Per-node policy — Each inference node can enforce its own scan before processing. Controlled by the node’s trust level setting.

22 regex patterns organized by category:

CategoryPatterns
API keysAWS access key, GCP key, GitHub token, Stripe key, generic sk- / key- prefixes
Passwordspassword=, passwd:, secret:, bearer tokens
PIISSN, email address, phone number, credit card, date of birth
FinancialIBAN, routing number, account number
InfrastructurePrivate IP ranges, connection strings, DSN URIs

Each pattern has a severity (block or warn) and a confidence score threshold.

The trust setting controls how aggressively Privacy Guard enforces at each layer:

LevelClientGatewayNode
strictScan + blockScan + 422Scan + reject
relaxedScan + warnScan + 422Scan + log only
honorScan + warnSkipSkip

Set the trust level:

Terminal window
# CLI
mycellm config set privacy.trust strict

In ~/.config/mycellm/.env:

Terminal window
MYCELLM_PRIVACY_TRUST=strict

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, placeholder
  • xxx, 000-00-0000, 1234
  • Code fence blocks tagged as example or test

This reduces false positives when discussing API key formats or writing documentation.

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: warn

Reload with:

Terminal window
mycellm config reload

If the gateway blocks a prompt you know is safe, send the X-Privacy-Override header:

Terminal window
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.

Terminal window
# Test a prompt against Privacy Guard without sending it
mycellm privacy scan "my password is hunter2"
# View recent blocks
mycellm privacy log
# List all active patterns
mycellm privacy patterns