Kaizen

Inline Expressions

The sandboxed {{ }} expression language that makes a board reactive.

Reward, condition, action, and trigger fields accept inline expressions wrapped in {{ … }}, evaluated at runtime against the live game state. This is the difference between a fixed board and a reactive one — without leaving the builder for a workflow.

It's a sandboxed expression language (evaluated with no eval, no Function, no globals, finite recursion): an expression that returns a value — no loops, no statements, no JavaScript.

Where you can use them

FieldReturnsExample
reward.base / reward.variablenumber{{ space.tier * 10 }} · {{ random(1, 5) + session.streak }}
reward.probability0–1{{ session.streak >= 7 ? 1 : 0.5 }}
condition.exprboolean{{ player.xp > 500 && time.hour >= 18 }}
trigger.whenboolean{{ session.streak >= 3 }}
action params (e.g. award_xp)number{{ 10 + session.lap * 5 }}

Context

The values available inside {{ }}:

  • player.*xp, currency.<id>, badges (list), level.
  • session.*streak, lap, moveCount, plus any eval_expr variables.
  • space.*id, and the space's own data.* (e.g. space.data.requiredCount).
  • board.*shape, theme, spaceCount.
  • time.*hour (0–23), weekday, … (the player's local time).

Functions & operators

  • Arithmetic: + - * / % and parentheses.
  • Comparison / logic: == != < <= > >=, && || !.
  • Conditional: cond ? a : b.
  • random(min, max) — a number in [min, max). Seeded from the session PRNG, so a landing replays to the same value (the event log is deterministic).
  • Helpersmin, max, floor, round, abs, list membership, …

Not available: loops, assignment, function definitions, JavaScript, IO. Heavy logic belongs in a Kaizen workflow (the run_workflow action); the DSL covers the 80% case. Use the eval_expr action to set a session.* variable you can read back later.

Patterns

# streak-scaled payout
reward.base:     10
reward.variable: {{ random(1, 5) + session.streak }}

# evening-only bonus
trigger.when:    {{ time.hour >= 18 && time.hour < 22 }}

# escalating requirement
condition.expr:  {{ space.data.progress >= space.data.baseRequirement + session.lap }}

# 70% chance, guaranteed on a long streak
reward.probability: {{ session.streak >= 7 ? 1 : 0.7 }}
On this page

On this page

Start building today
Trusted by over 60,000 builders.
Build Agentic workflows visually on a drag-and-drop canvas or with natural language.
Get started