Trigger: any new BizOS module or substantial module change. Owner: Jonny Allum. Policy anchors: POL-05, POL-06.
The canonical detail lives in BUILD_PLAN.md (house template) and CLAUDE.md; this SOP is the ordered checklist with the governance hooks.
The strict order
- Brief — for a new module, write the research + build prompt under
docs/modules/<ID>_<NAME>.md(the O11/O12/F09 pattern): the domain, the UK regulatory reality, the tables, the engine maths, the AI surface. - Migration — next number from
BUILD_PLAN.mdcounter; idempotent; RLS + touch triggers on every table (SOP-04). - DB helpers — typed row shapes flow from
packages/db/src/types.ts. - Pure engine —
src/lib/<name>/engine.ts: no Node builtins, no clock reads; all derivations computed at read time. - Pluggable store —
local.ts+supabase.tsbehind onegetXStore()contract; multi-write orchestrations live in the store so both adapters share one workflow. - Board — under
src/modules/<name>/; empty/loading/error states are acceptance criteria. - Registration —
@bizos/configentry (id, category, deps, vertical lock, owned tables,aiContext) +src/modules/registry.tsmapping; regenerate the registry seed (module-registry-sync). - AI wiring — same PR, no exceptions — signal provider in
lib/ai/signals.tsreusing the engine maths (compact: counts, renewal bands,byStatus, one worst item; degrade tonull); digest/import wiring; any executable actions intoaction-registry.tswith confirm step (SOP-13). - Round-trip test — tsx round-trip proving the workflow and the engine arithmetic against known-good numbers.
- Gates —
pnpm turbo run typecheck test buildgreen +cd apps/shell && pnpm exec tsx audit.mtsPASS. - Docs + kanban — tick
BUILD_PLAN.md, keep README/docs counts in sync (audit checks them). Commit + push.
Scaffolding
tools/module-generator (bizos-new-module) scaffolds a single-table CRUD module and prints the 3 shared-file wiring edits — use it, then follow the order above for everything it can't know (engine, signals, tests).
Definition of done
A module is done when a stranger can use it with no data, on a slow connection, with an error — and when JonnyAI can answer questions about it from live signals that match the board's own numbers.