# Shared code across the fleet **Before you build something, check this file. If it is here, install it.** **Starting a new product?** Do not assemble one: render [`templates/app`](templates/app/) (`scripts/templates/render-app.sh`, or Loki's kickoff / `new-site.sh`, which produce the same app). It already installs the packages below that every product needs, wired and tested. This exists because the alternative was tried and measurably failed. Every duplication in this fleet was already known, and knowing changed nothing: - orangecat's `ADR-0002-rate-limiting-unification.md` (2026-01-18) sat at **Status: Proposed** for seven months. It named _two_ implementations; the count reached **four** before it was finally resolved in-repo (Accepted 2026-08-25 — one canonical module, and almost none of the original plan survived contact). - `templates/ci/README.md` says "deliberately ONE central script, not a copy per repo". `auto-merge-sweep.sh` lives in **22 repos**, and as of 2026-08-16 in **8 distinct versions** spanning 11,787–19,344 bytes. A fix landed in one reaches at most 9 of them. Both were written down. Writing it down is what failed. So this file is short, the inventory underneath it is **generated**, and the number it produces is a **ratchet** — see "The process" below. --- ## A new package gets its own repo by declaration A package needs its own repo: a folder inside another repo cannot be installed by tag, so Dependabot cannot move its consumers forward and every release means hand-edited pins in every app. Add an entry to `registers/package-repos.json` (name, description, the source repo and folder, any devDependencies the folder needs to build alone). On merge, `.github/workflows/package-repos.yml` creates `bitbaum/` with `FLEET_PAT`: it copies the folder, makes it standalone from `templates/package` (CI, auto-merge, publish, release, Dependabot, licence), runs the package's own `verify`, and only then creates the repo and tags `v`. Nobody clicks anything; an existing repo is never written to directly — a file added to the template later reaches it as a pull request that adds only what it lacks (`scripts/packages/sync-package-template.mjs`). The `auto-merge.yml` file is only the workflow caller; it cannot enable GitHub's repository-level **Allow auto-merge** or **Automatically delete head branches** settings. Package creation turns both on, and the daily `package-repos.yml` reconciliation checks all registered package repositories and repairs them with `FLEET_PAT`. Its test is part of Fleet CI, so a future change cannot silently remove this guarantee. The central sweep remains the merge authority. It refreshes behind PR branches with `FLEET_PAT` so GitHub starts the required checks; if that token is unavailable, it leaves the branch untouched. GitHub deletes the merged head branch separately after a successful merge. **Releasing** is `release.yml` in the package repo: Loki's package page ("Release vX.Y.Z", for the package's owner) or the Actions tab starts it. It refuses unless main's CI is green on the commit, raises the version, runs `verify` (rebuilding `dist/`), commits `release vX.Y.Z`, tags, pushes with `FLEET_PAT` (so `publish.yml` fires on the tag) and writes a GitHub release. Dependabot then proposes the tag to every consumer. Every kit is published to npm by its own `publish.yml`, through npm Trusted Publishing (GitHub Actions OIDC, signed provenance, no token anywhere). A package's first version needs the account once (`NPM_BOOTSTRAP_TOKEN`); linking the package to its workflow is one form on npmjs.com (`https://www.npmjs.com/package//access`, organization `bitbaum`, repository = the package repo, workflow `publish.yml`, environment blank). To check that link without publishing anything, run the package's **Publish** workflow with `diagnose_auth` ticked: HTTP 200 means linked, 404 means the form is still to be filled in. Consumers install the version npm serves (`pnpm add @bitbaum/@^X.Y.Z`); `registers/packages.json` names the verified install command for each package. A Git tag is the source record, not the install route. ## The registry — what already exists Use [the generated release records](registers/packages.json) for current versions and immutable install commands. They compare stable npm releases with CI-verified Git tags; repository HEAD and old consumer pins are not release evidence. The table below describes package responsibilities; historical install examples are not the current target. | Package | Install | Replaces | | ---------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | [`writingkit`](https://github.com/bitbaum/writingkit) | See [verified release and install command](registers/packages.json) | Headless revision-safe content operations: capture document identity, reserve one operation, reject stale results and cancel/dispose work. Hosts own editors, model transport, source/evidence and language policy, storage and publishing. | | [`ai-forms`](https://github.com/bitbaum/ai-forms) | See [verified release and install command](registers/packages.json) | per-app "fill this form from prose" + conversational refinement. Headless — ships **no markup**, so each app keeps its own styling. | | [`ai-kit`](https://github.com/bitbaum/ai-kit) | See [verified release and install command](registers/packages.json) | **the AI layer, in one install** — which model to call, whether the vendor still lists it, how to walk the fallback chain and know when none of it worked (`tryChain`/`createHealthTracker`, v0.5.0), the three kinds of 429, fair-share of a free tier, and (re-exported) `ai-forms`. Renamed from `ai-ration` 2026-08-26: the name described one of five modules, and the package had one adopter while five repos that skipped it went down together to a retired model id. **`ai-kit/web` (v0.16.0) is where an agent gets EYES** — search over a backend chain (`searxng` self-hosted on bitbaum → `brave` → `tavily`, whichever the env configures), plus a page reader safe to point at a url the MODEL chose rather than one a user typed: `redirect: "manual"` with the full SSRF check re-run on every hop, because validating the first url and letting `fetch` follow the 302 is not a check. Its result is three-valued — found / nothing / **could_not_look** — so a dead backend can never be reported as "there is nothing about that on the internet". Both halves come back as `Fact`s from `ai-kit/grounding`, so web content and database rows go through ONE verifier and "cite your sources" is a string check instead of a line in a prompt. Do not hand-roll a fetch-and-summarise: search without citation binding makes hallucination worse, not better, because the invented sentence arrives surrounded by real ones. **v1.11.0 routes on VISION**: put an `image_url` part in a message and `complete()`/`completeStream()` skip the links that cannot read one — `freeChain()` is ordered for text, so a screenshot otherwise meets four Groq links that cannot see it before reaching one that can, and a blind model handed a picture answers the words around it, fluently, about nothing. Three verdicts, never two: declared-blind is skipped, declared-sighted is used, and **unclassified is TRIED** — reading a list's silence as a denial is how the strongest model a user brings becomes the one the agent can do least with (orangecat ADR-0008). `NoVisionLinkError` fires before any request when the whole chain is blind, because "no model here can see" needs a key and "every vendor failed" needs a retry. Do not build a second vision chain: loki did (`config/vision-models.ts`) and it never learned about Google. | | [`threadkit`](https://github.com/bitbaum/threadkit) | See [verified release and install command](registers/packages.json) | multi-participant message threads where _permission is participation_, not a role or an ownership column. Headless pure functions, so "who may read this" is unit-testable instead of buried in a `WHERE` clause. AI participants obey the same visibility rules. **ESM-only.** | | [`paykit`](https://github.com/bitbaum/paykit) | See [verified release and install command](registers/packages.json) | classify a pasted Bitcoin receive string and distinguish payment requests from display-only rails. It holds no keys and keeps no balance. Published on npm; adopters will be listed from package manifests. | | [`sitekit`](https://github.com/bitbaum/sitekit) | See [verified release and install command](registers/packages.json) | **a website as data** — the closed section union (Zod as SSOT, path-addressed errors a generator can act on), one set of React renderers emitting semantic classes only (tokens stay per-site: uniform system, divergent aesthetics), and per-field provenance (`scraped`/`operator`/`inferred`/`not-found`) so `assertDeliverable()` makes "we fabricate no facts" a check instead of a promise. Extracted from substrata per orangecat ADR-0003; the planned `siteFromUrl()` extractor targets this schema. RSC-native — the Link seam stays a server-component prop (learned in v0.1.1 when the first consumer's build refused a component function crossing 'use client'). **ESM-only.** | | [`mail-kit`](https://github.com/bitbaum/mail-kit) | See [verified release and install command](registers/packages.json) | the fleet's **~12 bespoke email implementations** across three provider styles (Resend SDK ×8, raw fetch ×4, one unused AWS SES dep). One provider (Resend over raw fetch, **zero runtime deps**), one env contract (`RESEND_API_KEY` + `RESEND_FROM`), one call shape: `sendMail()` **never throws** — honest `{sent}\|{error,status,retryable}`; `isMailConfigured()` treats placeholder keys and production `@resend.dev` sandbox senders as UNCONFIGURED (both shipped to prod once); `mailHealth()` for health routes; `conventionalFrom()` encodes the `@fleetcrown.orangecat.ch` shared-sender convention (free tier: 1 verified domain, 100/day). Born from the day a dead Brevo SMTP cred was found to have silenced evig+kivvi outbound mail for months; the account-level watchdog is this repo's `email-canary.yml`. **Since 0.3.0 the layout is shared too:** `renderMail(brand, content)` is the one HTML email (dark mode, Outlook button, plain-text twin, escaped plain-text content, a required footer that says why and unsubscribes), with `signUnsubscribe`/`verifyUnsubscribe`/`listUnsubscribeHeaders` for signed one-click unsubscribe (RFC 8058, required by Gmail and Yahoo for bulk senders). An app supplies a brand and the words, never its own layout. Adopted: heidi; extracted from OrangeCat's `src/lib/email/templates/layout.ts`, which can move onto it. Bulk/newsletter stays Listmonk. | | [`limitkit`](https://github.com/bitbaum/limitkit) | See [verified release and install command](registers/packages.json) | the fleet's **12 hand-rolled rate limiters** (this file's own "next extraction" row). Sliding/fixed windows over an injectable two-method `Store`; **bounded** memory default (the unbounded-Map leak is impossible by construction); standard `X-RateLimit-*` + `Retry-After` headers — what orangecat's ADR-0002 specified seven months before anything enforced it; `clientIp()`. Refusals count nothing, so a hammered key recovers. Ships no middleware and **no limit values** — how many attempts a route allows is app semantics, asserted locally. **The npm form is not cosmetic:** under pnpm 11 a git-hosted dependency's `prepare` build is refused without an `allowBuilds` entry, so `github:` installs a package with no build output and the adopter's CI fails on an import that resolves to nothing — it broke one on 2026-09-15. **`clientIp()` reads the LAST `X-Forwarded-For` hop, and that is the finding, not a detail:** all **seven** hand-rolled limiters replaced on 2026-09-15 (botsmann, petvity, surf-your-life, truthseeker, kivvi, evig, aoz-begleitung) keyed their bucket on the **first** hop. The first hop is whatever the caller typed; a client sending a fresh value per request got a fresh bucket per request and was never limited at all, so seven repos shipped a limiter that was decorative. Only the last hop was appended by the proxy you trust, so only the last hop is one the client cannot choose. Look for this **before** you swap a limiter out — it was seven for seven. (vitareba was checked and has no IP-derived limiter at all.) botsmann's carried a second failure on top: it **failed open** on any database error, so one `catch` around the store read switched the limiter off under exactly the load it existed for. **Eight adopters** on their default branches, read from `registers/packages.json` rather than counted by hand: botsmann, evig, heidi, loki, orangecat, petvity, surf-your-life, truthseeker — five of them added 2026-09-15; kivvi and aoz-begleitung have PRs open awaiting their owners. **heidi is still pinned to the `github:` form** and will hit the pnpm 11 wall the next time its lockfile is rebuilt; fix it when heidi is next touched. | | [`listkit`](https://github.com/bitbaum/listkit) | See [verified release and install command](registers/packages.json) | the fleet's **twelve incompatible filter-state shapes** — no two alike — plus ~34 hand-built URL builders (four of them carrying live bugs: a preset that wiped the reader's search, a date range that stranded them past the end, a builder that preserved three params by name, a debounced box using `push` so the back button walked every spelling of the word), ~25 copies of toggle-a-value-in-a-set in two encodings, ~11 debounces at five delays, ~11 copies of `Math.ceil(total / pageSize)`, and the four-of-seven repos that put a reader's text into a SQL `LIKE` without escaping `%` or `_`. Ships the DECISIONS: five facet kinds with the empty selection as the only sentinel (one repo used its _translated label_ as the all-value, making filter identity depend on the reader's language), a URL codec that copies rather than rebuilds and drops `page` when the result set changes, a comparator that puts missing values last in **both** directions, page arithmetic that cannot produce a negative offset. **No markup, no tokens, no React, no search engine** — nine token vocabularies and six chip treatments were found among those repos, several different on purpose. | | [`bip-kit`](https://github.com/bitbaum/bip-kit) | See [verified release and install command](registers/packages.json) | **blog / roadmap / changelog on a product site** — otherwise a markdown pipeline, a renderer and a security review per repo. A zero-dependency parser turning repo-authored markdown into typed blocks, plus `bip-kit/react`, an RSC-first reference renderer emitting semantic `bp-*` classes with every colour a CSS variable — shared vocabulary, your tokens on top. `shiki`/`katex`/`mermaid` are OPTIONAL peers that degrade rather than throw. **Eight adopters, third-most-used package in this registry after `ai-kit` and `mail-kit` — and it was absent from this table until 2026-09-12**, present only in the extraction-candidate list below as a _source_ of slug-helper duplication. That is this file's own failure mode rather than a clerical one: the instruction at the top ("check this file; if it is here, install it") is exactly as true as the table under it, and a package nobody can find here is a package the next agent rebuilds. | | [`design-tokens`](https://github.com/bitbaum/design-tokens) | See [verified release and install command](registers/packages.json) | the **brand** SSOT for OrangeCat, Loki and Solon: one `tokens.css` holding every colour, face, weight, tracking and radius the three share, a Tailwind preset that maps them, and self-hosted faces. Import it BEFORE the app's own `globals.css` — the app keeps its file, this supplies the primitives it used to hand-copy. It exists because they _were_ hand-copied and drifted: Solon's `globals.css` carried a comment claiming its tokens matched OrangeCat's while sharing **zero** names or values with it, so one company's three products looked like three companies. Retheming all three is an edit to the `▼▼▼ THE KNOBS ▼▼▼` block plus a tag. **This is a deliberate exception to "each app owns its design tokens" below, and the line is OWNERSHIP, not taste:** these are one company's own products and are _supposed_ to look alike. A client's site is not, and must never install this — a retheme would repaint somebody else's brand. | | [`chatkit`](https://github.com/bitbaum/chatkit) | See [verified release and install command](registers/packages.json) | **the one chat** — composer, thread, messages, markdown, attachments, and a microphone that is never a dead button (browser recogniser first; missing or SILENT, the same press records and a server transcribes — heidi's measured failure, now a browser test). Replaces **13 chats in 10 repos** (2026-09-25), each written from scratch and each missing what another had fixed: the mic, 16px text, the soft keyboard, Stop, Retry, stick-to-bottom, markdown without leaked `**`. Behaviour is fixed; the look follows the app through `--ck-*` variables (defaults read `@bitbaum/design-tokens`; loki maps its OKLCH tokens once in `globals.css`). Its `verify` drives Chromium at 390px and desktop, light and dark, and speaks a sentence through a fake mic — so the standard below is enforced, not described. **Fix chat bugs HERE, never in the app.** Adopted: loki (2026-09-25, every composer via one adapter). | | [`chartkit`](https://github.com/bitbaum/chartkit) | See [verified release and install command](registers/packages.json) | Server-rendered SVG charts, proportional/ranked bars and accessible table fallbacks; owning package for Substrata’s chart workspace. | | [`whenkit`](https://github.com/bitbaum/whenkit) | See [verified release and install command](registers/packages.json) | the fleet's **~120 raw ``fields in 15 repos** (counted 2026-10-08 in local checkouts — a floor, not a total), worst in booking dialogs that asked for a start AND an end date-time — the browser's`tt.mm.jjjj, --:--` placeholder twice — for a studio rented by the day. Ships the DECISIONS: **the listing decides the shape** (`BookingRequestPicker`: rented by the day → pick days, no times; hourly → day, start inside opening hours, length; **nobody types an end time**; "I'm flexible" → at most a preferred day); dates are `YYYY-MM-DD`/`HH:MM` wall-clock strings that become an instant in ONE place (`zonedToUtc`, DST gaps resolve forward) in the provider's zone; "today" is the provider's today. **To replace an existing date input use `DateInput`: a drop-in for ``— same props, same`onChange(event)`, so a call site changes its TAG and nothing else.** The value reads in words ("Sat, 11 Oct 2026 · 14:00", in ``) in the app's OWN input classes while the real input stays on top (picker, keyboard, autofill, `required`, form submission all keep working; controlled or uncontrolled). Its look is in `@layer base`, so an app's Tailwind utilities and plain CSS win; its structure is `span.wk-input`, so an app's `display:block` cannot break it. **`node node_modules/@bitbaum/whenkit/scripts/migrate-date-inputs.mjs --import "@/components/ui/date-input" --write`** does the rename (a JSX tag scanner that skips comments, aliases a name clash, lists what it will not guess; `--from Input`converts an app's own wrapper). Where an app wraps``in its own`Input`, delegate dates inside that one component and every call site is migrated at once (OrangeCat, evig, surf-your-life). Two traps worth knowing: an app that styles inputs by **element selector** (`.form input {…}`) puts its look on the hidden native input, not the visible box — give `.wk-input`the same rule and exclude`.wk-input-native`(substrata); and`pnpm add` with a newer pnpm than the repo's pinned one rewrites ~300 lockfile lines — use the pinned version (petvity, surf-your-life pin 11.6.0). Browser-checked at 390/1280, light/dark: 44px targets on the picker, 16px input, the date box exactly a native input's height, a dialog-shaped container (0.2.1 exists because the day strip propped OrangeCat's booking dialog open and pushed Send off-screen). **Adopted 2026-10-08:** OrangeCat (bookings + every date field), Loki, evig, petvity, hirnli, heidi, substrata, surf-your-life, datacat. **Not migrated, deliberately:** the client apps (kivvi, aoz-begleitung, vitareba — not deployed to without the owner's say-so) and non-React UIs (openclaw). | | [`accountkit`](https://github.com/bitbaum/accountkit) | See [verified release and install command](registers/packages.json) | **the one account: accounts themselves, the menu, AND "Sign in with OrangeCat".** `./auth` (+ `/schema`, `/next`, `/client`, since 2026-10-15) = every product's accounts on better-auth from one call: email + password, sign-in link, passkeys, 2FA, the shared sign-in and OrangeCat, with the same limits and identity rules everywhere. Adopted: causius. `.` = `AccountMenu` (avatar, who is signed in, places under “you”, a sign-out that says when it failed; built 2026-10-02 from Loki’s and OrangeCat’s, which each knew half — **a name is never rebuilt from the email**, 44px, arrow keys) + `SignInError` (Auth.js `pages.error`; **Try again RESTARTS sign-in**, never goes home, never prints the provider’s code). `./orangecat` (server-only, no next-auth import, v5 and v4) = what **nine apps hand-rolled nine times** until 2026-10-06: the provider (`client_secret_post` — OrangeCat answers Auth.js’s default with a misleading 400 "client_id is required" — and PKCE), a profile with **no `email`** (GoTrue auto-confirms, so an address is never an identity; with it, Auth.js links or refuses by email), `syncOcSession` (refresh in `jwt()`; `invalid_grant` = signed out, anything else retries in 60 s), `authorizationParams`/`returnPath`, and for user-table apps `withOrangecatIdentity` (adapter wrapper keyed on `sub`; `keepTokens` for loki), `resolveOrangecatUser` (race-safe), `decideOrangecatSignIn`, `mayReceivePasswordReset` (no reset link to an account OrangeCat created — petvity and evig mailed one), `emailEarnsPromotion`, evig’s signed link cookie. Contract tests are mutation-checked, and `test/types/adapter.ts` compiles against the REAL `@auth/core` Adapter (v0.2.0 rejected every real adapter). Look follows `--acct-*`; **import `styles.css` or SignInError is bare text** (solon shipped that once). **Fix sign-in and account-menu bugs HERE, never in the app.** Adopted (OrangeCat sign-in): heidi, solon, skif, substrata, petvity, surf-your-life, evig, datacat, loki; menu: loki. | | [`speechkit`](https://github.com/bitbaum/speechkit) | See [verified release and install command](registers/packages.json) | **measuring how somebody SPOKE** — distinct from chatkit, which turns speech into a message. Pauses and runs from raw samples (works on a dialect nothing transcribes), the rule for when a transcript may be judged at all (`mayJudgeForm`: a recogniser that translates dialect into standard is never evidence about form), speech rate, **where a long pause fell** (signal pauses named by recogniser word timings — Whisper swallows silences into words, measured), and grammar a listener would notice from a **self-hosted** LanguageTool (spelling/casing/punctuation excluded: the recogniser decided those). No pronunciation score, by design and by test. Language-agnostic: every fact about a language is passed in. Pairs with ai-kit `transcribe({ words: true })` ≥ 1.16. Extracted from heidi 2026-09-25; adopted: heidi. | | [`deckkit`](https://github.com/bitbaum/orangecat/tree/main/packages/deckkit) | `"@bitbaum/deckkit": "workspace:*"` inside orangecat; its own repo + npm when a second app adopts it | **presentations as data** — a deck is slides with a layout and a few fields, rendered by one component, so anyone edits one without code and nobody can make one ugly. Replaces the hand-written HTML decks in evig `public/presentations/*`: ~450 lines of engine copied into every deck (and drifted — notes/PDF in some, comments in others), a raster PDF, numbers typed by hand, no link to one slide, comments anchored to slide position. `normalizeDeck` (anything stored → a deck that renders; https-only links; enforced limits), `generateDeck(source, data)` (drafts an investor arc from what a project already says — nothing invented), `bindDeck` (`bind: facts | pace | roadmap`slides read live data, so a deck never goes stale),`/react` `Slide`(one 16:9 frame, identical at any size via container units) +`DeckPresenter`(keys, swipe,`#3`deep links, notes, print → PDF with real text),`styles.css` (`--dk-*` tokens, dark + light). **The README holds the writing rules** — one claim per slide, one accent, no fabrication, sources. Live in OrangeCat investor rooms (`/projects//room/deck`, `/room//deck`) since 2026-10-08. **Do not hand-write another HTML deck**; make a deck here, or add the missing layout to deckkit. | | [`searchkit`](https://github.com/bitbaum/searchkit) | See [verified release and install command](registers/packages.json) | **every search box** — a survey on 2026-10-12 found ~25 across loki, solon, evig, heidi and substrata, and one with typo tolerance (substrata's own engine); the rest were `toLowerCase().includes(q)` or `ILIKE '%q%'` (evig's mostly without escaping `%`). One slip in a name lost it — the SoundCloud failure. Ships the DECISIONS, from Algolia/Typesense/Meilisearch defaults and the IR literature: typo budget 0/1/2 at <4/4/8 letters counted as edits (optimal string alignment, so `kayne`→Kanye is ONE edit; Postgres `levenshtein` says two and `pg_trgm` scores the pair 0.2), the budget of the word MEANT when a short word matches nothing (`lki`→Loki), a wrong first letter matched but ranked as two, prefix-while-typing with typos (`bitcon`), umlauts indexed spelled out (Müller/Mueller), camelCase/handles split and adjacent words indexed joined, words that match nothing set aside instead of emptying the result, and **tie-break ranking, not a weighted sum** (typos → words → field → exactness → proximity → position → your rank). For a database: correct against the collection's OWN vocabulary (`corrections`, `didYouMean`) and send the words, so the database stays exact-and-prefix on its indexes. Highlight ranges that mark typo matches; `useSearchAsYouType` (abort + stale-drop) and `` under `/react`. **Proof is generated**: `typoCases` misspells every word of your own titles every way a finger can, `evaluate` reports success@1/MRR/zero-results — orangecat runs 500+ such cases over its live Discover titles in CI with zero misses. NOT for meaning (embeddings, descriptive queries only), NOT behind a visibility gate, no phonetics yet. | | [`geo-kit`](https://github.com/bitbaum/geo-kit) | See [verified release and install command](registers/packages.json) | **versioned geography, shared without copying the database**: country-neutral contracts for a manifest of content-addressed GeoJSON/TopoJSON resources (source, geography, layer and level keys, validity period, optional viewpoint, URL, SHA-256, size, feature count) and sourced boundary assertions, each source's licence and attribution checked on its own. A client asks for geographies, a date and (when needed) a viewpoint, and gets only the layers it needs. Its `/map` entry (0.2.0) is the fleet's one map renderer: an orthographic globe on Canvas 2D (d3-geo) that, zoomed in, is a flat map, so a world globe and a map of communes are one renderer; framework-free (`createMap` takes a canvas), with `d3-geo` and `topojson-client` as optional peers so a data-only client installs neither. It owns no country packs, political claims, personal data or server. **Solon** owns public places and published boundaries; **OrangeCat** owns private residence and account data; Substrata and other clients consume the published, versioned data rather than copying Solon's geography database. Adopted: solon, substrata, orangecat. | **Adopted:** `listkit` — loki (proving consumer, 2026-09-11: `/fleet`'s search, four facet rows and four sorts, every control a link or a GET form so the page filters with JavaScript off); hirnli (2026-09-11: 4 toggle copies replaced, plus a preset that rebuilt the URL from scratch and a filter missing from the active-count); bitbaum (2026-09-24: package catalogue and studio work grid now share query parsing, URL state, facet counts, search and sorting instead of carrying separate hand-written codecs). **Considered and declined, with the reason — read these before surveying a repo again.** Both cost a full survey to reach, and the survey is the expensive part. - **datacat** (2026-09-12): its `escapeLikePattern` is byte-identical to listkit's `escapeLike` on every adversarial input tried. Adopting would add a dependency in order to delete three correct, tested, documented lines. The duplication that would have justified it lived in a file nothing rendered, and that file was deleted instead. - **orangecat `/discover`** (2026-09-12): **four of its eight params have no facet representation.** `q`, `type`, `category` and `sort` map cleanly, but `country`, `city` and `postal` are free text a reader types, and `radius_km` is a distance _around_ them — `range` is a min/max over a row's own numeric field, which is a different thing. Adopting would leave two codecs writing one `URLSearchParams` in one effect, split by which half owns which param. That seam is worse than one hand-written file, so the page got a single local URL contract and a round-trip test instead. The rule both produced: **a shared package earns a dependency when it removes a decision you would otherwise keep re-making — not when it merely matches code you already have right.** A partial adoption that leaves a seam through one function is the sitekit failure in miniature, so when the fit is partial, fix the duplication locally and write down why here. And never behind a security boundary: listkit's core sentinel is _empty selection filters nothing_, which is precisely the wrong default for a visibility gate. orangecat's public-surface predicates (`getOpenDemand`, `searchPlatform`, `fetchDiscoverCounts`, pinned by `__tests__/unit/public-surface-filtering.test.ts`) serve the public internet through the admin client with RLS bypassed. An in-memory array filter has no business there. `threadkit` — vitareba, orangecat (2026-09-06). `ai-forms` — loki, evig, aoz-begleitung, surf-your-life, kivvi. `bip-kit` — loki, orangecat, evig, aoz-begleitung, botsmann, heidi, kivvi, petvity, datacat (frontend only; its backend is the `ai-kit` consumer), substrata. **Ten.** `design-tokens` — bitbaum, loki, solon. **Three.** **Both counts above were read from each repo's `origin/main`, and the first attempt at them — read from the working checkouts in `~/dev` — was wrong in both directions.** Those directories sit on feature branches and go stale: loki's checkout was on `ci/auto-merge-pat` and showed neither `listkit` nor `design-tokens`, while `heidi`, `sbb-fundbuero` and `hirnli` adoptions were missed entirely. `~/dev/` is a _checkout_, not a repo — the same trap as the withdrawn `@ai-native-cms/core` row below, one level down. Survey `git show origin/main:package.json`, and match on the package rather than the key, because half the fleet installs under an alias (`"@fleet/ai-forms": "npm:ai-forms@…"`, `"sitekit": "npm:@bitbaum/sitekit@…"`, solon's `"@fleet/design-tokens"`) and a key-only grep reports zero adopters for a package with five. **And the third name is the interesting one.** `design-tokens` is named for OrangeCat, Loki and Solon, but orangecat does not install it. Its `src/app/globals.css` hand-copies the values under a comment reading _"Mirrors --on-accent in @fleet/design-tokens v1.1.0, which is the SSOT"_ — twice, on `origin/main`. That is the _precise_ defect this package was extracted to end, a comment asserting an SSOT relationship that the dependency graph does not have, now reproduced inside the product the package is named after. A comment is not an import: it cannot drift-check, and the next retheme tag will move two products and leave the third behind, silently and in brand colours. `ai-kit` — loki, aoz-begleitung, truthseeker, botsmann, evig, orangecat, hirnli (all seven on `@bitbaum/ai-kit` from npm), surf-your-life and kivvi's `@kivvi/ai` (both still via git tag — convert when touched), **and this repo** (`model-pin-audit.mjs` calls `checkCatalog`; the audit needed exactly the vendor query the package owns, so writing a second one here would have been this file's own sin). **"Adopted" was overstating it for botsmann, specifically.** A fleet-wide AI-tooling audit on 2026-08-29 found botsmann had `ai-kit` installed for `freeChain`/`providerModels` (the model list) only — its actual retry and health logic (`generateWithBestProvider`, `getProviderChain`, an in-process `llm-health.ts`) was hand-rolled, the same shape this file exists to prevent, just one repo instead of five. That hand-rolled code is exactly what `tryChain`/`createHealthTracker` (v0.5.0) were extracted FROM, and botsmann was converted the same day as the proving consumer — walk one flat provider+model chain instead of two nested hand-rolled loops, and the health tracker now wraps `createHealthTracker` behind its original five-function API. **`tryChain`/`createHealthTracker` are new in v0.5.0 and had TWO real adopters (botsmann, hirnli) as of 2026-08-29** — loki/aoz-begleitung/ truthseeker are on `^0.6.2` now but do not use either function yet. Say so precisely rather than let "ai-kit adopted" imply the failover/health gap is closed fleet-wide. Since then: evig converted (`tryChain` in `src/lib/ai/providers.ts`), kivvi wraps `createHealthTracker` (`packages/ai/src/health.ts`), and orangecat installs `@bitbaum/ai-kit` for its grounding harness while keeping its own model registry. **hirnli and "revamp-info" were counted as two separate repos in the 2026-08-29 audit. They are not — `git remote -v` in `/home/g/dev/revamp-info` points at `github.com/bitbaum/hirnli`: same repo, two local checkout directories, the identical measurement trap this file's own registry already withdrew an extraction for once (`@ai-native-cms/core`, see below). `revamp-info` is the `apps.conf` deploy name (hirnli's `deploy.yml` says so in a comment); the repo is `hirnli`. It is now on `tryChain`/ `createHealthTracker`, same commit as the fix above — there is no separate "revamp-info" left to convert. Check `git remote -v` before counting a directory as a repo, every time, including here. Adoption went 2 -> 5 on 2026-08-27, all of it as a side effect of repairing the outage rather than as a migration project — which is the only way it has ever moved here. Three repos deliberately did NOT adopt, and the reason is the same in each: kivvi, orangecat and evig already own model REGISTRIES carrying context windows, tool/vision support and per-token cost, which `ai-kit` does not model. Installing it beside one of those adds a second source of model truth to a repo whose problem was having two. They were repaired in place and left pointing at the daily audit instead. Merging a registry into `ai-kit` is a real design question and belongs to a human, not to an outage. (All three have since adopted anyway, each on its own terms — see the paragraph above.) **That stated reason is now FALSE, and it was still being read as current on 2026-09-21.** `ai-kit` models a registry: `src/registry.ts` carries `contextWindow`, `capabilities` (including `vision`), `inputCostPer1M` and a live-probed `toolProtocol`, with `paid` required and no default so a forgotten field fails the build. Three of the reasons repos gave for keeping their own AI layer have been built into the package and left unclaimed: | The reason given | Where it stands | | --------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | | "no registry — context, cost, vision" | **built** — `src/registry.ts` | | "no streaming, so we hand-roll the one call that matters" | **built** — `completeStream()` + `ai-kit/sse` (v1.9). See the duplication row below, which is now a description of history. | | "three hand-rolled transcription clients — one in heidi, two in loki" | **built** — `transcribe()`. heidi migrated; loki's two are still there. | What is genuinely still missing, and is the honest reason to keep local code: **embeddings** (evig's `hirn` RAG layer), a **local/Ollama provider** (evig, kivvi, orangecat's `local-runtime.ts`), **image generation** (orangecat's `services/images/`), and anything **not JavaScript** (botsmann's Python research agent is structurally out of reach). Those four are deliberate, not debt. The lesson is not about `ai-kit`. A reason a repo gave for not adopting something becomes a FACT in this file the moment it is written down, and nothing re-reads it when the reason expires — the same failure the `blessed-versions.json` comment made about 0.x, one file over. **Date a reason, or it outlives what it was about.** **v0.4.0 is breaking:** form filling moved off the root export to `ai-kit/forms`. One install, one version, one import path per concern — the root re-export made a chain-only consumer load `ai-forms` (ESM-only) and broke AOZ's Jest run inside a module it never imported. Fixed in the package rather than with a `transformIgnorePatterns` line per adopter. **On merging packages.** `ai-kit` absorbed `ai-ration` and re-exports `ai-forms`, because to an app "which model do we call", "AI chat" and "AI form fill" are ONE feature — AOZ adopted the form half, hand-rolled the rest, and was taken down by the half it skipped. `threadkit` and `limitkit` are deliberately NOT merged in: neither is about AI, and an app throttling its login form should not install a model catalogue to do it. Merge by what a consumer needs together, never by "these are all shared utilities". `threadkit` — **vitareba** (`^0.1.1`, driving its care-team messaging in `lib/domain/messages.ts` — the exact clinic case it was extracted for). `limitkit` — loki (proving consumer; its old limiter had the unbounded Map). orangecat closed its ADR-0002 in-repo instead (Accepted 2026-08-25: one canonical `src/lib/rate-limit.ts`, the messaging duplicate deleted) — so the next limitkit adopter is whichever repo's hand-rolled limiter is touched next. (That paragraph describes the step before this one: orangecat's default-branch `package.json` now carries `limitkit@^0.2.0`, and heidi's carries the `github:` form. Read `registers/packages.json` for who has it, never this prose.) **2026-09-15 that stopped being one repo at a time:** botsmann, petvity, surf-your-life, truthseeker and evig converted and merged, kivvi and aoz-begleitung have PRs open for their owners. The ratchet row fell 13 → 11 — only two _files_ went, because five of the seven kept a thin local module that holds the app's own limit values and calls limitkit. That is the intended shape, and it is why a falling ratchet row understates an adoption: what left was seven hand-rolled implementations, not seven files. Every one of them had the forged-`X-Forwarded-For` bug described in the registry row above. `sitekit` — substrata (proving consumer, converted the day the package shipped: −577 lines of local renderer, and its test now validates the whole site against the shared schema, so a breaking schema change fails in the consumer's CI first) **and camille-boulangerie** (merged + live 2026-08-28; its rebuild forced `feature`/`contact`/`faq`/hero-actions/card-icons into v0.2.0 — the union grows only when a real site cannot be expressed). **s-ink: assessed and deliberately NOT adopted** — it is a current Next 16.3 app with seven-locale `app/[locale]` routing, a works gallery and an enquiry API; sitekit has no locale concept or gallery kind, so adoption would regress a real client's live site for nothing. Grow the union on the first multilingual PROSPECT instead, the way camille grew it. wild-spirit is NOT a straight conversion: it is a hand-rolled no-framework static generator (`src/build.mjs`) that independently reinvented site-as-data, so adopting sitekit there is a port decision, not a refactor — decide deliberately, don't drift into it. **Not yet:** orangecat still carries its own form-assist; kivvi's provider layer wraps ai-kit rather than using it directly, and still pins the old git tag (`#v0.5.0`). A package with zero adopters removes zero duplication — publishing is the cheap half. `threadkit` is listed here on its first day precisely so it does not become another extraction nobody wired up. **`threadkit` shipped 2026-08-16** — `v0.1.0` on the public registry, published by the tagged workflow with an SLSA provenance attestation, so the registry can prove which commit built the tarball. Verified from outside the fleet, not from CI: installed from the public registry into an empty project, imported, and got 17 named exports plus `dist/index.d.ts`. It exists because of the bug [`single-tenant-prod-hides-unscoped-queries`](https://github.com/bitbaum/dotfiles) records: role-derived access is correct at one doctor / one tenant / one org and silently wrong at two. `canRead(thread, user)` cannot express that bug, because there is no role to check. **Adoption candidates, in order of how much duplicated code it removes:** | Repo | What it replaces there | | -------------- | ------------------------------------------------------------------------------------- | | ~~`vitareba`~~ | **adopted** — care-team messaging runs on it (`lib/domain/messages.ts`) | | `orangecat` | Cat DMs / conversation visibility | | `loki` | agent↔human threads, where an AI participant already needs the same rules as a person | **ESM-only** (`"type": "module"`, no `require` condition), so a CJS consumer cannot `require()` it. Every candidate above is ESM already; note it before adopting anywhere that is not. ### "If one breaks, does it break every app?" — no, and the real risk is the opposite The intuition is that a shared package is a single point of failure: push a bad version, take down every app that installed it. Measured on 2026-09-12, that cannot happen here — and the thing that _is_ happening is its mirror image. **A publish reaches nobody by itself.** Every consumer commits `pnpm-lock.yaml` and every CI and deploy job installs with `pnpm install --frozen-lockfile`. A new version enters one repo at a time, as a reviewable lockfile diff, through that repo's own CI and its own deploy. There is no fleet-wide push and no ambient upgrade. `minimumReleaseAge` sits in front of that as a second gate: a fresh publish is refused until it ages, and our own packages are exempt from it: `minimumReleaseAgeExclude` lists `"@bitbaum/*"` (one glob, so a package published tomorrow is covered too; pnpm 11 matches the pattern) plus the four unscoped names `limitkit`, `bip-kit`, `threadkit` and `ai-forms`. A missing entry fails `pnpm install --frozen-lockfile` **before a line of code runs**, surfacing as a bare exit 1 with no annotation, reading like a broken build rather than a refused dependency. **So the blast radius of a bad publish is one repo — whichever bumps first — and its CI is the thing that catches it.** That is what the "proving consumer" practice in this file is for: a package is not adopted fleet-wide on publish day, it is driven through one real app, and that app's CI is the integration test the package cannot write for itself. **What is actually broken is distribution.** `@bitbaum/ai-kit` is published at `1.4.1`. Its thirteen consumers, read from `origin/main` **after fetching**: | Range | Repos | | --------- | -------------------------------------------------------------------- | | `^0.13.0` | datacat (`backend/`), evig | | `^0.15.0` | aoz-begleitung, heidi, hirnli, kivvi (`packages/ai/`), sbb-fundbuero | | `^1.2.0` | loki | | `^1.4.0` | botsmann, surf-your-life, truthseeker, vitareba | | `^1.4.1` | orangecat | A caret on a `0.x` version pins the **minor**: `^0.15.0` means `>=0.15.0 <0.16.0`. So a fix published right now as `1.4.2` reaches **six of thirteen repos**, and the seven on 0.x cannot receive it even by running `pnpm update` — each needs a deliberate major bump. Seven repos sit behind an 0.x line on the package that owns model ids, failover and the three kinds of 429; the last time this fleet was taken down it was five repos going down _together_ on a retired model id, which is the same shape as this table. **Two measurement traps, both walked into while producing that table.** The first: `~/dev/` is a checkout on whatever branch someone left it on, so read `origin/main`, never the working tree. The second is the one that survives fixing the first — **a remote-tracking ref is only as fresh as the last `git fetch`**, and a stale `origin/main` answers confidently and wrongly. The table above was built twice: before fetching it showed botsmann, surf-your-life, truthseeker and vitareba stranded on `^0.15.0`; all four had been current for days. `git fetch` first, or do not quote a number. **And `version-currency` can see only five of the seven.** Blessing `@bitbaum/ai-kit` at major 1 flags aoz-begleitung, evig, heidi, hirnli and sbb-fundbuero — but never datacat or kivvi, because the audit reads each repo's **root** `package.json` and those two install the package in `backend/` and `packages/ai/`. A monorepo consumer is invisible to the currency ratchet, and silence from it reads exactly like currency. The usual shape: the gate is not wrong, it indexes less than what it is trusted to cover. **The practice, then, is not "be careful what you share" — it is:** 1. **Consumers pin through a lockfile, always.** This is already true fleet-wide and is what makes shared packages safe. Never install a fleet package with a floating tag or a branch ref. 2. **A package earns adoption through one proving consumer**, whose CI is the integration gate. Publishing is the cheap half. 3. **Version spread is the metric to watch, not breakage.** A registry with seven adopters on stale majors has the cost of coupling and none of the benefit — the fix you wrote for everyone reached six of thirteen. Getting a repo current is the cheapest work in this file and nobody schedules it. **And right now nothing measures it:** `blessed-versions.json` tracks a package either in `majors` (npm, judged on major) or in `internal_tags` (git pin, judged on tag), and `ai-kit` fell through the seam between them. Its `internal_tags` entry was deleted when it graduated to npm — correctly, per that file's own rule — and it was never added to `majors` because it was `0.x` on graduation day and "0.x has no meaningful major". It is `1.4.1` now. The comment in that file still describes it as a 0.x package, so the reason it is untracked reads as deliberate. Adding `"@bitbaum/ai-kit": 1` is a one-line fix that flags five of the seven; it also raises the measured gap total, so it needs a baseline bump in the same PR, which is the point — the debt becomes a number someone chose rather than a silence. 4. **Breaking changes cost N deliberate bumps**, so spend majors carefully — but do not let that argue for a copy. The copy has the same cost with no version number on it and no way to find the other copies. ### Central audits — one script, never a copy per repo Not installable packages: these run FROM this repo against every other one, so there is nothing to adopt and nothing to drift. Check here before writing a fleet-wide checker. | Script | Answers | | -------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `scripts/ci/verify-floor-audit.sh` | does every repo's `verify` actually run lint + typecheck + test? | | `scripts/ci/model-pin-audit.mjs` | is any model id the fleet pins no longer served by its vendor? Zero tokens — one `GET /models` per vendor — so it runs DAILY. Uses `ai-kit`'s `checkCatalog` rather than a second vendor query. Self-tested by `scripts/ci/test-model-pin-audit.mjs` — **102 checks, no network, no key, no checkout**, every fixture the real code that fooled it. Using it to repair seven repos on 2026-08-27 exposed nine faults in both directions, and the blind spots were not random: they mirrored the shapes people write (`GROQ_MODELS = {` defeats `\bmodels?\b`; `models: AIModel[] = [` defeats an array pattern; `modelId` is not `model`). It also read ids out of COMMENTS — reporting a retired id in the very commit that removed it. Never trust its first clean run after widening; re-run the live sweep and read every line. | | `scripts/ci/currency-reconciler.mjs` | Plans first-party updates from fresh npm and CI-verified Git releases across every tracked project manifest. Reads immutable locked artifacts at the nearest pnpm/npm root, preserves aliases and refuses downgrades. The acting workflow leases both source commit and declaration before package-manager lock regeneration. Public automation covers explicitly public non-fork repositories; `--include-private` is local report only. Missing evidence aborts the scan. The bounded PR cap lives in the script; over-cap scans apply nothing. Self-tests cover preferred release channels, nested importers, private scope and stale-plan rejection. | | `scripts/ci/ui-defect-audit.mjs` | do any live sites ship an interactive label below its WCAG AA floor, or a stack whose rows start at different x? Renders each site; no repo checkout involved. Self-tested by `scripts/ci/test-ui-defect-audit.mjs`, which pins BOTH sides — the real defect is still caught, correct markup stays silent. | | `scripts/ci/hosted-supabase-audit.sh` | does any repo still point at a Supabase we retired? The fleet self-hosts on bitbaum; two managed-cloud projects are dead. botsmann kept a setup doc opening with "Completed Setup" for one of them, telling you to apply migrations by pasting SQL into a dashboard that does not exist for us — so nobody pasted anything, its eleven migrations were never applied, and `/api/health` served PGRST205 for months while every deploy went green. The docs were not stale clutter; they were the outage. Allows `supabase.com/docs` (the product documentation is still correct) and `your-project.supabase.co` (a placeholder misleads nobody) — a gate that fires on those gets muted. Legitimate mentions, like a decommission runbook naming what it decommissioned, live in `hosted-supabase.baseline` **with a reason**: a ratchet that may fall or hold, never rise. GitHub code search returns nothing for these repos, so the workflow shallow-clones the fleet and runs the same script — and says SKIPPED, loudly, when it sweeps nothing, because a vacuous pass reads exactly like coverage. Self-tested by `scripts/ci/test-hosted-supabase-audit.sh` — **28 checks, no network, no checkout**, pinning both sides. | | `scripts/ci/nextauth-origin-audit.mjs` | does every next-auth app advertise its own public origin? Behind Caddy the app never sees its public URL, so next-auth builds sign-in and callback URLs from the INTERNAL origin unless `NEXTAUTH_URL`/`AUTH_URL` is pinned in the box env — and `AUTH_TRUST_HOST=true` does NOT cover this path, which is what makes a broken app look configured. Nothing 500s: the site renders, only OAuth sign-in and sign-out are impossible. petvity shipped it, fixed it in petvity#39 (~2026-08-14), and had **silently reverted to `https://localhost:4013/api/auth/callback/google` by 2026-09-10** — a public JSON field stating the outage for weeks with nobody reading it. Reads `/api/auth/providers`, which next-auth publishes unauthenticated: no secret, no login, no box access, no quota, so it runs DAILY. 404 = not a next-auth app → SKIP; **5xx = FAIL**, because an auth stack that cannot answer is broken too (datacat's missing `secret:`), and treating "no data" as "no problem" is how this check would certify a dead auth. Sites come from the same footer SSOT `ui-defect-audit.mjs` reads, so nothing here is a second app list. Self-tested by `scripts/ci/test-nextauth-origin-audit.mjs` — **20 checks, no network**, fixtures captured from the real regression and the real repair. | | `scripts/ci/org-drift-audit.sh` | does any public document contradict the org register, or use a name or host that has been RETIRED? Sweeps README/CLAUDE/AGENTS/docs across the org's default branches via the GitHub API — the local `USE_LOCAL=1` sweep greps stale checkouts and every `docs/*.md`, so it sees a DIFFERENT set of files; generate the baseline with the instrument that judges it, or CI rejects it (44 of 51 locally-derived entries matched nothing production could see). Forbidden claims come from `registers/org.json`; retirements from `registers/retired.json`, where **adding a rename is a row, not code** — a 308 answers 200, so a stale host looks healthy and nothing else reports it. Findings say what to use instead and since when. Self-tested by `scripts/ci/test-org-drift-audit.sh` (49 checks, no network); its vacuous-scan case once overwrote the committed 41-repo inventory with "Scanned 0 repos" on every test run — a check that damages the artifact it checks. | Both report into a weekly workflow's job summary rather than only a log. | `scripts/ci/repo-metadata-audit.mjs` | does a repository's GitHub metadata agree with the register? The repo page is the first thing anyone opens and the furthest surface from the code, so it drifts first and silently: on 2026-09-11, **13 registered apps had no homepage at all** and evig's pointed at revamp-it.ch — a domain that is not the app. Checks only the MECHANICAL claims (a registered app's homepage is its canonical host; every live repo has a description) and deliberately not whether a name or description is _right_ — the live `` is not a reliable product name (a multi-tenant app serves the TENANT's title; some sites put the brand after a pipe), and a gate that guesses at prose gets muted. Name retirements are enforced precisely by `org-drift-audit.sh` instead. Exceptions in `repo-metadata.allow` with a reason each. Self-tested by `scripts/ci/test-repo-metadata-audit.mjs` — **17 checks, no network**, because the judgement is a pure function of (repos, register, allow); its first version ran the live audit on import and asserted nothing, which is why the CLI now sits behind an is-main guard. | **One more, and it lives elsewhere on purpose:** `bitbaum/loki:scripts/ci/check-register-reality.sh` — does `apps.conf` still describe the box? It reads the register, which is loki's SSOT, and needs SSH to bitbaum, so it cannot run from here or in CI; the daily `scripts/local/fleet-register-check` drives it. Listed here anyway, because this table is where you look before writing a fleet-wide checker and "is there already a drift check?" is exactly that question. It asks what a shape check cannot: does every registered domain SERVE ITSELF or merely redirect; is any Caddy vhost unbacked by a row; is anything listening in 4000-4099 the register does not know. All three were shape-valid and wrong on 2026-09-10 — a `domains` field naming a 308 would have had sync-infra delete a live client's real vhost, and an unregistered 4030 was two new sites from a port collision. Exceptions live in `register-reality.allow` with a reason each, so an exclusion is a decision someone can read rather than a silence. Two traps it encodes, both measured rather than argued: - **A daily check must run the JUDGE from the same commit as the data.** `fleet-register-check` read the register from `origin/main` — with a comment explaining that ~15 sessions make the working tree a scratchpad — and then ran the checking script out of that scratchpad. An old judge called three good rows of a new register "drift". - **`printf '%s\n' "$x" | grep -q …` under `set -o pipefail` fails on SUCCESS.** `grep -q` exits at the first match, the writer takes SIGPIPE, and pipefail reports the writer's death as the pipeline's status: 20/20 false failures on a large payload, 0/20 on a small one — so it looks like a flaky gate, not a wrong one. Use a here-string; it is not a pipeline and has nothing to signal. - **A `sed` range never matches its end address on the START line**, so the usual "strip C comments" one-liner deletes live code. `sed '/\/\*/,/\*\//d'` meets a single-line `/* … */`, starts a range, then looks for the closing `*/` from the NEXT line onward — running to the next comment and deleting every declaration in between. A gate that stripped `globals.css` this way to check for a forbidden colour **passed against the very file that declared it**: the colour sat in a primitives block the stripper had eaten. It had only ever worked on files that did not contain what it was looking for. `perl -0777 -pe 's{/\*.*?\*/}{}gs'` strips comments as comments. The general form is worth more than the sed detail: **an absence-shaped check ("the bad value is not here") is satisfied just as well by a broken reader as by a clean file.** Comment-awareness is still required — a gate that cannot tolerate its own rule being written down forces the explanation to be deleted — so strip comments _correctly_, and give the stripper its own two-way self-check: it must drop what it must drop AND keep what it must keep. ## Chat — the standard every chat meets **Never start a chat, assistant or composer from scratch.** Measured 2026-09-25: **13 chat implementations in 10 repos**, none packaged, and every one of them re-learned — or never learned — the same lessons. The cost lands on George, who has to open each product, find what this one forgot (usually the microphone) and ask again. The widget chat added to loki on 2026-09-24 (#879) did exactly this: written fresh, it shipped without a mic, with small text and a composer bolted under the panel, while three repos had already solved all three. **The rule.** Every chat, assistant and composer is [`@bitbaum/chatkit`](https://github.com/bitbaum/chatkit). App-specific parts go in its slots (`tools`, `header`, `footer`, `renderFooter`, `renderLink`); a bug, a gap or a missing slot is fixed IN chatkit, with the check that would have caught it, and released — never patched in one app, which is how there came to be thirteen. Markup follows each app's tokens through `--ck-*`; **behaviour may not differ.** A surface that cannot run React (loki's embeddable widget) meets the checklist by hand and is the one exception. chatkit was extracted from loki `/loki` (the most complete chat on 2026-09-25) and closed that chat's four gaps while at it: 16px answers, the `visualViewport` keyboard fix (`useViewportHeight`), mic failures shown in words, and the Web-Speech-first fallback from heidi. ### People talking to people — the same package A messenger (direct messages, a group, a conversation an agent has joined) is `Messenger` from `@bitbaum/chatkit/messenger`, never a list, a bubble and a composer assembled in the app. OrangeCat's was assembled in the app: about 8,700 lines, in which the Cat's answer in a conversation between two people looked like the other person's, nothing said an agent was taking part, the box sat in the middle of a phone with an empty band under it, and nothing could be attached (owner, 2026-11-12). None of that could be fixed for the next product, so it was fixed in the package and OrangeCat consumes it. The app implements `MessengerTransport` (its routes, its realtime channel, its storage) and nothing else; the rules behind the screen (who may write, what is unread, what may be attached, how far a message was read) are `@bitbaum/threadkit`'s. What the package guarantees is the README's "People talking to people" section and `test/browser-messenger.mjs`; where attachments are stored, and at what cost, is the app's (orangecat `src/config/message-attachments.ts` is the worked example: a private bucket behind signed URLs, a policy shared by browser, routes and bucket, a daily sweep). ### The checklist — each line is a bug somebody already fixed once 1. **A microphone in the composer, always.** Web Speech first; if it is missing **or silent** (Chromium without Google speech accepts `start()` and never fires — heidi `use-dictation.ts`, measured 9 s / 0 events), the same button records and sends audio to a server transcription route (ai-kit `transcribe()`). Recording is visible (timer, cancel, confirm) and a mic failure is shown, never swallowed. 2. **16px or larger** for message text and the input. Under 16px iOS zooms the whole page on focus (loki `globals.css`, "`text-base` is not a style choice"). 3. **The composer is part of the conversation surface**, not a form field under it: an auto-growing `<textarea>` (never `<input>` — it silently drops the newlines of a pasted prompt, loki `AskLokiButton.tsx`), Enter sends, Shift+Enter breaks the line, IME `isComposing` respected, and it stays above the soft keyboard and the safe area (orangecat `ViewportHeightSync.tsx`: "100dvh does not shrink when the Android soft keyboard opens"). 4. **Streams, and can be stopped.** Server side `completeStream()` + `ai-kit/sse` (a reader without a carry buffer drops frames — kivvi, aoz). Stop lives in the send slot: "a turn you cannot cancel is the thing that makes a slow answer feel broken" (loki `Composer.tsx`). 5. **Fails visibly, with Retry** — a failure bubble, never a silent nothing (heidi `use-conversation.ts`: the rewrite "had no retry and no failure bubble"). 6. **Scroll sticks to the bottom only when the reader is already there**, with a jump-down button (loki `Thread.tsx`). 7. **Markdown rendered** (no literal `**`), links clickable, **Copy** on every answer. 8. **An empty state that starts the conversation** — starter prompts that disappear once it has begun; and when more than one agent can answer, each message says **who** is speaking. 9. **Works at 320px** with no horizontal scroll (`min-w-0` on the composer row — heidi `composer.tsx`). **Done means looked at:** a screenshot at 390px and at desktop width, and one real sentence spoken into the mic, before the chat is called finished. ### Where each chat stands (2026-09-25, working checkouts) | Repo · surface | Missing against the checklist | | -------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | loki `/loki` | composer is chatkit (2026-09-25); the thread is still loki's own (14px answers, no `visualViewport` fix) until it moves to `ChatThread` | | loki `AskLokiButton` | voice, streaming, stop, markdown, copy | | loki widget Chat (`widget/chat.ts`) | cannot use chatkit (vanilla, runs on other people's sites) — must meet the checklist by hand: voice (it already has `voice.ts` for Report), 16px, composer integration, streaming, stop, markdown, copy | | orangecat Cat (`ModernChatPanel`, `ChatInput`) | attachments, 16px input (iOS zooms), retry on the last turn — best keyboard handling in the fleet | | orangecat companions `TalkRoom` | streaming (by design), retry | | heidi chat | stop, markdown — best voice and font size | | substrata `/ask` | auto-grow, mic fallback (Web Speech only, silently dead where unsupported), retry, copy, keyboard | | kivvi, evig (×3), aoz, botsmann (×4), surf-your-life, vitareba | nearly everything: no voice; single-line inputs or no Shift+Enter; kivvi and aoz drop SSE frames | The ratchet (`shared-inventory.sh`, concern `chat-composer`) counts files named as a composer — **6 in 5 repos** on 2026-09-25 (heidi, kivvi, loki ×2, orangecat, substrata) — so a NEW one fails `--check`. It cannot see chats whose input is inline in a page (most of the last row) — this section is the guard for those. ## The experience standard — what a person gets from every product **Owner, 2026-11-06:** a non-technical person who says "make me a website" must get, out of the door, the quality we have already decided is good — not find out that the menu or the text box is worse than ours and not know to say so. Installing a package is not that. Using its component is. AGENTS.md → "The experience belongs to the package" is the rule; this is the standard and where it stands. | A person… | …gets | From | | ---------------------------------------- | ------------------------------------------------------------------- | --------------------------------------------------------- | | types in any long text box | a microphone that always works, 16px, drafts that survive | chatkit `DictationField` (a conversation: `Composer`) | | writes an article | speak it, improve it, photo, chart, preview, publish, share | writingkit `/react` | | talks under an article, a page, an item | one thread, same box with the mic, remove your own | chatkit `CommentThread` | | writes to another person, or several | one messenger: list, thread, a one-row box with the mic, photos, videos and files, and an agent never mistaken for a person | chatkit `Messenger` (`/messenger`) | | opens the site | one header, one menu that explains each screen, one phone tab bar | sitekit (`SiteMasthead`, `SiteTabBar`, `SiteFooter`) | | acts on an item | one primary, then equal cells; owner controls apart | writingkit `ArticleActions` (the pattern, "One shape") | | types a short field (name, email, price) | a normal input at 16px; no mic unless it is prose | the app (the audit leaves single-line inputs alone) | What the app still owns: its words, its colours (tokens), its routes, its backend (each component takes a **transport** — `publish`, `assist`, `photos`, `transcribeUrl`, `comments` — and never a database or a vendor). Where a component's layout truly cannot serve a product, the product extends the package; it does not fork the markup. **Measured 2026-11-06** with `scripts/ci/experience-audit.mjs` on each repo's default branch (a count of source files, not a proof — it reads text and cannot tell a code editor from a note field, which is what `// experience-exempt:` is for): | Repo | bareTextareas | localChrome | localComposers | localComments | localArticleEditors | | ----------- | ------------: | ----------: | -------------: | ------------: | ------------------: | | orangecat | 47 | 3 | 0 | 0 | 1 | | biaslens | 6 | 0 | 1 | 0 | 0 | | loki | 34 | 2 | 1 | 0 | 0 | | evig | 96 | 3 | 0 | 0 | 0 | | substrata | 7 | 1 | 0 | 0 | 0 | | heidi | 6 | 0 | 0 | 0 | 0 | | solon | 4 | 0 | 0 | 0 | 0 | | causius | 4 | 1 | 0 | 0 | 0 | | diplodoctor | 2 | 1 | 0 | 0 | 0 | The audit also reports `mutedChats` (2026-11-11): a file that renders chatkit's `ChatApp` or `Composer` with `attach: false` or `voice: false` on a line with no `experience-exempt: <reason>`. A chat with no paperclip or no microphone cannot be used by everyone it serves (Solon's law chat shipped with both off). It is opt-in: it fails a product only when its ceiling names it, e.g. `"mutedChats": 0`, so no product's CI changes until it asks. BiasLens's one `localComposers` file is the article composer it shipped in November 2026 as app code; it moves into `writingkit` in the plan, which is the case the rule exists for. `localComments` reads 0 across the fleet because comment lists are rarely named as such: the audit under-counts there, and the plan says so. **How it is enforced.** `package-composition.yml` (already called by every product's CI) runs the audit. A product whose `package-plan.json` has `experience.ceiling` fails a pull request that raises any count; the app template ships `"ceiling": {}`, so a new product starts at zero. An existing product sets its ceiling to today's counts (`experience-audit.mjs --init`) in the PR that adopts the components, and lowers it as it migrates. Nobody raises a ceiling. ## Your own model — the standard every app meets **Anyone must be able to power an app with the strongest model they can reach, and entering a key must be the easy part.** Measured 2026-09-25: five apps took a reader's key and each did it differently — a hand-kept vendor list (no Anthropic, no Gemini), a free-text model box, a "Save" that stored a key nobody had checked, keys in PLAINTEXT columns sent back to the browser, and a check that could never pass (it read the wrong level of the response). The strongest model a reader had was usually the one they could not select. **The shared pieces — all `@bitbaum/ai-kit` ≥ 1.18.0; never a second copy:** - `ai-kit/byok` — `BYOK_VENDORS`, the CLOSED list (openrouter, openai, anthropic, google, groq, mistral, deepseek, xai, together, cerebras). Never a caller-supplied base URL: that is SSRF and key exfiltration in one field. `byokChain(config)` → `{chain, env, extraHeaders}`; the key lives in a per-call env (`BYOK_API_KEY`), never `process.env`. Its links are marked `byok`, so day-capacity, cooldowns and health skip them (1.18.0) — one reader's personal 429 must not cool a model for the whole site. - `ai-kit/byok-probe` (server only) — `probeByokKey(vendor, key)` → `{ok, status, message, models, suggested}`. Failure in the vendor's own words with the key redacted; `status: null` = "could not check", never "wrong key"; `suggested` = the strongest chat model that key can use, ranked without naming any model. It knows the traps: OpenRouter's `/models` is public and 200s a DEAD key (checks `/key`), Anthropic wants `x-api-key` + `anthropic-version`. **Never hand-roll a key check.** - `ai-kit/seal` — `sealSecret`/`openSecret` (AES-256-GCM) for keys at rest. **The flow.** Pick a provider (chips from `BYOK_VENDORS`) → "Get a key from X" → paste → it is checked on its own (~600 ms after typing stops) → the models that key can use, the strongest **preselected** → one button. Free-text model entry only when the vendor returned no list. **The rules — each one a bug somebody shipped:** 1. **The save route checks again**, server side, and refuses a model not in the probed list. Never trust the client's "it worked". 2. **Sealed at rest or kept in the browser** (the app's choice) — never a plaintext column. **No API ever returns a key**, only a hint (`…abcd`). 3. **An empty field keeps the saved key**; removing is explicit. A form that no longer holds the key and still writes `key || null` wipes it on save. 4. **Own-model calls are the reader's**: their key serves only their model, a server key never flows to a reader-chosen model, and the app's free budget and telemetry are not charged for them. Every "free budget used up" refusal links to the settings deep link (loki: `/settings#ai`). 5. **Subscriptions are never collected.** Claude Pro/Max, ChatGPT Plus and the like sign in through the vendor's own flow (its CLI's login in a terminal the user controls). No app stores, proxies or asks for a subscription credential or session token. API keys with a spending cap are the path for anything automated or multi-user. **Reference implementation:** loki #921 — `src/components/settings/OwnModelSettings.tsx`, `src/app/api/settings/model/{route,probe/route}.ts`, `src/lib/own-model.ts`, test `scripts/test/own-model.ts`. ### Where each app stands (2026-09-26) | App | State | | ------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | | loki | the reference — live (#921) | | heidi | live (#138; ai-kit 1.18 in #140) — browser-only key by choice | | botsmann | #208 — keys were plaintext AND returned by `GET /api/settings`; now sealed, checked, hinted | | kivvi | #125 (draft, client app) — company key checked + encrypted with its integration-secrets helper | | substrata | in progress in its own session — saved without a check; free-text model | | orangecat | direct (non-OpenRouter) keys unlock no models in the picker, and "auto" on a direct key uses hardcoded defaults instead of the key's strongest model | | evig | provider key is admin-only (not reader BYOK) | | aoz-begleitung, datacat, hirnli, sbb-fundbuero, surf-your-life, truthseeker, vitareba | no reader keys yet — adopt this section when one is added | ## What is worth extracting next Ranked by (copies × how identical the logic is). Counts from `scripts/ci/shared-inventory.sh`, forks excluded. | Concern | Files | Why it is a good candidate | | ------------------------- | ----------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `auto-merge-sweep.sh` | ~~22~~ **1** | **EXTRACTED 2026-08-16/20, DONE 2026-09-15.** The one file is **this repo**, the canonical home (moved here from dotfiles 2026-08-28). Every other repo with an `auto-merge.yml` — 32, read from default branches via the API, datacat/petvity/solon included (the earlier "dirty tree, convert when clear" note had gone stale) — calls it as a reusable workflow, and eight of them across six caller shapes were checked to actually _run_ it that day (a sweep that fails to start looks exactly like one with nothing to do). Which is how the day's real findings surfaced: dotfiles' caller had two `secrets:` blocks and had not parsed since 2026-09-13 (zero-job failures, nothing merged, nothing said so), and substrata + camille-boulangerie re-armed a `publish.yml` neither has. All three fixed; the caller shape is now ratcheted (`cicd-hygiene-audit.sh`, `automerge-miswired`) and the template lives at `templates/ci/auto-merge.yml`. The two repos that had ever _tested_ their copies (evig, orangecat) had that coverage ported into the canonical suite **before** deletion: 17 cases, mutation-proven. | | rate limiting | **12 files / 11 repos** | `limitkit` owns the window algorithms, bounded store, and trusted-proxy parsing. Local wrappers retain product-specific limits and route policy; these are expected adapters, not copied algorithms. A full 2026-10-26 census found 12 such files. | | AI provider client | **13 files / 8 repos** | The census fell from 19 to 13 files as apps adopted `ai-kit`; it now owns provider-chain selection, model availability, fallback, and budgets. The remaining files are adapters and domain prompt callers; keep them only where they bind app-specific context. | | **streaming model call** | **6** | **THE HOLE IS FILLED; THE ROW IS NOT. Corrected 2026-09-21.** `completeStream()` and the `ai-kit/sse` subpath shipped in v1.9 — `src/stream.ts` opens by quoting this row's own measurement — and of the six clients below, exactly ONE has been retired (heidi's). The rest still hand-roll, because a package feature is not an adoption: the consumers are pinned at `^1.4.0`–`^1.8.0` and most of them cannot even see v1.9 without a bump. That is what `currency-reconciler.mjs` now opens the PR for. **Everything from here on describes the state that motivated the fix, kept because the reasoning is still the argument.** `ai-kit` had no streaming API — `complete()` is request/response only; "stream" appears in it once, as a capability _label_. So every app that wants tokens to appear as they arrive uses ai-kit for chain selection, 429 classification and health, then **throws it away for the one call that matters**: orangecat (5 provider clients), loki, evig (3), kivvi, botsmann, aoz-begleitung all hand-roll the streaming fetch. Downstream of that absence sit **4 hand-rolled SSE readers** — orangecat's `src/lib/sse.ts` and loki's `src/lib/api/read-event-stream.ts` are the same function under the same name, independently written — and **4 SSE emitters with divergent headers**. Two of the readers (kivvi `hooks/use-chat.ts:114`, aoz `AIChatInterface.tsx:66`) `chunk.split("\n")` with **no carry buffer**, so any frame straddling a TCP chunk boundary is silently dropped; orangecat and loki buffer correctly. That is a live correctness delta, not a style difference. The fix is `completeStream()` over the existing chain/429/health machinery plus an `ai-kit/sse` subpath — and the code already exists and is battle-tested: it is loki's `lib/api/sse.ts` + `read-event-stream.ts`. Measured 2026-09-15. | | chat turn state | **9** | ~20,800 lines of chat UI across ~24 independent message-list/composer implementations in 9 repos, and not one has a `useChat`-shaped hook another repo could read. The shareable part is small and headless: the send/stream/abort/retry state machine, `useStickToBottom` (only orangecat and loki implement "stick only if already at the bottom" — everyone else yanks the reader away from what they were reading; ~25 inline copies across 8 repos, three techniques), and ONE LLM-markdown renderer to replace 454 lines of bespoke tokenizers plus four repos that render assistant output with literal `**` still in it. **Ships no bubbles, composers, avatars or typing indicators** — see "UI markup for chat and forms" below, which this row does not amend. Sequencing matters: evig has 5 hand-rolled chat threads _inside one codebase_ (`HirnChat`/`HirnChatPanel` ~85% byte-identical) and botsmann 4, so both need a local primitive before any package helps them, and `ai-kit` version skew already spans `^0.6.2`→`^1.8.0`. Do the row above first. | | logger | **7 files / 6 repos** | The implementations have distinct contracts: Aoz redacts resident data, OrangeCat has production log-level policy, DataCat uses `pino-http` with request-secret redaction, and Kivvi currently has separate web and core-job logger implementations. A prior draft to converge them did not merge; the reporter and redaction contract remains unresolved. A shared logger kit needs an explicit redaction and reporter contract before these adapters can safely converge. | | message threads | **3** | orangecat 2, vitareba 1. **Extracted already, as [`threadkit`](https://github.com/bitbaum/threadkit)** — 506 lines, headless, permission-as-participation. Added to the ratchet 2026-09-06 _after_ measuring, because the intuition that prompted it ("many of our apps have messaging") turned out to be wrong: only two repos carry thread logic at all. The row still earns its place, because the copy that existed was not merely duplicated but **wrong in ways invisible below three participants** — read receipts that reported READ when any one recipient had caught up, a reader counted outside their own visibility window, and an optimistic bubble that shared no identity with its stored row and so rendered twice whenever realtime won the race. orangecat converted as the proving consumer; the remaining file is vitareba's adapter, which is the point of a headless package rather than a copy of it. | | health route | **18 files / 18 repos** | Each endpoint's readiness contract differs: auth/account readiness, database liveness, free-analysis availability, mail readiness, or informational AI health. For example, DataCat returns 503 when its database is unavailable while Truthseeker remains 200 when only an LLM key is unavailable. A generic envelope would hide the assertion each deployment depends on. | | slug helper | **7 files / 7 repos** | The current files cover different identifier contracts: Xhiva/Evig/Heidi/Hirnli content slugs, Loki's reserved DNS labels, OrangeCat's collision-safe identity claim fallback, and Solon's place-path segments. A generic Unicode helper is still a SiteKit candidate, but changing these identifiers requires compatibility fixtures and an explicit migration plan first. | | ~~`@ai-native-cms/core`~~ | — | **Withdrawn — measurement error.** `bitbaum/revampit` was renamed to `bitbaum/evig` in the pivot (checked 2026-09-17: the old name now 404s outright — there is no redirect left to follow); the "two repos" with byte-identical trees were two clones of ONE repo. Nothing to extract. Two directories are not two repos: check `git remote -v` before reporting cross-repo duplication. | ## 2026-10-26 inventory review The reviewed baseline now reflects a complete scan of 43 non-kit default branches (17 published package repositories are excluded from the duplication scan). Counts that rose were investigated before they were accepted: the new rate-limit files are app policy adapters; the new logger files retain distinct redaction, reporting, or request-context behavior; the five additional health routes check different dependencies; and the new slug files protect different identity, DNS, and place-path contracts. The baseline also records measured improvements: AI-provider files fell 19 → 13 and chat-composer files fell 6 → 5 after shared-package adoption. The scanner and its baseline remain in the same reviewable change so subsequent increases still fail visibly. ## What must NOT be centralized Stated explicitly, because "share everything" is its own failure: - **Product identity, content and domain semantics** stay in the product. Shared auth screens, runtime and table definitions come from `@bitbaum/accountkit/auth`; products supply labels, theme adapters and roles. - **DB schemas** — Drizzle vs Prisma vs raw SQL; a shared schema fights every ORM. - **Product composition is not a package fork.** Use a package's renderer, style and slot contracts for a shared UI block; keep the product's content and domain-specific views locally. Chat behavior and UI use chatkit. Form assistance uses ai-forms. A theme adapter is expected; copying component state, markup and styles into each consumer is not. - **Anything where app semantics decide correctness.** orangecat legitimately lists paid model ids (BYOK — the user's key, the user's choice) while the same id in kivvi's fallback was a bug. Centralize the **rule**; assert it **locally**, where the app knows which is which. - **Navigation configuration** stays in the product: destinations, labels, identity and account slots. Header/footer/menu rendering and interaction behavior belong in sitekit. Its application appearance supplies standalone CSS and a responsive accessible menu; existing document appearances remain supported. The earlier instruction against sharing chrome is superseded by the owner's package-first composition direction (24 October 2026). Past shared bugs are regression tests in the owning package, not a reason to duplicate it. ## Composition before implementation The baseline lives in `registers/product-building-blocks.json`. Each new product records its selections and actual bindings in `package-plan.json`; justified exceptions explain a missing feature or concrete incompatibility. The reusable `package-composition.yml` workflow checks the plan against installed dependencies, real source imports/usages and the dependency-update path. Existing products add this check when their shared foundation is touched. The plan is a binding map, not a copy of the package registry or the product's mission/roadmap. --- ## The navigation contract Eight rules, each one a defect actually found — six in the 2026-08-29 audit, two in the 2026-09-21 multi-width sweep — and each mechanically checkable. This is the nav answer to "centralize the rule, assert it locally". 1. The active link of every nav surface carries `aria-current`. 2. Every toggle controlling a panel carries `aria-expanded`. 3. Every interactive nav element is at least 44×44px. 4. The label lives **inside** the control, never beside it. 5. Persisted UI state distinguishes `null` from empty. 6. Every internal href comes from a routes constant. 7. No nav or header control crosses the edge of the viewport, at any width. 8. No page scrolls sideways, at any width. **7 and 8 were added 2026-09-21, and the reason they are new is the reason they matter: this audit only ever rendered 1440×1000.** substrata shipped a mobile menu whose panel was positioned against a button in the middle of the header, so at 390px `right: 0` measured from there put 22rem of panel off the **left** edge of the screen — the search field and every link label painted where nobody could see them. Rules 1–6 all passed on it. The links had boxes, cleared 44px, and marked the current page. They were simply not on the screen, and nothing in this fleet rendered the screen they were missing from. The same header hid its entire nav between 768 and 1099px, so an iPad got a lone "MENU" in an empty bar for months. The first three-width sweep (390 / 834 / 1440) found the same class live on **three more sites, every one of them clean at 1440**: | Site | At 834px | | -------------- | ------------------------------------------------------------------- | | surf-your-life | "Jetzt starten" crosses the right edge by 93px | | vitareba | "ANMELDEN" crosses the right edge by 19px | | kivvi | "Demo anfragen" crosses by 15px, and the page scrolls sideways 15px | Rule 3 changes with width too, which is the quieter half of the same finding: petvity is clean at 390 and has three sub-44px targets at 834; datacat has three at 390 and seven at 834; botsmann is clean at both and has six at 1440. One width was never a sample of the layout, only of one branch of it. **Crossing the edge is the defect, not being past it.** A closed drawer parked at `translateX(-100%)` is entirely outside the viewport and is correct — that is how every drawer in this fleet waits. Only a control with part of itself on screen and part off is reported, which separates the two with no list of exceptions to maintain. The floor is 4px: the first sweep found loki's "Get started" one pixel past the edge, which is sub-pixel rounding rather than a clipped button. A link inside a nav that **scrolls** sideways (`overflow-x: auto|scroll`) is not reported while that scroller is itself on screen: its clip stops the link painting past the edge and a swipe reaches it, the same exemption the render sweep gives a carousel. camille's sitekit masthead was reported "95px off" for exactly that on 2026-09-26; what was real there — a third section showing as a lone "Ü" — was fixed in sitekit (#25), not by the exemption. An `overflow: hidden` clip stays reported: nothing scrolls it back. **Enforced in three places, because they cover disjoint surfaces.** `scripts/ci/ui-defect-audit.mjs` checks 1, 3, 4, 7 and 8 by **rendering** each live site at three widths — which is the only thing that spans Next apps, CSS modules, Tailwind and wild-spirit's no-framework generator alike. It opens every `<details>` in a nav or header before measuring (by setting the property, so no event fires and nothing can navigate) and clicks up to six `button[aria-expanded="false"]` with a URL guard, because a menu panel is closed on arrival and a closed panel cannot be measured. Findings merge across widths and print once, annotated with every width they were seen at, so rendering three times does not treble a report a human has to read. But it renders **public entry pages only**, so it structurally cannot see a sidebar behind a login. `nav-contract.yml` / `scripts/ci/nav-contract-audit.sh` closes exactly that gap for rule 1: a weekly, central, source-level sweep of every repo's default branch (public and authed alike), self-tested before it runs. It found and fixed six repos — botsmann, datacat, petvity, printcraft, s-ink, surf-your-life — on its first sweep, 2026-08-31. A per-repo `verify` check can still be worth adding alongside it: orangecat's `check:dead-labels` (rule 4) and loki's `check_paired` in `check-design-system.sh` (rule 1) block the _commit_, where the fleet sweep only reports weekly. **Open gap the central sweeps share: `orangecat.ch` isn't the whole fleet.** `ui-defect-audit.mjs` discovers sites from `FLEET_SITES` in loki's public footer — a deliberately hand-maintained editorial list, "each site's own words," not something to auto-expand. As of 2026-08-31 four public sites were outside it. **Two have since been added** (checked against loki's `src/config/fleet-sites.ts` on 2026-09-21): s-ink, on sinktattoo.com and genuinely off the `orangecat.ch` pattern, and substrata. **camille-boulangerie and wild-spirit are still absent**, so nothing renders them. `nav-contract-audit.sh` sees all four, because it reads source rather than a curated link list. Adding the remaining two to `FLEET_SITES` is a one-line-each product decision for a human, not folded into this sweep. Substrata's addition is the worked example of why the gap costs something: it became discoverable, and the very next widened sweep is the one that would have caught the header it had been shipping broken. A site outside the list is a site whose defects nobody is looking for. **Deliberately NOT on the ratchet.** The ratchet counts concerns that should converge on ONE implementation, and nav is the opposite: every repo is supposed to have its own nav config, so counting those files would score the correct outcome as duplication and the number would have no meaning. The contract is enforced by the gates above instead. (This revises the audit's own first recommendation — writing the "do not centralize" section above is what showed the two could not both be right.) **Why a gate and not a convention.** The audit's sharpest finding was not that teams do not know these rules — it is that aoz-begleitung, loki, vitareba and evig each applied `aria-current` correctly on every nav surface **but one**. Four teams, four stragglers. Hand-application always fails at the margin, and the margin is invisible until someone renders it. Design tokens are the control group: near-spotless fleet-wide, because they got a convention **plus a gate** (`check:accent-ink`) rather than a shared component library. --- ## Rendered layout — the render sweep and the widget's host contract Two classes that no repo's `verify` can see, each owned ONCE, centrally: **Layout defects on the painted page** — `scripts/ci/render-sweep.mjs` (`render-sweep.yml`, weekly + on demand). Renders home + key pages of every served site (loki `apps.conf` rows + `extraSites`; pages in `render-sweep.pages.json`) at 390 / 834 / 1440 and counts, per site: nav contract rules 3/7/8 (reusing `ui-defect-audit.mjs`'s MEASURE, not a second copy), other controls crossing the viewport, fixed/sticky controls on top of each other (incl. the Loki launcher), empty headings (and caps labels whose next heading opens a different section), numbers split across lines in table cells/stats, and uncaught page errors. `render-sweep.baseline` is a ratchet: a site x check count may fall, never rise. Public GET pages only (DENY refuses api/admin/auth/cron/job paths before any request); no AI calls. Self-tested (`test-render-sweep.mjs`, every check pinned firing and silent, mutation-proven) before each sweep. **Client sites are swept and baselined, never fixed from here.** To lower a count: fix the site, then `--emit-baseline` in the PR. **Sign-in methods on every sign-in page** — `scripts/ci/auth-parity.mjs` (`auth-parity.yml`, daily + on demand). For every app in `auth-parity.apps.json` it reads the sign-in page in Chromium at 390px and asks the server what it serves, then reports EP, ML, PK, 2FA, recovery, OrangeCat and the shared sign-in (Morulia) per app. It fails on configured-but-missing and shown-but-broken; not-configured-yet is reported only. Read-only: no account, no credential, no mail, and OIDC stops at the authorize leg. The inventory it starts from is `docs/auth-parity-2026-11-01.md`. **The feedback launcher sitting on host UI** — fixed in the widget itself (loki `widget/`), so all ~20 embedding sites get it without touching them. The launcher hit-tests candidate slots and never sits on a control; it hides rather than cover one. What heuristics cannot see, a host declares: | attribute | where | effect | | ---------------------------------- | ----------------------------- | ----------------------------------------- | | `data-fc-avoid` | any element | never overlap it | | `data-fc-place="left"` / `"right"` | `<html>` or a rendered region | keep the launcher on that side | | `data-fc-place="hidden"` | `<html>` or a rendered region | no launcher while that region is rendered | Full contract: loki `widget/README.md`. Do not add per-site offsets (`data-fc-bottom`, CSS padding for the launcher) — declare the region instead. ## The process **1. Rule of three.** First time, write it. Second time, notice. **Third time is forbidden** — extract it, or you have chosen to maintain N copies forever. **2. Check this file before building.** One grep. The cost of not checking is visible above: 22 copies of one script. **3. New extraction? Follow the shape that already works.** Unscoped `ai-*` name · ESM · `dist` built by `prepare` (gitignored) · `exports` map · `verify = build && test` · **tests that import the package by NAME**, not by reaching into `dist/` — otherwise a broken `exports`/`files` map stays green until the first consumer installs it. **4. Ship no HTTP client.** Every app has its own calling conventions, retries and logging. Replacing those is a rewrite, not an adoption. Supply the decisions; leave the fetch alone. This is why `ai-kit` has no client and `ai-forms` has no markup. **5. The ratchet.** `scripts/ci/shared-inventory.sh --check` runs **weekly** (`.github/workflows/shared-inventory.yml`) and on `workflow_dispatch`. Duplication counts may **fall**, may **hold**, and may **never rise**. This file and the README both used to say "on every PR here"; they were wrong — a PR runs only `test-shared-inventory.sh`, the network-free self-test of the _deciding_ half. Corrected 2026-09-15 rather than made true, because `--check` needs ~45 API calls and four minutes, which is not a per-PR cost worth paying for a number that moves on the timescale of a cleanup campaign. ```bash scripts/ci/shared-inventory.sh # report scripts/ci/shared-inventory.sh --check # ratchet — exit 1 if a count rose scripts/ci/shared-inventory.sh --update # move the baseline, in a PR, reviewed ``` Nobody has to fix 87 duplicated files today. The only requirement is to stop adding to them — and when a count _falls_, `--update` locks the win in so it cannot silently regress. **Raising the baseline is allowed** — sometimes a copy really is right. It just has to happen in a PR, where someone sees it, instead of by accident. **Know what the ratchet can and cannot do.** It runs _here_, and it measures the default branches of ~38 **other** repos. A PR in hirnli or aoz-begleitung never executes it, so it cannot block the commit that adds a copy — it can only go red afterwards, in a repo whose contributors did nothing. That is what happened between 2026-08-31 (green) and 2026-09-07 (`health-route` 9 → 11, `slug-util` 2 → 3), and again between 2026-09-11 and 2026-09-14 (`health-route` 12 → 13, `ai-provider-client` 17 → 19 — the first hypothesis, that the FleetCrown → Loki repo rename had double-counted a repo, was wrong: GitHub renames in place, and the repo list held `loki` alone; the rises were substrata and heidi): the rises landed through repos the gate cannot reach. Treat it as a **detector with an owner**, not as a gate — a detector nobody is assigned to is the muting this file was written to prevent. And never run `--update` on a rise you have not investigated: that erases the only signal there was. ## Safe package promotion Shared fixes reach consumers through the staged rollout gate, not simultaneous fleet merges. See [the promotion and recovery contract](docs/package-rollouts.md) and [the canary/blocked-artifact policy](registers/package-rollouts.json). Consumer CI and browser checks are required; unknown evidence holds automatic merging. Follow the gate for agent-authored dependency updates too.