Skip to main content
Conditions determine whether a policy matches. A policy can use either a typed native condition tree or Rego, never both.

Condition shapes

A condition tree contains exactly one of the following shapes at each node. all and any accept 1–64 children. Trees support at most 16 levels and 512 total nodes. Session-aware shapes are available only to Content policies.

Operators

Operators are type-checked when the policy is saved. Forge does not coerce strings into numbers, booleans, or collections. matches uses a regular-expression string. exists requires no value and matches only when the field is present and non-null. A missing field causes other comparisons to return false; it is not treated as an empty value. Regular expressions are limited to 1,024 bytes.

Content fields

Content facts are supplied by the enforcing surface. A field is omitted when that surface cannot observe it. Registered custom Content fields extend tool.input with a field name, label, value type, and source provenance. Forge validates their descriptors and makes them available to the same native condition engine. The response checkpoint depends on the routed API surface and its response adapter.

Access fields

The complete enums for account, classification, route, and local-model posture are exposed by the policy schema used by the Console, API, and Terraform provider.

Session conditions

Windows use a positive duration such as 5m, 2h, or 7d and cannot exceed 30 days.
Count shapes accept exactly one of eq, gt, gte, lt, or lte, with an integer threshold from 0–1,024. hasEventSequence.ordered controls whether the specified events must appear in the same order. These operators inspect prior events made available to the evaluation; they do not query arbitrary historical data.

Exceptions

except uses the same native condition grammar as conditions. Forge evaluates it only after the primary condition matches. A matching exception suppresses the policy hit; it cannot independently create an allow decision or override another policy.