# PLG Suite — Platform Monorepo

One platform, five products. AiCare · AiCode · AiGuide · AiReview · Gazal — all built on
a shared, config-driven **PLG control plane** (`plg_core`) and a shared **inference
engine** (Gazal). See [`ARCHITECTURE.md`](ARCHITECTURE.md) for the full design.

## Why this exists

The five products share ~80% of their machinery (trial → activation → health score →
ROI → billing → expansion → compliance). Building that once and configuring it per
product is what makes shipping all five realistic. Each product = one file in
[`products/`](products/) + a thin app.

## Run it now (no dependencies — stdlib Python only)

```bash
# See the same engine reproduce every product's spec numbers:
python3 scripts/verify.py

# Run the tests that assert those numbers:
python3 -m unittest discover -s tests -v
```

Expected: AiCare ROI = $120/14d; AiCode 4.3× the $2,000 plan; AiGuide 2.4× the $400
plan; AiReview $1.875M projected (37.5×); every PQL climbs 30s → 70+ by day 24.

## Layout

| Path | What |
|---|---|
| `products/*.json` | Per-product Configuration Block — the source of truth |
| `packages/plg_core/` | Shared engine: `pql`, `roi`, `lifecycle`, `events`, `billing`, `compliance` |
| `services/gazal/` | Healthcare LLM API gateway (OpenAI-compatible) |
| `apps/` | Thin product apps (one per product) |
| `demo/index.html` | Clickable journey demo — open in any browser |
| `scripts/verify.py` | Runs the engine across all products |
| `tests/` | Engine tests (reproduce the spec numbers) |

## Status

- ✅ **Done & tested:** config system, PQL score, ROI engine, lifecycle state machine, demo.
- 🔧 **Interface stubs:** events, billing (Stripe + M-Pesa), compliance/audit.
- ⏭️ **Next (Wave 1):** Gazal gateway, first product app, hosted environment.

## The corrected models live here in code

The PQL formula, the ROI reconciliation, and Convert-before-Expand are no longer just
prose in the specs — they are executable in `packages/plg_core/` and asserted in
`tests/`. Change a number in a `products/*.json` and the whole journey re-derives.
