
guard-rail
Keep personal data out of the model, without stopping your work.

guard-rail is a plugin for Claude Code. It hooks the point where tool results
reach the model and replaces personal data — national IDs, emails, phone numbers,
IBANs, addresses — with stable, reversible pseudonyms. The model sees
EMAIL_001; you keep a local map back to the real value. Prompts you write
yourself are checked too, and blocked when they carry personal data, because that
hook cannot rewrite text.
Detection is regex with check-digit validation, so document numbers and system
identifiers survive untouched. An optional model covers free-text names the
regex cannot reach: a local one served by Ollama by default, or TypeSafe's Jev
if you opt in with guard-rail model jev. With the default, nothing leaves your
machine.
Redaction is not a guarantee. Names in free text pass through by default,
results above a size limit pass uninspected, and a plugin whose hooks never fire
protects nothing while looking installed. Read
What this tool does not protect
before you rely on it, and run guard-rail doctor after installing.
Table of contents
What it looks like
A query against a business system returns real data:
LIFNR | NAME1 | EMAIL | CPF | BELNR
0010000006 | Comercio Atlantico | [email protected] | 529.982.247-25 | 5105600787
0010000006 | Comercio Atlantico | [email protected] | 52998224725 | 5105600788
0010000012 | Norte Distribuicao | [email protected] | 111.444.777-35 | 5105600790
The model receives this instead:
LIFNR | NAME1 | EMAIL | CPF | BELNR
0010000006 | Comercio Atlantico | EMAIL_001 | CPF_001 | 5105600787
0010000006 | Comercio Atlantico | EMAIL_001 | CPF_001 | 5105600788
0010000012 | Norte Distribuicao | EMAIL_002 | CPF_002 | 5105600790
Three things are happening.
System identifiers survive. Supplier numbers, document numbers, column names.
Redacting those would make the result useless to work with, so every numeric
detector validates a check digit before it fires.
Pseudonyms are stable. The same email is EMAIL_001 on both rows, so the
model can still tell those two documents belong to one person and reason about
duplicates. 529.982.247-25 and 52998224725 share a label too — formatting is
normalised before comparison.
You can go back.
$ guard-rail map EMAIL_001
[email protected]
$ guard-rail map -t "the record for EMAIL_001 is duplicated"
the record for [email protected] is duplicated
The audit log
Every intervention is recorded in ~/.cache/guard-rail/violations.jsonl — one
JSON object per line, appendable, greppable, ready for a SIEM.
$ guard-rail log
🔴 2026-09-07 08:12:15 redigido mcp__abap-adt__runQuery
• Email: 2× EMAIL_001, EMAIL_002
• CPF: 2× CPF_001, CPF_002
🔴 2026-09-07 08:12:15 BLOQUEADO UserPromptSubmit
• CPF: 1× —
🔴 2026-09-07 08:12:15 PASSOU EM CLARO mcp__abap-adt__tableContents
↳ resultado com 965000 chars excede max_output_chars=400000
| Action | Meaning |
|---|
redacted | Value replaced by a pseudonym. Work continued. |
blocked | Prompt stopped. Nothing left the machine. |
not_redacted | Data passed in the clear. The event worth investigating. |
degraded | Local model unavailable; only the regex layer was active. |
armed | A session started with hooks running. |
The log stores pseudonyms, never real values. A log holding the data would be a
worse repository than the original: it grows without bound and nobody remembers
it exists. Cross-reference with guard-rail map when you need the value.
guard-rail log --today
guard-rail log --leaks # only what passed in the clear
guard-rail log --summary # aggregated by violation point
guard-rail log --json
Status