effect-fiber

Fork, supervise, and interrupt Effect fibers using FiberHandle, FiberMap, and FiberSet.

3|Updated Apr 1, 2026
One-click install
npx skills add https://github.com/mpsuesser/opencode-effect-enforcer --skill effect-fiber-mpsuesser
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: effect-fiber
Source: https://github.com/mpsuesser/opencode-effect-enforcer/tree/main/skills/effect-fiber
Command: npx skills add https://github.com/mpsuesser/opencode-effect-enforcer --skill effect-fiber-mpsuesser

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Managing concurrent background work in Effect TypeScript is error-prone: forked fibers get silently interrupted when parents complete, failures go unobserved, and cancellation semantics differ across fork variants. This Skill provides authoritative guidance on fiber lifecycle, interruption, and supervision so agents write correct concurrent Effect code. ## Core Features & Use Cases - Forking and lifetime control: Covers Effect.forkChild, forkScoped, forkIn, and forkDetach, including lazy-start behavior, startImmediately, and structured concurrency rules for v4. - Supervision collections: Explains FiberHandle (latest-wins single slot), FiberMap (keyed workers with dedupe), and FiberSet (grow-only task sets), including join vs awaitEmpty, propagateInterruption, and runtime runners for callback APIs. - Interruption and cleanup: Details uninterruptible regions, uninterruptibleMask, onInterrupt/onExit/ensuring finalizers, AbortSignal bridging, and runMain keep-alive behavior. - Use Case: When building a search box that cancels in-flight queries on each keystroke, use the FiberHandle plus runtime pattern to get latest-wins cancellation from synchronous event handlers. ## Quick Start Ask the agent to implement a background worker with restart-on-crash supervision and graceful shutdown using Effect fibers.

Frequently Asked Questions about effect-fiber

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I fork a background fiber in Effect v4?

Use Effect.forkChild to attach a fiber to the parent, Effect.forkScoped to tie it to a Scope, or Effect.forkDetach for fully detached work. The v3 names Effect.fork and Effect.forkDaemon no longer exist in v4.

What is the difference between FiberHandle, FiberMap, and FiberSet?

FiberHandle manages one fiber with latest-wins replacement, FiberMap manages keyed fibers where a new run under an existing key interrupts the previous one, and FiberSet is a grow-only collection with no replacement semantics. All three interrupt their fibers when the owning scope closes.

Why does my forked Effect fiber never run or get cancelled?

Forked fibers start on the next scheduler tick by default, and children forked with forkChild are interrupted when the parent completes. Use startImmediately: true, yield* Effect.yieldNow, or switch to forkScoped/forkDetach depending on the intended lifetime.

Does Fiber.await fail when the fiber fails?

No, Fiber.await always succeeds with an Exit value for inspection. Use Fiber.join to propagate the fiber's failure into the current fiber, or inspect the Exit with Exit.isSuccess and Cause helpers.

How do I cancel an Effect fiber from a callback or event handler?

Capture a synchronous runner with FiberHandle.runtime, FiberMap.runtime, or FiberSet.runtime inside a scoped effect, then call it from event handlers. For raw fibers, fiber.interruptUnsafe() sends an interruption signal without waiting.

When should I use FiberSet versus Effect.all for concurrency?

Use Effect.all or Effect.forEach when you only need concurrent results; use FiberSet when you need lifecycle control over an unbounded set of background tasks. Bound admission with a Semaphore since FiberSet applies no backpressure on its own.