I. The Chassis
Commit 1 · The first push
The codebase was born almost fully grown. Multi-tenant auth via Clerk + workspace memberships. Three source pipelines (text-paste, URL-scrape, file-upload) feeding versioned bodies into Bedrock-Titan-v2 RAG. Voices as prompt fragments. Content formats as deletable-but-key-pinned templates. A two-state draft ladder (drafting | approved) with derived review states. Public-and-member comments hitting one table, public-and-member presence hitting one face-pile. An agent stub. A RAG namespace per workspace. A V8/Node runtime split where Node owns LLM and extraction and V8 owns CRUD and lifecycle.
The first review found 18 things, most of them small. The biggest one was almost embarrassing: displayName got stomped on every authed mutation, because every authed mutation flowed through an upsert that rewrote the user row from Clerk identity claims. A token of dev-tenant URL was hardcoded in auth.config.ts. Share-link tokens were minted with Math.random(). A handful of indices were missing. The agent's tools were declared but never registered, and the chat action had no auth at all.
The patterns worth standardizing on were already there too: soft-delete with a single generic cascadeRemoveKeys primitive. The same comment table powering both member and guest comments. The lifecycle gate (assertCanEditDraftBody) firing in every writer rather than at the UI. "Public surface returns null for everything wrong" so a token can't be fingerprinted. Curated public payloads that strip workspace ids, sibling versions, emails.
The skeleton was good. The skin needed work.