The masking policy is the YAML file that drives every decision Masker makes at runtime: which entity types to scan for, which detection passes to run, whether to tokenize or redact each entity, and which key to use when minting tokens. Masker ships a default policy atDocumentation Index
Fetch the complete documentation index at: https://docs.masker.dev/llms.txt
Use this file to discover all available pages before exploring further.
configs/mask_policy.yaml named healthcare-default that covers HIPAA Safe Harbor identifiers out of the box. You can tune that file, create per-agent policies, or switch tokenization schemes — all without touching code.
Sample mask_policy.yaml
The annotated example below matches the structure Masker expects. Every field is optional except those marked required.mask_policy.yaml
Field reference
Top-level fields
| Field | Type | Required | Description |
|---|---|---|---|
name | string | yes | Unique policy name. Referenced by agents and shown in the portal. |
version | int | yes | Schema version. Currently 1. |
description | string | no | Free-form description shown in the portal. |
kid | string | yes | Default key ID. Must match MASKER_KEY_<kid> in your environment. |
epsilon | float | no | Differential privacy budget for synthetic surrogates. Defaults to 0.5. |
tokenization | enum | yes | One of vault-deterministic, reversible-aead, or synthetic. |
passes | list | yes | Ordered list of detection passes: regex, gemma, diarize. |
entities | map | yes | Per-entity rules. See below. |
audit | map | no | Audit log behavior. |
Per-entity fields
| Field | Type | Default | Description |
|---|---|---|---|
enabled | bool | true | Master switch for this entity. Set to false to skip it entirely. |
regex | bool | true | Run the regex pass for this entity. |
ner | bool | true | Run the NER pass (Gemma model) for this entity. |
confidence_threshold | float | 0.6 | Minimum NER confidence score. Hits below this are discarded. |
action | enum | tokenize | What to do with detected spans: tokenize, redact, or passthrough. |
Audit fields
| Field | Type | Default | Description |
|---|---|---|---|
log_events | bool | true | Write a per-redaction event to the audit log. |
log_payloads | bool | false | Retain encrypted payloads alongside events. Off by default. |
retention_days | int | 2555 | How long audit records are kept. 2555 days (7 years) is the HIPAA minimum. |
Tokenization schemes
- vault-deterministic
- reversible-aead
- synthetic
Masker stores a mapping of
(plaintext, entity_kind) → token in a local SQLite vault. The same input always produces the same token, so LLM responses referring to MSKV1.PHONE.K_HEALTHCARE.abc123 can be correctly rehydrated even across turns.Best for: single-node deployments where vault state is easy to persist.Drawback: requires a shared vault in multi-replica setups. Use a Postgres database via MASKER_DATABASE_URL or switch to reversible-aead instead.Tuning detection sensitivity
Every entity’sconfidence_threshold controls how aggressively the NER pass fires. Lower values catch more but may introduce false positives; higher values are more precise but may miss edge cases.
To disable NER for a specific entity and rely only on regex, set ner: false. SSN and EMAIL are good candidates — their formats are regular enough that NER adds noise rather than coverage.
To disable an entity type entirely, set enabled: false. This prevents Masker from running any detection pass for that kind.
Applying a policy
Global policy
SetMASKER_POLICY_PATH to point to your policy file before starting Masker. The default is configs/mask_policy.yaml.
To reload a running server without restarting it:
Per-agent policy overrides
Each agent inherits the global policy by default. To assign a custom policy to one agent, passpolicy_yaml when creating or updating the agent:
CLI: validate and diff
Use themasker policy subcommands to validate and compare policies before deploying them.
Validate before deploying
unknown_kid— the policy references akidwith no matchingMASKER_KEY_<kid>environment variableinvalid_pass— thepasseslist contains a name Masker doesn’t recognizemissing_entity— an entity referenced inpassesis not declared underentities