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
Per-entity fields
Audit fields
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