Skip to main content
Every rule belongs to one rule set. A rule set is a named, ordered group of rules in a program. Sets run in order, and the rules inside each set run in order. Rule sets organize execution. They do not enable or disable their rules. Every applicable ACTIVE rule across every rule set participates when Scrip processes an event. This example has three rule sets after the program’s default set, which is empty here:
  • tracking has two rules: Track monthly spend, then Mark threshold crossing.
  • earning has two rules: Dining cashback, then Base cashback.
  • maintenance has one rule: Monthly reset.
Scrip runs those sets in that order, and the rules in each set in order. Dining cashback has stop_after_match: true, so a match skips Base cashback. Monthly reset still runs because it belongs to maintenance.

The default rule set

Each program has an automatically created rule set with key default. The default set starts at position 1. Creating another set appends it unless you send a position. You can omit rule_set_id when you create a rule. Scrip assigns the new rule to the program’s default set. Omitting the field when you update a rule preserves its current assignment.
The default set behaves like any other rule set during execution. Its key does not make it run first. Its order determines its position.

Create and inspect rule sets

Create a rule set under its program:
The key is a stable program-scoped identifier. It must start with a lowercase letter and contain only lowercase letters, numbers, hyphens, or underscores. A rule set’s name and position can change, but its key cannot. List a program’s sets in execution order:
Get or update a set by ID:
To place a set, send position the same way you do on create. To reorder every set in one request, use PUT /v1/programs/{program_id}/rule-sets/order; see Managing rule configuration. Rule sets cannot be deleted or archived. Keep keys stable and use names to describe their current purpose. See the Rule sets API reference for all fields and error responses.

Assign and move rules

Pass rule_set_id when you create a rule:
If you omit position, Scrip appends the rule to the selected set. If you omit rule_set_id, Scrip selects default before assigning the position. To move a rule into another set or change its position, use POST /v1/rules/{rule_id}/move. Send the program’s current rule_configuration_version, which Read the current configuration returns, as expected_rule_configuration_version. If someone else changed the rules first, the move fails with 409 rule_configuration_version_conflict instead of overwriting their change. See Move or reorder.

Execution order

Scrip builds one fixed sequence for each event:
  1. Rule sets sort by rule_set.order, lowest first.
  2. ACTIVE rules within each set sort by rule.order, lowest first.
  3. Scrip saves the actions of matching rules in that set and rule order.
All currently applicable ACTIVE rules across all sets participate. A lower set position changes when a set runs, not whether another set runs. Scrip numbers both order fields 1..N with no gaps. order is read-only: you place things with position, and Scrip returns the resulting order. ACTIVE and SUSPENDED rules occupy unique positions within their containing set. Archived rules leave the sequence. For example, with the empty default set at position 1: The two tracking rules run before the two earning rules. Dining cashback can use stop_after_match to skip Base cashback, but it cannot skip a tracking rule or a rule in any other set.

Set-local stopping

When a matching rule has stop_after_match: true and its actions execute successfully, Scrip skips only the remaining rules in that same set. Processing continues with the next set. This makes one set a useful boundary for mutually exclusive rules. Put dining, grocery, and base earn-rate rules in one earning set. A dining match can stop the other earning rules while tracking, maintenance, or notification rules in other sets still participate. stop_after_match does not stop earlier rules. It also does not undo actions that already ran. A skipped execution does not trigger the stop. For example, when a rule exceeds its budget, its actions roll back and processing continues with the next rule in the same set. Two mutually exclusive earn rates in one set:
VIPs get 10x because the first rule matches and stops the rest of the set. Everyone else gets 2x because the first rule does not match. Applicable rules in other sets still run for both participants.

One event-start snapshot

Every rule condition and action expression in an event reads participant, group, and program state as it was when processing started. A change a rule makes shows in the next event, not in later rules or actions of the same event. See State snapshot evaluation. The snapshot is shared across every rule set, so a counter incremented by an earlier set is not visible to a later set. See State snapshot evaluation for the threshold-crossing pattern.

Event traces

GET /v1/events/{event_id} and GET /v1/events/{event_id}/impact return the event’s rule evaluations. Each one has the rule_set_id of the set the rule was in when it ran, and they are listed in the set and rule order of that moment. The trace lists only the rules that left a record. A rule whose condition is false has no entry. Rules that a stop_after_match skips have no entry either, and processing continues with the next set. See Get an event for skipped-evaluation filtering. A rule configuration simulation lists every rule, including the ones a stop skipped. Use the trace to identify the set that contained a rule when it ran. Moving a rule later does not change the rule_set_id on evaluations already recorded.

Simulation boundaries

Single-rule simulation cannot prove set order or set-local stop_after_match. See Test a full configuration. Use a small number of sets with distinct responsibilities: The Cashback card example shows two named sets executing after an intentionally empty default set while the earn-rate rules remain mutually exclusive.

Cashback card

Full walkthrough using tracking and earning rule sets together.

Rule configuration

Preview, apply, analyze, and roll back multi-rule changes atomically.

Writing rules

Conditions, budgets, windows, and state snapshot evaluation.