Customer Lifetime Value (LTV)
ps_customer_ltvCalculate customer lifetime value and segment customers into champion, loyal, at-risk, or lost groups. Saves the KPI report to a dated JSON file for retention analysis.
Instructions
Calculate customer LTV and segment customers.
LTV = avg_order_value × purchase_frequency × lifespan_months
Segments:
"champion" : high LTV (top 20%)
"loyal" : medium LTV (20–60%)
"at_risk" : no purchase in 60+ days but ≥3 previous orders
"lost" : no purchase in 60+ days and <3 orders, or bottom 40% LTV
Saves to /data/kpi_ltv_YYYY-MM-DD.json.
Args:
limit: Max customers to analyse (default: 500)
at_risk_days: Days without purchase to flag as at_risk (default: 60)
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "ps_customer_ltv"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Max customers to analyse | |
| at_risk_days | No | Days without purchase to flag as at_risk |