// Effect-native wrappers · ▲ alpha

npm,effectified.

Effect-native packages for the libraries you already use. Typed errors, services as Layers, and interruption that cancels the call. Types derived from upstream's own, so a new upstream release fails the build instead of drifting.

16packages
5upstream packages wrapped
1family so far
// Before and after

Same library. Now the types say what can go wrong.

The left side is pi-ai as it ships. The right side is the same call through its effectified facade: what pi-ai does is what happens, but the failure, the timeout and the cancellation are in the type, not in your head.

pi-aipromise
import { builtinModels } from "@earendil-works/pi-ai/providers/all";

const models = builtinModels();
const model = models.getModel("anthropic", "claude-opus-4-7");
if (!model) throw new Error("no such model");

const controller = new AbortController();
const timer = setTimeout(() => controller.abort(), 30_000);

try {
  const message = await models.complete(model, context, {
    signal: controller.signal,
  });
  // A failed request resolves; you check for it.
  if (message.stopReason === "error") throw new Error(message.errorMessage);
  return message;
} finally {
  clearTimeout(timer);
}
Promise<AssistantMessage>: errors untyped, cancellation by hand
pi-ai-effecteffect
import { anthropicProvider } from "@earendil-works/pi-ai/providers/anthropic";
import { Effect } from "effect";
import { complete, getModel, Models } from "@gunta/pi-ai-effect";

const answer = Effect.gen(function* () {
  const model = yield* getModel({
    provider: "anthropic",
    modelId: "claude-opus-4-7",
  });
  return yield* complete(model, context);
}).pipe(
  // Interrupting the fiber aborts the provider request.
  Effect.timeout("30 seconds"),
  Effect.provide(Models.layer([anthropicProvider()])),
);
✓ AssistantMessage! ModelNotFound | ModelRequestError | TimeoutError◇ Models, provided
// The contract

Every package makes the same six promises.

Learn one effectified package and you know them all. The rules are checked in CI, not just written down.

01

Effect, Stream or Layer

Every public function returns one. No promise, callback or any in a public signature.

02

Errors with names

Failures are Schema.TaggedError classes, so catchTag sees every one. Library code never throws.

03

Interruption cancels

Interrupting the fiber aborts the upstream call, and an upstream abort interrupts the fiber.

04

Upstream's types, not copies

Types derive from upstream's own. What must stay hand-written is checked by a conformance test, so an upstream change fails the build and names what moved.

05

One Effect

effect is a peer dependency with one range across the organization, so an app holds one copy.

06

Runs where Effect runs

No node: or bun: import in a package core. Platform code sits behind its own subpath export.

// How it works

Decide once. Then keep up for free.

A person decides how a library maps to Effect. After that the work is mechanical, and mechanical work belongs to a machine. Today the first step is done by hand; the rest is what this organization is for.

01 · RECIPE

Map the library

Which calls become Effects, which failures become tagged errors, what becomes a service, who owns cancellation.

✓ Today · by hand
// proposed format
recipe("@earendil-works/pi-ai", {
  service: "Models",
  effects: ["complete", "stream"],
  errors: { stopReason: "ModelRequestError" },
  cancel: "fiber",
})
02 · GENERATOR

Write the facade

Reads upstream's type declarations and the recipe, and writes the facade, its errors and its conformance test. The same input always writes the same output.

▲ Roadmap
03 · UPSTREAM WATCH

Follow every release

Watches upstream releases, regenerates, runs the tests and opens a pull request. A change the recipe can't place asks a person instead of guessing.

▲ Roadmap · today a sync script
// Packages

16 packages, one family so far.

A family is one upstream project made Effect-native: facades that add no behaviour, and plugins built on them.

Pi

upstream earendil-works/pi @ 1.6.1effect ~4.1.5▲ alphasource
PackageKindWrapsWhat it does
@gunta/pi-ai-effectfacadepi-aiModels as a service, requests as Stream and Effect, bridges to effect/ai both ways.
@gunta/pi-durable-effectfacadepi-durable, pi-ai, chordThe durable agent harness as Layers, Effects and Streams.
@gunta/pi-schema-effectfacadepi-schemaEffect Schema to and from Pi tool parameters, with typed decode errors.
@gunta/pi-telemetry-effectfacadepi-telemetryPi spans, metrics and events as Effect spans, metrics and logs.
@gunta/pi-approvals-effectpluginpi-durableHuman approval of tool calls: a parking gate with typed requests and decisions.
@gunta/pi-budget-effectpluginpi-ai, pi-durableBudget leases: reserve before each request, settle after, stop when fenced.
@gunta/pi-guard-effectpluginpi-durableTool allow-lists, forbidden verbs and argument rules, failing closed.
@gunta/pi-recorder-effectpluginpi-ai, pi-durableEvery message, model call and tool call to a sink, at least once, with deterministic ids.
@gunta/pi-review-effectpluginpi-ai, pi-durableA second model of another family and a citation check before an answer stands.
@gunta/pi-router-effectpluginpi-aiModel routes: fallback, a limiter with backoff, prices, region filters.
@gunta/pi-search-effectpluginpi-durableSearch and fetch tools behind a provider port, with an Exa adapter.
@gunta/pi-subagent-effectpluginpi-durableForeground and background child agents with typed results.
@gunta/pi-swarm-effectpluginpi-durablePrime once, fork per job under a cap, typed fan-in and cleanup.
@gunta/pi-durable-rivet-effecthostpi-durable, pi-ai, chordA durable harness inside a Rivet actor: actor SQLite, schedules and forks.
@gunta/pi-thread-effectcompositionpi-ai, pi-durableAn agent thread: guarded, budgeted, recorded and reviewed, with subagents and swarms.
@gunta/pi-docs-effectdocs–The family's docs as pages for people and as skills for agents.
facade

Upstream's capability in Effect terms. Adds no behaviour.

plugin

Behaviour of ours, built on the facades.

host

Runs the upstream harness on another platform.

composition

The plugins composed as a product would compose them.

docs

The family's docs, as pages for people and skills for agents.

▲Not on npm yet. The Pi family moves to github.com/effectified and publishes as @effectified/*.

// Join

Effectify a library.Then never port it again.

Name the library you want in Effect. Bring its recipe if you know how it should map. Every family follows the same contract, so what you learn on one carries to the next.

# the Pi family, from source until it is on npm
$ git clone https://github.com/gunta/pi-effect
$ cd pi-effect && npm install --ignore-scripts
$ npm run build