A customer's full journey through the system, end-to-end. Phase 1 onboard creates the NS record + program. Phase 2 order intake handles both email and NS-native flows. Phase 3 fulfillment + invoice. Phase 4 payment + AR aging buckets. Phase 5 health-score computation + reactive workflows (ar_aging_action_plan on red tier, customer_invoice_dispute on credit memo). Phase 6 reflexion captures every workflow's observations into a status-curated log keyed by customer.
| Phase | D1 tables | NS records |
|---|---|---|
| Onboard | customers, name_synonyms, customer_program | customer |
| Order intake | inbound_email_log, review_items, transactions, transaction_lines | salesorder |
| Fulfillment | item_fulfillment, item_fulfillment_lines, shipments, shipping_events | itemfulfillment |
| Invoice | customer_invoice, customer_invoice_lines | custinvc |
| Payment | customer_payment, payment_application | custpymt |
| AR aging | v_customer_ar_aging (view) | (computed) |
| Health | customer_health_scores | (D1-only) |
| Reactive | workflow_run_log, proposed_actions | (N/A — staged for HITL) |
| Reflexion | reflexion_log (entity_type='customer') | (D1-only) |
| Color | Meaning |
|---|---|
| frontend | User-facing surface (chat UI, admin HTML pages) |
| backend | Worker logic / agent code / business rules |
| database | D1 table / R2 object / KV key / Vectorize index |
| cloud | External system (NetSuite, Anthropic, etc.) |
| security | Gate / policy / HITL approval / kill switch |
| messagebus | Event ledger, Queues, async fan-out |
| external | Inbound source (email, webhook, cron tick, user input) |
| → solid | Synchronous call (request → response) |
| → green | Approved / happy-path |
| → red dashed | Policy or security check |
| → grey dashed | Optional / conditional / async |