|
1 | 1 | --- |
2 | 2 | name: revenue-monitor |
3 | | -description: Monitors revenue metrics, tracks subscription changes, and alerts on revenue anomalies or threshold breaches. |
4 | | -tags: [monitoring, revenue, subscriptions] |
| 3 | +description: "Monitor LTX Studio revenue metrics and subscription changes. Detects revenue anomalies, churn spikes, and refund issues. Use when: (1) detecting revenue drops, (2) alerting on churn rate changes, (3) investigating subscription tier movements." |
| 4 | +tags: [monitoring, revenue, subscriptions, churn, mrr] |
5 | 5 | --- |
6 | 6 |
|
7 | 7 | # Revenue Monitor |
8 | 8 |
|
9 | | -## When to use |
| 9 | +## 1. Overview (Why?) |
10 | 10 |
|
11 | | -- "Monitor revenue trends" |
12 | | -- "Alert when revenue drops" |
13 | | -- "Track subscription churn" |
14 | | -- "Monitor MRR/ARR changes" |
15 | | -- "Alert on refund spikes" |
| 11 | +LTX Studio revenue varies by tier (Free/Lite/Standard/Pro/Enterprise) and plan type (self-serve/contract/pilot). Revenue monitoring requires tracking both top-line metrics (MRR, ARR) and operational indicators (churn, refunds, tier movements) to detect problems early. |
16 | 12 |
|
17 | | -## What it monitors |
| 13 | +This skill provides **autonomous revenue monitoring** with alerting on revenue drops, churn rate spikes, refund increases, and subscription changes. It monitors all segments and identifies which tiers or plan types drive changes. |
18 | 14 |
|
19 | | -- **Revenue metrics**: MRR, ARR, daily revenue |
20 | | -- **Subscription metrics**: New subscriptions, cancellations, churns, renewals |
21 | | -- **Refunds**: Refund rate, refund amount |
22 | | -- **Tier changes**: Upgrades, downgrades |
23 | | -- **Enterprise contracts**: Contract value, renewals |
| 15 | +**Problem solved**: Detect revenue problems, churn risk, and subscription health issues before they compound — with segment-level root cause analysis. |
24 | 16 |
|
25 | | -## Steps |
| 17 | +## 2. Requirements (What?) |
26 | 18 |
|
27 | | -1. **Gather requirements from user:** |
28 | | - - Which revenue metric to monitor |
29 | | - - Alert threshold (e.g., "drop > 10%", "< $X per day") |
30 | | - - Time window (daily, weekly, monthly) |
31 | | - - Notification channel (Slack, email) |
| 19 | +Monitor these outcomes autonomously: |
32 | 20 |
|
33 | | -2. **Read shared files:** |
34 | | - - `shared/bq-schema.md` — Subscription tables (ltxstudio_user_tiers_dates, etc.) |
35 | | - - `shared/metric-standards.md` — Revenue metric definitions |
| 21 | +- [ ] Revenue drops by segment (tier, plan type) |
| 22 | +- [ ] MRR and ARR trend changes |
| 23 | +- [ ] Churn rate increases above baseline |
| 24 | +- [ ] Refund rate spikes |
| 25 | +- [ ] New subscription volume drops |
| 26 | +- [ ] Tier movements (upgrades vs downgrades) |
| 27 | +- [ ] Enterprise contract renewals approaching (< 90 days) |
| 28 | +- [ ] Alerts fire only when changes exceed thresholds |
| 29 | +- [ ] Root cause identifies which tiers/plans drove changes |
36 | 30 |
|
37 | | -3. **Write monitoring SQL:** |
38 | | - - Query current metric value |
39 | | - - Compare against historical baseline or threshold |
40 | | - - Flag anomalies or breaches |
| 31 | +## 3. Progress Tracker |
41 | 32 |
|
42 | | -4. **Present to user:** |
43 | | - - Show SQL query |
44 | | - - Show example alert format |
45 | | - - Confirm threshold values |
| 33 | +* [ ] Read shared knowledge (schema, metrics, business context) |
| 34 | +* [ ] Write monitoring SQL with baseline comparisons |
| 35 | +* [ ] Execute query for target date range |
| 36 | +* [ ] Analyze results by segment (tier, plan type) |
| 37 | +* [ ] Identify root cause (which segments drove changes) |
| 38 | +* [ ] Present findings with severity and recommendations |
| 39 | +* [ ] Set up ongoing alerts (if requested) |
46 | 40 |
|
47 | | -5. **Set up alert** (manual for now): |
48 | | - - Document SQL in Hex or BigQuery scheduled query |
49 | | - - Configure Slack webhook or notification |
| 41 | +## 4. Implementation Plan |
50 | 42 |
|
51 | | -## Reference files |
| 43 | +### Phase 1: Read Alert Thresholds |
52 | 44 |
|
53 | | -| File | Read when | |
54 | | -|------|-----------| |
55 | | -| `shared/bq-schema.md` | Writing SQL for subscription/revenue tables | |
56 | | -| `shared/metric-standards.md` | Defining revenue metrics | |
| 45 | +**Generic thresholds** (data-driven analysis pending): |
| 46 | +- Revenue drop > 15% DoD or > 10% WoW |
| 47 | +- Churn rate > 5% or increase > 2x baseline |
| 48 | +- Refund rate > 3% or spike > 50% DoD |
| 49 | +- New subscriptions drop > 20% WoW |
| 50 | +- Enterprise renewals < 90 days out |
57 | 51 |
|
58 | | -## Rules |
| 52 | +[!IMPORTANT] These are generic thresholds. Consider creating production thresholds based on 60-day analysis (similar to usage/GPU cost monitoring). |
59 | 53 |
|
60 | | -- DO use LTX Studio subscription tables from bq-schema.md |
61 | | -- DO exclude is_lt_team unless explicitly requested |
62 | | -- DO validate thresholds with user before setting alerts |
63 | | -- DO NOT hardcode dates — use rolling windows |
64 | | -- DO account for timezone differences in daily revenue calculations |
| 54 | +### Phase 2: Read Shared Knowledge |
| 55 | + |
| 56 | +Before writing SQL, read: |
| 57 | +- **`shared/product-context.md`** — LTX products, user types, business model, enterprise context |
| 58 | +- **`shared/bq-schema.md`** — Subscription tables (ltxstudio_user_tiers_dates, ltxstudio_subscriptions, etc.), user segmentation queries |
| 59 | +- **`shared/metric-standards.md`** — Revenue metric definitions (MRR, ARR, churn, LTV) |
| 60 | +- **`shared/event-registry.yaml`** — Feature events (if analyzing feature-driven revenue) |
| 61 | + |
| 62 | +**Data nuances**: |
| 63 | +- Tables: `ltxstudio_user_tiers_dates`, `ltxstudio_subscriptions` |
| 64 | +- Key columns: `lt_id`, `griffin_tier_name`, `subscription_start_date`, `subscription_end_date`, `plan_type` |
| 65 | +- Exclude `is_lt_team` unless explicitly requested |
| 66 | +- Revenue calculations vary by plan type (self-serve vs contract/pilot) |
| 67 | + |
| 68 | +### Phase 3: Write Monitoring SQL |
| 69 | + |
| 70 | +✅ **PREFERRED: Monitor all segments with baseline comparisons** |
| 71 | + |
| 72 | +```sql |
| 73 | +WITH revenue_metrics AS ( |
| 74 | + SELECT |
| 75 | + dt, |
| 76 | + griffin_tier_name, |
| 77 | + plan_type, |
| 78 | + COUNT(DISTINCT lt_id) AS active_subscribers, |
| 79 | + SUM(CASE WHEN subscription_start_date = dt THEN 1 ELSE 0 END) AS new_subs, |
| 80 | + SUM(CASE WHEN subscription_end_date = dt THEN 1 ELSE 0 END) AS churned_subs, |
| 81 | + SUM(mrr_amount) AS total_mrr, |
| 82 | + SUM(arr_amount) AS total_arr |
| 83 | + FROM subscription_table |
| 84 | + WHERE dt >= DATE_SUB(CURRENT_DATE(), INTERVAL 30 DAY) |
| 85 | + AND dt <= DATE_SUB(CURRENT_DATE(), INTERVAL 1 DAY) |
| 86 | + AND is_lt_team IS FALSE |
| 87 | + GROUP BY dt, griffin_tier_name, plan_type |
| 88 | +), |
| 89 | +metrics_with_baseline AS ( |
| 90 | + SELECT |
| 91 | + *, |
| 92 | + AVG(total_mrr) OVER ( |
| 93 | + PARTITION BY griffin_tier_name, plan_type |
| 94 | + ORDER BY dt ROWS BETWEEN 7 PRECEDING AND 1 PRECEDING |
| 95 | + ) AS mrr_baseline_7d, |
| 96 | + AVG(churned_subs) OVER ( |
| 97 | + PARTITION BY griffin_tier_name, plan_type |
| 98 | + ORDER BY dt ROWS BETWEEN 7 PRECEDING AND 1 PRECEDING |
| 99 | + ) AS churn_baseline_7d |
| 100 | + FROM revenue_metrics |
| 101 | +) |
| 102 | +SELECT * FROM metrics_with_baseline |
| 103 | +WHERE dt = DATE_SUB(CURRENT_DATE(), INTERVAL 1 DAY); |
| 104 | +``` |
| 105 | + |
| 106 | +**Key patterns**: |
| 107 | +- **Segmentation**: By tier (Free/Lite/Standard/Pro/Enterprise) and plan type (self-serve/contract/pilot) |
| 108 | +- **Baseline**: 7-day rolling average for comparison |
| 109 | +- **Time window**: Yesterday only |
| 110 | + |
| 111 | +### Phase 4: Execute Query |
| 112 | + |
| 113 | +Run query using: |
| 114 | +```bash |
| 115 | +bq --project_id=ltx-dwh-explore query --use_legacy_sql=false --format=pretty " |
| 116 | +<query> |
| 117 | +" |
| 118 | +``` |
| 119 | + |
| 120 | +### Phase 5: Analyze Results |
| 121 | + |
| 122 | +**For revenue trends**: |
| 123 | +- Compare current period vs baseline (7-day avg, prior week, prior month) |
| 124 | +- Calculate % change and flag significant shifts (>15% DoD, >10% WoW) |
| 125 | +- Identify which tiers/plans drove changes |
| 126 | + |
| 127 | +**For churn analysis**: |
| 128 | +- Calculate churn rate = churned_subs / active_subscribers |
| 129 | +- Compare to baseline and flag if > 5% or increase > 2x baseline |
| 130 | +- Identify which tiers have highest churn |
| 131 | + |
| 132 | +**For subscription health**: |
| 133 | +- Track new subscription volume by tier |
| 134 | +- Monitor upgrade vs downgrade ratios |
| 135 | +- Flag enterprise renewal dates < 90 days out |
| 136 | + |
| 137 | +### Phase 6: Present Findings |
| 138 | + |
| 139 | +Format results with: |
| 140 | +- **Summary**: Key finding (e.g., "MRR dropped 18% yesterday") |
| 141 | +- **Root cause**: Which segment drove the change (e.g., "Standard tier churned 12 users") |
| 142 | +- **Breakdown**: Metrics by tier and plan type |
| 143 | +- **Recommendation**: Action to take (investigate churn reason, contact at-risk accounts) |
| 144 | + |
| 145 | +**Alert format**: |
| 146 | +``` |
| 147 | +⚠️ REVENUE ALERT: |
| 148 | + • Metric: MRR Drop |
| 149 | + Current: $X | Baseline: $Y |
| 150 | + Change: -Z% |
| 151 | + Segment: Standard tier, self-serve |
| 152 | +
|
| 153 | +Recommendation: Investigate recent Standard tier churns |
| 154 | +``` |
| 155 | + |
| 156 | +### Phase 7: Set Up Alert (Optional) |
| 157 | + |
| 158 | +For ongoing monitoring: |
| 159 | +1. Save SQL query |
| 160 | +2. Set up in BigQuery scheduled query or Hex Thread |
| 161 | +3. Configure notification threshold |
| 162 | +4. Route alerts to Revenue/Growth team |
| 163 | + |
| 164 | +## 5. Context & References |
| 165 | + |
| 166 | +### Shared Knowledge |
| 167 | +- **`shared/product-context.md`** — LTX products, user types, business model, enterprise context |
| 168 | +- **`shared/bq-schema.md`** — Subscription tables, user segmentation queries |
| 169 | +- **`shared/metric-standards.md`** — Revenue metric definitions (MRR, ARR, churn, LTV, retention) |
| 170 | +- **`shared/event-registry.yaml`** — Feature events for feature-driven revenue analysis |
| 171 | + |
| 172 | +### Data Sources |
| 173 | +Tables: `ltxstudio_user_tiers_dates`, `ltxstudio_subscriptions` |
| 174 | +- Key columns: `lt_id`, `griffin_tier_name`, `subscription_start_date`, `subscription_end_date`, `plan_type`, `mrr_amount`, `arr_amount` |
| 175 | +- Filter: `is_lt_team IS FALSE` for customer revenue |
| 176 | + |
| 177 | +### Tiers |
| 178 | +- Free (no revenue) |
| 179 | +- Lite (lowest paid tier) |
| 180 | +- Standard (mid-tier) |
| 181 | +- Pro (high-tier) |
| 182 | +- Enterprise (contract/pilot) |
| 183 | + |
| 184 | +### Plan Types |
| 185 | +- Self-serve (automated subscription) |
| 186 | +- Contract (enterprise contract) |
| 187 | +- Pilot (enterprise pilot) |
| 188 | + |
| 189 | +## 6. Constraints & Done |
| 190 | + |
| 191 | +### DO NOT |
| 192 | + |
| 193 | +- **DO NOT** include is_lt_team users unless explicitly requested |
| 194 | +- **DO NOT** hardcode dates — use rolling windows |
| 195 | +- **DO NOT** use absolute thresholds — compare to baseline |
| 196 | +- **DO NOT** mix plan types without proper segmentation |
| 197 | +- **DO NOT** ignore timezone differences in daily revenue calculations |
| 198 | + |
| 199 | +### DO |
| 200 | + |
| 201 | +- **DO** use LTX Studio subscription tables from bq-schema.md |
| 202 | +- **DO** exclude is_lt_team unless explicitly requested |
| 203 | +- **DO** validate thresholds with user before setting alerts |
| 204 | +- **DO** use rolling windows (7-day, 30-day baselines) |
| 205 | +- **DO** account for timezone differences in daily revenue calculations |
| 206 | +- **DO** segment by tier AND plan type for root cause analysis |
| 207 | +- **DO** compare against baseline (7-day avg, prior period) for trends |
| 208 | +- **DO** calculate churn rate = churned / active subscribers |
| 209 | +- **DO** flag MRR drops > 15% DoD or > 10% WoW |
| 210 | +- **DO** flag churn rate > 5% or increase > 2x baseline |
| 211 | +- **DO** flag refund rate > 3% or spike > 50% DoD |
| 212 | +- **DO** flag new subscription drops > 20% WoW |
| 213 | +- **DO** track enterprise renewal dates < 90 days out |
| 214 | +- **DO** include segment breakdown in all alerts |
| 215 | +- **DO** validate unusual patterns with Revenue/Growth team before alerting |
| 216 | + |
| 217 | +### Completion Criteria |
| 218 | + |
| 219 | +✅ All revenue metrics monitored (MRR, ARR, churn, refunds, new subs) |
| 220 | +✅ Alerts fire with thresholds (generic pending production analysis) |
| 221 | +✅ Segment-level root cause identified |
| 222 | +✅ Findings presented with recommendations |
| 223 | +✅ Timezone handling applied to daily revenue |
| 224 | +✅ Enterprise renewals tracked |
0 commit comments