Policy creator
Build a DefenseClaw policy in the browser with an admission preset, rule pack, suppressions, judges and webhooks, then test its install script safely.
The creator builds a complete policy (admission preset, rule pack, suppressions, judges, webhooks) and exports it as YAML plus one install script. Quick Start asks five questions (posture, what to block, what to allow, how to respond, where alerts go) and ends on a Review step; Playground edits every section. Both share one draft.
Nothing is uploaded
Evaluation runs in your browser with compiled copies of the shipped Rego (admission and guardrail). Your draft and test inputs never leave the page; saved progress lives in localStorage.
Build a policy
What posture should we start from?
Picks a base preset. You'll layer your block / allow choices on top.
- Pick a posture (Permissive, Balanced or Strict), then answer the questions.
- On Review, run the scenarios in Live Test. They use the selected mode; observe mode reports
alertfor the CRITICAL guardrail cases. - Open Playground to fine-tune. For a regex rule, paste the pattern in the Rule pack section: the tester runs it with your should-match and should-not-match examples and flags RE2-incompatible features and nested quantifiers (Recipes).
- Download the install script. A share link holds the whole policy in its URL fragment; treat it like the YAML.
Install the policy
The examples need Bash. On native Windows, use Git Bash or WSL.
The script writes the policy files and runs defenseclaw policy activate, which copies admission and levels into config.yaml. The rule pack is not enforced until you validate and switch to it:
defenseclaw policy activate my-policy
defenseclaw guardrail validate-pack ~/.defenseclaw/policies/guardrail/my-policy
defenseclaw guardrail use-pack my-policyTest it in a throwaway home first
Read the script before you run it; it inlines every pack file. Use the policy name the creator showed in place of my-policy.
Isolate the home
INSTALL_SCRIPT="$HOME/Downloads/install-my-policy.sh"
REAL_HOME="$HOME"
REAL_DEFENSECLAW_HOME="${DEFENSECLAW_HOME:-$HOME/.defenseclaw}"
VERIFY_HOME="$(mktemp -d "${TMPDIR:-/tmp}/defenseclaw-policy-verify.XXXXXX")"
export HOME="$VERIFY_HOME" DEFENSECLAW_HOME="$VERIFY_HOME/.defenseclaw"
grep -nE '^(cat >|defenseclaw )' "$INSTALL_SCRIPT" # what the script writesCreate a minimal install and run the script
defenseclaw init --non-interactive --yes --connector codex \
--skip-install --no-start-gateway --no-verify
bash -n "$INSTALL_SCRIPT" && bash "$INSTALL_SCRIPT"
defenseclaw policy show my-policyValidate and test the Rego
defenseclaw policy validate --rego-dir "$DEFENSECLAW_HOME/policies/rego"
defenseclaw policy test --rego-dir "$DEFENSECLAW_HOME/policies/rego" --verbose
defenseclaw config get guardrail.block_at --effectiveopa is used when it is on PATH, otherwise the engine inside defenseclaw-gateway.
Dry-run an admission decision
defenseclaw-gateway policy evaluate --target-type skill \
--target-name test-skill --severity HIGH --findings 3The JSON decision should match the HIGH action you set in the creator.
Validate and switch to the rule pack
defenseclaw guardrail validate-pack "$DEFENSECLAW_HOME/policies/guardrail/my-policy"
defenseclaw guardrail use-pack my-policyThe throwaway gateway is not running, so use-pack warns that the audit event was not recorded. That is expected.
Promote or clean up
To promote, run the reviewed script and use-pack again with HOME="$REAL_HOME" DEFENSECLAW_HOME="$REAL_DEFENSECLAW_HOME". To clean up:
rm -rf -- "${VERIFY_HOME:?}"Limits
- Live Test evaluates only the admission and guardrail Rego. It does not run ActionFacts parsing, CEL, regex, YARA or bounded chains.
- Firewall and audit choices are planning notes; they are left out of the export.
- The human-approval choice stays in the policy file. Turn it on with
defenseclaw guardrail hilt on --min-severity MEDIUM. - Playground's keep-host-mode choice omits
guardrail.mode, so activation keeps the host's mode. - Browser regex checks use V8; the gateway uses Go RE2. Final validation happens on the host with
validate-pack. - Admission first-party entries need an exact asset name and at least one
source_path_containspath pin (Admission).
Guardrail rule recipes
Search and copy the regex rules and suppressions in DefenseClaw's rule packs, plus RE2 patterns from the strict pack and what makes each one precise.
Human approval
Let a risky call pause and ask you in the agent instead of running or blocking. See which findings and agents can ask, and how to turn it on and check it.