Skip to content

Commit fad12f9

Browse files
AssafHayEdenclaude
andcommitted
feat: add enterprise account monitoring agent
Monitor enterprise account health, churn risk, and quota usage with organization-level alerting. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent fdd2727 commit fad12f9

File tree

1 file changed

+249
-61
lines changed

1 file changed

+249
-61
lines changed
Lines changed: 249 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,255 @@
11
---
22
name: enterprise-monitor
3-
description: Monitors enterprise account health, usage, and contract compliance. Alerts on low engagement, quota breaches, or churn risk.
4-
tags: [monitoring, enterprise, accounts, contracts]
3+
description: "Monitor enterprise account health, usage, and contract compliance. Detects low engagement, quota breaches, and churn risk. Use when: (1) detecting enterprise account usage drops, (2) alerting on inactive accounts, (3) investigating power user engagement changes."
4+
tags: [monitoring, enterprise, accounts, contracts, churn-risk]
55
---
66

77
# Enterprise Monitor
88

9-
## When to use
10-
11-
- "Monitor enterprise account usage"
12-
- "Monitor enterprise churn risk"
13-
- "Alert when enterprise account is inactive"
14-
15-
## What it monitors
16-
17-
- **Account usage**: DAU, WAU, MAU per enterprise org
18-
- **Token consumption**: Usage vs contracted quota, historical consumption trends
19-
- **User activation**: % of seats active
20-
- **Engagement**: Video generations, image generations, downloads per org
21-
- **Churn signals**: Declining usage, inactive users
22-
23-
## Steps
24-
25-
1. **Gather requirements from user:**
26-
- Which enterprise org(s) to monitor (or all)
27-
- Alert threshold based on historical usage of each account (e.g., "usage drops > 30% vs their baseline", "MAU below their 30-day average", "< 50% of contracted quota")
28-
- Time window (weekly, monthly)
29-
- Notification channel (Slack, email, Linear issue)
30-
31-
2. **Read shared files:**
32-
- `shared/product-context.md` — LTX products, enterprise business model, user types
33-
- `shared/bq-schema.md` — Enterprise user segmentation queries
34-
- `shared/metric-standards.md` — Enterprise metrics, quota tracking
35-
- `shared/event-registry.yaml` — Feature events (if analyzing engagement)
36-
- `shared/gpu-cost-query-templates.md` — GPU cost queries (if analyzing infrastructure costs)
37-
- `shared/gpu-cost-analysis-patterns.md` — Cost analysis patterns (if analyzing infrastructure costs)
38-
39-
3. **Identify enterprise users:**
40-
- Use enterprise segmentation CTE from bq-schema.md (lines 441-461)
41-
- Apply McCann split (McCann_NY vs McCann_Paris)
42-
- Exclude Lightricks and Popular Pays
43-
44-
4. **Write monitoring SQL:**
45-
- Query org-level usage metrics
46-
- Set baseline for each org based on their historical usage (e.g., 30-day average, 90-day trend)
47-
- Compare current usage against org-specific baseline or contracted quota
48-
- Flag orgs below threshold or showing decline
49-
- Flag meaningful drops for power users (users with top usage within each org)
50-
51-
5. **Present to user:**
52-
- Show SQL query
53-
- Show example alert format with org name and metrics
54-
- Confirm threshold values and alert logic
55-
56-
6. **Set up alert** (manual for now):
57-
- Document SQL
58-
- Configure notification to customer success team
59-
60-
## Rules
61-
62-
- DO use EXACT enterprise segmentation CTE from bq-schema.md without modification
63-
- DO apply McCann split (McCann_NY vs McCann_Paris)
64-
- DO exclude Lightricks and Popular Pays from enterprise orgs
65-
- DO break out pilot vs contracted accounts
66-
- DO NOT alert on free/self-serve users — this agent is enterprise-only
67-
- DO include org name in alert for easy customer success follow-up
9+
## 1. Overview (Why?)
10+
11+
Enterprise accounts (contract and pilot) represent high-value customers with negotiated quotas and specific engagement patterns. Unlike self-serve users, enterprise usage should be monitored per-organization with org-specific baselines, since each has different team sizes, use cases, and contract terms.
12+
13+
This skill provides **autonomous enterprise account monitoring** that detects declining usage, underutilization of quotas, inactive periods, and power user drops — all of which signal churn risk or engagement problems that require customer success intervention.
14+
15+
**Problem solved**: Identify enterprise churn risk early through usage signals — before contracts end or accounts go completely inactive — with org-level root cause analysis.
16+
17+
## 2. Requirements (What?)
18+
19+
Monitor these outcomes autonomously:
20+
21+
- [ ] DAU/WAU/MAU drops per enterprise org (> 30% vs org baseline)
22+
- [ ] Token consumption vs contracted quota (underutilization < 50%)
23+
- [ ] User activation (% of seats active)
24+
- [ ] Video/image generation engagement per org
25+
- [ ] Power user drops within org (> 20% decline)
26+
- [ ] Zero activity for 7+ consecutive days
27+
- [ ] Alerts include org name for customer success follow-up
28+
- [ ] Pilot vs contract accounts separated
29+
- [ ] McCann split applied (McCann_NY vs McCann_Paris)
30+
- [ ] Lightricks and Popular Pays excluded
31+
32+
## 3. Progress Tracker
33+
34+
* [ ] Read shared knowledge (enterprise segmentation, schema, metrics)
35+
* [ ] Identify enterprise users with segmentation CTE
36+
* [ ] Write monitoring SQL with org-specific baselines
37+
* [ ] Execute query for target date range
38+
* [ ] Analyze results by org and account type
39+
* [ ] Identify power user drops within each org
40+
* [ ] Present findings with org-level details
41+
* [ ] Route alerts to customer success team
42+
43+
## 4. Implementation Plan
44+
45+
### Phase 1: Read Alert Thresholds
46+
47+
**Generic thresholds** (data-driven analysis pending):
48+
- DoD/WoW usage drops > 30% vs org's baseline
49+
- MAU below org's 30-day average
50+
- Token consumption < 50% of contracted quota (underutilization)
51+
- Power user drops > 20% within org
52+
- Zero activity for 7+ consecutive days
53+
54+
[!IMPORTANT] These are generic thresholds. Consider creating production thresholds based on org-specific analysis.
55+
56+
### Phase 2: Read Shared Knowledge
57+
58+
Before writing SQL, read:
59+
- **`shared/product-context.md`** — LTX products, enterprise business model, user types
60+
- **`shared/bq-schema.md`** — Enterprise user segmentation queries (lines 441-461)
61+
- **`shared/metric-standards.md`** — Enterprise metrics, quota tracking
62+
- **`shared/event-registry.yaml`** — Feature events (if analyzing engagement)
63+
64+
**Data nuances**:
65+
- Use EXACT enterprise segmentation CTE from bq-schema.md (lines 441-461) without modification
66+
- Apply McCann split: `McCann_NY` vs `McCann_Paris`
67+
- Exclude: `Lightricks`, `Popular Pays`, `None`
68+
- Contract accounts: Indegene, HearWell_BeWell, Novig, Cylndr Studios, Miroma, Deriv, McCann_Paris
69+
- Pilot accounts: All other enterprise orgs
70+
71+
### Phase 3: Identify Enterprise Users
72+
73+
**PREFERRED: Use exact segmentation CTE from bq-schema.md**
74+
75+
```sql
76+
WITH ent_users AS (
77+
SELECT DISTINCT
78+
lt_id,
79+
CASE
80+
WHEN COALESCE(enterprise_name_at_purchase, current_enterprise_name, organization_name) = 'McCann_NY' THEN 'McCann_NY'
81+
WHEN COALESCE(enterprise_name_at_purchase, current_enterprise_name, organization_name) LIKE '%McCann%' THEN 'McCann_Paris'
82+
ELSE COALESCE(enterprise_name_at_purchase, current_enterprise_name, organization_name)
83+
END AS org
84+
FROM `ltx-dwh-prod-processed.web.ltxstudio_users`
85+
WHERE is_enterprise_user
86+
AND current_customer_plan_type IN ('contract', 'pilot')
87+
AND COALESCE(enterprise_name_at_purchase, current_enterprise_name, organization_name) NOT IN ('Lightricks', 'Popular Pays', 'None')
88+
),
89+
enterprise_users AS (
90+
SELECT DISTINCT
91+
lt_id,
92+
CASE
93+
WHEN org IN ('Indegene', 'HearWell_BeWell', 'Novig', 'Cylndr Studios', 'Miroma', 'Deriv', 'McCann_Paris')
94+
THEN org
95+
ELSE CONCAT(org, ' Pilot')
96+
END AS org,
97+
CASE
98+
WHEN org IN ('Indegene', 'HearWell_BeWell', 'Novig', 'Cylndr Studios', 'Miroma', 'Deriv', 'McCann_Paris')
99+
THEN 'Contract'
100+
ELSE 'Pilot'
101+
END AS account_type
102+
FROM ent_users
103+
WHERE org NOT IN ('Lightricks', 'Popular Pays', 'None')
104+
)
105+
```
106+
107+
### Phase 4: Write Monitoring SQL
108+
109+
**PREFERRED: Monitor all enterprise orgs with org-specific baselines**
110+
111+
```sql
112+
WITH org_metrics AS (
113+
SELECT
114+
a.dt,
115+
e.org,
116+
e.account_type,
117+
COUNT(DISTINCT a.lt_id) AS dau,
118+
SUM(a.num_tokens_consumed) AS tokens,
119+
SUM(a.num_generate_image) AS image_gens,
120+
SUM(a.num_generate_video) AS video_gens
121+
FROM `ltx-dwh-prod-processed.web.ltxstudio_agg_user_date` a
122+
JOIN enterprise_users e ON a.lt_id = e.lt_id
123+
WHERE a.dt >= DATE_SUB(CURRENT_DATE(), INTERVAL 30 DAY)
124+
AND a.dt <= DATE_SUB(CURRENT_DATE(), INTERVAL 1 DAY)
125+
GROUP BY a.dt, e.org, e.account_type
126+
),
127+
metrics_with_baseline AS (
128+
SELECT
129+
*,
130+
AVG(dau) OVER (
131+
PARTITION BY org
132+
ORDER BY dt ROWS BETWEEN 30 PRECEDING AND 1 PRECEDING
133+
) AS dau_baseline_30d,
134+
AVG(tokens) OVER (
135+
PARTITION BY org
136+
ORDER BY dt ROWS BETWEEN 30 PRECEDING AND 1 PRECEDING
137+
) AS tokens_baseline_30d
138+
FROM org_metrics
139+
)
140+
SELECT * FROM metrics_with_baseline
141+
WHERE dt = DATE_SUB(CURRENT_DATE(), INTERVAL 1 DAY);
142+
```
143+
144+
**Key patterns**:
145+
- **Org-specific baselines**: Each org compared to its own 30-day average
146+
- **McCann split**: Separate McCann_NY and McCann_Paris
147+
- **Account type**: Contract vs Pilot
148+
149+
### Phase 5: Analyze Results
150+
151+
**For usage trends**:
152+
- Compare org's current usage vs their 30-day baseline
153+
- Flag orgs with DoD/WoW drops > 30% vs baseline
154+
- Flag orgs with MAU below their 30-day average
155+
156+
**For quota analysis**:
157+
- Compare token consumption vs contracted quota
158+
- Flag underutilization (< 50% of quota)
159+
- Identify orgs approaching or exceeding quota
160+
161+
**For engagement**:
162+
- Track power users within each org (top 20% by token usage)
163+
- Flag power user drops > 20% within org
164+
- Flag zero activity for 7+ consecutive days
165+
166+
### Phase 6: Present Findings
167+
168+
Format results with:
169+
- **Summary**: Key finding (e.g., "Novig enterprise account inactive for 7 days")
170+
- **Org details**: Org name, account type (Contract/Pilot), baseline usage
171+
- **Metrics**: DAU, tokens, generations vs baseline
172+
- **Recommendation**: Customer success action (reach out, investigate, adjust quota)
173+
174+
**Alert format**:
175+
```
176+
⚠️ ENTERPRISE ALERT:
177+
• Org: Novig (Contract)
178+
Metric: Token consumption
179+
Current: 0 tokens | Baseline: 27K/day
180+
Drop: -100% | Zero activity for 7 days
181+
182+
Recommendation: Contact account manager immediately
183+
```
184+
185+
### Phase 7: Route Alert
186+
187+
For ongoing monitoring:
188+
1. Save SQL query
189+
2. Set up in BigQuery scheduled query or Hex Thread
190+
3. Configure notification for customer success team
191+
4. Include org name and account manager contact in alert
192+
193+
## 5. Context & References
194+
195+
### Shared Knowledge
196+
- **`shared/product-context.md`** — LTX products, enterprise business model, user types
197+
- **`shared/bq-schema.md`** — Enterprise user segmentation queries (lines 441-461)
198+
- **`shared/metric-standards.md`** — Enterprise metrics, quota tracking
199+
- **`shared/event-registry.yaml`** — Feature events for engagement analysis
200+
201+
### Data Sources
202+
- **Users table**: `ltx-dwh-prod-processed.web.ltxstudio_users`
203+
- **Usage table**: `ltx-dwh-prod-processed.web.ltxstudio_agg_user_date`
204+
- Key columns: `lt_id`, `enterprise_name_at_purchase`, `current_enterprise_name`, `organization_name`, `current_customer_plan_type`
205+
206+
### Enterprise Orgs
207+
208+
**Contract accounts**:
209+
- Indegene
210+
- HearWell_BeWell
211+
- Novig
212+
- Cylndr Studios
213+
- Miroma
214+
- Deriv
215+
- McCann_Paris
216+
217+
**Pilot accounts**: All other enterprise orgs (suffixed with " Pilot")
218+
219+
**Excluded**: Lightricks, Popular Pays, None
220+
221+
## 6. Constraints & Done
222+
223+
### DO NOT
224+
225+
- **DO NOT** modify enterprise segmentation CTE — use exact version from bq-schema.md
226+
- **DO NOT** alert on free/self-serve users — this agent is enterprise-only
227+
- **DO NOT** combine McCann_NY and McCann_Paris — keep them separate
228+
- **DO NOT** include Lightricks or Popular Pays in enterprise monitoring
229+
- **DO NOT** use generic baselines — each org compared to its own historical usage
230+
231+
### DO
232+
233+
- **DO** use EXACT enterprise segmentation CTE from bq-schema.md (lines 441-461) without modification
234+
- **DO** apply McCann split (McCann_NY vs McCann_Paris)
235+
- **DO** exclude Lightricks, Popular Pays, and None from enterprise orgs
236+
- **DO** break out pilot vs contracted accounts
237+
- **DO** include org name in alert for customer success follow-up
238+
- **DO** use org-specific baselines (each org's 30-day average)
239+
- **DO** flag DoD/WoW usage drops > 30% vs org baseline
240+
- **DO** flag MAU below org's 30-day average
241+
- **DO** flag token consumption < 50% of contracted quota
242+
- **DO** flag power user drops > 20% within org
243+
- **DO** flag zero activity for 7+ consecutive days
244+
- **DO** route alerts to customer success team with org details
245+
- **DO** validate unusual patterns with customer success before alerting
246+
247+
### Completion Criteria
248+
249+
✅ All enterprise orgs monitored (Contract and Pilot)
250+
✅ Org-specific baselines applied
251+
✅ McCann split applied (NY vs Paris)
252+
✅ Lightricks and Popular Pays excluded
253+
✅ Alerts include org name and account type
254+
✅ Usage drops, quota issues, and engagement drops detected
255+
✅ Findings routed to customer success team

0 commit comments

Comments
 (0)