Snapshot & Restore
Capture and rollback full context state for branching or error recovery — everything that determines the next compile is part of the snapshot.
typescript
const snap = chef.snapshot("before risky tool call");
// ... agent executes tool, something goes wrong ...
chef.restore(snap); // rolls back everything: history, dynamic state, janitor state, memoryWhat a snapshot carries
- History and the dynamic state that will be injected on the next compile.
- Janitor state — including the compression failure counter (circuit breaker) and, in
'incremental-anchored'mode, the persistent anchor document. Background compression state is not snapshotted. - Memory entries.
- Guardrail options v4 —
withGuardrailsis stored state in v4, soChefSnapshotgainsguardrailOptionsand snapshot/restore round-trips it. - Snapshot metadata: the
labelyou passed andcreatedAt.
See the runnable snapshot-restore example for a full rollback walkthrough.