Guardrail

Block and alert levels

Set the guardrail block_at and alert_at levels: where to set them, which scope wins, what the rule pack supplies by default, and how to change them.

Two settings decide how severe a finding must be before the guardrail acts:

  • block_at is the lowest severity that is blocked.
  • alert_at is the lowest severity that raises an alert.

Both take CRITICAL, HIGH, MEDIUM or LOW. They are the only levels for rule and judge findings, on every guardrail surface: hook tool calls, prompts and tool results, and proxy prompts, completions and tool calls. Later steps of the cascade can still change the final action (Cascade and Rego). To change them, go to Set the levels.

What the two levels do

With block_at: HIGH and alert_at: MEDIUM:

Finding severityAction modeObserve mode
CRITICAL, HIGHBlockedAlert
MEDIUMAlertAlert
LOWAllowedAllowed
  • Anything that blocks also alerts. An alert_at above block_at alerts from the block level instead; config get guardrail.alert_at --effective labels it (clamped to block_at).
  • Observe mode does not enforce policy findings. Findings at the alert level or above are logged as alerts; fail mode and proxy availability can still stop a call. One rule is the exception (Set up and modes).
  • Human approval sits below the block level. With human approval on, a finding at or above guardrail.hilt.min_severity but below block_at asks, where the agent can ask.
  • Only eligible findings block. A regex match on a tool call is detection only, and an alert-only rule (such as impact.sql_destructive_mutation, attack.http_command_injection, attack.http_sql_injection or exec.postgresql_copy_program) stays an alert at every block_at.

Which severities block, alert or ask

block_at is the lowest severity that blocks, alert_at the lowest that alerts. Human approval asks below the block level.

Rule packguardrail.rule_pack
Modeguardrail.mode
Finding
block_atguardrail.block_at
alert_atguardrail.alert_at
Human approvalguardrail.hilt.enabled
CRITICALBlockedHIGHBlockedMEDIUMAlertLOWAllowedalert_atblock_at

Effective values

guardrail.block_at
HIGH(source: config:guardrail.block_at)
guardrail.alert_at
MEDIUM(source: pack-default:default)
guardrail.hilt
enabled: false
blockedasks youalertallowed

Action modeCRITICAL blocks, HIGH blocks, MEDIUM alerts, LOW is allowed.

The levels apply to rule and judge findings on every guardrail surface; later steps of the cascade can still change the final action. A scope with no level of its own takes its rule pack’s posture. Only eligible findings block: a regex match on a tool call is detection only, and an alert-only rule stays an alert.
Text version of this figure

default pack, block_at HIGH, alert_at MEDIUM, human approval off, a finding that can block.

Finding severityAction modeObserve mode
CRITICALBlockedAlert
HIGHBlockedAlert
MEDIUMAlertAlert
LOWAllowedAllowed

Scopes and precedence

A level can be set at four scopes. The most specific scope that sets a value wins; an unset scope falls through to the next.

  1. Profile connector: guardrail.profiles.<profile>.connectors.<connector>.block_at
  2. Profile: guardrail.profiles.<profile>.block_at
  3. Connector: guardrail.connectors.<connector>.block_at
  4. Global: guardrail.block_at
  5. Rule-pack default: the posture of the pack that scope uses (below)

block_at and alert_at resolve independently. Other guardrail settings also take an application-protection overlay between the connector and the global scope (User and group profiles), but that overlay cannot carry block_at or alert_at: a config that sets either under application_protection is refused.

A profile's level outranks guardrail.connectors.<connector>: a user a profile selects gets the profile's block_at even on a connector with its own, unless the profile sets that connector too.

~/.defenseclaw/config.yaml
guardrail:
  block_at: HIGH            # global: HIGH and CRITICAL block everywhere
  alert_at: MEDIUM
  connectors:
    codex:
      block_at: CRITICAL    # connector: Codex blocks only CRITICAL
  profiles:
    contractors:
      block_at: MEDIUM      # profile: contractors block MEDIUM and above
      alert_at: LOW
      connectors:
        codex:
          block_at: HIGH    # profile connector: except on Codex

Which scope sets the level

The most specific scope that sets a level wins, for block_at and alert_at separately. A profile outranks the connector unless it sets that connector too.

Person
Connector
Scope, most specific firstblock_atalert_at1Profile connectorguardrail.profiles.contractors.connectors.codex2Profileguardrail.profiles.contractors3Connectorguardrail.connectors.codex4Globalguardrail5Rule-pack defaultpack-default:defaultHIGHMEDIUMCRITICALHIGHCRITICALnot setLOWnot setMEDIUMMEDIUMEffectiveHIGHLOW
falls through an unset scopethe scope that sets the level

A person in the contractors profile on Codexblock_at HIGH, from guardrail.profiles.contractors.connectors.codex; alert_at LOW, from guardrail.profiles.contractors.

The example config.yaml above, with the default rule pack. An unset scope falls through to the next. config get --effective reads the global and connector scopes; for a profile, run defenseclaw guardrail profile explain.
Text version of this figure

A person in the contractors profile on Codex. The scope that sets each level is marked.

Scopeblock_atalert_at
1. Profile connector (guardrail.profiles.contractors.connectors.codex)HIGH (sets it)not set
2. Profile (guardrail.profiles.contractors)MEDIUMLOW (sets it)
3. Connector (guardrail.connectors.codex)CRITICALnot set
4. Global (guardrail)HIGHMEDIUM
5. Rule-pack default (pack-default:default)CRITICALMEDIUM

Rule-pack default (posture)

A scope with no level of its own takes the default of the rule pack it enforces:

Postureblock_atalert_atPick it when
defaultCRITICALMEDIUMYou want to stop obvious harm. With human approval on, eligible HIGH findings ask first.
strictMEDIUMLOWA missed attack costs more than an interruption. Turn the LLM judge on too.
permissiveCRITICALHIGHYou are piloting, or agents must stay available.

The posture of a pack is, in order:

  1. the posture field of defenseclaw-pack.json at the pack's root, if the file exists;
  2. the tier of the pack's tiers.yaml, if it has one;
  3. the pack's own name, for the shipped packs;
  4. strict for a copy kept in a folder named strict; default for every other folder. A folder named permissive is default.

A custom pack is default unless it says otherwise, even when copied from strict into a folder with another name. To keep strict levels for a copy, add a manifest:

~/.defenseclaw/policies/guardrail/acme-strict/defenseclaw-pack.json
{"posture": "strict"}

The manifest is part of the pack digest, so adding or editing it needs a new pin (Packs and rules). Because scopes can select different packs, the default can differ per scope; setting block_at explicitly removes that dependency.

Read the effective value

config get --effective prints the value the gateway enforces and, on stderr, where it comes from:

Terminal output
$ defenseclaw config get guardrail.block_at --effective
(source: config:guardrail.block_at)
HIGH
$ defenseclaw config get guardrail.connectors.codex.block_at --effective
(source: config:guardrail.connectors.codex.block_at)
CRITICAL

The source is config:<key> for a value you set, or pack-default:<posture> when the rule pack decides. --effective reads the global and connector scopes. For a profile, ask which profile a request resolves to:

defenseclaw guardrail profile explain --connector codex --user alice

profile explain with an unknown connector exits with an error: the gateway returns HTTP 400 with unknown connector and the valid connectors. There is no fallback to the global levels.

defenseclaw guardrail status shows each connector's levels in its Block/alert column (MEDIUM+/LOW+). On a managed host, where the Python CLI is not installed, defenseclaw-gateway policy show prints what the gateway compiled from config.yaml.

Set the levels

ToRun
Set the global block leveldefenseclaw guardrail block-at HIGH
Set the global alert leveldefenseclaw guardrail alert-at MEDIUM
Set one connector's leveldefenseclaw guardrail block-at CRITICAL --connector codex
Clear a level so it inheritsdefenseclaw guardrail block-at inherit --connector codex
Set a profile's leveldefenseclaw config set guardrail.profiles.contractors.block_at MEDIUM
Set a profile connector's leveldefenseclaw config set guardrail.profiles.contractors.connectors.codex.block_at HIGH
Remove a profile keydefenseclaw config unset guardrail.profiles.contractors.block_at
Take an admission preset's levelsdefenseclaw policy activate strict
  • block-at and alert-at take CRITICAL, HIGH, MEDIUM, LOW (any case) or inherit, and have no --profile option.
  • Every change is validated before it is written; a bad level is refused and config.yaml stays as it was.
  • policy activate writes guardrail.block_at and alert_at only where the preset's level differs from the selected rule pack's default (Presets and packs).
  • The running gateway applies the change on its next decision; the command ends with The running gateway applies it now.

Check it worked: defenseclaw config get guardrail.block_at --effective. Undo: defenseclaw guardrail block-at inherit --connector codex, or config unset for a profile key.

Managed devices refuse local changes

On a device managed by MDM or a management plane, the config writer refuses with This device is managed: change config.yaml in the admin config (MDM or management plane), not on the device. Set the levels in the admin config instead.

When a change does not apply

Levels, rule packs, guardrail.rules, profiles, the mode, human approval and the trust level reload without a restart.

  • If a change is invalid, the previous policy keeps running. /health shows policy.last_reload_error and defenseclaw doctor fails its Policy row.
  • The guardrail commands wait up to 10 seconds for the gateway to report the new config generation. If it does not, they say so and name defenseclaw-gateway restart; mode, block-at and alert-at then exit 1.
  • These keys need a restart: guardrail.host, port, enabled, connector, scanner_mode, retain_judge_bodies, protected_files and the hook self-heal settings. The writer prints Restart the gateway to apply <key>. With gateway.config_reload.mode: restart the gateway restarts itself.

Cisco AI Defense trust level

guardrail.cisco_trust_level sets how much a Cisco AI Defense verdict counts with scanner_mode: remote or both. It is global only.

ValueEffect
full (default)Counts like a local finding and can reach block_at.
advisoryA Cisco verdict that alone would block raises an alert instead, unless a local finding also reaches the alert level. The permissive preset sets this.
noneCisco AI Defense severities are ignored.

Set it with defenseclaw config set guardrail.cisco_trust_level advisory.