resonate-durable-sleep-scheduled-work-typescript
Installation
SKILL.md
Resonate Durable Sleep & Scheduled Work (TypeScript)
Overview
Resonate's ctx.sleep() creates suspension points where workflows pause without consuming resources. Unlike regular setTimeout() or sleep(), durable sleep survives crashes, restarts, and redeployments. The workflow suspends its state, and Resonate resumes it exactly where it left off after the delay expires.
Core principle: yield* ctx.sleep(milliseconds) suspends execution durably. Workflows can sleep for seconds, hours, days, or weeks without holding threads, connections, or memory.
Mental Model
Regular Sleep (Ephemeral):
Process → sleep(10h) → [BLOCKS THREAD] → Resume
Crash during sleep? → LOST, never resumes
Durable Sleep (Resonate):
Workflow → yield* ctx.sleep(10h) → [SUSPENDS STATE] → Resume
Crash during sleep? → Automatically resumes after delay
Restart process? → Resumes from checkpoint after delay