A Rust-based rules engine focused on spreadsheet-managed business rules and compiled native executables.
- Excel-backed rule loading (
.xlsx,.xlsm,.xls) - JSON rule loading (
.json) - CLI execution against JSON facts
- Native executable builds (
cargo build --release) - Multi-model rule support:
- Decision Table
- Decision Tree
- If–Then (Production)
- Scorecard
- Constraint
- Validation
- Event–Condition–Action (ECA)
- Flow
Use the first worksheet with these headers:
id(string, unique)enabled(true/false)order(number, execution priority)rule_type(decision_table,decision_tree,if_then,scorecard,constraint,validation,eca,flow)field(facts key)op(eq,ne,gt,gte,lt,lte,contains,starts_with,ends_with,in)value(literal value or JSON array forin)action(continue,approve,reject,review)score(optional integer, used by scorecard rules)message(optional)next_rule(optional explicit chain jump)next_true(optional decision-tree true branch)next_false(optional decision-tree false branch)
# Build binary
cargo build --release
# Generate template + sample facts
cargo run -- scaffold --out-dir ./examples
# Open examples/rules-template.csv in Excel and save as rules.xlsx
# Run rules
cargo run -- run --rules ./examples/rules.xlsx --facts ./examples/sample-facts.json./target/release/rules-cli run --rules ./examples/rules.xlsx --facts ./examples/sample-facts.json./scripts/test-harness.shReports are written to reports/tests/:
summary.txtcargo-test.logexamples.log
The harness also executes every example run.sh and validates that each produces a non-empty result.json.
A runnable example is included in DecisionTable/:
DecisionTable/rules.jsonDecisionTable/facts.jsonDecisionTable/run.sh
Run it:
./DecisionTable/run.shResult JSON is written to DecisionTable/result.json.
A runnable decision-tree example is included in DecisionTree/:
DecisionTree/rules.jsonDecisionTree/facts.jsonDecisionTree/run.sh
Run it:
./DecisionTree/run.shResult JSON is written to DecisionTree/result.json.
A runnable If–Then example is included in ifThen/:
ifThen/rules.jsonifThen/facts.jsonifThen/run.sh
Run it:
./ifThen/run.shResult JSON is written to ifThen/result.json.
A runnable scorecard example is included in Scorecard/:
Scorecard/rules.jsonScorecard/facts.jsonScorecard/run.sh
Run it:
./Scorecard/run.shResult JSON is written to Scorecard/result.json.
A runnable constraint-rules example is included in Constraint/:
Constraint/rules.jsonConstraint/facts.jsonConstraint/run.sh
Run it:
./Constraint/run.shResult JSON is written to Constraint/result.json.
A runnable validation-rules example is included in Validation/:
Validation/rules.jsonValidation/facts.jsonValidation/run.sh
Run it:
./Validation/run.shResult JSON is written to Validation/result.json.
A runnable Event–Condition–Action example is included in ECA/:
ECA/rules.jsonECA/facts.jsonECA/run.sh
Run it:
./ECA/run.shResult JSON is written to ECA/result.json.
A runnable flow-rules example is included in Flow/:
Flow/rules.jsonFlow/facts.jsonFlow/run.sh
Run it:
./Flow/run.shResult JSON is written to Flow/result.json.
A lightweight browser UI concept is included in docs/ and published via GitHub Pages.
The rules execution is powered by a Rust WASM module in wasm-engine/.
Live URL: http://mallond.github.io/Deterministic-Rules-Engine-AI/
Build/update the WASM bundle:
./docs/build-wasm.shRun locally:
./docs/run-ui.shThen open http://localhost:8787.
Use the form inputs and click Run Decision Table to execute the sample decision table and see output instantly.
The web runtime is split into two layers:
- Engine runtime (versioned, stable)
docs/pkg/wasm_engine.jsdocs/pkg/wasm_engine_bg.wasm
- Rule/data payloads (frequently changed)
- Decision tables / trees / scorecards in JSON (or Excel-exported JSON)
- Facts/input datasets in JSON
- Deterministic behavior: Browser execution uses compiled Rust logic, not a separate JS reimplementation.
- Single source of truth: CLI and web can share the same core engine semantics.
- Safer change management: Business teams update rules/data without rebuilding engine binaries.
- Traceable QA: Test vectors can be pinned to
engine version + rule version. - Faster iteration: Rule tuning can ship independently from engine code changes.
- Engine: semantic versioning (e.g.,
engine v1.2.0) - Rules: domain/date or semantic tags (e.g.,
mortgage-rules-v2026.03.10) - Optional compatibility metadata in rule packs:
engine_minengine_max
- Rebuild WASM only when engine logic changes.
- Keep rule/data files external and versioned separately.
- Run deterministic QA against each promoted rule pack.
- Promote rule packs to production only after passing the test harness.