Persistent images snapshot safe Ricochet language state. They are useful for long interactive sessions, build tools that want a warm runtime state, and diagnostics that need to inspect what a VM knew without keeping the original process alive.
Image files are versioned. Ricochet refuses unsupported image formats or incompatible format versions loudly instead of guessing at state layout.
REPL Images
Start a REPL with an image path to load that image when it already exists and save it again when the session exits cleanly:
rco repl --image session.rci
Inside the REPL, colon commands manage checkpoints:
:bindings
:save
:save checkpoint.rci
:load checkpoint.rci
:bindings prints counts and names for preserved stack values, globals, functions, and classes. :save and :load default to the startup --image path; pass a path to write or read a separate checkpoint.
Image Files
Use the image command group for non-interactive workflows:
rco image save session.rci
rco image save session.rci --source main.rco
rco image inspect session.rci
rco image inspect session.rci --json
rco image save --source runs the source file first, then writes the resulting safe VM state. The JSON inspect form exposes the format, format version, Ricochet version, stack length, and preserved binding/function/class names for tools.
Safety Boundaries
Images preserve ordinary language state: nil, booleans, numbers, floats including special values, strings, arrays, lists, maps, sets, classes, instances, member selectors, blocks, functions, and results.
Images intentionally reject process-local or sensitive state instead of silently dropping it. Tasks, capabilities, regex internals, retained HTTP streams, upload streams, processes, PTYs, TCP sockets and listeners, WebSocket sockets and listeners, active approvals, native-only class methods, and literal secret references are not serialized.
Source Emission
rco emit-source prints a readable Ricochet-like view from either source or compiled bytecode:
rco emit-source main.rco
rco emit-source build/app.rcob
The emitted view keeps useful declarations, literals, calls, block structure, class bodies, accessors, methods, functions, returns, and irreducible bytecode jump notes. It is designed for inspection, generated artifacts, and recovery work.
Current Limits
- Images are VM-state snapshots, not operating-system process snapshots.
- Host capabilities and retained external resources stay process-local and must be recreated by the next run.
- Source emission is source-like and readable, but it is not a stable byte-for-byte source reconstruction contract.
- Native-only class behavior is rejected unless it is a generated accessor that Ricochet can rebuild from class field metadata.