← All examples
05

Canonical Grid model

Rulebook Operations

Rulebook coverage: WHEN reactions, EVERY/AT schedules, and ONCE seeding.

Scale
Medium
Source
05-rulebook-operations.grid
Length
52 lines
Collection
Live data & operations
Level
Intermediate
Runtime
Rules runtime
Version
1.1.0

Watch it in Grid

See this model in motion.

Watch the model respond in the product, then inspect the exact source and checkpoints on this page.

Companion film

Rules that act

Cross an operating threshold and see the model escalate review work automatically.

19 secGrid 0.61.0
Open film page

What this model gives you

An operational playbook with reactive conditions, sticky writes, interval and cron schedules, and a one-shot close.

25 min to study · Source reviewed 2026-08-24

Continue with guided practice

What to notice

  • Predicate rules and a transition challenge
  • Atomic range writes
  • Durable rule state
  • Missed-run policy

Requirements

  • Resident rules runtime
  • Host clock for schedules
  • No connector or network

Expected checkpoint

A known state for this walkthrough.

After first evaluation, before a reactive rule or recurring schedule fires. The dated G1:G2 one-shot remains blank only before its declared moment.

Flow status
normalB1
Gap status
steadyB2
Combined status
steady-flowB3
Reactive targets
C1:F2 BLANKUntil their first trigger or tick
01 · Observe

Formulas describe current conditions

Three derived statuses always follow their authored source values.

02 · Act

Rule writes record durable facts

Predicate and range actions commit atomically and remain after the trigger clears.

03 · Schedule

Every timer states its downtime contract

SKIP MISSED, BACKFILL, and ONCE make recurrence and restart behavior explicit.

05-rulebook-operations.grid
Get Grid
MODEL "Rulebook Operations"
DESCRIPTION "Rulebook coverage: WHEN reactions, EVERY/AT schedules, and ONCE seeding."
VERSION "1.1.0"
AUTHOR "Grid Team"
TAGS "canonical", "ts", "rules", "schedules"

# Inputs
A1 = 0
A2 = 0
A3 = FALSE
A4 = 0pct
A5 = "clear"

# Derived status
B1 = A3 THEN "frozen" ELSE A2 > 0 THEN "incident" ELSE "normal"
B2 = A4 > 5pct THEN "gap-open" ELSE "steady"
B3 = A1 > 100 THEN "heavy-flow" ELSE "steady-flow"

# Capture the model's first successful evaluation and retain it across reloads.
H1 = NOW() ONCE

# Reactive rules
WHEN A1 > 100 AND A3 = FALSE THEN
  C1 = "risk-review"
  C2 = NOW()
END

WHEN A2 > 0 OR A5 = "degraded" THEN
  C3 = "ops-paged"
  C4 = NOW()
END

WHEN A4 > 5pct THEN
  D1:D3 = ROW_INDEX
END

EVERY duration"PT15M" SKIP MISSED THEN
  E1 = E1 + 1
  E2 = NOW()
END

EVERY cron"0 * * * *" BACKFILL THEN
  F1 = F1 + 1
  F2 = "hourly-reconciliation"
END

AT dt"2026-12-31T23:59:00Z" BACKFILL THEN
  G1 = TRUE
  G2 = "year-end-close"
END

END MODEL