Concepts
Reset and determinism
The same starting state and the same requests give byte-identical ids, timestamps and events, run after run. The examples use the Lob simulator; every simulator takes the same calls.
The loop
curl -s -X POST localhost:$PORT/_rystic/reset # empty; ids and clock rewound
curl -s -X POST localhost:$PORT/_rystic/seed -d @scenario.json # or POST /_rystic/scenario
# ... run your code ...
curl -s localhost:$PORT/_rystic/inspect # assert exact records
curl -s localhost:$PORT/_rystic/egress # assert exact events
Scenarios and seeding covers scenario.json; Observing a simulator covers what to assert on.
Every boot starts the same
- The same command line boots the same state on every plan:
--scenario,--seed, both or neither. With no boot input, the simulator boots empty. - State lives in memory. A restart discards everything since boot and boots that state again.
- Requests run one at a time, so each one sees the state the one before it left.
What reset does
POST /_rystic/reset returns 204. It does not load the boot --scenario again; POST /_rystic/scenario resets and loads a scenario in one call, and {"to": "boot"} on the reset restores the boot state again (Control plane).
| State | After a reset |
|---|---|
| Registers | Cleared, then the simulator’s built-in records are seeded again |
| Id sequences | Restarted, so the first record gets the same id every time |
| Clock | Back at initial_clock, not the scenario’s instant: load the scenario again for that (The clock) |
The wall offset (wall_offset_seconds, below) | Back at 0 |
| RNG | Restarted from the last pinned seed |
| Egress log and call log | Emptied; seq restarts at 1 |
| Live feed | Emptied; its seq keeps counting |
| Action log file | Kept; the reset adds a control line |
| Credential bindings | Cleared, whether POST /_rystic/credentials, a boot file, a named scenario or a posted scenario file made them |
| Stored idempotency keys | Forgotten, so a repeated key runs again |
| Webhook deliveries waiting or retrying | Canceled |
| Open upload sessions | Closed |
| Rate-limit windows and query-cost budgets | Restarted |
The rate_limits setting (Turn on the real service’s rate limits) | Kept, unless a scenario set it: that one lasts for the scenario only |
| A scenario’s own timeline events | Dropped |
A schedule loaded on its own (POST /_rystic/inject, --inject, RYSTIC_INJECT) | Kept; it replays from its first event |
| A network profile a scenario installed | Dropped, and the one from before it returns, unless a post to /_rystic/network or a posted scenario file with a network came since |
A network profile you posted, or loaded from RYSTIC_NETWORK or a boot seed file | Kept |
| Egress retention | Kept |
| Revoked credentials, duplicate deliveries, page caps | Disarmed |
A webhook URL set with POST /_rystic/webhooks | Kept |
| A scenario’s tape, on a simulator that has one | Stopped: Kalshi → Determinism and reset |
rystic pull lob-twin
PORT=$(rystic run lob-twin -d --name loop --port 0 --scenario design_studio --json | jq -r .data.port)
add() { curl -s -u test_x: localhost:$PORT/addresses -d name=Ada -d address_line1='185 BERRY ST' \
-d address_city='SAN FRANCISCO' -d address_state=CA -d address_zip=94107 | jq -c '{id, date_created}'; }
add
# -> {"id":"adr_0000000000000001","date_created":"2026-03-01T00:00:00.001Z"}
curl -s -X POST localhost:$PORT/_rystic/reset
curl -s localhost:$PORT/_rystic/inspect
# -> {}
add
# -> {"id":"adr_0000000000000001","date_created":"2026-01-01T00:00:00.001Z"}
curl -s -X POST localhost:$PORT/_rystic/scenario -d '{"name":"design_studio"}'
add
# -> {"id":"adr_0000000000000001","date_created":"2026-03-01T00:00:00.001Z"}
The clock
Every simulator keeps its own clock, and timestamps come from it.
- Where it starts. A scenario sets its own instant, given in the Clock column of its simulator’s Scenarios table: Lob’s
design_studiostarts at2026-03-01T00:00:00Z. An empty boot starts at2026-01-01T00:00:00Z, unless the simulator’s Determinism and reset section names another start, such as the wall time the process started.GET /_rystic/versionshows the empty-boot instant asinitial_clock. - How it moves. Each request that stamps a time moves it one millisecond. It never follows wall time unless you pace it (below): two writes seconds apart still read
.001Zand.002Z. - Set it.
POST /_rystic/clockwith{"time":"<RFC3339>"}sets it;{"advance_seconds":N}moves it by N seconds; a negative N moves it back. A scenario file’sclocksets it too. Moving it past a loaded scenario’s events fires every one it skips, in order. - Shift the wall time.
{"wall_offset_seconds":N}on the same route shifts the wall time the simulator signs most deliveries with and checks incoming signatures against, and0puts it back. The clock does not move. Webhooks → Test a stale signature says what it reaches. - Pin the start.
rystic run --clock <RFC3339>(RYSTIC_CLOCK) setsinitial_clock, so an empty boot and every reset start there. Use it to make two processes agree. - Read it.
GET /_rystic/versionreturnsclock, the instant now. Reading it does not move it.
curl -s -X POST localhost:$PORT/_rystic/reset
curl -s localhost:$PORT/_rystic/version | jq .initial_clock
# -> "2026-01-01T00:00:00Z"
curl -s -X POST localhost:$PORT/_rystic/clock -d '{"time":"2026-06-01T09:00:00Z"}'
add
# -> {"id":"adr_0000000000000001","date_created":"2026-06-01T09:00:00.001Z"}
curl -s localhost:$PORT/_rystic/version | jq .clock
# -> "2026-06-01T09:00:00.001Z"
The RNG
- Every boot seeds the random stream with
1. POST /_rystic/seed-rngwith{"seed":N}pins another; so dorystic run --seed-rng Nand a scenario file’srng_seed.- Ids are sequences, not random draws: the seed does not change them. Their shapes are the simulator’s, so treat them as opaque.
- Network profiles draw from it: the same seed and profile refuse the same requests in the same order.
Pacing
The clock is manual by default: while your code is idle, nothing moves and no timeline event fires.
RYSTIC_PACE=<speed>moves the clockspeedsimulated seconds per wall second, firing events as they come due.rystic run --speed <speed>sets it.rystic runandrystic uppace at1on their own for an--injectschedule or a--seedscenario with events. A built-in--scenariostays manual.--speed 0, orspeed: 0in a stack file, keeps the clock manual.- A paced clock follows wall time, so timestamps depend on when requests arrive.
- It moves in steps: once per wall second it jumps
speedseconds. Each simulator steps on its own phase, so two paced simulators can read up to a step apart: up to a second at speed1. - A
/_replaytape or live feed drives the clock, and pacing waits for it. Kalshi’sbtc15m_tapedoes not wait, so set--speed 0beside it: Kalshi → Scripted events.
rystic run lob-twin -d --name paced --port 0 --scenario design_studio --speed 3600
# one simulated hour per second: the scenario's hourly events fire as they come due
An --inject file paces at 1 with no --speed, and the clock holds between steps:
echo '{"events":[{"id":"later","at":"+1h","message":{"channel":"ops","body":"an hour on"}}]}' > later.json
PORT=$(rystic run stripe-twin -d --name stepped --port 0 --inject later.json --json | jq -r .data.port)
for i in 1 2 3 4; do curl -s localhost:$PORT/_rystic/version | jq -r .clock; sleep 0.3; done
# 2026-01-01T00:00:01.001755459Z
# 2026-01-01T00:00:01.001755459Z
# 2026-01-01T00:00:01.001755459Z
# 2026-01-01T00:00:02.002358209Z
The same run with --speed 0 reads 2026-01-01T00:00:00Z every time.
Timelines covers scheduling events.
What is and isn’t deterministic
From the same boot or reset, with the same requests in the same order, these repeat byte for byte:
- Ids, numbers and sequences.
- Timestamps, on a manual clock.
- The egress log: its events, their order and their
seq. - Network-profile rejections, for the same seed and profile.
These do not:
- Concurrent requests. They run one at a time in the order they arrive, so which one gets which id changes run to run. Send them in a fixed order.
- A paced clock. It follows wall time.
- An empty boot that starts at wall time (The clock). Within one process every reset returns to that instant; across processes, pass
--clock. - Kalshi’s recorded tape.
btc15m_tapeplays on the wall clock, so what your code meets depends on when it acts (Kalshi → Determinism & reset). - Restarts. They discard everything since boot.
- Rate limits, once you turn them on. By default no simulator enforces a rate limit, so how fast you send never changes a result. Turning on the real service’s limits brings back refusals on the wall clock. Resend allows 10 requests a second, Linear 2,500 requests and 3,000,000 complexity points an hour and Shopify’s query-cost bucket restores by the wall second. The same requests sent back to back can then be refused where spaced out they pass, so a test that turns the limits on should expect a
429. A reset refills the allowance.
Done with the example: rystic stop loop, rystic stop paced and rystic stop stepped.