# The Effect 4 Handbook > A source-grounded guide audited 2026-11-19 against Effect 4.1.4 (289a53f7b1fc). This is the **4.1 edition** (effect@4.1.4). One edition is published per Effect major.minor; the site root always serves the latest. Match the edition to the `effect` version installed in your project (see [Editions](#editions) below, or fetch [versions.json](https://eugene1g.github.io/effect-handbook/versions.json)). Use the intent map or capability catalog first, then fetch only the linked Markdown page or domain bundle. For a broad overview read the Essentials digest; use the complete concise aggregate only for an exhaustive cross-cutting review, not as the default retrieval unit. Every HTML page has a Markdown twin at the same path with `.md` appended (`/` is `/index.md`); fetch the twin, never the HTML. Sizes are given in words; budget roughly 1.3 tokens per word, more for code-heavy pages. **Before you write code:** these Effect 3 names do not exist in Effect 4 and are the most common cause of broken generated code ([full list](https://eugene1g.github.io/effect-handbook/troubleshooting/anti-patterns.md#effect-3-names-that-do-not-exist-in-effect-4)). - `Effect.catchAll` → `Effect.catch` - `Effect.catchAllCause` → `Effect.catchCause` - `Effect.catchSome` → `Effect.catchIf` or `Effect.catchTag` - `Effect.either` → `Effect.result` (returns a `Result`) - `Effect.tapErrorCause` → `Effect.tapCause` - `Effect.zipLeft` / `Effect.zipRight` → `Effect.tap` / `Effect.andThen` - `Context.Tag`, `Effect.Service` → `Context.Service` - `Layer.scoped` → `Layer.effect` (it already handles a `Scope` requirement) - `Schema.decodeUnknown` / `Schema.encodeUnknown` → `Schema.decodeUnknownEffect` / `Schema.encodeUnknownEffect` (or the `Sync`, `Result`, `Exit`, `Option`, and `Promise` variants) - `Schema.decode(schema)` as a decoder → `Schema.decodeEffect(schema)`; in Effect 4 `Schema.decode` builds a transformation from getters - `@effect/platform`, `@effect/rpc`, `@effect/sql`, `@effect/cli` → modules inside `effect`: `FileSystem` and `Path` from `"effect"`, HTTP from `"effect/http"`, and so on; host Layers from `@effect/platform-node` - `NodeRuntime` from `"effect"` → `NodeRuntime` from `@effect/platform-node` - [Using this handbook from an agent](https://eugene1g.github.io/effect-handbook/reference/agent-guide.md): The reading protocol — which artifact to fetch for which task, the Markdown URL rule, how to read the catalog, how to cite, and a drop-in instructions block (~2.5K words). - [Essentials](https://eugene1g.github.io/effect-handbook/effect-4-essentials.md): **Start here for a broad read.** Every concise page and section in reading order — its purpose, stability, and when to reach for it — each linking to the full section (~40K words). - [Module index](https://eugene1g.github.io/effect-handbook/effect-4-modules.md): Every module section by name — import path, stability badge, and the Markdown twin anchor (415 modules; JSON at [effect-4-modules.json](https://eugene1g.github.io/effect-handbook/effect-4-modules.json)). - [Capability catalog](https://eugene1g.github.io/effect-handbook/effect-4-catalog.json): Structured symbols, task aliases, selection boundaries, error/context/lifetime facts, and canonical anchors. - [Example inventory and validation plan](https://eugene1g.github.io/effect-handbook/effect-4-examples.json): Classifies compile, contextual, run, pseudocode, and expected-invalid examples without embedding transient validation results. - [Complete concise handbook](https://eugene1g.github.io/effect-handbook/effect-4-handbook.md): All concise reference, recipe, and troubleshooting pages; long-form deep dives are intentionally excluded (~290K words; the same text is served as [llms-full.txt](https://eugene1g.github.io/effect-handbook/llms-full.txt)). ## Editions Each edition is a complete, independently audited handbook with its own `llms.txt`, module index, catalog, and Markdown twins at the same relative paths. Pick the edition whose id matches your installed `effect` major.minor; if that minor is not listed, use the highest listed edition below it in the same major. Editions of different majors are not interchangeable. - [4.1 — effect@4.1.4](https://eugene1g.github.io/effect-handbook/4.1/llms.txt): audited 2026-11-19 (latest, this file). - [4.0 — effect@4.0.5](https://eugene1g.github.io/effect-handbook/4.0/llms.txt): audited 2026-10-22 (frozen). ## Domain bundles - [Effect 4 Core](https://eugene1g.github.io/effect-handbook/effect-4-core.md): Focused aggregate for core tasks (~122K words). - [Effect 4 Web & Service Boundaries](https://eugene1g.github.io/effect-handbook/effect-4-web.md): Focused aggregate for web tasks (~68K words). - [Effect 4 Concurrency & Streaming](https://eugene1g.github.io/effect-handbook/effect-4-concurrency.md): Focused aggregate for concurrency tasks (~48K words). - [Effect 4 Durable & Distributed Systems](https://eugene1g.github.io/effect-handbook/effect-4-distributed.md): Focused aggregate for distributed tasks (~48K words). - [Effect 4 AI](https://eugene1g.github.io/effect-handbook/effect-4-ai.md): Focused aggregate for ai tasks (~41K words). ## Intent and primitive map ### Core runtime, errors, services, and configuration - [Effect / Effect.gen / Effect.fn](https://eugene1g.github.io/effect-handbook/foundations/core-runtime-execution.md#effect) — model an asynchronous computation, compose typed effects, replace async await. The default description type for work that may succeed, fail, or require services. - [Effect.tryPromise / Effect.promise / Effect.callback](https://eugene1g.github.io/effect-handbook/foundations/core-runtime-execution.md#1-creating-effects) — wrap a promise, call a promise api, adapt a callback api, convert rejection to typed error. Adapts foreign asynchronous APIs while keeping failures and cancellation explicit. - [Effect.acquireRelease / Effect.scoped / Scope](https://eugene1g.github.io/effect-handbook/foundations/core-runtime-execution.md#6-interruption-resource-safety) — close a resource, bracket acquire release, cleanup on interruption, resource safety. Acquires a value into a Scope and registers deterministic cleanup. - [Context.Service](https://eugene1g.github.io/effect-handbook/foundations/services-context-layers.md#context) — dependency injection, define a service, test substitute, ambient dependency. Defines a typed capability that Effects request through R. - [Context.Reference / References](https://eugene1g.github.io/effect-handbook/foundations/services-context-layers.md#references) — fiber local setting, default service value, override runtime policy. Defines a context value with a default that can be locally overridden. - [Layer.succeed / Layer.effect / Layer.provide](https://eugene1g.github.io/effect-handbook/foundations/services-context-layers.md#layer) — provide a service, compose dependencies, build an application layer, dependency graph. Builds and composes service implementations with memoized acquisition. - [Layer.effect / Layer.effectDiscard / Layer.launch](https://eugene1g.github.io/effect-handbook/foundations/services-context-layers.md#layer) — provide a resource service, application lifetime resource, start a server, graceful shutdown. Turns scoped acquisition into a reusable service graph with deterministic shutdown. - [ManagedRuntime.make / runtime.runPromise / runtime.dispose](https://eugene1g.github.io/effect-handbook/foundations/fibers-scopes-runtimes.md#managedruntime) — integrate Effect with a framework, call Effect from an Express, Hono, or Fastify route handler, run Effect from framework callbacks, reuse a runtime. Builds a reusable runtime for a non-Effect host and exposes explicit disposal. - [Config / ConfigProvider / Redacted](https://eugene1g.github.io/effect-handbook/foundations/configuration-secrets.md#config) — read environment variable, typed configuration, secret config, config validation. Builds typed configuration descriptions interpreted by a replaceable provider. - [NodeRuntime.runMain](https://eugene1g.github.io/effect-handbook/foundations/getting-started.md#install-effect-4) — install version 4, which version to install, npm install gave version 3, pin effect version. Pins one exact Effect 4 release for every effect and @effect/* package and sets the compiler options its types assume. - [Effect.tryPromise / Effect.callback / Effect.abortSignal](https://eugene1g.github.io/effect-handbook/foundations/core-runtime-execution.md#8-cancellable-adapters-for-promises-and-callbacks) — cancel fetch on interruption, forward abort signal, abort promise when fiber is interrupted, timeout does not cancel request. Forwards the AbortSignal Effect hands to a Promise or callback adapter so interruption stops the foreign work, not only the fiber. - [ManagedRuntime.make / runtime.runPromise / runtime.runPromiseExit](https://eugene1g.github.io/effect-handbook/recipes/request-cancellation-through-a-host.md#contract) — cancel effect when http request is aborted, forward an Express or Hono request abort signal, client disconnect should stop work, pass abort signal to runPromise. Turns a host request's AbortSignal into fiber interruption through one ManagedRuntime and on into the innermost adapter. - [Effect.provide / Layer.fresh / ManagedRuntime.make](https://eugene1g.github.io/effect-handbook/foundations/services-context-layers.md#what-is-shared-and-what-is-rebuilt) — layer built twice, share one connection pool, is my layer memoized, provide the same layer in two places. Explains when two requests for a Layer reuse one build and when each builds its own. - [Config.all / Config.Duration / Config.Redacted](https://eugene1g.github.io/effect-handbook/foundations/configuration-secrets.md#designing-the-startup-contract) — validate all configuration at startup, fail fast on bad config, config before opening connections, test configuration. Gathers every setting into one Config program that fails before any resource is acquired. - [Runtime.defaultTeardown / Runtime.errorExitCode / Runtime.InterruptExitCode](https://eugene1g.github.io/effect-handbook/foundations/fibers-scopes-runtimes.md#runtime) — choose process exit code, exit 0 after intentional shutdown, avoid exit code 130, custom exit code for error. Maps a program's final Exit to a process exit code, including annotated intentional interruptions. - [Effect / Layer / Schema](https://eugene1g.github.io/effect-handbook/reference/review-checklists.md#effect-construction-and-running) — code review checklist, design review questions, review a pull request, self check generated code. Yes/no review questions for each area of an Effect codebase, each linked to the section that owns the rule. ### Structured concurrency and coordination - [Effect.forkChild / Effect.forkScoped / Fiber](https://eugene1g.github.io/effect-handbook/foundations/fibers-scopes-runtimes.md#fiber) — start a child fiber, cancel background work on shutdown, structured concurrency. Forks work under an explicit parent or Scope instead of leaking a detached fiber. - [Deferred](https://eugene1g.github.io/effect-handbook/foundations/fibers-scopes-runtimes.md#deferred) — promise cell, wait for one value, complete from another fiber, one shot signal. A one-time Effect-aware result completed by one fiber and awaited by many. - [Latch](https://eugene1g.github.io/effect-handbook/foundations/fibers-scopes-runtimes.md#latch) — open a gate, pause many fibers, reusable signal, wait until ready. A gate that can open, close, and release all current waiters. - [Queue](https://eugene1g.github.io/effect-handbook/concurrency/concurrency-coordination.md#queue) — bounded work queue, producer consumer, backpressure, mailbox. A point-to-point buffer where each element is taken by one consumer. - [PubSub](https://eugene1g.github.io/effect-handbook/concurrency/concurrency-coordination.md#pubsub) — broadcast events, fan out messages, multiple subscribers, event bus. Publishes each value to every active subscriber according to a capacity strategy. - [Semaphore / PartitionedSemaphore](https://eugene1g.github.io/effect-handbook/concurrency/concurrency-coordination.md#semaphore) — mutex, limit concurrency, critical section, per key lock. Controls permits around arbitrary Effects, globally or by partition key. - [Effect.forEach / Effect.all](https://eugene1g.github.io/effect-handbook/foundations/core-runtime-execution.md#4-concurrency) — process array concurrently, bounded parallel map, limit parallel requests. Uses a local concurrency option for one finite batch of Effects. - [Pool](https://eugene1g.github.io/effect-handbook/concurrency/concurrency-coordination.md#pool) — resource pool, connection pool, reuse expensive objects, bounded resource acquisition. Maintains reusable acquired items between a minimum and maximum size. ### Mutable and transactional state - [Ref](https://eugene1g.github.io/effect-handbook/concurrency/state-mutable-references.md#ref) — atomic mutable state, counter, shared in memory state. Provides lock-free atomic reads and pure updates of one value. - [SynchronizedRef](https://eugene1g.github.io/effect-handbook/concurrency/state-mutable-references.md#synchronizedref) — effectful atomic update, serialize state transition, locked ref. Serializes effectful modifications of one state cell. - [SubscriptionRef / SubscriptionRef.changes](https://eugene1g.github.io/effect-handbook/concurrency/state-mutable-references.md#subscriptionref) — observable state, watch state changes, current value plus stream. Combines an atomic current value with a Stream of subsequent changes. - [Effect.tx / TxRef / TxQueue / TxHashMap](https://eugene1g.github.io/effect-handbook/concurrency/software-transactional-memory.md#the-mental-model) — atomic multiple state changes, software transactional memory, composable transaction, retry until state changes. Composes several in-memory reads, writes, and waits into one atomic transaction. ### Incremental processing and backpressure - [Stream](https://eugene1g.github.io/effect-handbook/concurrency/streaming-channels.md#stream) — process many values, incremental pipeline, backpressure stream, infinite sequence. Describes an effectful, resource-safe sequence consumed incrementally. - [Sink](https://eugene1g.github.io/effect-handbook/concurrency/streaming-channels.md#sink) — consume a stream, stream aggregation, batch stream output, fold stream. A reusable consumer that transforms a stream's input into a result and possible leftovers. - [Channel](https://eugene1g.github.io/effect-handbook/concurrency/streaming-channels.md#channel) — custom stream transducer, bidirectional protocol, typed channel, low level streaming. The lower-level typed engine beneath Stream and Sink with input/output/error channels. - [Csv / JsonArray / Tar / Zip / Xml](https://eugene1g.github.io/effect-handbook/concurrency/streaming-channels.md#csv) — parse csv stream, write csv, stream a large json array, read a tar archive. Streaming codecs for CSV, top-level JSON arrays, Tar and Zip archives, and XML. - [SchemaBinary](https://eugene1g.github.io/effect-handbook/concurrency/streaming-channels.md#schemabinary) — compact binary encoding, replace msgpack, binary frames over a socket, schema derived binary codec. Derives a compact binary codec and framed stream channels from a Schema. ### Finite data and SQL - [Array / Chunk / Iterable](https://eugene1g.github.io/effect-handbook/data/data-structures.md#array) — finite collection, immutable sequence, lazy pure iterable, chunk of values. Pure sequence tools for finite or synchronously iterable data already available in memory. - [SqlClient / SqlSchema](https://eugene1g.github.io/effect-handbook/interfaces/sql.md#sqlclient) — query database, sql transaction, parameterized sql, decode sql rows. Provides parameterized tagged-template SQL, transactions, streaming, and Schema row codecs. - [SqlResolver / SqlSchema](https://eugene1g.github.io/effect-handbook/interfaces/sql.md#sqlresolver) — batch sql queries, sql data loader, deduplicate database reads. Builds RequestResolvers backed by batched, Schema-decoded SQL operations. - [PgClient.layer](https://eugene1g.github.io/effect-handbook/interfaces/sql.md#session-settings-at-connect-time) — set postgres session parameters, statement timeout for every connection, search path per connection, postgres startup options. Sends session defaults in the startup packet of every physical PostgreSQL connection, including pooled replacements. - [Base64 / Base64Url / Hex / EncodingError](https://eugene1g.github.io/effect-handbook/data/functional-toolkit.md#base64) — base64 encode a string, decode base64 to bytes, hex encode bytes, url safe base64 token. Text codecs for bytes and strings, one module per format, with typed decode failures. - [ByteSize](https://eugene1g.github.io/effect-handbook/data/functional-toolkit.md#bytesize) — file size limit, parse 10 MiB, format bytes, upload size limit. Represents exact byte counts with explicit decimal and binary units, parsing, arithmetic, and formatting. - [SqlClient / PersistedQueue](https://eugene1g.github.io/effect-handbook/interfaces/sql.md#external-effects-after-commit-outbox) — publish event after database commit, transactional outbox, send email after transaction, dual write problem. Commits the domain write and an outbox row together, then delivers after commit with at-least-once semantics. - [Rational](https://eugene1g.github.io/effect-handbook/data/functional-toolkit.md#rational) — exact fraction, one third without rounding, ratio arithmetic, rational number. Exact bigint fractions in lowest terms with safe and Unsafe arithmetic and explicit rounding to BigDecimal. - [Json5 / Jsonc](https://eugene1g.github.io/effect-handbook/concurrency/streaming-channels.md#json5) — parse json5, json with comments, parse tsconfig, jsonc config file. Dependency-free JSON5 and JSONC parsers returning Result. ### Validation and codecs - [Schema / Schema.decodeUnknownEffect / Schema.encodeUnknownEffect](https://eugene1g.github.io/effect-handbook/data/schema.md#schema) — validate unknown input, decode json, encode domain value, runtime type safety. Defines one bidirectional boundary between encoded input and validated domain values. - [Schema.decodeTo / SchemaGetter / SchemaTransformation](https://eugene1g.github.io/effect-handbook/data/schema.md#6-transformations-decodeto-getters) — transform encoded value, parse string to domain, schema codec transformation, validate then convert. Connects encoded and domain schemas with explicit decode and encode logic. - [Schema.Class / Schema.TaggedClass / Schema.Error / Schema.TaggedError](https://eugene1g.github.io/effect-handbook/data/schema.md#9-classes-and-tagged-errors) — schema backed class, tagged error class, domain model, serializable error. Creates nominal constructors whose fields, decoding, and encoding share one Schema. - [SchemaJITCompiler / SchemaAOTCompiler / SchemaCompiler](https://eugene1g.github.io/effect-handbook/data/schema-tooling.md#schemajitcompiler) — faster schema decoding, compile schema decoders, schema decoding without new Function, content security policy blocks eval. Installs compiled decoders behind the unchanged SchemaParser API, generated at runtime (JIT) or at build time (AOT). - [Schema.decodeUnknownEffect / SchemaAST.ParseOptions](https://eugene1g.github.io/effect-handbook/data/schema-in-depth.md#5-parse-options-are-boundary-policy) — reject unknown properties, strip extra fields, report all validation errors, onExcessProperty. Sets excess-property, error-collection, and concurrency policy at the decode call that owns the boundary. ### Absence, expected failures, and diagnostics - [Option](https://eugene1g.github.io/effect-handbook/foundations/errors-option-result.md#option) — optional value, missing value without error, nullable value, zero or one. Models deliberate absence with no diagnostic payload. - [Result](https://eugene1g.github.io/effect-handbook/foundations/errors-option-result.md#result) — pure typed error, validation result, success or failure value. Models pure success or a typed expected failure without an Effect runtime. - [Cause / Exit / Effect.exit](https://eugene1g.github.io/effect-handbook/foundations/fibers-scopes-runtimes.md#cause) — inspect defects, inspect interruption, capture full failure, sandbox error. Preserves typed failures, defects, and interruption as one diagnostic tree. - [Data.TaggedError / Schema.TaggedError / Effect.catchTag](https://eugene1g.github.io/effect-handbook/foundations/errors-option-result.md#effect-error-handling) — typed domain error, catch by tag, model expected failure. Uses discriminated errors so recovery can be precise and exhaustive. - [Effect.validate / Effect.partition / Effect.all](https://eugene1g.github.io/effect-handbook/foundations/errors-option-result.md#accumulating-errors-instead-of-failing-fast) — collect all validation errors, do not stop at first failure, accumulate errors, partition successes and failures. Runs every item and reports all failures instead of failing fast on the first one. ### Retry, repetition, and polling - [Effect.retry / Schedule](https://eugene1g.github.io/effect-handbook/concurrency/scheduling-time.md#schedule) — retry transient failure, exponential backoff, retry with jitter, retry after. Drives repeated attempts from typed failures according to a composable Schedule. - [Effect.repeat / Schedule](https://eugene1g.github.io/effect-handbook/concurrency/scheduling-time.md#schedule) — repeat successful effect, run periodically, repeat action. Schedules another execution after successful completion. - [Effect.repeat / Schedule.while / Schedule.passthrough](https://eugene1g.github.io/effect-handbook/concurrency/scheduling-time.md#polling-with-repeat-and-passthrough) — poll until condition, wait for status, repeat until value. Repeats a successful query until its input/result satisfies a condition. - [Cron / Schedule.cron](https://eugene1g.github.io/effect-handbook/concurrency/scheduling-time.md#cron) — cron job, calendar schedule, run at a wall clock time, parse cron expression. Parses calendar recurrences and turns them into an in-process Schedule. ### Caching, refresh, and request batching - [Cache](https://eugene1g.github.io/effect-handbook/operations/caching-batching.md#cache) — memoize effectful lookup, cache a value, caching a value, ttl cache. Caches completed lookup Exits with capacity, time-to-live, and concurrent miss deduplication. - [ScopedCache](https://eugene1g.github.io/effect-handbook/operations/caching-batching.md#scopedcache) — cache a resource, cache scoped resources, caching scoped resources, memoize scoped acquisition. Caches scoped resources and releases each when its entry is removed or the cache closes. - [Resource](https://eugene1g.github.io/effect-handbook/foundations/services-context-layers.md#resource) — background refresh, refresh a value, periodically reload configuration, stale value. Maintains one acquired value that can refresh manually or on a Schedule. - [Request / RequestResolver / Effect.request](https://eugene1g.github.io/effect-handbook/operations/caching-batching.md#requestresolver) — data loader, batch requests, deduplicate requests, n plus one. Batches typed requests; RequestResolver.withCache separately adds equality-based sharing of in-flight and completed requests. - [Effect.cached / Effect.cachedWithTTL / Effect.cachedInvalidateWithTTL](https://eugene1g.github.io/effect-handbook/operations/caching-batching.md#caching-a-single-effect) — memoize one effect, compute once and reuse, cache a token until it expires, lazy singleton effect. Memoizes a single Effect's outcome, optionally with a time-to-live or manual invalidation. ### HTTP, GraphQL, RPC, and networking boundaries - [GraphQL / GraphQLGroup / GraphQLClient / GraphQLProtocol / GraphQLResolver](https://eugene1g.github.io/effect-handbook/interfaces/graphql.md#graphql) — typed graphql client, consume a graphql api, graphql partial results, graphql subscriptions. Consumes Schema-checked GraphQL operations with explicit partial results, transports, pagination, and identity-aware batching. - [Host / Dns / AddressResolver](https://eugene1g.github.io/effect-handbook/interfaces/platform-runtime-hosts.md#addressresolver) — resolve a hostname, dns lookup, query dns records, resolve host and port. Parses host endpoints and resolves them through OS lookup or typed DNS queries. - [DatagramSocket](https://eugene1g.github.io/effect-handbook/interfaces/platform-runtime-hosts.md#datagramsocket) — udp socket, send datagrams, pull based udp, datagram reader writer. Exposes scoped pull-based UDP readers and writers backed by the host runtime. - [HttpClient / HttpClientRequest / HttpClientResponse](https://eugene1g.github.io/effect-handbook/interfaces/http-client.md#httpclient) — make http request, fetch api, http client middleware, retry http. Composable outbound HTTP with typed request/response errors and platform clients. - [HttpRouter / HttpServerResponse](https://eugene1g.github.io/effect-handbook/interfaces/http-server.md#httprouter) — low level http router, custom http handler, serve an endpoint. Routes raw HTTP requests to Effect handlers without a shared Schema contract. - [HttpApi / HttpApiEndpoint / HttpApiBuilder / HttpApiClient](https://eugene1g.github.io/effect-handbook/interfaces/http-api.md#httpapi) — contract first http api, generated http client, openapi server, typed rest api. Defines Schema-backed HTTP endpoints once for server handlers, clients, and OpenAPI. - [Rpc / RpcGroup / RpcServer / RpcClient](https://eugene1g.github.io/effect-handbook/interfaces/rpc.md#rpc) — typed rpc, command query protocol, streaming rpc, internal service client. Defines Schema-backed request/response operations independent of a specific transport. - [SecureRandom / Digest / Mac / Aead / Signature / Kdf / KeyFormat](https://eugene1g.github.io/effect-handbook/interfaces/cryptography.md#cryptography) — secure random bytes, generate a uuid, sha256 digest, verify a webhook hmac. One service per cryptographic job, with opaque typed keys and a single CryptoError, provided by host crypto layers. - [NetAddress / IpNetwork / IpInterface](https://eugene1g.github.io/effect-handbook/interfaces/platform-runtime-hosts.md#netaddress) — parse ip address, check ip in cidr range, ssrf allow list, format socket address. Models IP, socket, MAC, and CIDR values with checked parsing, structural equality, and classification predicates. - [Jwt / Jws / Jwk / Jwks / JoseError](https://eugene1g.github.io/effect-handbook/interfaces/cryptography.md#jose-tokens-and-keys) — verify a jwt, issue a jwt, validate an access token, jwks endpoint. Signs, verifies, and encrypts compact JOSE tokens with algorithm-bound keys, schema-typed claims, and local or remote key sets. ### Persistence, workflows, cluster, and event history - [Persistence / PersistenceStore / KeyValueStore](https://eugene1g.github.io/effect-handbook/tooling/persistence.md#persistence) — persist effect result, current persisted state, key value storage, durable state. Provides Schema-backed persistence abstractions over memory, filesystem, SQL-like, or Redis-style stores. - [PersistedCache / RequestResolver.persisted](https://eugene1g.github.io/effect-handbook/tooling/persistence.md#persistedcache) — cache across restart, persistent cache, durable request result. Persists Schema-backed lookup/request Exits so results can be reused after restart. - [Workflow / WorkflowEngine / Activity](https://eugene1g.github.io/effect-handbook/systems/workflows-durable-execution.md#workflow) — durable workflow, durable orchestration, resume after restart, long running process. Records workflow progress so deterministic orchestration can resume across failures and ownership moves. - [Activity / Activity.idempotencyKey](https://eugene1g.github.io/effect-handbook/systems/workflows-durable-execution.md#activity) — workflow side effect, idempotent activity, external call in workflow. Moves nondeterministic/external Effect work behind a durable workflow step. - [Entity / Sharding / EntityProxy](https://eugene1g.github.io/effect-handbook/systems/cluster-sharding.md#entity) — actor, distributed actor, distributed actors, distributed entity. Routes typed operations for an entity identity to a single current cluster owner. - [EventLog / EventJournal / EventGroup](https://eugene1g.github.io/effect-handbook/systems/event-log-event-sourcing.md#eventlog) — event sourcing, append event, projection, audit history. Appends Schema-backed events and derives projections from ordered history. - [CircuitBreaker / HttpClient.withCircuitBreaker](https://eugene1g.github.io/effect-handbook/tooling/persistence.md#circuitbreaker) — circuit breaker, stop calling a failing dependency, trip after consecutive failures, shared circuit state across instances. Keyed circuits with consecutive or rate trip policies over an in-memory or Redis store. - [PersistedQueue](https://eugene1g.github.io/effect-handbook/tooling/persistence.md#persistedqueue) — durable job queue, background jobs that survive restart, retry failed job with backoff, dead letter queue. A durable work queue with claim-time attempt counting, scheduled retries, dead-lettering, and idempotent offers. - [MessageRetention](https://eugene1g.github.io/effect-handbook/systems/cluster-sharding.md#messageretention) — bound message storage, delete old persisted requests, message storage grows forever, cluster retention. Deletes a persisted entity type's completed requests and replies after a retention age. - [CloudflareCluster / CloudflareDurableObjects / CloudflareWorkflowEngine](https://eugene1g.github.io/effect-handbook/systems/cluster-sharding.md#running-on-cloudflare-durable-objects) — cloudflare durable objects, cluster on cloudflare workers, durable entities on workers, workflows on cloudflare. Runs cluster entities, workflows, durable queues, and singletons as SQLite-backed Durable Objects. ### Reactive graphs and local refs - [Atom / AtomRegistry / AsyncResult](https://eugene1g.github.io/effect-handbook/systems/reactivity-atom.md#atom) — reactive state graph, derived state, effectful atom, frontend state. Describes registry-managed reactive values, dependencies, async state, and invalidation. - [AtomRef](https://eugene1g.github.io/effect-handbook/systems/reactivity-atom.md#atomref) — local reactive cell, observable ref, form state, fine grained state. A standalone synchronous observable cell without an AtomRegistry. ### Observability - [Effect.log / Effect.withSpan / Metric / Otlp](https://eugene1g.github.io/effect-handbook/operations/observability.md#logger) — structured logging, tracing, metrics, opentelemetry. Adds structured logs, spans, metrics, and exporter Layers without changing domain results. - [Metric / Effect.withSpan / Effect.annotateLogs](https://eugene1g.github.io/effect-handbook/operations/observability.md#designing-signals) — metric label cardinality, which telemetry signal to use, avoid user id in metric labels, telemetry privacy. Chooses the right signal for a question and keeps names and attribute sets bounded and privacy-safe. ### Deterministic Effect tests - [it.effect / TestClock / TestConsole / Layer.mock](https://eugene1g.github.io/effect-handbook/tooling/testing-dev-tooling.md#effect-vitest) — test Effect code, virtual time test, test layer, deterministic retry test. Runs Effects with scoped test services, virtual time, and typed Layer substitution. - [Arbitrary / it.effect.prop](https://eugene1g.github.io/effect-handbook/tooling/testing-dev-tooling.md#arbitrary) — property based test, generate test data from schema, replace fast-check, shrink failing input. Derives generators from Schemas and checks properties with bounded shrinking and replay. ### Language models, tools, and MCP - [McpServer.layerHttpRequestScoped / McpProtocol.v2026_07_28](https://eugene1g.github.io/effect-handbook/systems/mcp.md#mcpserver) — mcp cloudflare workers, serverless mcp endpoint, request scoped mcp, mcp work outside request. Owns one sessionless MCP server per HTTP POST so no server fiber or timer outlives the request. - [LanguageModel / Prompt / Response](https://eugene1g.github.io/effect-handbook/systems/ai-language-models.md#languagemodel) — call a language model, structured model output, stream model response, llm provider. Provides provider-neutral generation, structured output, streaming, and telemetry contracts. - [Tool / Toolkit / Chat](https://eugene1g.github.io/effect-handbook/systems/ai-language-models.md#toolkit) — llm tool calling, language model tools, invoke application tools, agent loop. Defines Schema-backed tools and resolves model tool calls through typed Effect handlers. - [McpServer / McpProtocol](https://eugene1g.github.io/effect-handbook/systems/mcp.md#mcpserver) — mcp server, model context protocol, serve tools over mcp, stdio mcp. Exposes typed tools/resources over a selected MCP protocol and transport. - [McpServer.elicit / McpSchema.InputRequired / McpSchema.McpRequestContext](https://eugene1g.github.io/effect-handbook/systems/mcp.md#mcpserver) — ask the user to confirm before an mcp tool runs, human in the loop for an mcp tool, mcp elicitation, input required round trip. Collects a human answer in the middle of an MCP tool call: a pushed elicitation on session protocols or a stateless input-required round trip with sealed request state. - [Decision / DecisionModel](https://eugene1g.github.io/effect-handbook/systems/ai-language-models.md#decisionmodel) — classify text with a model, rate or score items with a model, probability estimate from a model, batched classification. Asks a model provider a typed classification, rating, or probability question over schema-encoded items and validates every answer. - [McpClient / McpClientError](https://eugene1g.github.io/effect-handbook/systems/mcp.md#mcpclient) — call a remote mcp server, mcp client, use mcp tools in a toolkit, list mcp tools. Connects to an MCP server and exposes its tools, resources, and prompts as typed calls or an AI Toolkit. - [AgUiServer / AgUi / AgUiSchema](https://eugene1g.github.io/effect-handbook/systems/ai-language-models.md#aguiserver) — ag-ui agent endpoint, serve agent to frontend, frontend tools, copilot ui streaming. Serves a LanguageModel agent to AG-UI frontends as an SSE run stream with server and client-executed tools. - [WorkloadIdentity / AnthropicWorkloadIdentity / OpenAiWorkloadIdentity / OpenRouterWorkloadIdentity](https://eugene1g.github.io/effect-handbook/systems/ai-language-models.md#workloadidentity) — provider auth without api key, workload identity federation, kubernetes token for llm, oidc token exchange. Exchanges platform identity tokens for cached short-lived provider access tokens on the provider's HttpClient. ## Start Here - [The Effect 4 Handbook — A Guided Tour of Effect v4](https://eugene1g.github.io/effect-handbook/index.md): How to use the Effect 4 Handbook, its version contract, conventions, and official companion resources. (~2.2K words) - [Getting Started](https://eugene1g.github.io/effect-handbook/foundations/getting-started.md): Installing the Effect 4 release line, TypeScript and ESM settings, a first program, import forms, and editor tooling. (~2.7K words) ## Runtime Fundamentals - [Core Runtime & Execution](https://eugene1g.github.io/effect-handbook/foundations/core-runtime-execution.md): Building and combining Effects: creation, gen and fn, error handling, concurrency, racing, interruption, adapters, and execution planning. (~7.4K words) - [Fibers, Scopes & Runtimes](https://eugene1g.github.io/effect-handbook/foundations/fibers-scopes-runtimes.md): How Effects run: Exit and Cause, fibers and fiber handles, Scope, scheduler and clock, Deferred, Latch, Runtime, and ManagedRuntime. (~6.5K words) - [Services, Context & Layers](https://eugene1g.github.io/effect-handbook/foundations/services-context-layers.md): Typed services, Context, References, Layer construction, memoization, and resource lifecycles. (~5.4K words) - [Configuration & Secrets](https://eugene1g.github.io/effect-handbook/foundations/configuration-secrets.md): Configuration providers, validation, secrets, redaction, and application configuration patterns. (~4.5K words) - [Errors, Option & Result](https://eugene1g.github.io/effect-handbook/foundations/errors-option-result.md): Typed errors, defects, Cause, Exit, Option, Result, recovery, retry, and failure modeling. (~6.8K words) ## Concurrency & Streams - [Concurrency & Coordination](https://eugene1g.github.io/effect-handbook/concurrency/concurrency-coordination.md): Structured concurrency and coordination with fibers, queues, deferred values, semaphores, latches, and pools. (~6.3K words) - [Software Transactional Memory](https://eugene1g.github.io/effect-handbook/concurrency/software-transactional-memory.md): Composable atomic state and coordination with STM, transactional references, queues, maps, sets, and locks. (~3.1K words) - [State & Mutable References](https://eugene1g.github.io/effect-handbook/concurrency/state-mutable-references.md): Mutable and synchronized state using Ref, SynchronizedRef, SubscriptionRef, PubSub, and related primitives. (~3.7K words) - [Streaming & Channels](https://eugene1g.github.io/effect-handbook/concurrency/streaming-channels.md): Streams, sinks, channels, codecs, configuration parsers (TOML, YAML, INI, JSON5, JSONC), multipart parsing, and incremental data processing. (~11K words) - [Scheduling & Time](https://eugene1g.github.io/effect-handbook/concurrency/scheduling-time.md): Schedules, retries, repetition, Duration, DateTime, Clock, Cron, and time-zone-aware execution. (~8.0K words) ## Data & Schema - [Data Structures](https://eugene1g.github.io/effect-handbook/data/data-structures.md): Effect's immutable collections, equality, hashing, ordering, numeric types, and data-oriented utilities. (~6.3K words) - [The Functional Toolkit](https://eugene1g.github.io/effect-handbook/data/functional-toolkit.md): Functional composition with Function, Match, Predicate, Equivalence, Order, Optic, Brand, exact numbers such as BigDecimal and Rational, and utilities. (~10K words) - [Schema](https://eugene1g.github.io/effect-handbook/data/schema.md): Schema essentials: decoding and encoding, Type versus Encoded, structs, unions, refinements, transformations, brands, defaults, and classes. (~5.8K words) - [Schema in Depth](https://eugene1g.github.io/effect-handbook/data/schema-in-depth.md): Schema at real boundaries: annotations, serialization codecs, recursive schemas, construction fallbacks, parse options, optional fields, error messages, and effectful schemas. (~4.4K words) - [Schema Tooling & Internals](https://eugene1g.github.io/effect-handbook/data/schema-tooling.md): Schema internals and tooling: SchemaAST, parsers and compilers, getters, transformations, issues, SchemaError, JSON Schema, Standard Schema, JSON Patch, models, and TestSchema. (~6.3K words) ## Runtime Services - [Observability](https://eugene1g.github.io/effect-handbook/operations/observability.md): Instrumentation: designing signals, structured logging, log levels, formatting, spans and tracing, and metrics. (~6.3K words) - [Telemetry Export](https://eugene1g.github.io/effect-handbook/operations/telemetry-export.md): Exporting telemetry: choosing an export path, OTLP exporters, Prometheus, Effect DevTools, and the OpenTelemetry Node and Web SDK bridge. (~4.9K words) - [Caching & Batching](https://eugene1g.github.io/effect-handbook/operations/caching-batching.md): Caching, request batching, resolvers, resource-aware memoization, and deduplicated data loading. (~6.2K words) ## Web & Integrations - [HTTP Client](https://eugene1g.github.io/effect-handbook/interfaces/http-client.md): Typed HTTP clients, requests, responses, middleware, retries, timeouts, scoped responses, cookies, tracing, and platform layers. (~4.2K words) - [HTTP Server](https://eugene1g.github.io/effect-handbook/interfaces/http-server.md): HTTP servers, routers, incoming messages, multipart handling, static files, and host integrations. (~6.9K words) - [HttpApi](https://eugene1g.github.io/effect-handbook/interfaces/http-api.md): Contract-first HTTP APIs, endpoints, schemas, handlers, middleware, clients, OpenAPI, and security. (~8.1K words) - [GraphQL](https://eugene1g.github.io/effect-handbook/interfaces/graphql.md): Experimental typed GraphQL operations, clients, middleware, transports, resolvers, partial results, pagination, and code generation. (~1.7K words) - [RPC](https://eugene1g.github.io/effect-handbook/interfaces/rpc.md): Typed RPC requests, routers, clients, transports, serialization, streaming, middleware, and OpenRPC documents. (~7.6K words) - [SQL](https://eugene1g.github.io/effect-handbook/interfaces/sql.md): SQL clients, schemas, resolvers, models, migrations, transactions, streams, and provider adapters. (~11K words) - [Platform & Runtime Hosts](https://eugene1g.github.io/effect-handbook/interfaces/platform-runtime-hosts.md): Node, Bun, Deno, browser, Cloudflare, filesystem, path, terminal, worker, runtime services, and exit codes. (~9.4K words) - [Cryptography](https://eugene1g.github.io/effect-handbook/interfaces/cryptography.md): Cryptography services: secure randomness, digests, MACs, signatures, AEAD and ciphers, key derivation, agreement, wrapping, key formats, the WebCrypto backend, and JOSE keys, JWS, JWE, JWTs, and JWKS key sets. (~5.6K words) ## Application Systems - [Reactivity & Atom](https://eugene1g.github.io/effect-handbook/systems/reactivity-atom.md): Effect's reactive Atom graph, registries, hydration, typed clients, and framework bindings. (~5.1K words) - [AI & Language Models](https://eugene1g.github.io/effect-handbook/systems/ai-language-models.md): Language models, tools, toolkits, chat, prompts, embeddings, decisions, telemetry, errors, provider integrations including Amazon Bedrock, workload identity, and AG-UI frontends. (~12K words) - [MCP Servers](https://eugene1g.github.io/effect-handbook/systems/mcp.md): Model Context Protocol: MCP wire schemas, protocol adapters, McpServer over stdio and streamable HTTP, Skills, tracing, McpClient, and in-memory McpTest. (~6.1K words) - [Workflows & Durable Execution](https://eugene1g.github.io/effect-handbook/systems/workflows-durable-execution.md): Durable workflows, activities, retries, interruption, persistence, and operational recovery. (~5.4K words) - [Cluster & Sharding](https://eugene1g.github.io/effect-handbook/systems/cluster-sharding.md): Cluster membership, sharding, entities, runners, proxies, messaging, message retention, Cloudflare Durable Objects, and distributed coordination. (~9.0K words) - [EventLog & Event Sourcing](https://eugene1g.github.io/effect-handbook/systems/event-log-event-sourcing.md): Event logs, event sourcing, projections, encryption, identity, and session authorization. (~4.0K words) ## Decisions & Recipes - [Choosing Effect Primitives](https://eugene1g.github.io/effect-handbook/reference/choosing-effect-primitives.md): Contrastive decision tables for selecting Effect primitives by errors, services, lifetime, backpressure, durability, and distribution. (~9.0K words) - [Review Checklists](https://eugene1g.github.io/effect-handbook/reference/review-checklists.md): Design-review and code-review checklists for Effect services, errors, lifetimes, concurrency, boundaries, persistence, observability, and tests. (~4.6K words) - [Troubleshooting](https://eugene1g.github.io/effect-handbook/troubleshooting/troubleshooting-and-anti-patterns.md): Searchable symptoms, causes, and fixes for Effect programs, with focused diagnoses for the most common failures. (~9.5K words) - [Generated-Code Anti-Patterns](https://eugene1g.github.io/effect-handbook/troubleshooting/anti-patterns.md): Code shapes to search generated or pasted Effect code for, why each is wrong, and the preferred replacement. (~4.0K words) - [Recipe: A Service with Live and Test Layers](https://eugene1g.github.io/effect-handbook/recipes/service-and-layers.md): A runnable service with live and test Layers, explicit requirements, and lifecycle boundaries. (~986 words) - [Recipe: Schema to HttpApi to SQL](https://eugene1g.github.io/effect-handbook/recipes/schema-httpapi-sql-boundary.md): A complete typed boundary from Schema through HttpApi to SQL persistence. (~1.4K words) - [Recipe: A Resource-Safe Bounded Worker](https://eugene1g.github.io/effect-handbook/recipes/resource-safe-bounded-worker.md): A bounded Queue worker with structured concurrency, backpressure, and deterministic cleanup. (~726 words) - [Recipe: Typed Retry with TestClock](https://eugene1g.github.io/effect-handbook/recipes/retry-with-test-clock.md): Typed retry policy tested deterministically with TestClock. (~1.1K words) - [Recipe: Production Observability](https://eugene1g.github.io/effect-handbook/recipes/production-observability.md): Production logging, metrics, tracing, exporter Layers, and graceful flushing. (~1.0K words) - [Recipe: A Graceful Node Entrypoint](https://eugene1g.github.io/effect-handbook/recipes/graceful-entrypoint-and-shutdown.md): A Node application entrypoint with scoped resources, signals, and graceful shutdown. (~1.1K words) - [Recipe: ManagedRuntime at an Imperative Boundary](https://eugene1g.github.io/effect-handbook/recipes/managed-runtime-integration.md): Safe integration of Effect services into imperative framework callbacks with ManagedRuntime. (~1.2K words) - [Recipe: Request Cancellation Through a Host](https://eugene1g.github.io/effect-handbook/recipes/request-cancellation-through-a-host.md): Forwarding a host's cancellation through ManagedRuntime and into a Promise adapter so abandoned requests stop their work. (~1.6K words) - [Recipe: A Transactional Write with an Outbox](https://eugene1g.github.io/effect-handbook/recipes/transactional-write-with-outbox.md): An atomic SQL write with a transactional outbox, commit-before-deliver ordering, and honest at-least-once delivery. (~2.5K words) ## Tooling & Reference - [CLI Framework](https://eugene1g.github.io/effect-handbook/tooling/cli-framework.md): Typed command-line applications, arguments, flags, prompts, completions, help, documentation specs, and error handling. (~7.9K words) - [Persistence](https://eugene1g.github.io/effect-handbook/tooling/persistence.md): Persistence services, backing stores, serialization, primary keys, and durable application state. (~7.8K words) - [Testing & Dev Tooling](https://eugene1g.github.io/effect-handbook/tooling/testing-dev-tooling.md): Effect testing, Vitest integration, generators, doctests, language tooling, and repository tools. (~8.8K words) - [Cheat Sheet & Index](https://eugene1g.github.io/effect-handbook/reference/cheat-sheet-index.md): A task-oriented Effect 4 cheat sheet and linked index into the concise handbook. (~3.2K words) - [Using the Handbook from an Agent](https://eugene1g.github.io/effect-handbook/reference/agent-guide.md): How a coding agent should read this handbook: which Markdown artifact to fetch for which task, the .md URL rule, catalog and example-inventory fields, citing sections, and a drop-in instructions block. (~2.5K words) - [Release History](https://eugene1g.github.io/effect-handbook/reference/release-history.md): What changed between audited Effect releases: behavior, stability, renamed options and telemetry names, new modules, and handbook corrections, one entry per release. (~6.2K words) ## Optional Long-form human-oriented explanations. They are published as individual Markdown pages but excluded from the concise aggregate and domain bundles. - [Deep Dives](https://eugene1g.github.io/effect-handbook/deep-dives/index.md): Long-form Effect 4 guides that connect individual APIs into complete application patterns. (~455 words) - [Reactivity — From Atoms to Mastery](https://eugene1g.github.io/effect-handbook/deep-dives/reactivity-from-atoms-to-mastery.md): A source-grounded journey from Atom fundamentals through invalidation, hydration, React, and a complete feature. (~7.6K words) - [Adopting Effect in an Existing TypeScript Codebase](https://eugene1g.github.io/effect-handbook/deep-dives/adopting-effect-in-an-existing-codebase.md): An incremental strategy for bringing Effect into a Promise-based TypeScript codebase: audit, characterize, migrate leaf-first, and keep one interop seam. (~4.3K words) - [Anatomy of a Real Effect Application](https://eugene1g.github.io/effect-handbook/deep-dives/anatomy-of-a-real-effect-application.md): A complete application composition from domain schemas and services through resources, observability, entrypoint, shutdown, and tests. (~3.7K words) - [Owning Lifetimes — Startup, Readiness, and Shutdown](https://eugene1g.github.io/effect-handbook/deep-dives/owning-lifetimes-startup-readiness-and-shutdown.md): Who owns each resource and fiber, startup as a transaction, readiness and draining, one shutdown path, and callback bridges across hosts. (~4.3K words) - [Schema — From External Input to Domain and Back](https://eugene1g.github.io/effect-handbook/deep-dives/schema-from-external-input-to-domain-and-back.md): Schema boundaries from encoded input to domain types and back across HTTP, RPC, SQL, persistence, evolution, and tests. (~4.3K words) - [Failure, Retry, Fallback, and Interruption](https://eugene1g.github.io/effect-handbook/deep-dives/failure-retry-fallback-and-interruption.md): A connected model of typed failure, defects, Cause, retry, fallback, interruption, and cleanup. (~5.5K words) - [Structured Concurrency Through a Bounded Worker](https://eugene1g.github.io/effect-handbook/deep-dives/structured-concurrency-through-a-bounded-worker.md): A bounded worker architecture that composes Queue, fibers, Scope, backpressure, shutdown, and tests. (~4.6K words) - [Testing an Effect Application](https://eugene1g.github.io/effect-handbook/deep-dives/testing-an-effect-application.md): A testing strategy for typed failures, services, resources, time, concurrency, and integration boundaries. (~8.1K words) - [Streaming Ingestion Without Accidental Buffering](https://eugene1g.github.io/effect-handbook/deep-dives/streaming-ingestion-without-accidental-buffering.md): End-to-end streaming ingestion with bounded memory, backpressure, batching, resource safety, and failure handling. (~3.3K words) - [The Durability and Distribution Ladder](https://eugene1g.github.io/effect-handbook/deep-dives/durability-and-distribution-ladder.md): A decision-oriented progression from persistence through event history, workflows, and clustered entities. (~4.9K words) - [Building a Production AI Capability](https://eugene1g.github.io/effect-handbook/deep-dives/building-a-production-ai-capability.md): A production AI architecture using provider-neutral models, schemas, tools, telemetry, retries, and explicit MCP boundaries. (~5.6K words) - [Exposing an Effect Application over MCP](https://eugene1g.github.io/effect-handbook/deep-dives/exposing-an-effect-application-over-mcp.md): Serving an Effect application to AI clients over MCP: transports and protocol eras, catalog shaping, OAuth resource-server authorization, human-in-the-loop round trips, idempotency, and in-process tests. (~9.0K words)