resonate-recursive-fan-out-pattern-typescript
Installation
SKILL.md
Resonate Recursive Fan-Out Pattern (TypeScript)
Overview
The recursive fan-out pattern enables workflows to spawn multiple child workflows in parallel, either collecting their results or letting them execute independently. Resonate provides two primitives for this: ctx.detached() for fire-and-forget execution and ctx.beginRpc() for parallel execution with result gathering.
Core principle: Break complex work into parallel subtasks that recursively break down further, with automatic deduplication via promise IDs and transparent load balancing across workers.
Mental Model
Parent Workflow
│
├─────────┬─────────┬─────────┐
│ │ │ │
Child 1 Child 2 Child 3 Child 4
│ │ │
├──┬──┐ ├──┐ └──┬──┐
G1 G2 G3 G4 G5 G6 G7