Limits and thresholds
Amounts must stay inside limits that depend on context: the channel, the customer's tier, the size of the request. Set too tight, limits create manual work; too loose, they create losses. This example decides which refunds a retailer pays out at once and which a person approves.
How this runs
Every result on this page is the recorded run of the rulebook below through the Helixor rule engine, case by case. In production a rulebook like this runs in a digital worker Available that you build and deploy in the console or with the agent command-line tools; console access is granted on request (email hello@helixor.ai). The rule language itself is described in Rules.
The policy#
| Channel | Standard customer | Gold customer |
|---|---|---|
| In store | up to 200 dollars | up to 400 dollars |
| Online | up to 150 dollars | up to 300 dollars |
| Phone | up to 100 dollars | up to 200 dollars |
A refund within its limit pays out at once. One over its limit is held for a supervisor; one over 1,000 dollars, whatever the channel, is held for a manager. A request that fraud screening flagged is declined and referred to the fraud team, and staff do not tell the customer about the screening. A guidance rule from customer experience suggests approving gold customers; policy outranks it.
What the rules decided#
Each row is one case run through the rulebook. The outcome is one of four; the deciding rule is the one whose recommendation won; derived facts show every criterion the rules established; and the last column lists the obligations and prohibitions that follow.
| Case | Outcome | Deciding rule | Derived facts | What follows |
|---|---|---|---|---|
| S1 A 120 dollar in-store refund for a standard customer. | APPROVE | RDEC04: A refund within its limit pays out at once. | WITHIN_LIMIT | none |
| S2 A 260 dollar in-store refund for a standard customer: over the 200 dollar limit. | HOLD | RDEC03: A refund over its limit is held for a supervisor. | OVER_LIMIT SUPERVISOR_APPROVAL | OBLIGATION_SUPERVISOR_APPROVAL |
| S3 The same 260 dollar refund for a gold customer: within the 400 dollar limit. | APPROVE | RDEC04: A refund within its limit pays out at once. | WITHIN_LIMIT LOYALTY_APPROVAL_SUGGESTED | none |
| S4 A 450 dollar in-store refund for a gold customer: over the 400 dollar limit. | HOLD | RDEC03: A refund over its limit is held for a supervisor. (overrides RGDN01) | LOYALTY_APPROVAL_SUGGESTED OVER_LIMIT SUPERVISOR_APPROVAL | OBLIGATION_SUPERVISOR_APPROVAL |
| S5 A 140 dollar phone refund for a standard customer: over the 100 dollar phone limit. | HOLD | RDEC03: A refund over its limit is held for a supervisor. | OVER_LIMIT SUPERVISOR_APPROVAL | OBLIGATION_SUPERVISOR_APPROVAL |
| S6 A 1500 dollar online refund for a gold customer. | HOLD | RDEC02: A large refund is held for a manager. (overrides RGDN01) | LARGE_REFUND LOYALTY_APPROVAL_SUGGESTED OVER_LIMIT MANAGER_REVIEW | OBLIGATION_MANAGER_REVIEW |
| S7 A small refund that fraud screening flagged. | DECLINE | RDEC01: Suspected fraud declines the refund. | WITHIN_LIMIT SUSPECTED_FRAUD | OBLIGATION_REFER_TO_FRAUD_TEAM PROHIBITION_DISCLOSE_FRAUD_SCREENING |
| S8 The channel was not recorded. | NEED_DATA | No rule ran: missing channel | none | none |
| Outcome | Means here |
|---|---|
APPROVE | The refund is within the limit for its channel and tier and pays out at once. |
HOLD | A person approves: a supervisor for an over-limit refund, a manager for a large one. |
DECLINE | Fraud screening flagged the request. |
NEED_DATA | The amount, channel, tier or screening result is missing. |
Compare the second and third cases: the same 260 dollar refund is held for a standard customer and approved for a gold one, because the limit is part of the context. In the fourth and sixth cases the guidance rule suggests approval and the result shows it overridden: policy outranks guidance, and the record says so.
The rulebook#
Every rule names its owner, its authority, how hard it is, and what it means in plain English, and binds to a typed vocabulary so a misspelled fact fails at load instead of silently never matching.
# Example refund limits rulebook in the Helixor rule language. # Fictional domain for helixor.dev: a retailer decides which refunds pay out at once and which a person approves. # Classes and predicates: ontology.json. Each case fact <name> reaches the rules as HAS_<NAME>, # carrying its value, and KNOWN_<NAME>, true when it has one. # Recommendations are resolved by @authority, then @priority, then decline > hold > approve. # ---------------------------------------------------------------- required data @domain retail_refunds @ontology example_refund_limits @ontology_ver 1 @authority policy @owner refund-policy @severity hard @category data @priority 100 @required_fact_mode explicit @required_facts [HAS_REFUND_AMOUNT, HAS_CHANNEL, HAS_CUSTOMER_TIER, HAS_FRAUD_FLAG] @english The request is complete when the amount, channel, customer tier and fraud screening result are known. @uses_predicates [hasRefundAmount, hasChannel, hasCustomerTier, hasFraudFlag] @uses_classes [RefundRequest, Customer] RDAT01: IF KNOWN_REFUND_AMOUNT AND KNOWN_CHANNEL AND KNOWN_CUSTOMER_TIER AND KNOWN_FRAUD_FLAG THEN FILE_COMPLETE # ---------------------------------------------------------------- the limit table: refunds that pay out at once @domain retail_refunds @ontology example_refund_limits @authority policy @owner refund-policy @severity hard @category limit @priority 100 @required_fact_mode explicit @required_facts [HAS_CHANNEL, HAS_CUSTOMER_TIER, HAS_REFUND_AMOUNT] @english A standard customer's store refund up to 200 dollars is within the limit. @uses_predicates [hasChannel, hasCustomerTier, hasRefundAmount] @uses_classes [RefundRequest, Customer] RLIM01: IF FILE_COMPLETE AND HAS_CHANNEL == STORE AND HAS_CUSTOMER_TIER == STANDARD AND HAS_REFUND_AMOUNT <= 200 THEN WITHIN_LIMIT @domain retail_refunds @ontology example_refund_limits @authority policy @owner refund-policy @severity hard @category limit @priority 100 @required_fact_mode explicit @required_facts [HAS_CHANNEL, HAS_CUSTOMER_TIER, HAS_REFUND_AMOUNT] @english A gold customer's store refund up to 400 dollars is within the limit. @uses_predicates [hasChannel, hasCustomerTier, hasRefundAmount] @uses_classes [RefundRequest, Customer] RLIM02: IF FILE_COMPLETE AND HAS_CHANNEL == STORE AND HAS_CUSTOMER_TIER == GOLD AND HAS_REFUND_AMOUNT <= 400 THEN WITHIN_LIMIT @domain retail_refunds @ontology example_refund_limits @authority policy @owner refund-policy @severity hard @category limit @priority 100 @required_fact_mode explicit @required_facts [HAS_CHANNEL, HAS_CUSTOMER_TIER, HAS_REFUND_AMOUNT] @english A standard customer's online refund up to 150 dollars is within the limit. @uses_predicates [hasChannel, hasCustomerTier, hasRefundAmount] @uses_classes [RefundRequest, Customer] RLIM03: IF FILE_COMPLETE AND HAS_CHANNEL == ONLINE AND HAS_CUSTOMER_TIER == STANDARD AND HAS_REFUND_AMOUNT <= 150 THEN WITHIN_LIMIT @domain retail_refunds @ontology example_refund_limits @authority policy @owner refund-policy @severity hard @category limit @priority 100 @required_fact_mode explicit @required_facts [HAS_CHANNEL, HAS_CUSTOMER_TIER, HAS_REFUND_AMOUNT] @english A gold customer's online refund up to 300 dollars is within the limit. @uses_predicates [hasChannel, hasCustomerTier, hasRefundAmount] @uses_classes [RefundRequest, Customer] RLIM04: IF FILE_COMPLETE AND HAS_CHANNEL == ONLINE AND HAS_CUSTOMER_TIER == GOLD AND HAS_REFUND_AMOUNT <= 300 THEN WITHIN_LIMIT @domain retail_refunds @ontology example_refund_limits @authority policy @owner refund-policy @severity hard @category limit @priority 100 @required_fact_mode explicit @required_facts [HAS_CHANNEL, HAS_CUSTOMER_TIER, HAS_REFUND_AMOUNT] @english A standard customer's phone refund up to 100 dollars is within the limit. @uses_predicates [hasChannel, hasCustomerTier, hasRefundAmount] @uses_classes [RefundRequest, Customer] RLIM05: IF FILE_COMPLETE AND HAS_CHANNEL == PHONE AND HAS_CUSTOMER_TIER == STANDARD AND HAS_REFUND_AMOUNT <= 100 THEN WITHIN_LIMIT @domain retail_refunds @ontology example_refund_limits @authority policy @owner refund-policy @severity hard @category limit @priority 100 @required_fact_mode explicit @required_facts [HAS_CHANNEL, HAS_CUSTOMER_TIER, HAS_REFUND_AMOUNT] @english A gold customer's phone refund up to 200 dollars is within the limit. @uses_predicates [hasChannel, hasCustomerTier, hasRefundAmount] @uses_classes [RefundRequest, Customer] RLIM06: IF FILE_COMPLETE AND HAS_CHANNEL == PHONE AND HAS_CUSTOMER_TIER == GOLD AND HAS_REFUND_AMOUNT <= 200 THEN WITHIN_LIMIT # ---------------------------------------------------------------- signals @domain retail_refunds @authority policy @owner refund-policy @severity hard @category limit @priority 100 @english A refund above the limit for its channel and tier is over the limit. RSIG01: IF FILE_COMPLETE AND NOT WITHIN_LIMIT THEN OVER_LIMIT @domain retail_refunds @ontology example_refund_limits @authority policy @owner refund-policy @severity hard @category limit @priority 100 @required_fact_mode explicit @required_facts [HAS_REFUND_AMOUNT] @english A refund over 1000 dollars is large, whatever the channel or tier. @uses_predicates [hasRefundAmount] @uses_classes [RefundRequest] RSIG02: IF FILE_COMPLETE AND HAS_REFUND_AMOUNT > 1000 THEN LARGE_REFUND @domain retail_refunds @ontology example_refund_limits @authority policy @owner refund-policy @severity hard @category screening @priority 100 @required_fact_mode explicit @required_facts [HAS_FRAUD_FLAG] @english A request flagged by fraud screening is suspected fraud. @uses_predicates [hasFraudFlag] @uses_classes [RefundRequest] RSIG03: IF FILE_COMPLETE AND HAS_FRAUD_FLAG == 1 THEN SUSPECTED_FRAUD # ---------------------------------------------------------------- recommendations @domain retail_refunds @authority policy @owner refund-policy @severity hard @category decision @priority 100 @english Suspected fraud declines the refund. RDEC01: IF SUSPECTED_FRAUD THEN RECOMMEND_DECLINE @domain retail_refunds @authority policy @owner refund-policy @severity hard @category decision @priority 90 @english A large refund is held for a manager. RDEC02: IF LARGE_REFUND AND NOT SUSPECTED_FRAUD THEN RECOMMEND_HOLD AND MANAGER_REVIEW @domain retail_refunds @authority policy @owner refund-policy @severity hard @category decision @priority 80 @english A refund over its limit is held for a supervisor. RDEC03: IF OVER_LIMIT AND NOT LARGE_REFUND AND NOT SUSPECTED_FRAUD THEN RECOMMEND_HOLD AND SUPERVISOR_APPROVAL @domain retail_refunds @authority policy @owner refund-policy @severity hard @category decision @priority 100 @english A refund within its limit pays out at once. RDEC04: IF WITHIN_LIMIT AND NOT SUSPECTED_FRAUD THEN RECOMMEND_APPROVE @domain retail_refunds @ontology example_refund_limits @authority guidance @owner customer-experience @severity soft @category guidance @priority 10 @required_fact_mode explicit @required_facts [HAS_CUSTOMER_TIER, HAS_FRAUD_FLAG] @english A gold customer with a clean screening is suggested for approval. @uses_predicates [hasCustomerTier, hasFraudFlag] @uses_classes [Customer, RefundRequest] RGDN01: IF HAS_CUSTOMER_TIER == GOLD AND HAS_FRAUD_FLAG == 0 THEN RECOMMEND_APPROVE AND LOYALTY_APPROVAL_SUGGESTED # ---------------------------------------------------------------- what follows from the decision @domain retail_refunds @authority policy @owner refund-policy @severity hard @category obligation @priority 100 @english A refund held over its limit needs a supervisor's approval. ROBL01: IF SUPERVISOR_APPROVAL THEN OBLIGATION(supervisor_approval) @domain retail_refunds @authority policy @owner refund-policy @severity hard @category obligation @priority 100 @english A large refund needs a manager's review. ROBL02: IF MANAGER_REVIEW THEN OBLIGATION(manager_review) @domain retail_refunds @authority policy @owner refund-policy @severity hard @category obligation @priority 100 @english A declined refund is referred to the fraud team. ROBL03: IF RECOMMEND_DECLINE THEN OBLIGATION(refer_to_fraud_team) @domain retail_refunds @authority policy @owner refund-policy @severity hard @category obligation @priority 100 @english Staff do not tell the customer that fraud screening flagged the request. ROBL04: IF SUSPECTED_FRAUD THEN PROHIBITION(disclose_fraud_screening)
The full recorded run
ontology example_refund_limits v1: 2 classes, 4 properties rulebook refund-limits@v1: 19 rules, bound to ontology example_refund_limits: yes == S1-in-store-within: A 120 dollar in-store refund for a standard customer. facts: refund_amount=120, channel=STORE, customer_tier=STANDARD, fraud_flag=0 outcome: APPROVE report: fired; fired 3 of 19 rules fired: RDAT01 RLIM01 RDEC04 derived facts: FILE_COMPLETE WITHIN_LIMIT recommendations: RECOMMEND_APPROVE obligations: none deciding rule RDEC04 (policy, hard, priority 100): A refund within its limit pays out at once. resolution: only_candidate: RDEC04 recommends APPROVE == S2-in-store-over: A 260 dollar in-store refund for a standard customer: over the 200 dollar limit. facts: refund_amount=260, channel=STORE, customer_tier=STANDARD, fraud_flag=0 outcome: HOLD report: fired; fired 4 of 19 rules fired: RDAT01 RSIG01 RDEC03 ROBL01 derived facts: FILE_COMPLETE OVER_LIMIT SUPERVISOR_APPROVAL recommendations: RECOMMEND_HOLD obligations: OBLIGATION_SUPERVISOR_APPROVAL deciding rule RDEC03 (policy, hard, priority 80): A refund over its limit is held for a supervisor. resolution: only_candidate: RDEC03 recommends HOLD == S3-gold-within: The same 260 dollar refund for a gold customer: within the 400 dollar limit. facts: refund_amount=260, channel=STORE, customer_tier=GOLD, fraud_flag=0 outcome: APPROVE report: fired; fired 4 of 19 rules fired: RDAT01 RLIM02 RGDN01 RDEC04 derived facts: FILE_COMPLETE WITHIN_LIMIT LOYALTY_APPROVAL_SUGGESTED recommendations: RECOMMEND_APPROVE obligations: none deciding rule RDEC04 (policy, hard, priority 100): A refund within its limit pays out at once. resolution: agreement: RDEC04, RGDN01 all recommend APPROVE == S4-gold-over: A 450 dollar in-store refund for a gold customer: over the 400 dollar limit. facts: refund_amount=450, channel=STORE, customer_tier=GOLD, fraud_flag=0 outcome: HOLD report: fired; fired 5 of 19 rules fired: RDAT01 RGDN01 RSIG01 RDEC03 ROBL01 derived facts: FILE_COMPLETE LOYALTY_APPROVAL_SUGGESTED OVER_LIMIT SUPERVISOR_APPROVAL recommendations: RECOMMEND_APPROVE RECOMMEND_HOLD obligations: OBLIGATION_SUPERVISOR_APPROVAL deciding rule RDEC03 (policy, hard, priority 80): A refund over its limit is held for a supervisor. overridden RGDN01 (guidance, priority 10): A gold customer with a clean screening is suggested for approval. resolution: authority: RDEC03 (policy) outranks RGDN01 (guidance): HOLD over APPROVE == S5-phone-over: A 140 dollar phone refund for a standard customer: over the 100 dollar phone limit. facts: refund_amount=140, channel=PHONE, customer_tier=STANDARD, fraud_flag=0 outcome: HOLD report: fired; fired 4 of 19 rules fired: RDAT01 RSIG01 RDEC03 ROBL01 derived facts: FILE_COMPLETE OVER_LIMIT SUPERVISOR_APPROVAL recommendations: RECOMMEND_HOLD obligations: OBLIGATION_SUPERVISOR_APPROVAL deciding rule RDEC03 (policy, hard, priority 80): A refund over its limit is held for a supervisor. resolution: only_candidate: RDEC03 recommends HOLD == S6-large: A 1500 dollar online refund for a gold customer. facts: refund_amount=1500, channel=ONLINE, customer_tier=GOLD, fraud_flag=0 outcome: HOLD report: fired; fired 6 of 19 rules fired: RDAT01 RSIG02 RGDN01 RSIG01 RDEC02 ROBL02 derived facts: FILE_COMPLETE LARGE_REFUND LOYALTY_APPROVAL_SUGGESTED OVER_LIMIT MANAGER_REVIEW recommendations: RECOMMEND_APPROVE RECOMMEND_HOLD obligations: OBLIGATION_MANAGER_REVIEW deciding rule RDEC02 (policy, hard, priority 90): A large refund is held for a manager. overridden RGDN01 (guidance, priority 10): A gold customer with a clean screening is suggested for approval. resolution: authority: RDEC02 (policy) outranks RGDN01 (guidance): HOLD over APPROVE == S7-fraud-flag: A small refund that fraud screening flagged. facts: refund_amount=40, channel=STORE, customer_tier=STANDARD, fraud_flag=1 outcome: DECLINE report: fired; fired 6 of 19 rules fired: RDAT01 RLIM01 RSIG03 RDEC01 ROBL03 ROBL04 derived facts: FILE_COMPLETE WITHIN_LIMIT SUSPECTED_FRAUD recommendations: RECOMMEND_DECLINE obligations: OBLIGATION_REFER_TO_FRAUD_TEAM PROHIBITION_DISCLOSE_FRAUD_SCREENING deciding rule RDEC01 (policy, hard, priority 100): Suspected fraud declines the refund. resolution: only_candidate: RDEC01 recommends DECLINE == S8-missing-channel: The channel was not recorded. facts: refund_amount=120, customer_tier=STANDARD, fraud_flag=0 outcome: NEED_DATA missing facts: channel rulebook not run: the decision type's required facts are missing
Adapt it to your policy#
- Write your limit table as one rule per row, so every approval names the limit that allowed it.
- Keep "how much over" as separate tiers (supervisor, manager), each with its own obligation.
- Let advisory rules from other teams sit at a lower authority; the engine resolves them and records which rule won.