resonate-recursive-fan-out-pattern-typescript

resonate-recursive-fan-out-pattern-typescript is a skill for Claude Code, Codex from resonatehq/resonate-skills. It costs 43 tokens per session (3,514 once invoked), scanned A, original, Apache-2.0.

A TypeScript implementation of recursive fan-out, where a workflow splits work into independent child workflows that run in parallel and may split into more children. It can either wait for results or start work without waiting.

In plain words
What is it for?
Use it for batch processing, tree or graph traversal, and other workflows that break complex work into smaller tasks. It covers both result-gathering tasks and fire-and-forget tasks.
Why use it?
It avoids serial processing when many independent tasks need to run, while Resonate deduplicates repeated promise IDs and balances work across workers.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it for batch processing, tree or graph traversal, and other workflows that break complex work into smaller tasks. It covers both result-gathering tasks and fire-and-forget tasks.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/resonatehq/resonate-skills/resonate-recursive-fan-out-pattern-typescript
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add resonatehq/resonate-skills --skill resonate-recursive-fan-out-pattern-typescript
Clone the repo
git clone --depth 1 https://github.com/resonatehq/resonate-skills

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for resonate-recursive-fan-out-pattern-typescript

README.md
[![agentmods](https://agentmods.dev/badge/skills/resonatehq/resonate-skills/resonate-recursive-fan-out-pattern-typescript/github.svg)](https://agentmods.dev/skills/resonatehq/resonate-skills/resonate-recursive-fan-out-pattern-typescript)
Your own site
<a href="https://agentmods.dev/skills/resonatehq/resonate-skills/resonate-recursive-fan-out-pattern-typescript"><img src="https://agentmods.dev/badge/skills/resonatehq/resonate-skills/resonate-recursive-fan-out-pattern-typescript/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for resonate-recursive-fan-out-pattern-typescript

Your own site · 80×15
<a href="https://agentmods.dev/skills/resonatehq/resonate-skills/resonate-recursive-fan-out-pattern-typescript"><img src="https://agentmods.dev/badge/skills/resonatehq/resonate-skills/resonate-recursive-fan-out-pattern-typescript.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 43 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,514 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00043 $0.03514
Opus 5 $0.00022 $0.01757
Sonnet 5 $0.00009 $0.00703
Haiku 4.5 $0.00004 $0.00351

Measured 12d ago against content hash 187c9be5c777, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, from the pricing page.

Security

Grade A, and why

resonate-recursive-fan-out-pattern-typescript scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 12d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

resonate-recursive-fan-out-pattern-typescript/SKILL.md · 587 lines

How it starts

The opening of the file, as written. The whole thing — 587 lines — stays where its author put it; the contents beside it link to each section on GitHub.

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

Fan-out: Parent spawns multiple children
Recursive: Children spawn grandchildren
Parallel: All execute concurrently
Deduplication: Same ID => same promise

Pattern 1: Detached Fan-Out (Fire-and-Forget)

Use when: You want to spawn independent work without waiting for results.

Basic Pattern

import { Context } from "@resonatehq/sdk";

function* parentWorkflow(ctx: Context, items: string[]) {
  // Spawn detached workflows for each item
  for (const item of items) {
    yield* ctx.detached(
      processItem,
      item,
      ctx.options({ id: `process/${item}` })
    );
  }

  // Parent completes immediately, children continue independently
  return { spawned: items.length };
}

function* processItem(ctx: Context, item: string) {
  // Process the item
  yield* ctx.run(async () => {
    console.log(`Processing ${item}`);
    // ... actual work ...
  });
}

With Automatic Deduplication

function* scrapeUser(
  ctx: Context,
  userId: string,
  depth: number
): Generator<any, void, any> {
  // Fetch user data
  const user = yield* ctx.run(fetchUserData, userId);

  console.log(`Scraped: ${user.handle}`);

  // Recursively scrape followers
  if (depth > 0) {
    const followers = yield* ctx.run(getFollowers, userId);

    for (const follower of followers) {
      // CRITICAL: Use follower ID as promise ID for deduplication
      // If same follower appears in multiple lists, only one scrape happens
      yield* ctx.detached(
        scrapeUser,
        follower.id,
        depth - 1,
        ctx.options({ id: follower.id })
      );
    }
  }
}

Read the full file on GitHub · 587 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 12d ago First seen · 587 lines · 43 tokens per session scan A 187c9be5c777

Subscribe to this mod's changes

resonate-recursive-fan-out-pattern-typescript is a skill published in the GitHub repository resonatehq/resonate-skills (6 stars, last pushed 20d ago), licensed Apache-2.0. It adds 43 tokens to every session and 3,514 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories