🧭 Start
Architecture map
Hub, Stack, commons, catalog, bot: who owns what and how they talk.
MaiPai is several repos with different release cadences. Home is the one a household runs; the others feed it or sit beside it.
Who owns what
| Repo | Owns | Talks to |
|---|---|---|
home (this repo) | The hub: people, memory, the turn engine, settings, the package host, the credentials center, backups, updates and the shell. Backend in Bun, Hono, Zod and Drizzle on SQLite; frontend in React and Vite. | The Stack over HTTP; the catalog for packages; robots that pair with it. |
stack | The headless engine: models, the resource governor, jobs for pictures, video and music. Home is its only caller. | Called by Home on the same computer. |
commons | Three libraries, each tagged on its own: core, spec and ui. Public. Imports no product. | Pinned by Home by tag. |
catalog | The public signed package catalog. Pins spec. | Read by the hub and the robot. |
bot | The robot companion. Complete without a hub, pairs with one for more. | Home, over the pairing routes. |
go | The Apple TV and iPhone client; renders the UI schema natively. | Home. |
.github | Org standards, the shared Claude plugin, the shared wt.sh and gate-lock.sh. | Every repo's scripts. |
How the pieces connect
- Home to Stack. Home reads the Stack's address from the household setting
engines.stack.url(the dev hub useshttp://127.0.0.1:8770when that answers). The client isbackend/src/lib/stack/client.ts; the wire shapes are inbackend/src/lib/stack/contract.ts. Home never loads a model itself. - Shared records. Anything the hub and robot both store is a record type in
@maipai/spec. A shape change goes spec first, then Home, then the robot. Home pins@maipai/specby tag; the current pins are inbackend/package.jsonandfrontend/package.json(see Repo layout and pins). - Packages. Features ship as packages. The default set is bundled in
backend/packages(63 packages, with provenance inbundled-provenance.json); the package host (backend/src/lib/packageHost.ts) loads them without a rebuild. Package pages are JSON validated againstspec/ui/schema.jsonand drawn by the kit interpreter infrontend. See Build a package. - UI. The kit (
@maipai/ui) holds the primitives and Elements. Home restyles them by tokens only. - Privacy. Nothing leaves the household by default; an outbound connection needs an entry in the org's
PRIVACY.mdandTHIRD-PARTY-SERVICES.mdfirst.
Where a change goes
- A shared record or setting key:
commonsspec, then tag it. - A kit look or Element prop:
commonsui, then tag it, then bump the pin withbash scripts/pin.sh commons ui-vX.Y.Z. - A hub feature: a package if it can be data, otherwise
backend/srcandfrontend/src. - An engine job or model: the Stack, then
bash scripts/pin.sh stack <sha>as its own commit.

