Skip to content

Wander tools

Write, check, test, graph and inspect Wander behaviors.

19 tools in the wander category. Badges: read-only tools never change the project; mutating tools are undoable and attributed; open-world tools reach outside the engine and MCP clients ask before running them.

Tool Summary
wander_reference The Wander 2 guide for writing behaviors: syntax, triggers, statements, idioms, and every builtin function with its signature (generated from the builtin registry, including subsystem and native-module builtins).
wander_check Compile Wander source without attaching it, exactly as the engine would run it (components, builtins, used modules from the project).
behavior_set Create or replace a named behavior on an entity: its natural-language intent (the human source of truth), an optional structured spec derived from the intent ({summary, rules: [{text, tests: [test names]}]}), and the Wander source.
behavior_remove Remove a named behavior from an entity.
behavior_spec The intent -> spec -> code view of a behavior: its intent, the stored spec (rules an agent derived from the intent, each naming the tests that verify it), what the code declares (triggers, states, tunable params with ranges and current per-entity values, vars, functions, tests), and coverage (rules without tests, tests without rules).
wander_test Run the test "..." blocks of a behavior in a sandbox simulation (the real scene is never touched): each test gets a fresh world, ticks once (on start ran), then runs with self = the entity under test; wait advances the simulation at 1/60 s, emit/press/hold/release/click inject input, and expect reports failures with the compared values.
behavior_graph Visual node graph of a behavior (or raw source): bodies (handlers, fns, tests, state handlers) with an entry node, exec-flow statement nodes wired by exec pins (if: then/elif/else; loops: body), expression nodes wired into data pins, and literals/names inline on pins (value).
behavior_from_graph Turn a node graph (from behavior_graph, possibly edited) back into Wander source.
wander_inspect While playing: the runtime state of an entity's behaviors — current state of each state machine and how long it has been active, handlers waiting in wait (and for how long), plus the entity's vars.
wander_break_set Stops the running game at a line of a behavior script so you can inspect it (wander_stack, wander_eval).
wander_break_clear Removes breakpoints: one by id, every breakpoint of a script, or all (no arguments).
wander_break_list Breakpoints and logpoints with their script, line (and the line asked for when it moved), condition, hit condition, hits so far, whether a compiled script has code there, plus break-on-error.
wander_debug_state Whether the game is paused in the Wander debugger, why (breakpoint, step, pause, error with its message) and where (script, line, function, entity, state), plus the breakpoints.
wander_continue Resumes a game paused in the Wander debugger.
wander_step Steps a paused behavior: over (the next statement of this function; calls run through), into (the next statement anywhere, entering called functions), out (back in the caller).
wander_pause Stops at the next statement any behavior runs (the game is frozen mid-tick there; resume with wander_continue).
wander_stack The paused behavior's call stack, innermost first: function, script, line and column, entity, behavior and state, each frame's arguments and locals (value and display text), the entity's vars, and globals (time, frame, dt).
wander_eval Evaluates a Wander expression in a paused frame (0 = innermost): its locals, arguments, the behavior's vars, self and every read-only builtin are available ("distance(self, target)", "items.length").
wander_set_var Changes a local, an argument or one of the entity's vars in a paused frame, then the behavior continues with it (test a fix without restarting).

wander_reference

Wander language reference read-only

The Wander 2 guide for writing behaviors: syntax, triggers, statements, idioms, and every builtin function with its signature (generated from the builtin registry, including subsystem and native-module builtins). Read it once before writing behaviors. topic="" returns detailed entries with parameter types and examples, e.g. topic="physics", topic="list", topic="raycast".

Argument Type Required Description Values
topic string Optional: a builtin category (math, vector, scene, list, physics...) or a function name
wander_reference {"topic": "physics"}
skywalker call wander_reference '{"topic": "physics"}' --project my_game
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "wander_reference",
    "arguments": {
      "topic": "physics"
    }
  }
}

wander_check

Check Wander code read-only

Compile Wander source without attaching it, exactly as the engine would run it (components, builtins, used modules from the project). Returns diagnostics (line, column, stable code, message, did-you-mean hint, file for module errors), warnings, and a summary of the behaviors (vars, params, handlers, states, tests). format=true also returns the canonical formatting; disassemble=true the bytecode listing.

Argument Type Required Description Values
source string yes Wander source code
format boolean Also return the canonically formatted source
disassemble boolean Also return the bytecode listing (performance work)
wander_check {"source": "behavior Coin\n  param spin = 90 in 0..360 \"degrees per second\"\n  on tick\n    rotate self by (0, spin * dt, 0)\n  end\n  test \"spins\"\n    let before = self.rotation.y\n    wait 0.5\n    expect self.rotation.y != before\n  end\nend", "format": true}
skywalker call wander_check '{"source": "behavior Coin\n  param spin = 90 in 0..360 \"degrees per second\"\n  on tick\n    rotate self by (0, spin * dt, 0)\n  end\n  test \"spins\"\n    let before = self.rotation.y\n    wait 0.5\n    expect self.rotation.y != before\n  end\nend", "format": true}' --project my_game
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "wander_check",
    "arguments": {
      "source": "behavior Coin\n  param spin = 90 in 0..360 \"degrees per second\"\n  on tick\n    rotate self by (0, spin * dt, 0)\n  end\n  test \"spins\"\n    let before = self.rotation.y\n    wait 0.5\n    expect self.rotation.y != before\n  end\nend",
      "format": true
    }
  }
}

behavior_set

Set behavior mutating

Create or replace a named behavior on an entity: its natural-language intent (the human source of truth), an optional structured spec derived from the intent ({summary, rules: [{text, tests: [test names]}]}), and the Wander source. The source is compiled; by default code with errors is rejected and the diagnostics returned so you can fix and retry. Workflow: intent -> spec rules -> code with a test block per rule -> wander_test -> behavior_spec to check coverage.

Argument Type Required Description Values
entity integer | string yes Entity id (number) or exact name
name string yes Behavior name, e.g. "Patrol"
intent string What the behavior should do, in plain language
spec object Structured spec: {summary, rules: [{text, tests: [...]}], notes}
source string Wander source code
enabled boolean Enabled (default true)
allow_errors boolean Save even if the code does not compile (default false)
behavior_set {"entity": "Menu", "name": "Menu", "intent": "Play hides the menu", "source": "behavior Menu\n  on ui \"Play\"\n    self.enabled = false\n  end\nend"}
skywalker call behavior_set '{"entity": "Menu", "name": "Menu", "intent": "Play hides the menu", "source": "behavior Menu\n  on ui \"Play\"\n    self.enabled = false\n  end\nend"}' --project my_game
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "behavior_set",
    "arguments": {
      "entity": "Menu",
      "name": "Menu",
      "intent": "Play hides the menu",
      "source": "behavior Menu\n  on ui \"Play\"\n    self.enabled = false\n  end\nend"
    }
  }
}

behavior_remove

Remove behavior mutating destructive

Remove a named behavior from an entity.

Argument Type Required Description Values
entity integer | string yes Entity id (number) or exact name
name string yes Behavior name
behavior_remove {"entity": "Guard", "name": "Patrol"}
skywalker call behavior_remove '{"entity": "Guard", "name": "Patrol"}' --project my_game
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "behavior_remove",
    "arguments": {
      "entity": "Guard",
      "name": "Patrol"
    }
  }
}

behavior_spec

Behavior spec read-only

The intent -> spec -> code view of a behavior: its intent, the stored spec (rules an agent derived from the intent, each naming the tests that verify it), what the code declares (triggers, states, tunable params with ranges and current per-entity values, vars, functions, tests), and coverage (rules without tests, tests without rules). Use it to keep intent, spec and code in sync.

Argument Type Required Description Values
entity integer | string yes Entity id (number) or exact name
name string yes Behavior name
behavior_spec {"entity": "Coin", "name": "Coin"}
skywalker call behavior_spec '{"entity": "Coin", "name": "Coin"}' --project my_game
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "behavior_spec",
    "arguments": {
      "entity": "Coin",
      "name": "Coin"
    }
  }
}

wander_test

Run behavior tests read-only

Run the test "..." blocks of a behavior in a sandbox simulation (the real scene is never touched): each test gets a fresh world, ticks once (on start ran), then runs with self = the entity under test; wait advances the simulation at 1/60 s, emit/press/hold/release/click inject input, and expect reports failures with the compared values. Pass entity+name (mode "entity" copies that entity's components, tags and vars; "scene" runs inside a copy of the whole scene; "isolated" uses a plain entity) or raw source. Returns pass/fail per test, failures with line numbers, logs and simulated time.

Argument Type Required Description Values
entity integer | string Entity whose behavior to test
name string Behavior name
source string Test this source instead of a saved behavior
filter string Only tests whose name contains this
mode string Sandbox contents (default: entity) entity scene isolated
max_seconds number Simulated time limit per test (default 600)
wander_test {"entity": "Coin", "name": "Coin", "mode": "entity"}
skywalker call wander_test '{"entity": "Coin", "name": "Coin", "mode": "entity"}' --project my_game
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "wander_test",
    "arguments": {
      "entity": "Coin",
      "name": "Coin",
      "mode": "entity"
    }
  }
}

behavior_graph

Behavior as a node graph read-only

Visual node graph of a behavior (or raw source): bodies (handlers, fns, tests, state handlers) with an entry node, exec-flow statement nodes wired by exec pins (if: then/elif/else; loops: body), expression nodes wired into data pins, and literals/names inline on pins (value). Positions come from the saved layout or an automatic layout. Edit the JSON and send it back with behavior_from_graph. palette=true adds every node type with its pins.

Argument Type Required Description Values
entity integer | string Entity id (number) or exact name
name string Behavior name
source string Graph this source instead
palette boolean Include the node palette
behavior_graph {"entity": "Coin", "name": "Coin"}
skywalker call behavior_graph '{"entity": "Coin", "name": "Coin"}' --project my_game
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "behavior_graph",
    "arguments": {
      "entity": "Coin",
      "name": "Coin"
    }
  }
}

behavior_from_graph

Behavior from a node graph mutating

Turn a node graph (from behavior_graph, possibly edited) back into Wander source. With entity+name the code is compiled and saved as that behavior (rejected on errors unless allow_errors) and the node positions are stored, so the editor reopens the same layout. Returns the generated source and diagnostics.

Argument Type Required Description Values
graph object yes Graph JSON (format wander-graph)
entity integer | string Entity id (number) or exact name
name string Behavior name to save into
allow_errors boolean Save even if the code does not compile
behavior_from_graph {"entity": "Coin", "name": "Spin", "graph": {"format": "wander-graph", "version": 1, "behaviors": []}}
skywalker call behavior_from_graph '{"entity": "Coin", "name": "Spin", "graph": {"format": "wander-graph", "version": 1, "behaviors": []}}' --project my_game
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "behavior_from_graph",
    "arguments": {
      "entity": "Coin",
      "name": "Spin",
      "graph": {
        "format": "wander-graph",
        "version": 1,
        "behaviors": []
      }
    }
  }
}

Pass the whole graph object that behavior_graph returned, after editing it; an empty graph like this one saves an empty behavior.

wander_inspect

Inspect running behaviors read-only

While playing: the runtime state of an entity's behaviors — current state of each state machine and how long it has been active, handlers waiting in wait (and for how long), plus the entity's vars. Use it to debug why a behavior is not doing what its intent says.

Argument Type Required Description Values
entity integer | string yes Entity id (number) or exact name
wander_inspect {"entity": "Guard"}
skywalker call wander_inspect '{"entity": "Guard"}' --project my_game
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "wander_inspect",
    "arguments": {
      "entity": "Guard"
    }
  }
}

wander_break_set

Set a Wander breakpoint read-only

Stops the running game at a line of a behavior script so you can inspect it (wander_stack, wander_eval). script is the behavior's script name as in behavior_set (or a used module path, "scripts/ai.wander"); omit it to stop in any script at that line. The breakpoint moves to the first line with code. Options: condition (a Wander expression over the frame's locals and vars: "hp < 3"), hit_count ("5" = the 5th hit, ">=5", "%10"), log (a logpoint: logs "hp={hp}" instead of stopping), entity (only that entity). on_error: true stops at any runtime error instead (line not needed). Costs nothing until set. Example: {"script": "Guard", "line": 12, "condition": "hp <= 0"}.

Argument Type Required Description Values
script string Behavior script name (behavior_set name) or module path; omit for any script
line integer 1-based line
condition string Stop only when this Wander expression is true
hit_count string "N" (the Nth hit), ">=N", "%N"
log string Logpoint message with {expressions}; never stops
entity integer | string Only stop for this entity
on_error boolean Stop at runtime errors (true) or not (false)
wander_break_set {"script": "Guard", "line": 12, "condition": "hp <= 0"}
skywalker call wander_break_set '{"script": "Guard", "line": 12, "condition": "hp <= 0"}' --project my_game
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "wander_break_set",
    "arguments": {
      "script": "Guard",
      "line": 12,
      "condition": "hp <= 0"
    }
  }
}

wander_break_clear

Clear Wander breakpoints read-only

Removes breakpoints: one by id, every breakpoint of a script, or all (no arguments). on_error: false also stops breaking on errors. With no breakpoints left the debugger costs nothing again. Example: {"id": 2}.

Argument Type Required Description Values
id integer Breakpoint id (wander_break_list)
script string Every breakpoint of this script
on_error boolean false: stop breaking on runtime errors
wander_break_clear {"id": 2}
skywalker call wander_break_clear '{"id": 2}' --project my_game
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "wander_break_clear",
    "arguments": {
      "id": 2
    }
  }
}

wander_break_list

List Wander breakpoints read-only

Breakpoints and logpoints with their script, line (and the line asked for when it moved), condition, hit condition, hits so far, whether a compiled script has code there, plus break-on-error.

Takes no arguments.

wander_break_list {}
skywalker call wander_break_list '{}' --project my_game
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "wander_break_list",
    "arguments": {}
  }
}

wander_debug_state

Wander debugger state read-only

Whether the game is paused in the Wander debugger, why (breakpoint, step, pause, error with its message) and where (script, line, function, entity, state), plus the breakpoints. wait_ms waits for the next stop when running (agent connections; the game must be playing). Example: {"wait_ms": 5000}.

Argument Type Required Description Values
wait_ms integer Wait up to this long for the next stop (0 = answer now)
wander_debug_state {"wait_ms": 5000}
skywalker call wander_debug_state '{"wait_ms": 5000}' --project my_game
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "wander_debug_state",
    "arguments": {
      "wait_ms": 5000
    }
  }
}

wander_continue

Continue (Wander debugger) read-only

Resumes a game paused in the Wander debugger. It runs until the next stop or the end of the ticks in progress, then answers with the debugger state; wait_ms keeps waiting for the next stop on agent connections. Example: {"wait_ms": 2000}.

Argument Type Required Description Values
wait_ms integer Then wait up to this long for the next stop
wander_continue {"wait_ms": 2000}
skywalker call wander_continue '{"wait_ms": 2000}' --project my_game
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "wander_continue",
    "arguments": {
      "wait_ms": 2000
    }
  }
}

wander_step

Step (Wander debugger) read-only

Steps a paused behavior: over (the next statement of this function; calls run through), into (the next statement anywhere, entering called functions), out (back in the caller). When the handler ends, the step stops at the next statement any behavior runs. Answers with where it stopped. Example: {"mode": "into"}.

Argument Type Required Description Values
mode string over (default), into or out over into out
wait_ms integer Wait up to this long for the stop
wander_step {"mode": "into"}
skywalker call wander_step '{"mode": "into"}' --project my_game
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "wander_step",
    "arguments": {
      "mode": "into"
    }
  }
}

wander_pause

Pause behaviors (Wander debugger) read-only

Stops at the next statement any behavior runs (the game is frozen mid-tick there; resume with wander_continue). Unlike sim_control pause it stops inside the code, so wander_stack shows where each behavior is. wait_ms waits for the stop on agent connections. Example: {"wait_ms": 1000}.

Argument Type Required Description Values
wait_ms integer Wait up to this long for the stop
wander_pause {"wait_ms": 1000}
skywalker call wander_pause '{"wait_ms": 1000}' --project my_game
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "wander_pause",
    "arguments": {
      "wait_ms": 1000
    }
  }
}

wander_stack

Wander call stack read-only

The paused behavior's call stack, innermost first: function, script, line and column, entity, behavior and state, each frame's arguments and locals (value and display text), the entity's vars, and globals (time, frame, dt). Example: {"vars": true}.

Argument Type Required Description Values
vars boolean Include args, locals and vars (default true)
wander_stack {"vars": true}
skywalker call wander_stack '{"vars": true}' --project my_game
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "wander_stack",
    "arguments": {
      "vars": true
    }
  }
}

wander_eval

Evaluate in a paused frame read-only

Evaluates a Wander expression in a paused frame (0 = innermost): its locals, arguments, the behavior's vars, self and every read-only builtin are available ("distance(self, target)", "items.length"). Watch expressions: call it at each stop. Read-only: assignments to the scene fail (use wander_set_var). Example: {"expression": "hp * 2 + bonus", "frame": 0}.

Argument Type Required Description Values
expression string yes Wander expression
frame integer Frame index (0 = innermost)
wander_eval {"expression": "hp * 2 + bonus", "frame": 0}
skywalker call wander_eval '{"expression": "hp * 2 + bonus", "frame": 0}' --project my_game
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "wander_eval",
    "arguments": {
      "expression": "hp * 2 + bonus",
      "frame": 0
    }
  }
}

wander_set_var

Set a variable while paused mutating

Changes a local, an argument or one of the entity's vars in a paused frame, then the behavior continues with it (test a fix without restarting). The value is JSON ([x, y, z] is a vector). Example: {"name": "hp", "value": 10}.

Argument Type Required Description Values
name string yes Variable name
value any yes New value (JSON)
frame integer Frame index (0 = innermost)
wander_set_var {"name": "hp", "value": 10}
skywalker call wander_set_var '{"name": "hp", "value": 10}' --project my_game
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "wander_set_var",
    "arguments": {
      "name": "hp",
      "value": 10
    }
  }
}