Worlds
Simulations
Fork hundreds of worlds from one moment, run a script in each, score them and keep the best.
SoonThese pages describe Chronos Cloud, which opens from the waitlist. Running Chronos yourself? Self-host docs
SIMULATE
A simulation tries many variations at once. It forks n worlds from one moment, runs the same SQL script in each in parallel, scores each with a query, keeps the best and discards the rest. Forks are instant, so a thousand worlds of a real database cost what they change.
SIMULATE n WORLDS [FROM base] AS prefix RUN 'script' SCORE 'select ...' [ASC | DESC] [KEEP k | KEEP ALL] [SEED s] [THREADS t]simulate 1000 worlds from main as trial run $$update prices set p = p * (0.9 + random() * 0.2) where sku % 100 = $1 % 100$$ score $$select sum(p * sold) from prices$$ keep 10 seed 42;Its parts
| Part | Default | Meaning |
|---|---|---|
FROM base | the session’s world | a world, or 'name@when' |
RUN | required | any statements. $1 is the world’s index, $2 its seed. It can’t fork, merge, restore, switch or drop worlds, or change settings (0A000) |
SCORE | required | one SELECT whose first value is a number |
DESC / ASC | DESC | highest score first, or lowest |
KEEP | ALL | worlds kept, best first; the rest are discarded |
SEED | 0 | seeds random() and gen_random_uuid() with the world’s index |
THREADS | every free core |
Strings can be dollar-quoted ($$…$$, $tag$…$tag$). Script and score together are at most 32 KB. KEEP k needs room for k + 1 worlds at once under the plan’s open-world limit; KEEP ALL needs n.
Results
| Column | Meaning |
|---|---|
world, id | the world (prefix_i) |
index, seed | $1 and $2 |
score | null if it failed |
error | the failure, with its SQLSTATE |
kept | whether the world was kept |
Rows are best first, failed worlds last. Kept worlds hold their inputs in metadata sim (seed, index, script, score query, score, base and moment), so you can read them, diff them, and merge the winner like any world.
Repeatable by design
- Each world’s random numbers come from the simulation’s seed and the world’s index, and its clock stands at the base moment: the same simulation gives the same worlds on any machine and any number of threads.
serialnumbers are the exception: they come from the database’s shared counters, so they differ between runs.
REPLAY WORLD
REPLAY WORLD world [AS name]Forks a kept world’s base as it was then, runs its script and score again with the same index and seed, and compares: identical, rows_differing, score now and recorded_score then. The replay is dropped unless AS name keeps it. It needs history back to the simulation’s moment. MCP: simulate, replay.
What it’s for
- Pricing and allocation: try many parameter choices on real data and keep the best.
- Agent evaluation: run a candidate prompt’s SQL in many worlds and score the outcomes against a query.
- Migrations: run a migration in a few worlds of last week’s data and check every one passes the merge checks.