How koraysrn/retention-intelligence works
This repository implements an e-commerce churn re-engagement platform: customer data is ingested and transformed into features, churn risk is modeled and served, campaigns are evaluated through experimentation, and an agentic workflow drafts guarded personalized outreach or escalates cases. The dashboard is the main visible user entry point; the API also exposes scoring and customer/business views. Streaming events, CDP/channel integrations, and drift monitoring are supporting capabilities. Some end-to-end connections are documented in the README but their runtime wiring was not sampled, so those links cite the README rather than implying source-level calls.
Main entry points: orchestrator.py Agent orchestrator · train.py Model training · flow.py Event flow · api.py Serving API
Components 29
Dashboard and serving
- Dashboard
frontend/src/App.tsx - Serving API
src/serving/api.py - Batch scoring
src/serving/batch_score.py
Customer data
- Data ingestion
src/data/loader.py - Data quality
src/data/quality.py - Feature engineering
src/features/ecommerce.py - Online features
src/features/online_store.py - CDP client
src/cdp/client.py - Event flow
src/streaming/flow.py - Event bus
src/streaming/events.py
Churn modeling
- Model training
src/models/train.py - Training preparation
src/models/prepare.py - Model ensemble
src/models/ensemble.py - Model evaluation
src/models/evaluate.py - Drift monitoring
src/monitoring/drift.py - Retraining control
src/monitoring/retrain.py
Campaign experiments
- Experiment assignment
src/experiments/assignment.py - Experiment analysis
src/experiments/analysis.py - CUPED adjustment
src/experiments/cuped.py
Agentic engagement
- Agent orchestrator
src/agents/orchestrator.py - Offer retrieval
src/agents/rag.py - Content generation
src/agents/llm.py - Content guardrails
src/agents/guardrails.py - Outreach actions
src/agents/actions.py - Sales escalation
src/agents/escalation.py - Message channels
src/channels/notifier.py
Other components
- Dashboard user
- LLM provider
- Sales representative
Connections 30
- Dashboard user → Dashboard: uses
README.md - Dashboard → Serving API: requests data
frontend/src/App.tsx - Serving API → Data ingestion: loads profiles
src/serving/api.py - Serving API → Batch scoring: uses scores
src/serving/api.py - Data ingestion → Feature engineering: uses date schema
src/data/loader.py - Data ingestion → Data quality: validates data
- Feature engineering → Model training: supplies features
README.md - Model training → Training preparation: prepares inputs
src/models/train.py - Model training → Model evaluation: evaluates models
src/models/train.py - Model training → Model ensemble: trains ensemble
README.md - Model ensemble → Batch scoring: scores customers
- Drift monitoring → Retraining control: informs retraining
src/monitoring/retrain.py - Drift monitoring → Model training: triggers retraining
README.md - Batch scoring → Experiment assignment: targets risk group
README.md - Experiment assignment → Experiment analysis: assigns variants
src/experiments/analysis.py - Experiment analysis → CUPED adjustment: adjusts outcomes
src/experiments/analysis.py - Experiment analysis → Agent orchestrator: feeds campaign
README.md - Serving API → Agent orchestrator: invokes assistance
- Agent orchestrator → Offer retrieval: retrieves context
src/agents/orchestrator.py - Agent orchestrator → Content generation: generates draft
src/agents/orchestrator.py - Content generation → LLM provider: calls provider
src/agents/llm.py - Agent orchestrator → Content guardrails: checks draft
src/agents/orchestrator.py - Agent orchestrator → Outreach actions: dispatches action
src/agents/orchestrator.py - Agent orchestrator → Sales escalation: routes cases
src/agents/orchestrator.py - Outreach actions → Message channels: sends message
src/agents/actions.py - Sales escalation → Sales representative: forwards summary
README.md - Event flow → Event bus: publishes events
src/streaming/flow.py - Event flow → CDP client: tracks customer
src/streaming/flow.py - Event flow → Online features: updates features
src/streaming/flow.py - Event flow → Message channels: notifies customer
src/streaming/flow.py