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.
# ~/.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.
HIGH maps to alert under the default pack
Emit decision record
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
- Rule pack. A folder of YAML rules, judge prompts and suppressions. Three ship with DefenseClaw:
permissive,defaultandstrict. 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 (ruletamper.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
Change block and alert levels
Set block_at and alert_at globally, per agent or per profile.
Use a different rule pack
Switch to strict or permissive.
Write a custom rule
One CEL rule in your own pack.
Build a policy in the browser
The policy creator.
All guides: How-to > Rules and policy. Reference: Guardrail and policy, thresholds, rules, defaults, detection, CEL.
Contextual LLM judge benchmark
Production-path Gemma judge accuracy, benign interruption rate, latency, token use, cost, and connector context behavior.
Defaults
What every fresh DefenseClaw install ships with — three policy presets (permissive / default / strict), three matching guardrail rule packs, the operator-config defaults, and how to pick the combination that fits your team's risk tolerance.