Segment 4 timing adapts to 90-day window. Source: config/hea_pricing.js → freeMonths
🏗️ Architecture — Three-Layer Event Consumer Separation
heaLogger — lifecycle events
↙ ↓ ↘
Three parallel consumers · no shared code paths
P0 CRITICAL
💰 Billing / Metering
heaMeteringEngine
freemium.js
stripe/webhook.js
• NCU/NRU metering
• Freemium window
• Stripe sync
• Subscription state
🔒 NEVER touch for marketing reasons
P1 STABLE
⚙️ Product Notifications
heaNotificationHooks.js
catalog.js
dispatcher.js
• New chat started
• Training completed
• Freemium expiry
• Usage warnings
Rarely touch · Well-tested changes only
P2 DYNAMIC
📣 Marketing Nurture
heaMarketingNurturingHook.js
chainEngine.js
nurtureScheduler.js
• Welcome chains
• Value demonstration
• Conversion push
• Win-back sequences
Iterate freely · Own kill switch · Own KV
Walled garden — Billing has no imports from product or marketing. No shared KV keys.
Aware, not coupled — Marketing checks if product notified today → 24h suppression
Separate opt-out — Marketing unsubscribe ≠ product alerts ≠ billing metering
Nurture email (click to preview)
Existing expiry warning
Dormant (no more emails)
Handoff to notification catalog
Dormant reactivation (1 email)