{
  "kinds": [
    "condition",
    "merchant_lock",
    "merchant_block",
    "mcc_block",
    "amount_ceiling",
    "spend_cap",
    "velocity",
    "time_window",
    "max_uses",
    "cooldown",
    "repeat",
    "approval_threshold",
    "new_merchant_review",
    "per_merchant_spend_cap",
    "duplicate_charge_guard",
    "webhook_check"
  ],
  "keys": {
    "merchant_lock": [
      "allow_hosts",
      "allowlist",
      "allow",
      "domains"
    ],
    "merchant_block": [
      "deny_hosts",
      "denylist",
      "deny",
      "block",
      "blocked"
    ],
    "mcc_block": [
      "allow",
      "allow_codes",
      "allowed_mccs",
      "deny_codes",
      "blocked_mccs",
      "deny",
      "block"
    ],
    "amount_ceiling": [
      "max_cents",
      "allow_partial"
    ],
    "spend_cap": [
      "max_total_cents",
      "window",
      "window_sec",
      "allow_partial"
    ],
    "velocity": [
      "max_count",
      "window_sec"
    ],
    "time_window": [
      "start_hour",
      "end_hour",
      "allow_hours",
      "tz"
    ],
    "max_uses": [
      "max_uses"
    ],
    "condition": [
      "when_amount_over_cents",
      "when_amount_under_cents",
      "when_merchant",
      "when_mcc"
    ],
    "repeat": [
      "times",
      "total_cents",
      "merchant",
      "allow_partial"
    ],
    "cooldown": [
      "cooldown_sec",
      "seconds"
    ],
    "approval_threshold": [
      "above_cents"
    ],
    "new_merchant_review": [
      "action",
      "per_card"
    ],
    "per_merchant_spend_cap": [
      "merchant",
      "max_total_cents",
      "window",
      "window_sec",
      "allow_partial"
    ],
    "duplicate_charge_guard": [
      "window_sec"
    ],
    "webhook_check": [
      "url",
      "fail_mode",
      "timeout_ms"
    ]
  },
  "defaults": {
    "condition": {
      "when_amount_over_cents": 5000
    },
    "merchant_lock": {
      "allow": [
        "sample.example"
      ]
    },
    "merchant_block": {
      "deny": [
        "blocked.example"
      ]
    },
    "mcc_block": {
      "allow": [
        "5814"
      ]
    },
    "amount_ceiling": {
      "max_cents": 5000
    },
    "spend_cap": {
      "max_total_cents": 20000,
      "window": "month"
    },
    "velocity": {
      "max_count": 5,
      "window_sec": 3600
    },
    "time_window": {
      "start_hour": 8,
      "end_hour": 20,
      "tz": "UTC"
    },
    "max_uses": {
      "max_uses": 1
    },
    "cooldown": {
      "cooldown_sec": 60
    },
    "repeat": {
      "times": 3
    },
    "approval_threshold": {
      "above_cents": 2500
    },
    "new_merchant_review": {
      "action": "review"
    },
    "per_merchant_spend_cap": {
      "merchant": "sample.example",
      "max_total_cents": 10000,
      "window": "month"
    },
    "duplicate_charge_guard": {
      "window_sec": 600
    },
    "webhook_check": {
      "url": "https://example.com/decision"
    }
  },
  "limits": {
    "maxRules": 100,
    "maxDepth": 8,
    "maxHistory": 500,
    "maxList": 100,
    "maxString": 200,
    "maxWork": 300000,
    "maxRequestBytes": 64000,
    "decisionBudgetMs": 1000
  },
  "version": "1",
  "engine_sha256": "0f0201c9b48a981dc2ecc5739f4e7f544f6360104044a04681b53479bab5a6d8",
  "input": {
    "rulebook": "array of {kind,config,children?,when?,active?}; scope is workspace-only metadata",
    "intent": "{merchant,amount_cents,mcc}",
    "history": "optional prior ledger entries; timestamp at in milliseconds; amount_cents integer; status approved/captured/settled",
    "human": "simulated approval input, not authentication"
  },
  "composition": "Any deciding fail wins, then review, then partial, then approve; condition failures steer branches only.",
  "repeat_semantics": "A repeat policy counts eligible approved purchases in the supplied ledger; children run once per request, not a JavaScript loop.",
  "workspace_scopes": "Shared spend caps default to program history; behavioral controls default to cardholder history. Branches inherit root scope. The raw API uses caller-supplied history.",
  "limits_apply_to": "Program workspace and candidate /api/decide handler. Existing AWS demo has independent deployment/configuration. maxWork is an admission estimate. decisionBudgetMs is a shared elapsed-time budget; late results decline after bounded synchronous evaluation, not through hard interruption.",
  "known_limits": [
    "All time-window hours use UTC.",
    "Named spend windows are rolling 24-hour, 7-day, and 30-day periods.",
    "Merchant allow/block matching uses case-insensitive substrings, not network identity.",
    "Raw engine unknown keys and missing config can be permissive; program workspace rejects them.",
    "webhook_check does not call an endpoint in the browser or current AWS demo handler. Program workspace fails closed when an external decision would run.",
    "Temporary unlock, funding, clearing, reversals and refunds are program-model behavior, not network integration.",
    "No real cards or money movement; no production-validated issuing claim."
  ]
}