Standing Order Agent / Module 04
Module 04

Deterministic rules decide what the agent may do.

Language models can suggest, but rules enforce restricted products, exact-item requirements, substitutions, price limits, basket totals, slots, and approval validity.

6evaluation layers
3decision outcomes
1versioned JSON DSL
0executable user code
Evaluation

Priority and conflict flow

Rules module
Rules module
Safety rules evaluate before household preferences. A deny cannot be overwritten by a lower-priority allow, and ambiguity becomes user review.
Order

Six deterministic layers

  1. 01

    Safety

    Restricted categories, origin integrity, configured purchase boundary, and platform-wide maximums.

  2. 02

    Exclusions

    Never-buy products, exact-only rules, category blocks, and household-specific exclusions.

  3. 03

    Item policy

    Quantity, cadence, size, approved alternatives, current price, and product availability.

  4. 04

    Basket policy

    Hard maximum, change from previous basket, must-have coverage, and unexpected cart lines.

  5. 05

    Slot policy

    Allowed day, time range, fallback rank, fee constraint, and review deadline.

  6. 06

    Approval policy

    Active mode, consent, snapshot hash, approved maximum, recent authentication, and expiration.

DSL

Constrained data, never executable code

{
  "id": "rule-milk-price-v1",
  "priority": 100,
  "when": {
    "all": [
      { "fact": "item.productPreferenceId", "op": "eq", "value": "milk-001" },
      { "fact": "item.currentPriceCents", "op": "gt", "value": 699 }
    ]
  },
  "then": {
    "decision": "needs-review",
    "reasonCode": "ITEM_PRICE_OVER_LIMIT"
  }
}
Plain language can draft a rule, but cannot activate it

An LLM may translate “ask me if milk is over $6.99” into the constrained schema. The dashboard shows examples and requires confirmation before a new immutable rule-set version becomes active.

Evidence

Every decision explains itself

OutcomeMeaningWorkflow action
ALLOWAll applicable rules permit the operationContinue and write evaluation record
NEEDS REVIEWA configured exception or unresolved conflict existsFreeze context and ask the user
DENYA safety or hard household policy failedStop operation; no lower rule can override