You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Which capability packages does the ported monorepo have, what does each own (tables, migrations, config slice, routes, errors), and what stays a module? Starting proposal: api, auth (tokens, principals, scopes, bearer parsing, minting + quota, revocation), patches (records, versions, upload contract, visits, retention/expiry, pins, moderation, reports), serving (render, headers, CSP, page routes — the seam tiers 1/2 extend), storage, sql (client + migration runner), cli; core shrinks to html-policy + ids; limits and analytics stay modules in apps/server. Where does the expiry sweep live (it spans patches and storage)?
Produces the new CONTEXT-MAP.md contexts and a CONTEXT.md per capability, and the ordered list of per-capability build tickets for the spec. Call grilling and domain-modeling. HITL.
Runtime with tiers is how execution is named in code and docs (tier 0 = static page, no execution; tiers 1–3 later, out of scope). Serving means serving a patch to the user: guarantees, headers, CSP, page routes. Today serving is what a tier-0 runtime needs; no runtime package exists until a second tier does.
Content store = the platform's object store for a patch's bytes (invisible to the author). Reserves the plain word "storage" for the later per-patch file primitive. The package is content-store, not storage.
A patch is runtime-agnostic: id, owner, versions, retention clock, pin, quota. Content and what runs it vary by tier; lifecycle (create/update/delete/expire) is written once in patches.
Packages and what each owns
package
owns
core
shared kernel: html-policy, ids. No services.
api
wire schemas, the HttpApi definition, bearer-middleware definition, derived client. Imports only core + Effect.
sql
@effect/sql-pg layer, Migrator + ledger, embedded-Postgres test layer. Owns no tables.
auth
tokens, principals, self-service mint + mint quota, revocation, bearer parsing; migrations 1–2 (accounts, api_tokens, token_mints); implements the tokens/mint/me API group.
content-store
put/get/delete objects; filesystem (dev) and Azure blob layers. One consumer (patches) but two implementations — kept a package for the layer swap.
patches
records, versions, upload contract (object then row, rollback on failure), visits, retention/expiry, expiry sweep, pins, moderation, draft quota; migrations 3+; implements the patches API group. Depends on content-store, so the sweep has one home and serving never touches bytes.
serving
serving guarantees, headers, CSP, cache-control, page routes (/, /d/*, /healthz) as HttpRouter, trusted-proxy CIDR schema. Reads content through patches.
analytics
the event service (two emitters: auth, patches); PostHog layer; finalizer flush. Expected to grow.
limits
the fixed-window limiter as an Effect service (interface mirrors RateLimiter.consume). Expected to change a lot (billing, abuse, safety net). Quotas are not here: mint quota is auth's, draft quota patches', both DB counts.
Deleted: packages/config (Effect Config per capability; CIDR schema → serving), packages/db (split into sql + auth + patches), packages/storage (renamed).
Dependency graph (arrow = imports)
cli ──▶ api ──▶ core
auth ──▶ api, sql, analytics, limits
patches ──▶ api, sql, analytics, content-store
serving ──▶ patches (+ limits only if a page rate limit survives reports removal — verify in its ticket)
apps/server ──▶ all
patches never imports auth: handlers receive the principal id from the bearer middleware. Rule amended: a capability with one consumer stays a module unless it has two implementations (content-store).
Reports are removed (scope change, recorded on the map)
Reports were PatchPage's free-service safety valve and are the one feature nothing later builds on; they also leak a reader-facing surface (/report/*, the wrapper form) into serving. Self-service mint, pins, expiry, quotas stay — they are foundations.
Migrations
Baseline rewritten by owner with patches/patch_versions naming and integer ids (auth 1–2, patches 3+); draft_reports never exists. No prod DB exists, so no rename or mark-applied step — the ledger is simply new.
CONTEXT.md / ADRs
Every package gets packages/<name>/CONTEXT.md + packages/<name>/docs/adr/; root docs/adr/ for system-wide. Vocabulary is universal across the project; a package glossary is scoped to prevent context bloat, and the ADRs are the main value for infra-only packages. Each port PR moves its terms out of apps/server/CONTEXT.md so the glossary follows the code; nothing is written ahead of code. Term homes: token/principal/mint/quota/revocation → auth; patch/visit/expiry/sweep/pin/live/moderation/analytics event → patches; serving guarantee → serving; Publishing glossary → cli. Target CONTEXT-MAP.md: contexts auth, patches, serving, cli; kernel core; infra api, sql, content-store, analytics, limits; relationships: cli→api, serving→patches, patches→content-store.
Build tickets for the spec (one PR each, one agent session each, main stays green)
Remove reports (pre-port, plain TS)
Dev runner
packages/api + --json (Fastify decodes through Schema)
packages/sql (Pg layer, Migrator, test layer)
packages/analytics + packages/limits (ported before their first consumer)
Activity
allisonmahmood commentedon Aug 28, 2026
Resolution (grilled with Allison, 2026-08-28)
Vocabulary that shaped the cut
servingis what a tier-0 runtime needs; noruntimepackage exists until a second tier does.content-store, notstorage.patches.Packages and what each owns
coreapiHttpApidefinition, bearer-middleware definition, derived client. Imports onlycore+ Effect.sql@effect/sql-pglayer, Migrator + ledger, embedded-Postgres test layer. Owns no tables.authcontent-storepatches) but two implementations — kept a package for the layer swap.patchescontent-store, so the sweep has one home andservingnever touches bytes.serving/,/d/*,/healthz) asHttpRouter, trusted-proxy CIDR schema. Reads content throughpatches.analyticsauth,patches); PostHog layer; finalizer flush. Expected to grow.limitsRateLimiter.consume). Expected to change a lot (billing, abuse, safety net). Quotas are not here: mint quota isauth's, draft quotapatches', both DB counts.cliapi+core.apps/serverConfig, stacks layers, schedules the sweep, listens.Deleted:
packages/config(EffectConfigper capability; CIDR schema →serving),packages/db(split intosql+auth+patches),packages/storage(renamed).Dependency graph (arrow = imports)
patchesnever importsauth: handlers receive the principal id from the bearer middleware. Rule amended: a capability with one consumer stays a module unless it has two implementations (content-store).Reports are removed (scope change, recorded on the map)
Reports were PatchPage's free-service safety valve and are the one feature nothing later builds on; they also leak a reader-facing surface (
/report/*, the wrapper form) intoserving. Self-service mint, pins, expiry, quotas stay — they are foundations.Migrations
Baseline rewritten by owner with
patches/patch_versionsnaming and integer ids (auth1–2,patches3+);draft_reportsnever exists. No prod DB exists, so no rename or mark-applied step — the ledger is simply new.CONTEXT.md / ADRs
Every package gets
packages/<name>/CONTEXT.md+packages/<name>/docs/adr/; rootdocs/adr/for system-wide. Vocabulary is universal across the project; a package glossary is scoped to prevent context bloat, and the ADRs are the main value for infra-only packages. Each port PR moves its terms out ofapps/server/CONTEXT.mdso the glossary follows the code; nothing is written ahead of code. Term homes: token/principal/mint/quota/revocation →auth; patch/visit/expiry/sweep/pin/live/moderation/analytics event →patches; serving guarantee →serving; Publishing glossary →cli. TargetCONTEXT-MAP.md: contextsauth,patches,serving,cli; kernelcore; infraapi,sql,content-store,analytics,limits; relationships: cli→api, serving→patches, patches→content-store.Build tickets for the spec (one PR each, one agent session each,
mainstays green)packages/api+--json(Fastify decodes through Schema)packages/sql(Pg layer, Migrator, test layer)packages/analytics+packages/limits(ported before their first consumer)packages/auth(migrations 1–2, tokens/mint/me group)packages/content-store(rename + layers)packages/patches(migrations 3+, sweep, patches group;draft → patchrename in tables/code/wire)packages/serving+apps/serveron HttpApi/HttpRouter; deleteconfig,db; Effect lint toerrorpackages/clioneffect/unstable/cliCONTEXT-MAP.md, remainingCONTEXT.md/ADRs, wipe self-hosting artefacts, retire ADR-0000/0001Not built here (context only, not scope): runtime tiers 1–3, primitives, integrations, auth-provider swap.