Safety Filter
The safety-filter policy is a term-based safety control. It does not use a classifier or moderation service. It checks configured terms. It can also use fuzzy matching and a simple age list.
Phase and verdicts
- Input phase: full input check with
block_if, optional fuzzy matching, and optionalmax_age - Output phase: term checks in supported buffered and streaming response paths
- Verdicts:
allow,block,escalate
Configuration
pack:
name: safety-filter-example-1
version: "1.0.0"
enabled: true
policies:
chain:
- safety-filter
policy:
safety-filter:
mode: critical_infrastructure
block_if:
- override safety interlock
- disable emergency shutdown
action: block
fuzzy_matching: true
max_distance: 1
max_age: 0
Supported fields
| Field | Type | Default | Notes |
|---|---|---|---|
mode | string | critical_infrastructure | critical_infrastructure, automotive, education, law_enforcement, government, military, hr, justice, healthcare, finance, legal, or defense. |
block_if | string[] | [] | When non-empty, this is the active match list. Built-in defaults are used only when block_if is empty. |
action | string | block | block or escalate. |
fuzzy_matching | boolean | false | Used by the input phase only. |
max_distance | integer | 1 | Edit-distance threshold for input fuzzy matching. |
max_age | integer | 0 | Used by the input phase only. Ages 1..17 start a simple adult-term check. |
Built-in default keywords when block_if is empty
| Mode | Default terms |
|---|---|
critical_infrastructure | explosive, weapon, attack |
automotive | disable airbags, bypass brakes, tamper |
education | self-harm, suicide |
law_enforcement | doxx, target |
Other accepted modes use the generic critical_infrastructure terms. A non-empty block_if list replaces these terms.
Important behavior notes
- Custom
block_ifvalues replace the default terms. The gateway does not merge the lists. - The input phase supports fuzzy matching and
max_agechecks. - The output path checks terms and
action. It does not use the input fuzzy checks or age control. max_ageuses a simple keyword list (alcohol,tobacco,gambling,explicit,pornograph,drug use,substance abuse,violence,gore,profanity) rather than a classifier.- For SSE output, the gateway buffers assistant text before it sends the stream.
- The SSE output path enforces only
action: block. It does not enforceaction: escalate.
Use stream: false when output escalation is necessary. Test each response
family because an input allow result does not prove output enforcement.
Minimal correct example
policy:
safety-filter:
action: block