# The rebuild package — read me first

This directory is the complete plan for rebuilding `work` as the
multi-business operations platform (project management, time tracking,
invoicing, and eventually profit sharing / commissions / bookkeeping),
on the server's standard stack, behind BW Auth (id-auth Pattern B).

Assembled 2026-07-06/07 from: the full session transcript (118 user
messages, 2026-05-20 → 2026-07-07), all 13 feature docs, all 44 ADRs,
all 41 migrations, the complete app source, the test suite,
`docs/domain/` (the business blueprint), `/srv/projects/standards/`,
and `/srv/.logs/planning/unified-auth-2026.md`.

## Reading order

| doc | what it answers |
|---|---|
| [00-vision-and-scope.md](00-vision-and-scope.md) | What we're building, why a rebuild, phase-outs, the R0–R5 roadmap, success criteria. |
| [01-current-system/](01-current-system/) | **The parity bar.** Complete rebuild-ready specs of everything the current app does: schema, RPC/authz semantics, per-feature behavior specs with test cases, test inventory. |
| [02-domain-model.md](02-domain-model.md) | The target data model: parties, engagements, compensation terms, visibility, tenants — and the permission engine. |
| [03-stack-decision.md](03-stack-decision.md) | React SPA + FastAPI + Postgres; why; what Supabase's retirement costs and replaces. |
| [04-architecture.md](04-architecture.md) | How the new app is structured: authz engine, money paths, frontend design system, Pattern B middleware. |
| [05-migration-plan.md](05-migration-plan.md) | Snapshot → transform → validate → parallel-run → cutover, with the diff harness as oracle. |
| [06-test-plan.md](06-test-plan.md) | The complete test catalog for the rebuild (ported + new). |
| [07-judgment-calls.md](07-judgment-calls.md) | **Rian: read this one.** Every significant call I made on your behalf, with reversal costs. |
| [08-current-tooling.md](08-current-tooling.md) | The PlusROI books + Airtable PM system decoded in full (settlement formula, $5-unit economics, roles, billing SOP, the live "new model") — the R2–R5 requirements source. |
| [09-build-plan.md](09-build-plan.md) | **The execution plan**: Day-0 owner checklist + the M0–M9 milestone ladder to cutover (gates, review scripts, effort, contingencies) + the UX program. |

## How to use this package

- **To start the rebuild:** work through 00 → 03 → 04 (decisions),
  then R0 of the roadmap. Every R1 feature builds from its spec in
  01-current-system/features/ + the deltas in 02/04.
- **To challenge a decision:** 07-judgment-calls.md first; each entry
  links back to the doc it shapes.
- **Maintenance rule:** this package follows the same discipline as
  docs/ — it describes the plan as it currently stands; superseded
  ideas are removed, not tombstoned; significant changes append to
  docs/decisions.md as ADRs.

## Status

- [x] Current-system extraction (transcript, docs, ADRs, schema, code, tests)
- [x] Core decision docs (00, 02, 03, 04, 05, 07)
- [x] 01-current-system feature specs (12 specs + schema + rpcs + tests refs)
- [x] 06-test-plan (415 tests, tiered; all 116 current tests mapped)
- [x] Adversarial gap review — 3 rounds: 7-lens critique (18 significant + 30 minor found & fixed), verification + fresh sweeps (5 partials + 2 new found & fixed), final 12-invariant pass (4 label nits, fixed). Package verified consistent + executable.
- [x] Plan-quality critique (7 senior lenses, 68 improvements) + build plan authored; Pattern B ship (2026-07-07) integrated — the Wave 3 dependency dissolved
- [ ] rian sign-off on 07-judgment-calls.md (33 calls) + the Day-0 checklist in 09-build-plan.md
