What is Policy Priority?
Policy priority is the order in which policies are evaluated when multiple rules could match a tool call, with higher-priority rules overriding lower-priority ones to produce a deterministic decision.
WHY IT MATTERS
In any non-trivial policy configuration, multiple rules will match the same tool call. A server-level default says "log all tools." A tool-level rule says "deny create_charge when amount > 1000." Another tool-level rule says "allow create_charge when currency == GBP." When an agent calls create_charge with amount: 500 and currency: GBP, which rule wins?
Priority resolves this ambiguity deterministically. Every rule has a priority (explicit or implicit), and Intercept evaluates rules in priority order. The first matching rule produces the final decision. This "first match wins" model is familiar from firewall rules, CSS specificity, and routing tables — it is predictable and well-understood.
Implicit priority follows the specificity principle: tool-level rules are more specific than server-level defaults, which are more specific than global rules. Within the same level, rules are evaluated in the order they appear in the policy file. Explicit priority values can override this default ordering when needed, giving policy authors full control over evaluation order.
HOW POLICYLAYER USES THIS
Intercept assigns priority to rules based on specificity (tool > server > global) and file order. You can assign explicit priority values to override the default ordering. During evaluation, Intercept sorts matching rules by priority and applies the first match. The decision log records the full sorted rule list and which rule was selected, making priority resolution transparent and debuggable.