Skip to main content

Decisions (locked)

Rendered from corpus/wiki/decisions.md · updated 2026-11-05

This page is generated from the project corpus and rewritten on every docs build. Edit the source in corpus/, not here.

Settled calls. Don't relitigate one without an explicit revisit and a log.md note. This page wins over status.md for any choice not formally revisited.

An entry earns a place here only if it is hard to reverse, surprising without context, and a genuine trade-off. Obvious choices belong in architecture.md, not here.

Everything on this page still constrains new work. A decision that stops binding is deleted, and log.md keeps its history.

npm workspaces, not pnpm or yarn​

pre-2026-06-26 — The monorepo is plain npm workspaces (shared + bots/*). Rejected: pnpm, yarn. Reason not recorded — predates the corpus. Treat as locked-by-inertia rather than defended; if it ever matters, revisit deliberately and record the why.

No build step — run TypeScript directly with tsx​

pre-2026-06-26 — The bots run tsx src/index.ts in dev and in production under pm2; imports carry explicit .ts suffixes (from './play.ts'), and engines.node is >=22.12.0. Rejected: a tsc → dist/ build. Reason: there is no compiled artifact to keep in sync with source, so dev and prod run the same files and a deploy is a git pull + restart — a few seconds of startup traded for one less moving part. Cost accepted: no type-checking at runtime boundaries (npm run typecheck is a separate step), and tsx lives in root devDependencies — so npm install --production breaks the run script. If that scenario ever comes up, move tsx to a real dependency rather than reintroducing a build. Scope, restated 2026-10-02: this decision is about the bot, and the bot still never builds. bots/dice-activity, which built, is gone as of 2026-08-27. The one build in the repo since 2026-09-07 is docs-site's docusaurus build, a static documentation site that the bot neither imports nor needs at runtime.

A container in production, pm2 locally (revisited 2026-10-04)​

pre-2026-06-26, revisited 2026-10-04 (the state-volume move, audit-fixes.md) — Production runs the bot as a container through the estate's deploy (vps-deploy stacks/just-a-bot.ts, container-only since 2026-09-06; the image is from 53a5cbb). Its state is two bind mounts outside the rsync mirror. docker compose logs replaces pm2 logs there. ecosystem.config.cjs stays for local runs. Unchanged: tsx at runtime, no build step, the .env bind-mounted and never baked in. Since 2026-11-04 the image starts the bot as node --import tsx, not through npm: the owner decided apps start with node directly, to save the wrappers' memory on the VPS. Was: pm2 everywhere, rejecting containers for "no container runtime to maintain". That reason lapsed when the estate took on rootless Docker for every service.

Env validated with Zod at startup, optional integrations degrade​

pre-2026-06-26 — bots/discord/src/env.ts validates the environment through @bots/shared's loadEnv. Rejected: reading process.env ad hoc at each call site. Reason: bad required config fails fast at boot rather than at first use, but a missing optional integration reports "not configured" instead of crashing the whole bot — one broken API key must not take the other twenty features down.

Music: see decisions-music.md​

The two music calls (no music until it starts from zero; the Jukebox signed in to atrium as its own user) moved there on 2026-11-04 to keep this page under the size cap.

JSON files on disk for all state — no SQLite​

pre-2026-06-26 — Every bit of persisted state is gitignored JSON under bots/data/ (cross-bot) and bots/<bot>/data/ (per-bot), read through an in-memory cache with a serialized write chain. Rejected: SQLite, which would fit the access patterns fine. Reason: the RPG world needs to be ingestible by an LLM in one read, and every volume here is trivial — human- and LLM-readable files are worth more than query power at this scale. Cost accepted: no transactions, no queries, and the write chain is the only thing preventing lost updates.

Feature logic stays free of platform imports​

pre-2026-06-26 — A feature's pure logic (game.ts) imports no discord.js; platform glue (embeds, button prefixes, replies) lives in a separate module, and commands stay thin. Rejected: writing features directly against the platform SDK. Original reason: the same logic module could be ported to another bot — the point of having shared/ be runtime-agnostic at all.

Revisited 2026-08-27, downgraded — the original reason is void. With Slack and WhatsApp removed there is no other bot to port to, so portability can no longer justify the split. Kept anyway, on a different and weaker basis: it keeps the data model readable and testable without a Discord client, which is worth something on its own. It is now a convention, not a rule — a feature that is genuinely easier to write against discord.js directly may do so, and that is not a violation. Do not cite portability to defend it again.

The duplication this used to justify is also gone: Wordle and Tic-Tac-Toe were duplicated between Discord and Slack, and only the Discord copies remain.

Discord-only — Slack, WhatsApp and dice-activity removed​

2026-08-27 — bots/slack, bots/whatsapp and bots/dice-activity deleted (~2,700 lines, 60 tracked files), along with docs/slack/ and shared/src/bot-adapter.ts. Workspaces narrowed to shared + bots/discord. Rejected: keeping Slack (1,209 lines and six docs pages of working features — Wordle, Tic-Tac-Toe, reminders, polls, clock), and keeping dice-activity on the grounds that a Discord voice Activity is arguably part of the Discord surface. Reason: only the Discord bot is actually used or maintained, and every other workspace was taxing every repo-wide change — the cross-bot abstraction, the duplicated game modules, and three sets of docs all had to be kept coherent for code nobody ran.

Consequences worth knowing, since none of them are visible in the diff:

  • shared/src/dice-protocol.ts stays. bots/discord/src/dicetable/ is a WebSocket client of the Activity app (link.ts connects to its /engine endpoint), so the wire types are still imported by live code. Deleting the Activity did not make the protocol dead.
  • /dicetable is now a client with no server in this repo. It degrades cleanly — the command already answers "not configured" when DICETABLE_ACTIVITY_URL is unset — so this is a dormant feature, not a broken one. Open thread: open-questions.md.
  • Two workspaces, not one. shared/ is kept because it holds code with no discord.js dependency, including the protocol above. (As of 2026-09-07 there is a third, docs-site, and the protocol is gone with /dicetable.)
  • bots/dice-activity/.env was deliberately left on disk — it holds DISCORD_CLIENT_SECRET, SESSION_HMAC_KEY and ENGINE_AUTH_TOKEN, is gitignored, and exists nowhere else. Removing it is a manual, irreversible call for the user to make.
  • The "feature logic free of platform imports" decision above lost its stated reason and was formally downgraded rather than quietly kept.

Removed features​

/dicetable (2026-08-27) and /dnd + /post (2026-10-06) were deleted outright rather than shelved. The calls and their follow-ons are in decisions-removals.md.

docs/ and corpus/ both stay, split why vs how​

2026-08-27 — docs/ (29 files, per-feature operating manuals and setup) keeps its own tree; corpus/ owns decisions, status, and synthesis. The boundary is written into both front doors and docs/ ranks last in the source-of-truth order. Rejected: folding docs/ into corpus/wiki/ and deleting it (would blow the 200-line-per-page cap immediately and lose the per-feature structure), and leaving the two layers unrelated (they had already drifted into contradiction: a docs/ page described a shelved feature as working). Reason: they answer different questions for different readers, and the failure mode was never duplication — it was that nothing said which one to trust. Cost accepted: two places to update when a feature's usage changes.

Major UX variants ship as sibling commands, not rewrites​

pre-2026-06-26 — A significantly different take on a working feature ships as /featureN+1 (dice → dice2, blackjack → blackjack2) sharing extracted code, rather than replacing the original. Rejected: rewriting the original command in place, feature-flagging one command into two behaviors. Reason: the original keeps working for the people already using it, both variants stay comparable in real use, and a bad variant is deleted instead of reverted. Cost accepted: command-list clutter and two surfaces to maintain.

Production state: the owner reads the server and picks each file​

2026-10-04, owner — Before the state move deploys, the owner checks the VPS and picks the pm2-era or container copy per file. Rejected: the agent holding SSH to the box, even read-only. Overtaken on 2026-10-07: the owner purged the state instead and the bot started fresh (audit-fixes.md).

/ask asks one model, and later goes through Wicket​

2026-11-04, owner — Members don't pick /ask's model: it always uses OLLAMA_MODEL, and an Ollama failure answers only the member. Once Wicket (the estate's LLM queue, its own repo) is deployed, /ask sends its questions there instead of calling Ollama itself; Wicket holds the key, runs one call at a time with ticket numbers, and falls back to a small model on the VPS. Rejected: a picker of several models (brief 11's OLLAMA_MODELS, now removed), a small fast model beside the default, public error lines, and calling Ollama Cloud directly for good. Reason: one model keeps the quota predictable; one queue for every app keeps the box and the quota from being hit by two callers at once. 2026-11-05: built (brief 14). Wicket asks Ollama Cloud only since the owner's call of 2026-11-04, so there is no small model to fall back on: a cloud failure fails the question.