make-mp-data 2.1.11 → 3.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +31 -0
- package/dungeons/adspend.js +2 -2
- package/dungeons/ai-chat-analytics-ed.js +3 -2
- package/dungeons/anon.js +2 -2
- package/dungeons/array-of-object-loopup.js +181 -0
- package/dungeons/benchmark-heavy.js +241 -0
- package/dungeons/benchmark-light.js +141 -0
- package/dungeons/big.js +9 -8
- package/dungeons/business.js +2 -1
- package/dungeons/clinch-agi.js +632 -0
- package/dungeons/complex.js +3 -2
- package/dungeons/copilot.js +383 -0
- package/dungeons/ecommerce-store.js +0 -0
- package/dungeons/experiments.js +5 -4
- package/dungeons/foobar.js +1 -1
- package/dungeons/funnels.js +2 -2
- package/dungeons/gaming.js +3 -2
- package/dungeons/harness/harness-education.js +988 -0
- package/dungeons/harness/harness-fintech.js +976 -0
- package/dungeons/harness/harness-food.js +985 -0
- package/dungeons/harness/harness-gaming.js +1178 -0
- package/dungeons/harness/harness-media.js +961 -0
- package/dungeons/harness/harness-sass.js +923 -0
- package/dungeons/harness/harness-social.js +928 -0
- package/dungeons/kurby.js +211 -0
- package/dungeons/media.js +5 -4
- package/dungeons/mil.js +4 -3
- package/dungeons/mirror.js +2 -2
- package/dungeons/money2020-ed.js +8 -7
- package/dungeons/sanity.js +3 -2
- package/dungeons/scd.js +3 -2
- package/dungeons/simple.js +30 -15
- package/dungeons/strict-event-test.js +30 -0
- package/dungeons/student-teacher.js +3 -2
- package/dungeons/text-generation.js +84 -85
- package/dungeons/too-big-events.js +166 -0
- package/dungeons/uday-schema.json +220 -0
- package/dungeons/userAgent.js +4 -3
- package/index.js +41 -54
- package/lib/core/config-validator.js +122 -7
- package/lib/core/context.js +7 -14
- package/lib/core/storage.js +57 -25
- package/lib/generators/adspend.js +12 -12
- package/lib/generators/events.js +6 -5
- package/lib/generators/funnels.js +32 -10
- package/lib/generators/product-lookup.js +262 -0
- package/lib/generators/product-names.js +195 -0
- package/lib/generators/profiles.js +3 -3
- package/lib/generators/scd.js +13 -3
- package/lib/generators/text.js +17 -4
- package/lib/orchestrators/mixpanel-sender.js +244 -204
- package/lib/orchestrators/user-loop.js +54 -16
- package/lib/templates/funnels-instructions.txt +272 -0
- package/lib/templates/hook-examples.json +187 -0
- package/lib/templates/hooks-instructions.txt +295 -8
- package/lib/templates/phrases.js +473 -16
- package/lib/templates/refine-instructions.txt +485 -0
- package/lib/templates/schema-instructions.txt +239 -109
- package/lib/templates/schema.d.ts +173 -0
- package/lib/templates/verbose-schema.js +140 -206
- package/lib/utils/ai.js +853 -77
- package/lib/utils/chart.js +210 -0
- package/lib/utils/function-registry.js +285 -0
- package/lib/utils/json-evaluator.js +172 -0
- package/lib/utils/logger.js +38 -0
- package/lib/utils/mixpanel.js +101 -0
- package/lib/utils/project.js +3 -2
- package/lib/utils/utils.js +41 -4
- package/package.json +15 -21
- package/types.d.ts +15 -5
- package/lib/generators/text-bak-old.js +0 -1121
- package/lib/orchestrators/worker-manager.js +0 -203
- package/lib/templates/phrases-bak.js +0 -925
- package/lib/templates/prompt (old).txt +0 -98
- package/lib/templates/scratch-dungeon-template.js +0 -116
- package/lib/templates/textQuickTest.js +0 -172
|
@@ -0,0 +1,632 @@
|
|
|
1
|
+
|
|
2
|
+
import dayjs from "dayjs";
|
|
3
|
+
import utc from "dayjs/plugin/utc.js";
|
|
4
|
+
import "dotenv/config";
|
|
5
|
+
import { weighNumRange, pickAWinner, initChance, integer, decimal } from "../lib/utils/utils.js";
|
|
6
|
+
import { uid } from "ak-tools";
|
|
7
|
+
|
|
8
|
+
const SEED = "clinch-agi-cpo-demo";
|
|
9
|
+
dayjs.extend(utc);
|
|
10
|
+
const chance = initChance(SEED);
|
|
11
|
+
const num_users = 5_000;
|
|
12
|
+
const days = 95;
|
|
13
|
+
|
|
14
|
+
/** @typedef {import("../types.js").Dungeon} Config */
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* CLINCH AGI — AI-Native Sales & GTM Workflow Platform
|
|
18
|
+
*
|
|
19
|
+
* Models an AI-powered platform where AI agents operate as virtual team members
|
|
20
|
+
* for sales/GTM teams: joining meetings, summarizing calls, drafting follow-ups,
|
|
21
|
+
* updating CRM, monitoring pipeline, and coaching reps.
|
|
22
|
+
*
|
|
23
|
+
* Built for a CPO interview demo with Uday Chakravarthi (founder of Clinch AGI).
|
|
24
|
+
* Designed to showcase Mixpanel's analysis features against a realistic B2B SaaS dataset.
|
|
25
|
+
*
|
|
26
|
+
* Core product loop:
|
|
27
|
+
* Meeting → AI Summary → Follow-up Draft → Send → CRM Auto-Update → Pipeline Insight
|
|
28
|
+
*
|
|
29
|
+
* Monetization: Tiered SaaS (starter / growth / enterprise)
|
|
30
|
+
*
|
|
31
|
+
* ═══════════════════════════════════════════════════════════════════
|
|
32
|
+
* HOOKED INSIGHTS — WHAT'S HIDDEN IN THE DATA
|
|
33
|
+
* ═══════════════════════════════════════════════════════════════════
|
|
34
|
+
*
|
|
35
|
+
* 1. THE AI GOT SMARTER — About 60 days ago, meeting summary quality jumped
|
|
36
|
+
* dramatically. The old model scored 50-72; the new one hits 75-95+. You
|
|
37
|
+
* can see the inflection point clearly in a line chart of quality_score.
|
|
38
|
+
*
|
|
39
|
+
* 2. PERSONALIZATION PAYS OFF — Follow-up emails with high personalization
|
|
40
|
+
* scores get 3x more replies and clicks than generic ones. The AI's effort
|
|
41
|
+
* in crafting personal messages directly drives better sales outcomes.
|
|
42
|
+
*
|
|
43
|
+
* 3. AI WORKS WEEKENDS — On Saturdays and Sundays, CRM updates are almost
|
|
44
|
+
* entirely autonomous (no human in the loop), and the AI updates more
|
|
45
|
+
* fields per record. The agents truly operate as "always-on" team members.
|
|
46
|
+
*
|
|
47
|
+
* 4. ENTERPRISE DEALS MOVE FASTER — Enterprise-tier users see deals progress
|
|
48
|
+
* through pipeline stages 2x faster than starter-tier users. The platform
|
|
49
|
+
* delivers disproportionate value to larger teams.
|
|
50
|
+
*
|
|
51
|
+
* 5. INTEGRATIONS PREDICT SUCCESS — Users who connect 5+ integrations are
|
|
52
|
+
* tagged as "high" data completeness and overwhelmingly become champions.
|
|
53
|
+
* Fewer integrations correlates with at-risk status.
|
|
54
|
+
*
|
|
55
|
+
* 6. TIER DRIVES ACTIVATION — Enterprise users convert through every funnel
|
|
56
|
+
* at 1.3x the base rate; starter users convert at 0.7x. Onboarding,
|
|
57
|
+
* meeting-to-action, pipeline management — all show the same pattern.
|
|
58
|
+
*
|
|
59
|
+
* 7. EARLY ADOPTION = RETENTION — Users who deploy 3+ agents and join 5+
|
|
60
|
+
* meetings in their first 30 days hit a "power user milestone" and retain
|
|
61
|
+
* at dramatically higher rates. Users with zero agent deploys get flagged
|
|
62
|
+
* as churn risks — and they do churn.
|
|
63
|
+
*
|
|
64
|
+
* 8. BAD FEEDBACK PREDICTS CHURN — Users who give 3+ negative ratings
|
|
65
|
+
* (1 or 2 stars) to AI agents show a steep engagement dropoff in the
|
|
66
|
+
* second half of their lifecycle. Their event volume falls by ~60%.
|
|
67
|
+
*
|
|
68
|
+
* ═══════════════════════════════════════════════════════════════════
|
|
69
|
+
*/
|
|
70
|
+
|
|
71
|
+
/** @type {Config} */
|
|
72
|
+
const config = {
|
|
73
|
+
token: "ff821702cde57664bd2b50eb12ead0bf",
|
|
74
|
+
seed: SEED,
|
|
75
|
+
numDays: days,
|
|
76
|
+
numEvents: num_users * 120,
|
|
77
|
+
numUsers: num_users,
|
|
78
|
+
hasAnonIds: false,
|
|
79
|
+
hasSessionIds: true,
|
|
80
|
+
format: "json",
|
|
81
|
+
gzip: true,
|
|
82
|
+
alsoInferFunnels: false,
|
|
83
|
+
hasLocation: true,
|
|
84
|
+
hasAndroidDevices: true,
|
|
85
|
+
hasIOSDevices: true,
|
|
86
|
+
hasDesktopDevices: true,
|
|
87
|
+
hasBrowser: false,
|
|
88
|
+
hasCampaigns: false,
|
|
89
|
+
isAnonymous: false,
|
|
90
|
+
hasAdSpend: false,
|
|
91
|
+
percentUsersBornInDataset: 35,
|
|
92
|
+
hasAvatar: true,
|
|
93
|
+
makeChart: false,
|
|
94
|
+
batchSize: 2_500_000,
|
|
95
|
+
concurrency: 1,
|
|
96
|
+
writeToDisk: false,
|
|
97
|
+
scdProps: {},
|
|
98
|
+
mirrorProps: {},
|
|
99
|
+
lookupTables: [],
|
|
100
|
+
|
|
101
|
+
// ──────────────────────────────────────────────
|
|
102
|
+
// EVENTS (18)
|
|
103
|
+
// ──────────────────────────────────────────────
|
|
104
|
+
events: [
|
|
105
|
+
{
|
|
106
|
+
event: "account created",
|
|
107
|
+
weight: 0,
|
|
108
|
+
isFirstEvent: true,
|
|
109
|
+
properties: {
|
|
110
|
+
signup_source: ["organic", "referral", "demo_request", "product_hunt", "g2_review"],
|
|
111
|
+
initial_plan: ["free_trial", "free_trial", "free_trial", "growth", "enterprise"],
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
event: "agent deployed",
|
|
116
|
+
weight: 3,
|
|
117
|
+
properties: {
|
|
118
|
+
agent_type: pickAWinner(["pre_call_researcher", "meeting_assistant", "follow_up_writer", "crm_updater", "pipeline_monitor", "outreach_agent"]),
|
|
119
|
+
configuration_time_min: weighNumRange(2, 45, 0.4),
|
|
120
|
+
},
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
event: "meeting joined",
|
|
124
|
+
weight: 5,
|
|
125
|
+
properties: {
|
|
126
|
+
meeting_platform: ["zoom", "zoom", "google_meet", "google_meet", "teams", "webex"],
|
|
127
|
+
meeting_type: ["discovery", "demo", "negotiation", "check_in", "onboarding", "qbr"],
|
|
128
|
+
participants: weighNumRange(2, 12, 0.5),
|
|
129
|
+
duration_min: weighNumRange(10, 90, 0.3),
|
|
130
|
+
},
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
event: "meeting summary generated",
|
|
134
|
+
weight: 5,
|
|
135
|
+
properties: {
|
|
136
|
+
summary_length_words: weighNumRange(100, 800, 0.3),
|
|
137
|
+
action_items_count: weighNumRange(0, 8, 0.5),
|
|
138
|
+
quality_score: weighNumRange(50, 95, 0.4), // Hook 1 overrides this
|
|
139
|
+
},
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
event: "crm auto-updated",
|
|
143
|
+
weight: 8,
|
|
144
|
+
properties: {
|
|
145
|
+
crm_platform: ["hubspot", "hubspot", "salesforce", "salesforce", "pipedrive"],
|
|
146
|
+
fields_updated: weighNumRange(1, 6, 0.5),
|
|
147
|
+
update_type: ["contact_info", "deal_stage", "activity_log", "meeting_notes", "next_steps"],
|
|
148
|
+
},
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
event: "follow-up drafted",
|
|
152
|
+
weight: 4,
|
|
153
|
+
properties: {
|
|
154
|
+
personalization_score: weighNumRange(30, 98, 0.3),
|
|
155
|
+
template_used: ["post_meeting", "deal_nudge", "re_engagement", "intro", "proposal"],
|
|
156
|
+
word_count: weighNumRange(50, 400, 0.4),
|
|
157
|
+
},
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
event: "follow-up sent",
|
|
161
|
+
weight: 3,
|
|
162
|
+
properties: {
|
|
163
|
+
channel: ["email", "email", "email", "linkedin", "slack"],
|
|
164
|
+
personalization_score: weighNumRange(30, 98, 0.3),
|
|
165
|
+
time_to_send_hr: weighNumRange(0, 48, 0.5),
|
|
166
|
+
email_outcome: ["pending", "pending", "pending", "opened", "opened", "clicked", "bounced", "replied"], // Hook 2 overrides
|
|
167
|
+
},
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
event: "pipeline alert received",
|
|
171
|
+
weight: 4,
|
|
172
|
+
properties: {
|
|
173
|
+
alert_type: ["deal_stalling", "champion_left", "competitor_mentioned", "no_activity", "budget_risk"],
|
|
174
|
+
severity: pickAWinner(["low", "medium", "high", "critical"]),
|
|
175
|
+
deal_value: weighNumRange(5000, 500000, 0.2),
|
|
176
|
+
},
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
event: "deal stage changed",
|
|
180
|
+
weight: 5,
|
|
181
|
+
properties: {
|
|
182
|
+
from_stage: ["lead", "qualified", "proposal", "negotiation", "verbal_commit"],
|
|
183
|
+
to_stage: ["qualified", "proposal", "negotiation", "verbal_commit", "closed_won", "closed_lost"],
|
|
184
|
+
days_in_previous_stage: weighNumRange(1, 60, 0.3), // Hook 4 modifies
|
|
185
|
+
},
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
event: "insight generated",
|
|
189
|
+
weight: 6,
|
|
190
|
+
properties: {
|
|
191
|
+
insight_type: pickAWinner(["deal_risk", "buyer_intent", "competitive_intel", "engagement_trend", "revenue_forecast", "coaching_opportunity"]),
|
|
192
|
+
confidence_score: weighNumRange(55, 98, 0.4),
|
|
193
|
+
data_sources_used: weighNumRange(1, 5, 0.5),
|
|
194
|
+
},
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
event: "agent feedback",
|
|
198
|
+
weight: 4,
|
|
199
|
+
properties: {
|
|
200
|
+
rating: [1, 2, 3, 3, 4, 4, 4, 5, 5, 5],
|
|
201
|
+
feedback_type: ["accuracy", "relevance", "timeliness", "completeness", "tone"],
|
|
202
|
+
agent_type: pickAWinner(["meeting_assistant", "follow_up_writer", "crm_updater", "pre_call_researcher"]),
|
|
203
|
+
},
|
|
204
|
+
},
|
|
205
|
+
{
|
|
206
|
+
event: "dashboard viewed",
|
|
207
|
+
weight: 7,
|
|
208
|
+
properties: {
|
|
209
|
+
dashboard_type: ["pipeline_overview", "team_performance", "ai_agent_stats", "revenue_forecast", "activity_feed"],
|
|
210
|
+
time_spent_sec: weighNumRange(10, 300, 0.3),
|
|
211
|
+
},
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
event: "integration connected",
|
|
215
|
+
weight: 1,
|
|
216
|
+
properties: {
|
|
217
|
+
integration_name: pickAWinner(["hubspot", "salesforce", "slack", "google_calendar", "zoom", "linkedin", "gmail", "outlook"]),
|
|
218
|
+
setup_time_min: weighNumRange(2, 30, 0.5),
|
|
219
|
+
},
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
event: "search performed",
|
|
223
|
+
weight: 3,
|
|
224
|
+
properties: {
|
|
225
|
+
search_type: ["deals", "contacts", "meetings", "insights", "activities"],
|
|
226
|
+
results_count: weighNumRange(0, 50, 0.4),
|
|
227
|
+
clicked_result: [true, true, true, false],
|
|
228
|
+
},
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
event: "workflow created",
|
|
232
|
+
weight: 2,
|
|
233
|
+
properties: {
|
|
234
|
+
workflow_type: ["meeting_prep", "post_meeting", "deal_update", "weekly_digest", "pipeline_review"],
|
|
235
|
+
steps_count: weighNumRange(2, 8, 0.5),
|
|
236
|
+
trigger_type: ["time_based", "event_based", "manual"],
|
|
237
|
+
},
|
|
238
|
+
},
|
|
239
|
+
{
|
|
240
|
+
event: "contact enriched",
|
|
241
|
+
weight: 5,
|
|
242
|
+
properties: {
|
|
243
|
+
enrichment_source: ["linkedin", "company_website", "crm_history", "email_threads", "meeting_notes"],
|
|
244
|
+
fields_enriched: weighNumRange(2, 12, 0.4),
|
|
245
|
+
confidence_level: ["high", "high", "medium", "medium", "low"],
|
|
246
|
+
},
|
|
247
|
+
},
|
|
248
|
+
{
|
|
249
|
+
event: "deal created",
|
|
250
|
+
weight: 2,
|
|
251
|
+
properties: {
|
|
252
|
+
deal_source: ["inbound", "outbound", "referral", "upsell", "expansion"],
|
|
253
|
+
estimated_value: weighNumRange(5000, 250000, 0.2),
|
|
254
|
+
close_date_days: weighNumRange(14, 120, 0.3),
|
|
255
|
+
},
|
|
256
|
+
},
|
|
257
|
+
{
|
|
258
|
+
event: "coaching tip viewed",
|
|
259
|
+
weight: 3,
|
|
260
|
+
properties: {
|
|
261
|
+
tip_category: ["objection_handling", "discovery_questions", "closing_techniques", "rapport_building", "negotiation"],
|
|
262
|
+
tip_relevance_score: weighNumRange(40, 98, 0.4),
|
|
263
|
+
applied: [true, false, false, false],
|
|
264
|
+
},
|
|
265
|
+
},
|
|
266
|
+
],
|
|
267
|
+
|
|
268
|
+
// ──────────────────────────────────────────────
|
|
269
|
+
// FUNNELS (5)
|
|
270
|
+
// ──────────────────────────────────────────────
|
|
271
|
+
funnels: [
|
|
272
|
+
{
|
|
273
|
+
name: "Onboarding",
|
|
274
|
+
sequence: ["account created", "integration connected", "agent deployed", "meeting joined"],
|
|
275
|
+
isFirstFunnel: true,
|
|
276
|
+
conversionRate: 65,
|
|
277
|
+
timeToConvert: 48,
|
|
278
|
+
order: "sequential",
|
|
279
|
+
weight: 1,
|
|
280
|
+
},
|
|
281
|
+
{
|
|
282
|
+
name: "Meeting to Action",
|
|
283
|
+
sequence: ["meeting joined", "meeting summary generated", "follow-up drafted", "follow-up sent"],
|
|
284
|
+
conversionRate: 70,
|
|
285
|
+
timeToConvert: 4,
|
|
286
|
+
order: "sequential",
|
|
287
|
+
weight: 8,
|
|
288
|
+
},
|
|
289
|
+
{
|
|
290
|
+
name: "Pipeline Management",
|
|
291
|
+
sequence: ["pipeline alert received", "dashboard viewed", "deal stage changed"],
|
|
292
|
+
conversionRate: 45,
|
|
293
|
+
timeToConvert: 24,
|
|
294
|
+
order: "sequential",
|
|
295
|
+
weight: 5,
|
|
296
|
+
},
|
|
297
|
+
{
|
|
298
|
+
name: "AI Adoption",
|
|
299
|
+
sequence: ["agent deployed", "insight generated", "agent feedback"],
|
|
300
|
+
conversionRate: 55,
|
|
301
|
+
timeToConvert: 72,
|
|
302
|
+
order: "sequential",
|
|
303
|
+
weight: 4,
|
|
304
|
+
},
|
|
305
|
+
{
|
|
306
|
+
name: "Value Realization",
|
|
307
|
+
sequence: ["dashboard viewed", "workflow created", "agent deployed"],
|
|
308
|
+
conversionRate: 40,
|
|
309
|
+
timeToConvert: 96,
|
|
310
|
+
order: "sequential",
|
|
311
|
+
weight: 3,
|
|
312
|
+
},
|
|
313
|
+
],
|
|
314
|
+
|
|
315
|
+
// ──────────────────────────────────────────────
|
|
316
|
+
// SUPER PROPS (3) — on every event
|
|
317
|
+
// ──────────────────────────────────────────────
|
|
318
|
+
superProps: {
|
|
319
|
+
subscription_tier: pickAWinner(["starter", "growth", "growth", "enterprise"]),
|
|
320
|
+
team_role: pickAWinner(["sales_rep", "sales_rep", "sales_rep", "sales_manager", "rev_ops", "marketing"]),
|
|
321
|
+
ai_agent_version: ["v1.0", "v1.0", "v1.5", "v1.5", "v1.5", "v2.0", "v2.0", "v2.0"],
|
|
322
|
+
},
|
|
323
|
+
|
|
324
|
+
// ──────────────────────────────────────────────
|
|
325
|
+
// USER PROPS (5)
|
|
326
|
+
// ──────────────────────────────────────────────
|
|
327
|
+
userProps: {
|
|
328
|
+
company_size: pickAWinner(["SMB", "mid_market", "enterprise"]),
|
|
329
|
+
industry: pickAWinner(["SaaS", "fintech", "healthcare", "e_commerce", "consulting", "manufacturing"]),
|
|
330
|
+
deals_in_pipeline: weighNumRange(2, 50, 0.3),
|
|
331
|
+
onboarding_cohort: ["Q1_2025", "Q2_2025", "Q3_2025", "Q4_2025"],
|
|
332
|
+
integrations_connected: weighNumRange(1, 8, 0.4),
|
|
333
|
+
},
|
|
334
|
+
|
|
335
|
+
// ──────────────────────────────────────────────
|
|
336
|
+
// GROUPS (1 group key)
|
|
337
|
+
// ──────────────────────────────────────────────
|
|
338
|
+
groupKeys: [
|
|
339
|
+
["company_id", 500],
|
|
340
|
+
],
|
|
341
|
+
|
|
342
|
+
groupProps: {
|
|
343
|
+
company_id: {
|
|
344
|
+
name: () => chance.company(),
|
|
345
|
+
industry: pickAWinner(["SaaS", "fintech", "healthcare", "e_commerce", "consulting", "manufacturing"]),
|
|
346
|
+
segment: ["SMB", "mid_market", "enterprise"],
|
|
347
|
+
arr: weighNumRange(10000, 500000, 0.2),
|
|
348
|
+
csm: () => chance.pickone(["Sarah Chen", "Marcus Johnson", "Priya Patel", "Alex Rivera", "Jordan Kim"]),
|
|
349
|
+
},
|
|
350
|
+
},
|
|
351
|
+
|
|
352
|
+
// ──────────────────────────────────────────────
|
|
353
|
+
// HOOK FUNCTION (8 hooks)
|
|
354
|
+
// ──────────────────────────────────────────────
|
|
355
|
+
hook: function (record, type, meta) {
|
|
356
|
+
const NOW = dayjs();
|
|
357
|
+
|
|
358
|
+
// ════════════════════════════════════════════
|
|
359
|
+
// HOOK 1 — AI Model Quality Evolution (EVENT)
|
|
360
|
+
// Meeting summary quality improves after day 60
|
|
361
|
+
// ════════════════════════════════════════════
|
|
362
|
+
// HOOK 2 — Personalization Drives Outcomes (EVENT)
|
|
363
|
+
// Higher personalization → better email outcomes
|
|
364
|
+
// ════════════════════════════════════════════
|
|
365
|
+
// HOOK 3 — Weekend Autonomous Agents (EVENT)
|
|
366
|
+
// AI works autonomously on weekends
|
|
367
|
+
// ════════════════════════════════════════════
|
|
368
|
+
// HOOK 4 — Deal Velocity by Tier (EVENT)
|
|
369
|
+
// Enterprise deals move faster through pipeline
|
|
370
|
+
// ════════════════════════════════════════════
|
|
371
|
+
if (type === "event") {
|
|
372
|
+
const EVENT_TIME = dayjs(record.time);
|
|
373
|
+
const QUALITY_INFLECTION = NOW.subtract(60, "day");
|
|
374
|
+
|
|
375
|
+
// Hook 1: AI Model Quality Evolution
|
|
376
|
+
if (record.event === "meeting summary generated") {
|
|
377
|
+
if (EVENT_TIME.isBefore(QUALITY_INFLECTION)) {
|
|
378
|
+
record.quality_score = Math.round(decimal(50, 72) * 10) / 10;
|
|
379
|
+
record.ai_model = "v1_base";
|
|
380
|
+
} else {
|
|
381
|
+
const daysSinceInflection = Math.min(60, EVENT_TIME.diff(QUALITY_INFLECTION, "day"));
|
|
382
|
+
const improvement = (daysSinceInflection / 60) * 0.15;
|
|
383
|
+
record.quality_score = Math.min(98, Math.round(decimal(75, 95) * (1 + improvement) * 10) / 10);
|
|
384
|
+
record.ai_model = "v2_enhanced";
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
// Hook 2: Personalization Drives Outcomes
|
|
389
|
+
if (record.event === "follow-up sent") {
|
|
390
|
+
const persScore = record.personalization_score || 50;
|
|
391
|
+
if (persScore > 70) {
|
|
392
|
+
record.email_outcome = chance.pickone(["opened", "opened", "opened", "clicked", "clicked", "replied", "replied"]);
|
|
393
|
+
record.personalization_level = "high";
|
|
394
|
+
} else if (persScore > 50) {
|
|
395
|
+
record.email_outcome = chance.pickone(["pending", "opened", "opened", "clicked", "bounced"]);
|
|
396
|
+
record.personalization_level = "medium";
|
|
397
|
+
} else {
|
|
398
|
+
record.email_outcome = chance.pickone(["pending", "pending", "bounced", "bounced", "opened"]);
|
|
399
|
+
record.personalization_level = "low";
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
// Hook 3: Weekend Autonomous Agents
|
|
404
|
+
if (record.event === "crm auto-updated") {
|
|
405
|
+
const eventDay = EVENT_TIME.day(); // 0=Sun, 6=Sat
|
|
406
|
+
if (eventDay === 0 || eventDay === 6) {
|
|
407
|
+
record.update_source = "ai_autonomous";
|
|
408
|
+
record.fields_updated = Math.max(record.fields_updated || 1, integer(3, 8));
|
|
409
|
+
} else {
|
|
410
|
+
record.update_source = chance.pickone(["ai_assisted", "ai_assisted", "ai_assisted", "ai_autonomous"]);
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
// Hook 4: Deal Velocity by Tier
|
|
415
|
+
if (record.event === "deal stage changed") {
|
|
416
|
+
const tier = record.subscription_tier;
|
|
417
|
+
if (tier === "enterprise") {
|
|
418
|
+
record.days_in_previous_stage = Math.max(1, Math.round((record.days_in_previous_stage || 15) * decimal(0.5, 0.8)));
|
|
419
|
+
record.velocity_category = "fast";
|
|
420
|
+
} else if (tier === "starter") {
|
|
421
|
+
record.days_in_previous_stage = Math.round((record.days_in_previous_stage || 15) * decimal(1.3, 2.0));
|
|
422
|
+
record.velocity_category = "slow";
|
|
423
|
+
} else {
|
|
424
|
+
record.velocity_category = "normal";
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
// ════════════════════════════════════════════
|
|
430
|
+
// HOOK 5 — Power User + Integration Depth (USER)
|
|
431
|
+
// Tags users with engagement segments
|
|
432
|
+
// ════════════════════════════════════════════
|
|
433
|
+
if (type === "user") {
|
|
434
|
+
const intCount = record.integrations_connected || 1;
|
|
435
|
+
if (intCount >= 5) {
|
|
436
|
+
record.data_completeness_tier = "high";
|
|
437
|
+
} else if (intCount >= 3) {
|
|
438
|
+
record.data_completeness_tier = "medium";
|
|
439
|
+
} else {
|
|
440
|
+
record.data_completeness_tier = "low";
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
const tier = record.subscription_tier;
|
|
444
|
+
if (tier === "enterprise") {
|
|
445
|
+
record.user_segment = chance.pickone(["champion", "champion", "champion", "power_user", "standard"]);
|
|
446
|
+
} else if (tier === "growth") {
|
|
447
|
+
record.user_segment = chance.pickone(["champion", "power_user", "power_user", "standard", "standard"]);
|
|
448
|
+
} else {
|
|
449
|
+
record.user_segment = chance.pickone(["explorer", "explorer", "standard", "standard", "at_risk"]);
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
// ════════════════════════════════════════════
|
|
454
|
+
// HOOK 6 — Tier-Based Conversion (FUNNEL-PRE)
|
|
455
|
+
// Enterprise converts better, starter struggles
|
|
456
|
+
// ════════════════════════════════════════════
|
|
457
|
+
if (type === "funnel-pre") {
|
|
458
|
+
const tier = meta?.profile?.subscription_tier;
|
|
459
|
+
if (tier === "enterprise") {
|
|
460
|
+
record.conversionRate = Math.min(99, Math.round(record.conversionRate * decimal(1.2, 1.4)));
|
|
461
|
+
} else if (tier === "starter") {
|
|
462
|
+
record.conversionRate = Math.max(5, Math.round(record.conversionRate * decimal(0.6, 0.8)));
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
// ════════════════════════════════════════════
|
|
467
|
+
// HOOK 7 — Agent Adoption → Power Users (EVERYTHING)
|
|
468
|
+
// Early agent adoption predicts retention
|
|
469
|
+
// ════════════════════════════════════════════
|
|
470
|
+
// HOOK 8 — Negative Feedback → Disengagement (EVERYTHING)
|
|
471
|
+
// Repeated bad feedback predicts churn
|
|
472
|
+
// ════════════════════════════════════════════
|
|
473
|
+
if (type === "everything") {
|
|
474
|
+
if (!record.length) return record;
|
|
475
|
+
const userId = record[0].user_id || record[0].device_id;
|
|
476
|
+
if (!userId) return record;
|
|
477
|
+
|
|
478
|
+
// Hook 7: Agent Adoption → Power Users
|
|
479
|
+
const times = record.map(e => new Date(e.time).getTime()).filter(t => !isNaN(t));
|
|
480
|
+
if (times.length) {
|
|
481
|
+
const firstEventTime = dayjs(Math.min(...times));
|
|
482
|
+
const thirtyDayMark = firstEventTime.add(30, "day");
|
|
483
|
+
|
|
484
|
+
const earlyAgentDeploys = record.filter(e =>
|
|
485
|
+
e.event === "agent deployed" && dayjs(e.time).isBefore(thirtyDayMark)
|
|
486
|
+
).length;
|
|
487
|
+
const earlyMeetings = record.filter(e =>
|
|
488
|
+
e.event === "meeting joined" && dayjs(e.time).isBefore(thirtyDayMark)
|
|
489
|
+
).length;
|
|
490
|
+
|
|
491
|
+
if (earlyAgentDeploys >= 3 && earlyMeetings >= 5) {
|
|
492
|
+
record.push({
|
|
493
|
+
event: "power user milestone",
|
|
494
|
+
time: thirtyDayMark.add(integer(1, 48), "hour").toISOString(),
|
|
495
|
+
user_id: userId,
|
|
496
|
+
insert_id: uid(12),
|
|
497
|
+
milestone_type: "early_adopter",
|
|
498
|
+
agents_deployed: earlyAgentDeploys,
|
|
499
|
+
meetings_recorded: earlyMeetings,
|
|
500
|
+
});
|
|
501
|
+
} else if (earlyAgentDeploys < 1) {
|
|
502
|
+
record.push({
|
|
503
|
+
event: "churn risk flagged",
|
|
504
|
+
time: thirtyDayMark.add(integer(1, 72), "hour").toISOString(),
|
|
505
|
+
user_id: userId,
|
|
506
|
+
insert_id: uid(12),
|
|
507
|
+
risk_reason: "low_agent_adoption",
|
|
508
|
+
agents_deployed: earlyAgentDeploys,
|
|
509
|
+
});
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
// Hook 8: Negative Feedback → Disengagement
|
|
514
|
+
const negativeFeedbacks = record.filter(e =>
|
|
515
|
+
e.event === "agent feedback" && (e.rating === 1 || e.rating === 2)
|
|
516
|
+
).length;
|
|
517
|
+
|
|
518
|
+
if (negativeFeedbacks >= 3) {
|
|
519
|
+
const sortedByTime = [...record].sort((a, b) => new Date(a.time) - new Date(b.time));
|
|
520
|
+
const midpoint = Math.floor(sortedByTime.length * 0.6);
|
|
521
|
+
const cutoffTime = sortedByTime[midpoint]?.time;
|
|
522
|
+
|
|
523
|
+
if (cutoffTime) {
|
|
524
|
+
const filtered = record.filter(e => {
|
|
525
|
+
if (new Date(e.time) > new Date(cutoffTime)) {
|
|
526
|
+
return chance.bool({ likelihood: 40 });
|
|
527
|
+
}
|
|
528
|
+
return true;
|
|
529
|
+
});
|
|
530
|
+
record.length = 0;
|
|
531
|
+
record.push(...filtered);
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
return record;
|
|
537
|
+
},
|
|
538
|
+
};
|
|
539
|
+
|
|
540
|
+
export default config;
|
|
541
|
+
|
|
542
|
+
/**
|
|
543
|
+
* ═══════════════════════════════════════════════════════════════════
|
|
544
|
+
* CLINCH AGI — DATASET DOCUMENTATION
|
|
545
|
+
* ═══════════════════════════════════════════════════════════════════
|
|
546
|
+
*
|
|
547
|
+
* OVERVIEW
|
|
548
|
+
* --------
|
|
549
|
+
* This dungeon generates ~120,000 events across 1,000 users over 120 days,
|
|
550
|
+
* simulating Clinch AGI — an AI-native workflow automation platform for
|
|
551
|
+
* sales and go-to-market teams. The data models core product behaviors:
|
|
552
|
+
* AI meeting assistants, automated CRM updates, pipeline intelligence,
|
|
553
|
+
* personalized outreach, and AI coaching.
|
|
554
|
+
*
|
|
555
|
+
* 200 companies are generated as group analytics entities.
|
|
556
|
+
*
|
|
557
|
+
* HOOKS — 8 DELIBERATELY ARCHITECTED ANALYTICS PATTERNS
|
|
558
|
+
* ─────────────────────────────────────────────────────
|
|
559
|
+
*
|
|
560
|
+
* ┌──────┬────────────────────────────────┬────────────┬─────────────────────────────────────────────────┐
|
|
561
|
+
* │ Hook │ Name │ Type │ How to Find It in Mixpanel │
|
|
562
|
+
* ├──────┼────────────────────────────────┼────────────┼─────────────────────────────────────────────────┤
|
|
563
|
+
* │ 1 │ AI Model Quality Evolution │ event │ Insights → Line chart: avg(quality_score) on │
|
|
564
|
+
* │ │ │ │ "meeting summary generated" over time. │
|
|
565
|
+
* │ │ │ │ Clear inflection ~60 days ago. Breakdown by │
|
|
566
|
+
* │ │ │ │ ai_model shows v1_base vs v2_enhanced. │
|
|
567
|
+
* │ │ Real-world: Model improvement │ │ │
|
|
568
|
+
* │ │ after training data refinement │ │ │
|
|
569
|
+
* ├──────┼────────────────────────────────┼────────────┼─────────────────────────────────────────────────┤
|
|
570
|
+
* │ 2 │ Personalization Drives Results │ event │ Insights → Bar chart: "follow-up sent" broken │
|
|
571
|
+
* │ │ │ │ down by email_outcome, filtered by │
|
|
572
|
+
* │ │ │ │ personalization_level. High personalization has │
|
|
573
|
+
* │ │ │ │ 3x more replies vs low. │
|
|
574
|
+
* │ │ Real-world: AI effort → ROI │ │ │
|
|
575
|
+
* ├──────┼────────────────────────────────┼────────────┼─────────────────────────────────────────────────┤
|
|
576
|
+
* │ 3 │ Weekend Autonomous Agents │ event │ Insights → "crm auto-updated" broken down by │
|
|
577
|
+
* │ │ │ │ update_source, viewed by day of week. Weekends │
|
|
578
|
+
* │ │ │ │ are nearly 100% ai_autonomous with higher │
|
|
579
|
+
* │ │ │ │ fields_updated. AI works when humans rest. │
|
|
580
|
+
* │ │ Real-world: 24/7 AI coverage │ │ │
|
|
581
|
+
* ├──────┼────────────────────────────────┼────────────┼─────────────────────────────────────────────────┤
|
|
582
|
+
* │ 4 │ Deal Velocity by Tier │ event │ Insights → avg(days_in_previous_stage) on │
|
|
583
|
+
* │ │ │ │ "deal stage changed", broken down by │
|
|
584
|
+
* │ │ │ │ subscription_tier. Enterprise is 2x faster. │
|
|
585
|
+
* │ │ │ │ Also see velocity_category breakdown. │
|
|
586
|
+
* │ │ Real-world: Tier-driven ROI │ │ │
|
|
587
|
+
* ├──────┼────────────────────────────────┼────────────┼─────────────────────────────────────────────────┤
|
|
588
|
+
* │ 5 │ Power User + Integration Depth │ user │ Users → Breakdown by user_segment shows │
|
|
589
|
+
* │ │ │ │ champion/power_user/standard/explorer/at_risk. │
|
|
590
|
+
* │ │ │ │ Cross with data_completeness_tier to see │
|
|
591
|
+
* │ │ │ │ integration depth correlates with user quality. │
|
|
592
|
+
* │ │ Real-world: PQL scoring model │ │ │
|
|
593
|
+
* ├──────┼────────────────────────────────┼────────────┼─────────────────────────────────────────────────┤
|
|
594
|
+
* │ 6 │ Tier-Based Conversion │ funnel-pre │ Funnels → Any funnel broken down by │
|
|
595
|
+
* │ │ │ │ subscription_tier. Enterprise converts 1.3x │
|
|
596
|
+
* │ │ │ │ better; starter converts 0.7x worse. │
|
|
597
|
+
* │ │ Real-world: Segment activation │ │ │
|
|
598
|
+
* ├──────┼────────────────────────────────┼────────────┼─────────────────────────────────────────────────┤
|
|
599
|
+
* │ 7 │ Agent Adoption → Power Users │ everything │ Retention → Cohort by "power user milestone" │
|
|
600
|
+
* │ │ │ │ vs "churn risk flagged". Milestone users retain │
|
|
601
|
+
* │ │ │ │ at 3x the rate. Filter by agents_deployed to │
|
|
602
|
+
* │ │ │ │ see the adoption threshold. │
|
|
603
|
+
* │ │ Real-world: Aha moment │ │ │
|
|
604
|
+
* ├──────┼────────────────────────────────┼────────────┼─────────────────────────────────────────────────┤
|
|
605
|
+
* │ 8 │ Negative Feedback → Churn │ everything │ Retention → Segment by users who did │
|
|
606
|
+
* │ │ │ │ "agent feedback" with rating 1 or 2, >=3 times. │
|
|
607
|
+
* │ │ │ │ These users show steep engagement dropoff in │
|
|
608
|
+
* │ │ │ │ second half of their lifecycle. │
|
|
609
|
+
* │ │ Real-world: Churn prediction │ │ │
|
|
610
|
+
* └──────┴────────────────────────────────┴────────────┴─────────────────────────────────────────────────┘
|
|
611
|
+
*
|
|
612
|
+
* EXPECTED METRICS SUMMARY
|
|
613
|
+
* ────────────────────────
|
|
614
|
+
* │ Metric │ Expected Range │
|
|
615
|
+
* │ Total events │ ~120,000 │
|
|
616
|
+
* │ Unique users │ ~1,000 │
|
|
617
|
+
* │ Companies (groups) │ 200 │
|
|
618
|
+
* │ Avg quality_score (early) │ 50-72 │
|
|
619
|
+
* │ Avg quality_score (recent) │ 78-95 │
|
|
620
|
+
* │ Enterprise deal velocity │ 2-24 days avg │
|
|
621
|
+
* │ Starter deal velocity │ 15-120 days avg │
|
|
622
|
+
* │ Onboarding funnel conversion │ ~65% (enterprise ~85%) │
|
|
623
|
+
* │ Power user milestone rate │ ~15-25% of users │
|
|
624
|
+
* │ Churn risk flagged rate │ ~30-40% of users │
|
|
625
|
+
*
|
|
626
|
+
* CROSS-HOOK ANALYSIS IDEAS
|
|
627
|
+
* ─────────────────────────
|
|
628
|
+
* - Do power users (Hook 7) also have high data_completeness_tier (Hook 5)?
|
|
629
|
+
* - Does AI model improvement (Hook 1) correlate with better email outcomes (Hook 2)?
|
|
630
|
+
* - Do enterprise tier users (Hook 4, 6) generate more positive agent feedback (Hook 8)?
|
|
631
|
+
* - Is weekend autonomous behavior (Hook 3) more common for growth/enterprise tiers?
|
|
632
|
+
*/
|
package/dungeons/complex.js
CHANGED
|
@@ -8,12 +8,12 @@
|
|
|
8
8
|
|
|
9
9
|
import Chance from 'chance';
|
|
10
10
|
const chance = new Chance();
|
|
11
|
-
import { weighNumRange, date, integer } from
|
|
11
|
+
import { weighNumRange, date, integer } from "../lib/utils/utils.js";
|
|
12
12
|
import * as u from 'ak-tools';
|
|
13
13
|
|
|
14
14
|
/** @type {import('../types.js').Dungeon} */
|
|
15
15
|
const config = {
|
|
16
|
-
token: "",
|
|
16
|
+
token: process.env.MASTER_PROJECT_TOKEN || "",
|
|
17
17
|
seed: "quite complexus",
|
|
18
18
|
numDays: 30, //how many days worth of data
|
|
19
19
|
numEvents: 100_000, //how many events
|
|
@@ -33,6 +33,7 @@ const config = {
|
|
|
33
33
|
hasAdSpend: true,
|
|
34
34
|
|
|
35
35
|
hasAvatar: true,
|
|
36
|
+
makeChart: false,
|
|
36
37
|
|
|
37
38
|
batchSize: 500_000,
|
|
38
39
|
concurrency: 10,
|