Rule Types
Counter Rules
Count and limit occurrences within a planning period.Working Days
Limit total working days:Days Idle
Ensure minimum days off:Weekends Idle
Guarantee free weekends:Requires weekend definition in options to specify what constitutes a weekend.
Shift Type Limits
Limit specific shift types using tags:Maximum Consecutive Days
Cap the number of consecutive working days:Counter Types
DAYS_IDLE and WEEKENDS_IDLE require a period (either a fixed from/to range or a duration) to be specified — without one, the rule is silently ignored and never affects the schedule.Period Scoping
By default, rules apply to the entire planning period. Scope rules to specific periods:Fixed Period
Fixed-Length Windows
period.duration splits the planning horizon into consecutive, non-overlapping blocks of the given length, starting at the horizon’s start date (e.g. P3D over a 14-day horizon produces four 3-day blocks plus one 2-day clamped block). Each block is scored independently:
Sequence Rules
Limit consecutive occurrences without specifying a period window.Consecutive Working Days
Employees work between 2 and 4 consecutive days before a day off.
Maximum Consecutive Days
Conditional Rules
Trigger a rule when another rule’s threshold is exceeded. Example: If 20+ hours of night shifts within 72 hours, then require 2 days idle:max to trigger on “N or more”; use min to trigger on “fewer than N”.
Rule Properties
string
required
Rule type:
COUNTER or SEQUENCEstring
required
What to count or sequence (see tables above)
integer
Minimum count or sequence length
integer
Maximum count or sequence length
array
Filter rule to specific shift tags
object
Time scope with
from/to dates, or a fixed-length duration that tiles the planning horizon into non-overlapping blocksRule
Conditional rule triggered when this rule is exceeded. The
then rule always inherits the parent rule’s resolved period window (including any rolling-window expansion); any period set directly on the then object is ignored.Common Rule Patterns
40-hour work week
40-hour work week
Maximum 5 consecutive days
Maximum 5 consecutive days
At least 2 weekends off per month
At least 2 weekends off per month
Max 2 night shifts per week
Max 2 night shifts per week