Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
68 KiB
Shared code across the fleet
Before you build something, check this file. If it is here, install it.
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.mdsays "deliberately ONE central script, not a copy per repo".auto-merge-sweep.shlives 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.
The registry — what already exists
| Package | Install | Replaces |
|---|---|---|
ai-forms |
"@fleet/ai-forms": "github:bitbaum/ai-forms#v0.1.2" in dependencies (the alias every consumer uses) |
per-app "fill this form from prose" + conversational refinement. Headless — ships no markup, so each app keeps its own styling. |
ai-kit |
pnpm add @bitbaum/ai-kit (on npm since 2026-09-04) |
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 Facts 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 |
pnpm add threadkit |
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 |
pnpm add @bitbaum/paykit |
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 |
pnpm add github:bitbaum/sitekit#v0.3.0 |
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 |
pnpm add @bitbaum/mail-kit (on npm since 2026-09-05) |
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 <app>@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. Templates stay per-app; bulk/newsletter stays Listmonk. |
limitkit |
pnpm add limitkit@^0.2.0 (on npm) — not github:bitbaum/limitkit#v0.2.0 |
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 |
pnpm add github:bitbaum/listkit#v0.1.0 |
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 |
pnpm add bip-kit (on npm since 2026-09-06) |
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 |
"@bitbaum/design-tokens": "github:bitbaum/design-tokens#v1.1.0" |
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 |
pnpm add github:bitbaum/chatkit#v0.1.0 (dist committed — no allowBuilds entry needed; npm once the first publish is bootstrapped) |
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). |
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
escapeLikePatternis byte-identical to listkit'sescapeLikeon 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,categoryandsortmap cleanly, butcountry,cityandpostalare free text a reader types, andradius_kmis a distance around them —rangeis a min/max over a row's own numeric field, which is a different thing. Adopting would leave two codecs writing oneURLSearchParamsin 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/<x> 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
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 need an explicit
minimumReleaseAgeExclude line to be installable at all — which is why 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/<x> 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:
- 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.
- A package earns adoption through one proving consumer, whose CI is the integration gate. Publishing is the cheap half.
- 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.jsontracks a package either inmajors(npm, judged on major) or ininternal_tags(git pin, judged on tag), andai-kitfell through the seam between them. Itsinternal_tagsentry was deleted when it graduated to npm — correctly, per that file's own rule — and it was never added tomajorsbecause it was0.xon graduation day and "0.x has no meaningful major". It is1.4.1now. 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": 1is 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. - 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 |
which repos are behind on Bitbaum-owned npm packages — and it OPENS THE PULL REQUEST rather than reporting. It reads package identities from the curated registry, so scoped @bitbaum/* and explicitly registered unscoped npm packages are covered, including npm aliases; git-tag dependencies remain untouched pending a release contract. version-currency.mjs judges by MAJOR, which is right for next and wrong for our packages: we ship features in minors. Measured 2026-09-21, @bitbaum/ai-kit was published at 1.10.0 and ten of its fourteen consumers sat on major 1 with an older minor — so the ratchet was green while a fix published for everyone reached two repos. Downstream already works without a human — PR → the repo's CI → auto-merge-sweep → CD → box. A green bump ships itself; a red one names the repo that cannot take the new version. The reconciler checks out each repo and runs pnpm install so the LOCKFILE is package-manager-written. Capped at 20 PRs per run, below the 43 repos swept, so a whole-fleet mismatch fails closed. Self-tested by scripts/ci/test-currency-reconciler.mjs; the test includes alias resolution, excludes Git-only/third-party packages, and preserves semver specs it cannot safely rewrite. |
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 <title> 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-checkread the register fromorigin/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 …underset -o pipefailfails on SUCCESS.grep -qexits 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
sedrange 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 strippedglobals.cssthis 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. 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.
The checklist — each line is a bug somebody already fixed once
- A microphone in the composer, always. Web Speech first; if it is missing
or silent (Chromium without Google speech accepts
start()and never fires — heidiuse-dictation.ts, measured 9 s / 0 events), the same button records and sends audio to a server transcription route (ai-kittranscribe()). Recording is visible (timer, cancel, confirm) and a mic failure is shown, never swallowed. - 16px or larger for message text and the input. Under 16px iOS zooms the
whole page on focus (loki
globals.css, "text-baseis not a style choice"). - 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, lokiAskLokiButton.tsx), Enter sends, Shift+Enter breaks the line, IMEisComposingrespected, and it stays above the soft keyboard and the safe area (orangecatViewportHeightSync.tsx: "100dvh does not shrink when the Android soft keyboard opens"). - 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" (lokiComposer.tsx). - Fails visibly, with Retry — a failure bubble, never a silent nothing
(heidi
use-conversation.ts: the rewrite "had no retry and no failure bubble"). - Scroll sticks to the bottom only when the reader is already there, with a
jump-down button (loki
Thread.tsx). - Markdown rendered (no literal
**), links clickable, Copy on every answer. - 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.
- Works at 320px with no horizontal scroll (
min-w-0on the composer row — heidicomposer.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.
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 |
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 | Extracted 2026-08-20 as limitkit (see registry above). loki converted as the proving consumer; orangecat instead unified in-repo (ADR-0002 Accepted 2026-08-25, one canonical module) without limitkit. 2026-09-15: five more landed — botsmann (two limiter files, one deleted), petvity, surf-your-life, truthseeker, evig (three files, one deleted) — with kivvi and aoz-begleitung open for their owners. The count fell 13 → 11 rather than to 6, because a repo that adopts correctly keeps a thin local module holding its own limit values; the hand-rolled implementations are what went. What the sweep found is worth more than the count: seven for seven keyed the bucket on the client-controlled first X-Forwarded-For hop, so every one of them could be walked straight past. Read the registry row before converting the next one. |
|
| AI provider client | 19 | evig 7, orangecat 5. ai-kit already owns the hard part (chain, 429, budget); these are the callers. Priced 2026-08-26, re-priced 2026-08-27: Groq retired the llama-3.x family and the damage was far wider than the first count. Seven repos were broken, not five — the audit could not see two of them — and inside a repo the id was written down two to four times. Kivvi took three PRs to remove one retired id: it lived in the provider registry, an app's inline fetch body, the fallback chain, and a client hook's FALLBACK_MODEL. Each pass only found the copies the tooling could see. That is the cost of duplication measured rather than argued. loki, which adopted the package, was unaffected throughout. 2026-09-14: 17 → 19, both files in heidi — lib/auth/provider.ts (an OIDC config) and lib/domain/model/providers.ts (a BYOK vendor allowlist that uses ai-kit, which heidi installs). Neither is a hand-rolled caller: the path pattern `(provider |
| 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, and the ratchet is RED | Measured 2026-09-15 on default branches: aoz-begleitung, botsmann, datacat, evig, kivvi (2), orangecat. The old "10, sbb-lost-found alone has 4" was stale — that repo is sbb-fundbuero and carries none. The row is deliberately left at 6 while the fleet sits at 7, so --check stays red. The extra file is datacat's backend/lib/logger.js, created the same day by its own consolidation (#271, "one logger") — a repo that had no file matching this pattern now has exactly one, which is the right end state scoring as a rise. It is not absorbed into the baseline because the offsetting fix already exists and is unmerged: kivvi's two loggers (apps/web/lib/logger.js + packages/core/src/logger.ts) go to one in kivvi#96, a draft awaiting its owner. When that lands the count returns to 6 on its own. Raising the baseline now would retire the only pressure on that PR, which is the failure this whole file exists to stop. |
| message threads | 3 | orangecat 2, vitareba 1. Extracted already, as 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 | 13 | Identical shape in 13 repos — and, checked 2026-09-07, not identical content. vitareba's asserts the app role can still read its own tables (lib/db/schema-usable.ts, written because a migration once created a table the app could not read); orangecat's checks Supabase reachability. Extracting the 20-line envelope would leave every app still writing the only part that differs, which is the assertions. Baseline raised 9 → 11 rather than absorbed; 11 → 12 with heidi (2026-09-10) and 12 → 13 on 2026-09-14 with substrata, whose route asserts the one number that says the research is moving (portalTotals()). Same shape, different assertion, same verdict. |
| slug helper | 3 | bip-kit, evig, hirnli. Not one function copied three times — three different functions that disagreed, and two of them were broken. evig serves eight locales and deleted seven of them: Café Genève → caf-gen-ve, and a Russian or Japanese title produced the empty string, which under a unique constraint means the second such record cannot save at all. hirnli transliterated a hand-written list (ä ö ü à é è) that omitted ç, so Association Française → association-fran-aise. Both fixed in place 2026-09-07 (evig 32 tests, hirnli 26) using the same approach: German digraphs first, then NFD + combining-mark strip for everything else, because a list of accents is never finished. Consolidation into sitekit is the right end state and is NOT done: it needs a publish plus a minimumReleaseAgeExclude entry in each consumer, and that chain was not worth delaying two live bug fixes. Baseline raised 2 → 3 knowingly. |
@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. |
What must NOT be centralized
Stated explicitly, because "share everything" is its own failure:
- Auth / sessions — coupled to the framework and the user schema.
- DB schemas — Drizzle vs Prisma vs raw SQL; a shared schema fights every ORM.
- UI markup for chat and forms — behaviour is shareable, markup is not.
Each app owns its design tokens and has to keep looking like itself. This is
why
ai-formsis headless. The "chat turn state" extraction row above is the behaviour half and does not amend this line: measured 2026-09-15, the chat surfaces run three incompatible token namespaces (--color-surface-pagein loki/evig/heidi,--color-ui-canvasin aoz,--color-text-*in evig) and five tool-call presentations that are each correct for their product (loki's WorkTrail, orangecat's action cards, kivvi's tool-result actions, evig's CTA cards, aoz's deliberately-hidden server-side tools). A styled shared bubble would need a token contract nobody has agreed to. One exception, and it is about ownership rather than taste:@bitbaum/design-tokens(registry above) is shared by OrangeCat, Loki and Solon, because those are one company's own products and are supposed to look alike — three hand-copied token sets had already drifted into looking like three companies. A client's site stays on its own tokens; the rule holds everywhere the brand is not ours. - 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 chrome. Measured 2026-08-29: ~13,300 lines of nav across 20
repos, and the experiment has already been run.
sitekitis the one shared renderer, it serves 2 of 20, and it shipped two defects — ~28px targets and no focus style — to both consumers, unfixable downstream because a consumer cannot patch markup it does not own. Its nav model (a flat{path, label}list, no groups, no icons, no footer links, no mobile menu) also cannot express what solon's mega-menu or reparaturbonus-zh's drawer need, which is why every repo with real nav complexity reinvented its own rather than adopt it. Centralizing the markup centralized the bug. The navigation contract below is the shareable part.
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".
- The active link of every nav surface carries
aria-current. - Every toggle controlling a panel carries
aria-expanded. - Every interactive nav element is at least 44×44px.
- The label lives inside the control, never beside it.
- Persisted UI state distinguishes
nullfrom empty. - Every internal href comes from a routes constant.
- No nav or header control crosses the edge of the viewport, at any width.
- 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.
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.
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.
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.