Policies

How DefenseClaw decides — OPA/Rego policy, structured tool-call rules, regex and judge detection, scanner policy, and noise suppression.

A policy is what turns a finding into an action. DefenseClaw checks each prompt, model reply and tool call against a rule pack, optionally asks an LLM judge for a second opinion, and then maps the worst severity to allow, alert, confirm or block. The connector turns that action into the agent's own allow, ask or deny.

Guided example · Synthetic runtime event

Trace a runtime verdict from event to action

Follow normalization, a bundled rule match, suppressions, severity, and the default pack mapping.

Deterministic
# ~/.defenseclaw/config.yaml (excerpt)guardrail:  mode: action           # observe mode never blocks  judge:    enabled: false       # the optional LLM judge is off by default  # No block_at is set, so the default pack decides:  # CRITICAL blocks, HIGH and MEDIUM alert, LOW allows.# ~/.defenseclaw/config.yaml (excerpt)guardrail:  mode: action           # observe mode never blocks  judge:    enabled: false       # the optional LLM judge is off by default  # No block_at is set, so the default pack decides:  # CRITICAL blocks, HIGH and MEDIUM alert, LOW allows.
DecisionAlert and allow the call
Reason

HIGH maps to alert under the default pack

Action

Emit decision record

06

Resolve actionUnder the default pack, HIGH resolves to alert.

Step 6 / 6
What DefenseClaw did — and did not do

What it did

  • Show the ordered stages that assemble a runtime verdict
  • Distinguish the optional judge from deterministic rules

What it did not do

  • Evaluate Rego or scanner output in the browser
  • Reuse runtime actions as skill or MCP admission actions

How the layers fit together

scanned
if the judge is on
findings
adds findings
returns
Prompt, reply or tool call
Rule packCEL · regex · secrets · injection
LLM judge (optional)suppressions remove known noise
Block and alert levelsHITL below the block level
allow · alert · confirm · block
One prompt, reply or tool call. A rule match is enough on its own; the judge is optional. Suppressions only remove judge findings. The block and alert levels, and human approval (HITL), pick the action. The session correlator is separate: it reads saved findings afterwards and never changes the request.
  • Rule pack. A folder of YAML rules, judge prompts and suppressions. Three ship with DefenseClaw: permissive, default and strict. The pack also sets the default block and alert levels. The balanced/default enabled catalog currently contains 244 local rules. Regexes compile during rule-pack validation; an invalid expression rejects the complete candidate.
  • Structured tool calls. For a shell command or file write, the gateway first extracts the commands, paths and network targets, and CEL rules match those facts. A regex match on its own is recorded as detection only and does not block. See deterministic detection.
  • LLM judge. Off until you turn it on. It reads prompts, replies and tool calls for subtle injection, personal data and exfiltration. See set up an LLM key.
  • Suppressions. Three lists in the pack drop known noise from the judge. They never silence a regex or CEL rule. See tune the LLM judge.
  • Session correlator. Watches saved findings in one session and records a CORR-* finding when untrusted input, sensitive access and external egress happen in order. It is detection after the fact, not a block.
  • Admission. Skills, MCP servers and plugins are decided separately, by scan severity and the allow and block lists. See scanning.

What it does not do

  • A level alone does not block in observe mode. Blocking needs action mode; see the guardrail. One exception: an agent that changes DefenseClaw's own files, such as a copy into ~/.defenseclaw, is blocked in every mode (rule tamper.detector_state_write, with every rule pack).
  • A custom CEL rule cannot grant itself blocking power. A block needs complete facts and a connector that can stop the call before it runs.
  • The correlator never stops the request that completes a pattern.

Do it

All guides: How-to > Rules and policy. Reference: Guardrail and policy, thresholds, rules, defaults, detection, CEL.