agentleFS
Ordo-EngineOrdo-Engine/Ordo/.cursor/skills/ordo-expression-syntax/SKILL.md

ordo-expression-syntax

Skill37 starsChanged 10 months agoMITView on GitHub

Ordo expression syntax quick reference. Includes comparison operators, logical operators, built-in functions, conditional expressions, field access syntax. Use for writing rule conditions, calculating output values, data transformation.

The file

Files
SKILL.md

Ordo Expression Syntax

Operators

Comparison Operators

OperatorDescriptionExample
==Equalstatus == "active"
!=Not equalstatus != "banned"
>Greater thanage > 18
>=Greater or equalbalance >= 1000
<Less thanprice < 100
<=Less or equallevel <= 5

Logical Operators

OperatorDescriptionExample
&&Andage >= 18 && active == true
||Orvip == true || points > 1000
!Not!is_blocked

Arithmetic Operators

OperatorDescriptionExample
+Additionprice + tax
-Subtractiontotal - discount
*Multiplicationquantity * price
/Divisiontotal / count
%Moduloindex % 2

Field Access

Dot Notation

user.name
user.profile.level
order.items[0].price

Array Indexing

items[0]
matrix[1][2]
users[index]

Safe Access (coalesce)

coalesce(user.nickname, user.name, "Anonymous")

Built-in Functions

String Functions

FunctionDescriptionExample
len(s)String lengthlen(name) > 0
upper(s)To uppercaseupper(code) == "VIP"
lower(s)To lowercaselower(email)
trim(s)Trim whitespacetrim(input)
starts_with(s, prefix)Prefix matchstarts_with(url, "https")
ends_with(s, suffix)Suffix matchends_with(file, ".pdf")
contains_str(s, sub)Contains substringcontains_str(desc, "urgent")
substring(s, start, end)Extract substringsubstring(code, 0, 3)

Math Functions

FunctionDescriptionExample
abs(n)Absolute valueabs(diff) < 0.01
min(a, b, ...)Minimummin(price, max_price)
max(a, b, ...)Maximummax(0, balance)
floor(n)Floorfloor(rating)
ceil(n)Ceilingceil(price)
round(n)Roundround(average)

Array Functions

FunctionDescriptionExample
len(arr)Array lengthlen(items) > 0
sum(arr)Sum of arraysum(prices) >= 100
avg(arr)Averageavg(scores) > 60
count(arr)Element countcount(orders)
first(arr)First elementfirst(results)
last(arr)Last elementlast(history)

Type Functions

FunctionDescriptionExample
type(v)Get typetype(value) == "string"
is_null(v)Is nullis_null(optional)
is_number(v)Is numberis_number(input)
is_string(v)Is stringis_string(data)
is_array(v)Is arrayis_array(items)

Conversion Functions

FunctionDescriptionExample
to_int(v)To integerto_int(str_num)
to_float(v)To floatto_float(price)
to_string(v)To stringto_string(code)

Time Functions

FunctionDescriptionExample
now()Current timestamp (seconds)now() - created_at > 86400
now_millis()Current timestamp (milliseconds)now_millis()

Conditional Expressions

if-then-else

if condition then value1 else value2

Examples:

if exists(discount) then price * (1 - discount) else price
if vip == true then 0.2 else 0.05
if age >= 18 then "adult" else "minor"

exists Check

if exists(user.nickname) then user.nickname else user.name

Nested Conditions

if tier == "gold" then 0.2
else if tier == "silver" then 0.1
else 0.05

Literals

Numbers

42          # Integer
3.14        # Float
-100        # Negative

Strings

"hello"
"it's ok"
"line1\nline2"

Booleans

true
false

Null

null

Rust API

Parsing Expressions

use ordo_core::prelude::*;

let parser = ExprParser::new();
let expr = parser.parse("age >= 18 && status == \"active\"")?;

Evaluation

let evaluator = Evaluator::new();
let context = Context::from_json(r#"{"age": 25, "status": "active"}"#)?;
let result = evaluator.eval(&expr, &context)?;

Compile to Bytecode

let compiler = ExprCompiler::new();
let compiled = compiler.compile(&expr)?;
let vm = BytecodeVM::new();
let result = vm.execute(&compiled, &context)?;

Key Files

  • crates/ordo-core/src/expr/parser.rs - Expression parser
  • crates/ordo-core/src/expr/eval.rs - Expression evaluation
  • crates/ordo-core/src/expr/functions.rs - Built-in functions
  • crates/ordo-core/src/expr/ast.rs - AST definitions

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.