Packages
@chat/discord-bot
The main application. Contains every feature and command:
AutoThreads, AiResponse, Summarizer, Playground, Reminders, and more.@chat/discord
The Discord infrastructure layer. Provides the gateway WebSocket connection, the REST client, channel and member caches, and configuration.
@chat/shared
Shared utilities used by any package. Currently exports
TracerLayer, the OpenTelemetry setup for Honeycomb or a local OTLP collector.Entry point
The application starts inpackages/discord-bot/src/main.ts. It builds a single MainLive layer by merging every feature layer, provides the tracer and log-level layers, then hands it to NodeRuntime.runMain.
Layer.launch acquires every layer’s resources and keeps the process alive. NodeRuntime.runMain attaches SIGINT/SIGTERM handlers for graceful shutdown.
Layer composition model
Every feature is a self-contained Effect Layer. A layer declares its own dependencies and wires them internally before being merged intoMainLive.
Feature layer
Each feature exports a
Layer (e.g. AutoThreadsLive, Summarizer.layer). It uses Layer.effectDiscard for fire-and-forget features or Layer.effect for services that expose an API to other features.Discord infrastructure
Features that react to Discord events or call the API declare a dependency on
DiscordGatewayLayer from @chat/discord. That single layer brings in the gateway WebSocket, the REST client, and bot application metadata.Merge into MainLive
main.ts calls Layer.mergeAll to combine all feature layers. Because each layer resolved its own dependencies, MainLive has no remaining requirements — it is a Layer<never, never, never> that can be launched directly.