ServiceMap.Service — defining services
Every injectable service is a class that extendsServiceMap.Service. The class body holds the make factory (an Effect.gen block), and a static layer property that wraps it in a Layer.
Github, EffectRepo, Summarizer, ChannelsCache, MemberCache, Messages, DiscordApplication.
Layer — dependency injection and composition
Effect Layers are the dependency-injection mechanism. The bot uses several Layer combinators.Layer.effectDiscard — for features that register gateway handlers or slash commands and return nothing:
Layer.effect — for services whose value is consumed by other layers:
Layer.provide — wires a dependency into a layer:
Layer.mergeAll — combines multiple independent feature layers in main.ts:
Effect.gen — generator-style composition
Effect.gen lets you write sequential Effect logic using yield* for a readable, imperative style. Every make factory and most handlers use it.
Effect.fn / Effect.fnUntraced — named traced functions
Effect.fn wraps a generator function and attaches an OpenTelemetry span automatically. Effect.fnUntraced skips the span for hot-path helpers.
Effect.fnUntraced is used for gateway event handlers where the outer span comes from Effect.withSpan:
Config / ConfigProvider — environment variables
All configuration is read through Effect’sConfig module, keeping secrets out of code.
ConfigProvider.nested + ConfigProvider.constantCase — AutoThreads scopes its config under a namespace so all variables are prefixed AUTOTHREADS_:
Data.TaggedError — typed error classes
Data.TaggedError creates nominal error types with a _tag discriminant, making error handling exhaustive and precise.
Ix.builder:
Effect.withSpan — OpenTelemetry tracing
Effect.withSpan manually annotates an effect with a span name and optional attributes. It composes with Effect.fn (which adds spans automatically) for fine-grained traces.
Effect.annotateCurrentSpan:
FiberMap — managing concurrent fibers by key
FiberMap tracks running fibers by a key, preventing duplicate work and allowing cancellation by key.
Schedule — retry and recurrence
Schedule drives retries and periodic tasks.