Rules Schema
Rule definition in cruxIR format.
Rule Interface
interface Rule {
name: string;
priority: number;
selector?: Selector;
condition?: Condition;
action: string;
params: Record<string, unknown>;
}Selector
interface Selector {
type?: string;
tags?: string[];
ids?: string[];
}Condition
interface Condition {
op: "==" | "!=" | ">" | "<" | ">=" | "<=" | "and" | "or" | "not";
left?: Condition | { prop: string } | { value: any };
right?: Condition | { prop: string } | { value: any };
}Example
{
"name": "Rest When Tired",
"priority": 2,
"selector": { "type": "visitor" },
"condition": {
"op": "<=",
"left": { "prop": "energy" },
"right": { "value": 20 }
},
"action": "rest",
"params": { "recovery": 5 }
}