What is a Policy Rule?
A policy rule is a single rule within a policy file that specifies an action (allow, deny, or log) for a specific tool or tool pattern, optionally with argument constraints that must be satisfied for the rule to match.
WHY IT MATTERS
Rules are the atomic unit of policy. Each rule answers a precise question: "When an agent tries to call this tool with these arguments, what should happen?" This granularity is essential because blanket allow/deny decisions are rarely sufficient. You might want to allow an agent to create Stripe charges under £100 but deny charges above that threshold — that requires a rule with a condition, not a binary permission.
Rules follow a match-then-act pattern familiar from firewall rules, iptables, and security group configurations. When a tool call arrives, Intercept evaluates rules in priority order, finds the first matching rule, and applies its action. This deterministic evaluation model means you can reason about policy behaviour without running the system — critical for security review and compliance.
The expressiveness of rules comes from combining tool patterns with argument conditions. A rule can target a single tool by exact name, a group of tools by glob pattern (e.g. read_*), or all tools on a server. Conditions can compare argument values against literals, check types, validate string patterns, and enforce numerical bounds. This covers the vast majority of real-world policy requirements without requiring a full programming language.
HOW POLICYLAYER USES THIS
In Intercept, each rule is a YAML block within a policy file specifying: the tool name or pattern to match, an optional list of conditions on tool arguments, and the action to take (allow, deny, or log). Rules are evaluated in priority order — the first matching rule wins. Intercept's rule engine supports exact matches, glob patterns, comparison operators for numeric and string conditions, and boolean logic for combining multiple conditions.