Recipes

Catalog of the regex rules and suppressions shipped with DefenseClaw's bundled policy packs — search, filter, and copy the YAML.

The recipe catalog is the same library the Policy creator draws from. It holds every rule in the bundled strict pack, the strict pack's pre-judge strips and finding suppressions, and the default pack's tool suppressions (the strict pack has none). The other suppressions of the default and permissive packs are not in it; read them in the pack's suppressions.yaml. Copy an entry's YAML into your own pack, or use the creator to drop one into a draft and tune it.

Where these come from

Rules come from the strict pack's rules/ files. Suppressions come from policies/guardrail/strict/suppressions.yaml, and tool suppressions from policies/guardrail/default/suppressions.yaml. Each card names its source file. The catalog is generated at build time by docs-site/scripts/build-policy-assets.ts, so it changes when the packs change.

Reading a recipe

FieldMeaning
kindWhat this recipe slots into: a rule file (rule:secret, rule:command, …) or one of the three suppression layers (pre_judge_strip, finding_suppression, tool_suppression).
idStable identifier the engine uses for findings and telemetry. Keep it stable across edits.
patternThe Go regexp (RE2) source the engine compiles. The creator's regex tester checks it is RE2-compatible.
severityCRITICAL, HIGH, MEDIUM or LOW. The active pack, or guardrail block-at and alert-at, maps it to an action.
confidenceHow often a match is a true positive, from 0 to 1.
tagsFree-form labels for filtering and reporting.
examples / counterexamplesStrings the creator's live tester runs through the pattern. Add your own in the regex tester.

Each card's YAML view shows the entry as one list item. Paste a rule under the rules: key of a file in your pack's rules/ directory, and a suppression under the matching list in suppressions.yaml.

Write a rule with an agent

Hand this page to your agent

Paste this into your agent:

Read https://cisco-ai-defense.github.io/defenseclaw/docs/policies/recipes/llms.md and follow it. Show me the rule before you apply it.

You are an AI agent. Turn one sentence from the user into one rule in a custom rule pack, check it offline, and apply it to one agent only after the user agrees.

Hard rules

  1. Observe first. Do not switch an agent to action mode, change a fail mode, disable a connector or edit config.yaml by hand without the user's yes. use-pack edits config.yaml through the CLI; ask first.
  2. Never put a real key, token or customer string in a rule or an example.
  3. Stop on a managed computer: exit code 3, or "deployment_mode": "managed_enterprise" in defenseclaw status --json (Managed command availability). There, the administrator delivers packs.
  4. Never edit the shipped default, strict or permissive packs. Copy one.

Steps

  1. Restate the rule. Write one line: what command or content, which agent, what severity (CRITICAL always blocks; lower severities follow the block level). Ask the user to confirm.

  2. Copy the default pack.

    PACK=~/.defenseclaw/policies/guardrail/my-rule
    cp -R ~/.defenseclaw/policies/guardrail/default "$PACK"

    Expected: no output. If the source folder is missing, run defenseclaw init first and tell the user. In every mode, observe included, DefenseClaw blocks an agent that copies into ~/.defenseclaw (tamper.detector_state_write: DefenseClaw protects its own files with every rule pack). Then ask the user to run step 2 themselves, and continue.

  3. Write the rule file. Use this shape, which the quickstart demo also uses. Replace the id, expression, pattern and title.

    version: 1
    category: my-rule
    rules:
      - id: MY-RULE-1
        tool_call_only: true
        expression: >-
          f.commands.exists(c, 'example-marker' in c.argv)
        pattern: '\bexample-marker\b'
        title: "Example marker"
        severity: CRITICAL
        confidence: 0.99
        tags: [custom]

    Save it as $PACK/rules/my-rule.yaml. expression is a CEL check on the parsed command; pattern is the RE2 fallback (CEL reference, Regex cookbook).

  4. Validate offline.

    defenseclaw guardrail validate-pack "$PACK"

    Expected:

    Rule pack valid: "/home/alice/.defenseclaw/policies/guardrail/my-rule"
      rules: 240/244 enabled across 8 files
      components: judges=4 judge_categories=23 local_patterns=11 suppressions=9 sensitive_tools=6
      digest: b8f9…13e9e0
      files digest: 4b04…8fa71b (the guardrail.custom_packs pin)

    If it prints Rule pack invalid and exits 1: the next line is <code> at <file>: <reason>. Fix that file and repeat. Do not apply an invalid pack.

  5. Show the user the rule and the digest. Ask: "Apply this to <agent> only?"

  6. Apply to one agent, after the user says yes.

    defenseclaw guardrail use-pack my-rule --connector <agent>

    Expected: the pack is validated, its digest pinned in guardrail.custom_packs.my-rule, and the agent switched to it. The gateway reloads without a restart. If it differs: quote the message. Do not edit config.yaml by hand.

  7. Check.

    defenseclaw guardrail list-packs
    defenseclaw doctor

    Expected: list-packs shows <agent> using my-rule; doctor shows no new [FAIL]. Optionally ask the user to run the matching command in the agent in observe mode and look at defenseclaw alerts --limit 5. The rule blocks only when that agent is in action mode; that switch is the user's decision.

  8. To undo: defenseclaw guardrail use-pack --clear --connector <agent>.

Report

Reply with:

  • The user's sentence and the rule you wrote (the YAML).
  • The validate-pack result and digest.
  • The agent it applies to and whether that agent is in observe or action mode.
  • The undo command.

Browse the recipes

Showing 24 of 265 recipes.
  • webhook.site (known exfil)rule:c2
    RECIPE-C2-WEBHOOK-SITE
    egress_external

    Pattern shipped in the bundled strict rule pack (c2.yaml). Severity HIGH.

    YAML
    - id: C2-WEBHOOK-SITE
      pattern: (?i)(?:^|[^a-zA-Z0-9-])webhook\.site(?:[^a-zA-Z0-9.-]|$)
      title: webhook.site (known exfil)
      severity: HIGH
      confidence: 0.9
      tags:
        - exfiltration
        - c2
    
    policies/guardrail/strict/rules/c2.yaml
  • ngrok tunnel (exfil risk)rule:c2
    RECIPE-C2-NGROK
    egress_external

    Pattern shipped in the bundled strict rule pack (c2.yaml). Severity HIGH.

    YAML
    - id: C2-NGROK
      pattern: (?i)(?:^|[^a-zA-Z0-9-])(?:ngrok\.io|ngrok-free\.app)(?:[^a-zA-Z0-9.-]|$)
      title: ngrok tunnel (exfil risk)
      severity: HIGH
      confidence: 0.85
      tags:
        - exfiltration
        - c2
    
    policies/guardrail/strict/rules/c2.yaml
  • Pipedream (known exfil)rule:c2
    RECIPE-C2-PIPEDREAM
    egress_external

    Pattern shipped in the bundled strict rule pack (c2.yaml). Severity HIGH.

    YAML
    - id: C2-PIPEDREAM
      pattern: (?i)pipedream\.net
      title: Pipedream (known exfil)
      severity: HIGH
      confidence: 0.9
      tags:
        - exfiltration
        - c2
    
    policies/guardrail/strict/rules/c2.yaml
  • RequestBin (known exfil)rule:c2
    RECIPE-C2-REQUESTBIN
    egress_external

    Pattern shipped in the bundled strict rule pack (c2.yaml). Severity HIGH.

    YAML
    - id: C2-REQUESTBIN
      pattern: (?i)requestbin\.com
      title: RequestBin (known exfil)
      severity: HIGH
      confidence: 0.9
      tags:
        - exfiltration
        - c2
    
    policies/guardrail/strict/rules/c2.yaml
  • HookBin (known exfil)rule:c2
    RECIPE-C2-HOOKBIN
    egress_external

    Pattern shipped in the bundled strict rule pack (c2.yaml). Severity HIGH.

    YAML
    - id: C2-HOOKBIN
      pattern: (?i)hookbin\.com
      title: HookBin (known exfil)
      severity: HIGH
      confidence: 0.9
      tags:
        - exfiltration
        - c2
    
    policies/guardrail/strict/rules/c2.yaml
  • Burp Collaborator (pentest C2)rule:c2
    RECIPE-C2-BURP
    egress_external

    Pattern shipped in the bundled strict rule pack (c2.yaml). Severity HIGH.

    YAML
    - id: C2-BURP
      pattern: (?i)burpcollaborator\.net
      title: Burp Collaborator (pentest C2)
      severity: HIGH
      confidence: 0.9
      tags:
        - exfiltration
        - c2
    
    policies/guardrail/strict/rules/c2.yaml
  • interact.sh (OOB exfil)rule:c2
    RECIPE-C2-INTERACTSH
    egress_external

    Pattern shipped in the bundled strict rule pack (c2.yaml). Severity HIGH.

    YAML
    - id: C2-INTERACTSH
      pattern: (?i)interact\.sh
      title: interact.sh (OOB exfil)
      severity: HIGH
      confidence: 0.9
      tags:
        - exfiltration
        - c2
    
    policies/guardrail/strict/rules/c2.yaml
  • oast.fun (OOB testing)rule:c2
    RECIPE-C2-OAST
    egress_external

    Pattern shipped in the bundled strict rule pack (c2.yaml). Severity HIGH.

    YAML
    - id: C2-OAST
      pattern: (?i)(?:^|[^a-zA-Z0-9-])oast\.fun(?:[^a-zA-Z0-9.-]|$)
      title: oast.fun (OOB testing)
      severity: HIGH
      confidence: 0.85
      tags:
        - exfiltration
        - c2
    
    policies/guardrail/strict/rules/c2.yaml
  • Canary Tokensrule:c2
    RECIPE-C2-CANARY
    egress_external

    Pattern shipped in the bundled strict rule pack (c2.yaml). Severity MEDIUM.

    YAML
    - id: C2-CANARY
      pattern: (?i)canarytokens\.com
      title: Canary Tokens
      severity: MEDIUM
      confidence: 0.75
      tags:
        - exfiltration
        - c2
    
    policies/guardrail/strict/rules/c2.yaml
  • Pastebin raw fetchrule:c2
    RECIPE-C2-PASTEBIN
    egress_external

    Pattern shipped in the bundled strict rule pack (c2.yaml). Severity MEDIUM.

    YAML
    - id: C2-PASTEBIN
      pattern: (?i)pastebin\.com/raw/
      title: Pastebin raw fetch
      severity: MEDIUM
      confidence: 0.7
      tags:
        - exfiltration
        - c2
    
    policies/guardrail/strict/rules/c2.yaml
  • AWS metadata endpoint (SSRF)rule:c2
    RECIPE-C2-METADATA-AWS
    sensitive_accessegress_external

    Pattern shipped in the bundled strict rule pack (c2.yaml). Severity CRITICAL.

    YAML
    - id: C2-METADATA-AWS
      expression: f.commands.exists(c, c.argv_complete && defenseclaw.guardrail.semantic.v1.OperationKind.OPERATION_KIND_FETCH in c.operations && f.network.exists(n, n.command_id == c.id && n.action in [defenseclaw.guardrail.semantic.v1.NetworkAction.NETWORK_ACTION_DOWNLOAD, defenseclaw.guardrail.semantic.v1.NetworkAction.NETWORK_ACTION_CONNECT]))
      pattern: 169\.254\.169\.254
      title: AWS metadata endpoint (SSRF)
      severity: CRITICAL
      confidence: 0.95
      tags:
        - ssrf
        - credential
    
    policies/guardrail/strict/rules/c2.yaml
  • GCP metadata endpoint (SSRF)rule:c2
    RECIPE-C2-METADATA-GCP
    sensitive_accessegress_external

    Pattern shipped in the bundled strict rule pack (c2.yaml). Severity CRITICAL.

    YAML
    - id: C2-METADATA-GCP
      pattern: (?i)(?:^|[^a-zA-Z0-9-])metadata\.google\.internal(?:[^a-zA-Z0-9.-]|$)
      title: GCP metadata endpoint (SSRF)
      severity: CRITICAL
      confidence: 0.95
      tags:
        - ssrf
        - credential
    
    policies/guardrail/strict/rules/c2.yaml
  • Azure metadata endpoint (SSRF)rule:c2
    RECIPE-C2-METADATA-AZURE
    sensitive_accessegress_external

    Pattern shipped in the bundled strict rule pack (c2.yaml). Severity CRITICAL.

    YAML
    - id: C2-METADATA-AZURE
      pattern: 169\.254\.169\.254/metadata
      title: Azure metadata endpoint (SSRF)
      severity: CRITICAL
      confidence: 0.95
      tags:
        - ssrf
        - credential
    
    policies/guardrail/strict/rules/c2.yaml
  • AWS metadata endpoint (hex-encoded SSRF)rule:c2
    RECIPE-C2-METADATA-HEX
    sensitive_accessegress_external

    Pattern shipped in the bundled strict rule pack (c2.yaml). Severity CRITICAL.

    YAML
    - id: C2-METADATA-HEX
      pattern: (?i)0xa9fea9fe
      title: AWS metadata endpoint (hex-encoded SSRF)
      severity: CRITICAL
      confidence: 0.95
      tags:
        - ssrf
        - credential
    
    policies/guardrail/strict/rules/c2.yaml
  • AWS metadata endpoint (decimal-encoded SSRF)rule:c2
    RECIPE-C2-METADATA-DECIMAL
    sensitive_accessegress_external

    Pattern shipped in the bundled strict rule pack (c2.yaml). Severity CRITICAL.

    YAML
    - id: C2-METADATA-DECIMAL
      pattern: (?:^|[/])2852039166(?:$|[/])
      title: AWS metadata endpoint (decimal-encoded SSRF)
      severity: CRITICAL
      confidence: 0.93
      tags:
        - ssrf
        - credential
    
    policies/guardrail/strict/rules/c2.yaml
  • AWS metadata endpoint (octal-encoded SSRF)rule:c2
    RECIPE-C2-METADATA-OCTAL
    sensitive_accessegress_external

    Pattern shipped in the bundled strict rule pack (c2.yaml). Severity CRITICAL.

    YAML
    - id: C2-METADATA-OCTAL
      pattern: 0251\.0376\.0251\.0376
      title: AWS metadata endpoint (octal-encoded SSRF)
      severity: CRITICAL
      confidence: 0.93
      tags:
        - ssrf
        - credential
    
    policies/guardrail/strict/rules/c2.yaml
  • DNS TXT query with high-entropy label (tunneling indicator)rule:c2
    RECIPE-C2-DNS-TUNNEL
    egress_external

    Pattern shipped in the bundled strict rule pack (c2.yaml). Severity HIGH.

    YAML
    - id: C2-DNS-TUNNEL
      pattern: (?i)\b(?:dig|host|nslookup|drill)\b\s+[^;\n]*\$\((?:whoami|hostname|id(?:\s+-u)?|cat\s+(?:/etc/hostname|/etc/machine-id))\)[A-Za-z0-9._-]*\.[A-Za-z0-9-]+(?:\.[A-Za-z0-9-]+)+
      title: DNS TXT query with high-entropy label (tunneling indicator)
      severity: HIGH
      confidence: 0.78
      tags:
        - exfiltration
        - dns-tunnel
    
    policies/guardrail/strict/rules/c2.yaml
  • nslookup with hex subdomain (DNS exfil)rule:c2
    RECIPE-C2-DNS-EXFIL
    egress_external

    Pattern shipped in the bundled strict rule pack (c2.yaml). Severity HIGH.

    YAML
    - id: C2-DNS-EXFIL
      pattern: (?i)\bnslookup\b\s+[a-f0-9]{8,}\.\w+\.
      title: nslookup with hex subdomain (DNS exfil)
      severity: HIGH
      confidence: 0.8
      tags:
        - exfiltration
        - dns-tunnel
    
    policies/guardrail/strict/rules/c2.yaml
  • SOUL.md active-file mutationrule:cognitive-file
    RECIPE-COG-SOUL
    sensitive_access

    Pattern shipped in the bundled strict rule pack (cognitive.yaml). Severity CRITICAL.

    YAML
    - id: COG-SOUL
      tool_call_only: true
      expression: f.paths.exists(p, p.access in [defenseclaw.guardrail.semantic.v1.PathAccess.PATH_ACCESS_WRITE, defenseclaw.guardrail.semantic.v1.PathAccess.PATH_ACCESS_APPEND, defenseclaw.guardrail.semantic.v1.PathAccess.PATH_ACCESS_DELETE])
      pattern: (?i)SOUL\.md
      title: SOUL.md active-file mutation
      severity: CRITICAL
      confidence: 0.95
      tags:
        - cognitive-tampering
    
    policies/guardrail/strict/rules/cognitive.yaml
  • IDENTITY.md active-file mutationrule:cognitive-file
    RECIPE-COG-IDENTITY
    sensitive_access

    Pattern shipped in the bundled strict rule pack (cognitive.yaml). Severity CRITICAL.

    YAML
    - id: COG-IDENTITY
      tool_call_only: true
      expression: f.paths.exists(p, p.access in [defenseclaw.guardrail.semantic.v1.PathAccess.PATH_ACCESS_WRITE, defenseclaw.guardrail.semantic.v1.PathAccess.PATH_ACCESS_APPEND, defenseclaw.guardrail.semantic.v1.PathAccess.PATH_ACCESS_DELETE])
      pattern: (?i)IDENTITY\.md
      title: IDENTITY.md active-file mutation
      severity: CRITICAL
      confidence: 0.95
      tags:
        - cognitive-tampering
    
    policies/guardrail/strict/rules/cognitive.yaml
  • MEMORY.md mutation or referencerule:cognitive-file
    RECIPE-COG-MEMORY
    sensitive_access

    Pattern shipped in the bundled strict rule pack (cognitive.yaml). Severity HIGH.

    YAML
    - id: COG-MEMORY
      expression: f.paths.exists(p, p.access in [defenseclaw.guardrail.semantic.v1.PathAccess.PATH_ACCESS_WRITE, defenseclaw.guardrail.semantic.v1.PathAccess.PATH_ACCESS_APPEND, defenseclaw.guardrail.semantic.v1.PathAccess.PATH_ACCESS_DELETE])
      pattern: (?i)MEMORY\.md
      title: MEMORY.md mutation or reference
      severity: HIGH
      confidence: 0.85
      tags:
        - cognitive-tampering
    
    policies/guardrail/strict/rules/cognitive.yaml
  • CLAUDE.md active-file mutationrule:cognitive-file
    RECIPE-COG-CLAUDE-MD
    sensitive_access

    Pattern shipped in the bundled strict rule pack (cognitive.yaml). Severity HIGH.

    YAML
    - id: COG-CLAUDE-MD
      tool_call_only: true
      expression: f.paths.exists(p, p.access in [defenseclaw.guardrail.semantic.v1.PathAccess.PATH_ACCESS_WRITE, defenseclaw.guardrail.semantic.v1.PathAccess.PATH_ACCESS_APPEND, defenseclaw.guardrail.semantic.v1.PathAccess.PATH_ACCESS_DELETE])
      pattern: (?i)CLAUDE\.md
      title: CLAUDE.md active-file mutation
      severity: HIGH
      confidence: 0.85
      tags:
        - cognitive-tampering
    
    policies/guardrail/strict/rules/cognitive.yaml
  • TOOLS.md active-file mutationrule:cognitive-file
    RECIPE-COG-TOOLS-MD
    sensitive_access

    Pattern shipped in the bundled strict rule pack (cognitive.yaml). Severity HIGH.

    YAML
    - id: COG-TOOLS-MD
      tool_call_only: true
      expression: f.paths.exists(p, p.access in [defenseclaw.guardrail.semantic.v1.PathAccess.PATH_ACCESS_WRITE, defenseclaw.guardrail.semantic.v1.PathAccess.PATH_ACCESS_APPEND, defenseclaw.guardrail.semantic.v1.PathAccess.PATH_ACCESS_DELETE])
      pattern: (?i)TOOLS\.md
      title: TOOLS.md active-file mutation
      severity: HIGH
      confidence: 0.8
      tags:
        - cognitive-tampering
    
    policies/guardrail/strict/rules/cognitive.yaml
  • AGENTS.md active-file mutationrule:cognitive-file
    RECIPE-COG-AGENTS-MD
    sensitive_access

    Pattern shipped in the bundled strict rule pack (cognitive.yaml). Severity HIGH.

    YAML
    - id: COG-AGENTS-MD
      tool_call_only: true
      expression: f.paths.exists(p, p.access in [defenseclaw.guardrail.semantic.v1.PathAccess.PATH_ACCESS_WRITE, defenseclaw.guardrail.semantic.v1.PathAccess.PATH_ACCESS_APPEND, defenseclaw.guardrail.semantic.v1.PathAccess.PATH_ACCESS_DELETE])
      pattern: a^
      title: AGENTS.md active-file mutation
      severity: HIGH
      confidence: 0.8
      tags:
        - cognitive-tampering
    
    policies/guardrail/strict/rules/cognitive.yaml