Skip to content

Multiple Rules

A single policy can contain multiple rules. The last rule in the set is the “golden rule” — the one whose result determines the overall outcome. A single policy can contain multiple rules. The “golden rule” is the rule that everything evaluates to.

The Golden Rule

When a policy has multiple rules, the engine evaluates them in order of result. The golden rule is the one that produces the final result. Earlier rules exist as building blocks.

# Sub-rule 1
A **user** passes the age check
if __age__ of **user** is greater than or equal to 18.
# Sub-rule 2
A **user** passes the status check
if __status__ of **user** is equal to "active".
# Golden rule
A **user** is eligible
if the **user** passes the age check
and the **user** passes the status check.

Interactive Example

Policy Rule
Test Data (JSON)

Rule References

The golden rule references sub-rules using the pattern:

the **selector** outcome_verb outcome_value

For example, the **user** passes the age check references the rule “A user passes the age check”.

Using Labels

You can also use labels to reference sub-rules:

ageCheck. A **user** passes the age check
if __age__ of **user** is greater than or equal to 18.
statusCheck. A **user** passes the status check
if __status__ of **user** is equal to "active".
A **user** is eligible
if §ageCheck passes
and §statusCheck passes.

Interactive Example

Policy Rule
Test Data (JSON)

Benefits of Multi-Rule Policies

  • Readability — each rule focuses on one check
  • Reusability — sub-rules can be referenced by multiple golden rules
  • Debugging — the trace shows which sub-rule passed or failed
  • Maintainability — change one sub-rule without touching others