@ak--47/dungeon-master 1.4.1 → 1.4.3

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.
@@ -229,7 +229,7 @@ const communityIds = v.range(1, 30).map(() => `COMM_${v.uid(4)}`);
229
229
  * 8. PRO SUBSCRIBER CONTENT CREATION LIFT (everything hook)
230
230
  * -------------------------------------------------------------------
231
231
  *
232
- * PATTERN: Free-tier users drop 35% of final funnel step events
232
+ * PATTERN: Free-tier users drop 50% of final funnel step events
233
233
  * ("comment posted"), creating a visible conversion gap between
234
234
  * paid and free users. Pro/supporter users keep all their events.
235
235
  *
@@ -239,11 +239,77 @@ const communityIds = v.range(1, 30).map(() => `COMM_${v.uid(4)}`);
239
239
  * - Report type: Funnels
240
240
  * - Steps: "article viewed" -> "article published" -> "comment posted"
241
241
  * - Breakdown: "subscription_tier" (superProp)
242
- * - Expected: pro ~ 52% vs free ~ 35% conversion
242
+ * - Expected: pro ~ 52% vs free ~ 26% conversion (~2x gap)
243
243
  *
244
244
  * REAL-WORLD ANALOGUE: Premium wiki tools (analytics dashboards,
245
245
  * badge systems) incentivize more content creation from subscribers.
246
246
  *
247
+ * -------------------------------------------------------------------
248
+ * 9. CONTENT CREATION TIME-TO-CONVERT (funnel-post hook)
249
+ * -------------------------------------------------------------------
250
+ *
251
+ * PATTERN: Pro/supporter subscribers complete the Content Creation
252
+ * funnel 1.3x faster (time gaps scaled by 0.77). Free-tier users
253
+ * complete it 1.25x slower (gaps scaled by 1.25). The hook iterates
254
+ * over the funnel-post event array, compresses or stretches the
255
+ * inter-step time gaps based on the user's subscription_tier from
256
+ * meta.profile, then rewrites each event's timestamp.
257
+ *
258
+ * HOW TO FIND IT IN MIXPANEL:
259
+ *
260
+ * Report 1: Content Creation TTC by Subscription Tier
261
+ * - Report type: Funnels
262
+ * - Steps: "article viewed" -> "article published" -> "comment posted"
263
+ * - Breakdown: "subscription_tier" (superProp)
264
+ * - Metric: Median time to convert
265
+ * - Expected: pro/supporter median TTC ~ 0.77x of free-tier TTC
266
+ * (e.g., pro ~ 27h vs free ~ 45h)
267
+ *
268
+ * NOTE: This effect is visible ONLY in Mixpanel funnel median TTC.
269
+ * Cross-event MIN->MIN SQL queries on raw events do NOT show this
270
+ * because funnel-post mutates timestamps after event generation but
271
+ * before storage.
272
+ *
273
+ * REAL-WORLD ANALOGUE: Premium wiki contributors with analytics
274
+ * dashboards and streamlined tools move from reading to publishing
275
+ * faster; free users hesitate longer without feedback loops.
276
+ *
277
+ * -------------------------------------------------------------------
278
+ * 10. ARTICLE-PUBLISHED MAGIC NUMBER (everything hook)
279
+ * -------------------------------------------------------------------
280
+ *
281
+ * PATTERN: Users who published 2-5 articles sit in a "sweet spot" --
282
+ * all their upvote_count values on "upvote given" events are boosted
283
+ * by +35% (factor 1.35). Users who published 6+ articles trigger
284
+ * over-publishing fatigue: 25% of their "upvote given" events are
285
+ * dropped entirely. No flag is stamped -- discoverable only by
286
+ * binning users on article-published COUNT and comparing upvote
287
+ * totals or upvote event volume.
288
+ *
289
+ * HOW TO FIND IT IN MIXPANEL:
290
+ *
291
+ * Report 1: Upvote Count by Article Volume Cohort
292
+ * - Report type: Insights (with cohorts)
293
+ * - Cohort A: users who did "article published" 2-5 times
294
+ * - Cohort B: users who did "article published" 0-1 times
295
+ * - Event: "upvote given"
296
+ * - Measure: Average of "upvote_count"
297
+ * - Compare cohort A vs cohort B
298
+ * - Expected: cohort A ~ 1.35x higher avg upvote_count
299
+ *
300
+ * Report 2: Upvote Events per User by Article Volume
301
+ * - Report type: Insights (with cohorts)
302
+ * - Cohort C: users who did "article published" 6+ times
303
+ * - Cohort A: users who did "article published" 2-5 times
304
+ * - Event: "upvote given"
305
+ * - Measure: Total events per user
306
+ * - Compare cohort C vs cohort A
307
+ * - Expected: cohort C ~ 25% fewer upvote events per user
308
+ *
309
+ * REAL-WORLD ANALOGUE: Creators who publish a handful of quality
310
+ * articles earn outsized community engagement; over-publishers
311
+ * dilute their signal and get less traction per piece.
312
+ *
247
313
  * ===================================================================
248
314
  * EXPECTED METRICS SUMMARY
249
315
  * ===================================================================
@@ -257,7 +323,10 @@ const communityIds = v.range(1, 30).map(() => `COMM_${v.uid(4)}`);
257
323
  * Edit War Detection | edit_quality | 3.0 | 1.5 | 0.5x
258
324
  * Lurker Churn | events after day 10 | 100% | 40% | 0.4x
259
325
  * Creator Profiles | reputation_score | 25 | 90 | 3.6x
260
- * Pro Content Creation Lift | funnel conversion | 35% | 52% | ~1.5x
326
+ * Pro Content Creation Lift | funnel conversion | ~26% | 52% | ~2.0x
327
+ * Content Creation TTC | funnel median TTC | 1x | 0.77x | 1.3x faster (pro)
328
+ * Article-Published Magic Num | sweet upvote_count | 1x | 1.35x | +35%
329
+ * Article-Published Magic Num | over upvote events | 1x | 0.75x | -25%
261
330
  */
262
331
 
263
332
  /** @type {Config} */
@@ -768,11 +837,11 @@ const config = {
768
837
  }
769
838
 
770
839
  // -- HOOK 8: PRO SUBSCRIBER CONTENT CREATION LIFT ---------
771
- // Free-tier users drop 35% of final funnel step events to
772
- // create visible conversion gap vs paid subscribers.
840
+ // Free-tier users drop 50% of comment events to widen
841
+ // the gap to ~2.0x vs paid subscribers.
773
842
  if (profile.subscription_tier !== "pro" && profile.subscription_tier !== "supporter") {
774
843
  events = events.filter(e => {
775
- if (e.event === "comment posted" && chance.bool({ likelihood: 35 })) return false;
844
+ if (e.event === "comment posted" && chance.bool({ likelihood: 50 })) return false;
776
845
  return true;
777
846
  });
778
847
  }
@@ -46,7 +46,7 @@ const chance = u.initChance(SEED);
46
46
 
47
47
  /**
48
48
  * ===================================================================
49
- * ANALYTICS HOOKS (10 hooks)
49
+ * ANALYTICS HOOKS (11 hooks)
50
50
  * ===================================================================
51
51
  *
52
52
  * NOTE: All cohort effects are HIDDEN — no flag stamping. Discoverable
@@ -241,8 +241,9 @@ const chance = u.initChance(SEED);
241
241
  *
242
242
  * PATTERN: Users with 8-20 swaps in dataset get +30% on stake
243
243
  * amount_usd plus 1-2 extra cloned stake events per existing.
244
- * Users with 21+ swaps drop 40% of portfolio-viewed events
245
- * (over-active traders ignore portfolio review). No flag.
244
+ * Users with 21+ swaps drop 75% of portfolio-viewed events
245
+ * and halve total_value_usd on survivors (over-active traders
246
+ * ignore portfolio review). No flag.
246
247
  *
247
248
  * HOW TO FIND IT IN MIXPANEL:
248
249
  *
@@ -265,6 +266,34 @@ const chance = u.initChance(SEED);
265
266
  * REAL-WORLD ANALOGUE: Engaged swappers grow stake; over-active
266
267
  * day-traders ignore long-term portfolio review.
267
268
  *
269
+ * ---------------------------------------------------------------
270
+ * 11. EARLY STAKER RETENTION (everything — retention magic number)
271
+ *
272
+ * PATTERN: Born-in-dataset users with 2+ "stake" events in their
273
+ * first 10 days retain normally. Those with fewer than 2 early
274
+ * stakes lose 60% of post-day-40 events. No flag — discover via
275
+ * behavioral cohort on early stake count.
276
+ *
277
+ * HOW TO FIND IT IN MIXPANEL:
278
+ *
279
+ * Report 1: Retention by Early Stakers
280
+ * - Report type: Retention
281
+ * - Cohort A: users with >= 2 "stake" in first 10 days
282
+ * - Cohort B: users with 0-1 "stake" in first 10 days
283
+ * - Expected: A retains strongly; B drops ~60% after day 40
284
+ *
285
+ * Report 2: Post-Day-40 Event Volume by Cohort
286
+ * - Report type: Insights (with cohort)
287
+ * - Cohort A vs B (as above)
288
+ * - Event: any event
289
+ * - Measure: Total per user
290
+ * - Filter: date > day 40
291
+ * - Expected: A ~ 2.5x B in post-d40 volume
292
+ *
293
+ * REAL-WORLD ANALOGUE: Users who stake early have skin in the game
294
+ * and stick around; the "magic number" for retention is 2 stakes
295
+ * in the first 10 days.
296
+ *
268
297
  * ===================================================================
269
298
  * EXPECTED METRICS SUMMARY
270
299
  * ===================================================================
@@ -281,7 +310,8 @@ const chance = u.initChance(SEED);
281
310
  * Rug-Pull Aftermath | victim post-D70 | 1x | 0.2x | -80%
282
311
  * Trading T2C | median min by tier | 1x | 0.7x/1.3x | 1.86x range
283
312
  * Swap Magic Number | sweet stake amount | 1x | 1.3x | 1.3x
284
- * Swap Magic Number | over portfolio/user | 1x | 0.6x | -40%
313
+ * Swap Magic Number | over portfolio/user | 1x | 0.25x | -75%
314
+ * Early Staker Retain | post-d40 events (non) | 1x | 0.4x | -60%
285
315
  */
286
316
 
287
317
  // Token pairs used in swap events
@@ -778,8 +808,8 @@ const config = {
778
808
 
779
809
  // HOOK 10: SWAP-COUNT MAGIC NUMBER (no flags)
780
810
  // Sweet 8-20 swaps → +30% on stake amount_usd; clone 1-2 extra
781
- // stake events per existing. Over 21+ → drop 40% of portfolio
782
- // viewed events (over-active traders ignore their portfolio).
811
+ // stake events per existing. Over 21+ → drop 75% of portfolio viewed events and halve
812
+ // total_value_usd on survivors (overcomes H6 injection overlap).
783
813
  const swapCount = userEvents.filter(e => e.event === "swap").length;
784
814
  if (swapCount >= 8 && swapCount <= 20) {
785
815
  const stakeTemplate = userEvents.find(e => e.event === "stake");
@@ -798,9 +828,34 @@ const config = {
798
828
  });
799
829
  }
800
830
  } else if (swapCount >= 21) {
831
+ // Over-active traders ignore portfolio review.
832
+ // Drop aggressively (75%) to overcome H6 stake-to-retain injection,
833
+ // and halve total_value_usd on survivors to sharpen the signal.
801
834
  for (let i = userEvents.length - 1; i >= 0; i--) {
802
- if (userEvents[i].event === "portfolio viewed" && chance.bool({ likelihood: 40 })) {
803
- userEvents.splice(i, 1);
835
+ if (userEvents[i].event === "portfolio viewed") {
836
+ if (chance.bool({ likelihood: 75 })) {
837
+ userEvents.splice(i, 1);
838
+ } else {
839
+ userEvents[i].total_value_usd = Math.round((userEvents[i].total_value_usd || 5000) * 0.5);
840
+ }
841
+ }
842
+ }
843
+ }
844
+
845
+ // HOOK 11: EARLY STAKER RETENTION — users with 2+ "stake" events in first
846
+ // 10 days retain; others lose 60% of post-day-40 events.
847
+ if (meta.userIsBornInDataset) {
848
+ const firstT = userEvents[0]?.time;
849
+ if (firstT) {
850
+ const window10 = dayjs(firstT).add(10, 'days').toISOString();
851
+ const earlyStakes = userEvents.filter(e => e.event === 'stake' && e.time <= window10).length;
852
+ if (earlyStakes < 2) {
853
+ const cutoff = dayjs(firstT).add(40, 'days');
854
+ for (let i = userEvents.length - 1; i >= 0; i--) {
855
+ if (dayjs(userEvents[i].time).isAfter(cutoff) && chance.bool({ likelihood: 60 })) {
856
+ userEvents.splice(i, 1);
857
+ }
858
+ }
804
859
  }
805
860
  }
806
861
  }
@@ -48,7 +48,7 @@ const chance = u.initChance(SEED);
48
48
 
49
49
  /*
50
50
  * =====================================================================================
51
- * ANALYTICS HOOKS (9 hooks)
51
+ * ANALYTICS HOOKS (10 hooks)
52
52
  * =====================================================================================
53
53
  *
54
54
  * NOTE: All cohort effects are HIDDEN — no flag stamping. Discoverable via
@@ -81,7 +81,7 @@ const chance = u.initChance(SEED);
81
81
  * -------------------------------------------------------------------------------------
82
82
  * 2. WEEKEND SWIPE SURGE (everything)
83
83
  * -------------------------------------------------------------------------------------
84
- * PATTERN: Sunday swipes get heavy cloning (evening 4x, daytime 2x)
84
+ * PATTERN: Sunday swipes get heavy cloning (evening 5x, daytime 2x)
85
85
  * to overcome soup DOW weight deficit. No flag.
86
86
  *
87
87
  * HOW TO FIND IT IN MIXPANEL:
@@ -196,6 +196,22 @@ const chance = u.initChance(SEED);
196
196
  *
197
197
  * REAL-WORLD ANALOGUE: Premium notifications + boost surface matches faster.
198
198
  *
199
+ * -------------------------------------------------------------------------------------
200
+ * 10. AGE RANGE AFFECTS DATE CONVERSION (funnel-pre)
201
+ * -------------------------------------------------------------------------------------
202
+ * PATTERN: On the Date Funnel (message sent → phone number exchanged →
203
+ * date scheduled), users aged 25-34 convert at 1.3x baseline; 40+ at 0.6x.
204
+ * Scoped to the funnel containing "date scheduled".
205
+ *
206
+ * HOW TO FIND IT IN MIXPANEL:
207
+ * Report 1: Date Funnel Conversion by Age Range
208
+ * - Funnels > "message sent" → "phone number exchanged" → "date scheduled"
209
+ * - Breakdown: age_range
210
+ * - Expected: 25-29 / 30-34 ~ 1.3x baseline; 40+ ~ 0.6x
211
+ *
212
+ * REAL-WORLD ANALOGUE: Peak dating age ranges convert faster to in-person
213
+ * dates; older users are more selective.
214
+ *
199
215
  * =====================================================================================
200
216
  * EXPECTED METRICS SUMMARY
201
217
  * =====================================================================================
@@ -212,6 +228,8 @@ const chance = u.initChance(SEED);
212
228
  * Valentine's Day Spike | signups days 58-63 | 1x | 3x | 3x
213
229
  * Off-App Retention | D30 retention | ~ 20% | ~ 60% | 3x
214
230
  * Match Flow T2C | median min by tier | 1x | 0.71x/1.4x| ~ 2x range
231
+ * Age Range Date Conv | date funnel 25-34 | 1x | 1.3x | 1.3x
232
+ * Age Range Date Conv | date funnel 40+ | 1x | 0.6x | 0.6x
215
233
  */
216
234
 
217
235
  /** @type {Config} */
@@ -453,6 +471,20 @@ const config = {
453
471
 
454
472
  hook: function (record, type, meta) {
455
473
 
474
+ // HOOK 10: AGE RANGE AFFECTS DATE CONVERSION (funnel-pre)
475
+ // 25-29 / 30-34 convert 1.3x on the date funnel; 40+ at 0.6x.
476
+ if (type === "funnel-pre") {
477
+ const isDateFunnel = meta.funnel?.sequence?.includes("date scheduled");
478
+ if (isDateFunnel) {
479
+ const age = meta.profile?.age_range;
480
+ if (age === "25-29" || age === "30-34") {
481
+ record.conversionRate = Math.min(95, Math.round(record.conversionRate * 1.3));
482
+ } else if (age === "40+") {
483
+ record.conversionRate = Math.round(record.conversionRate * 0.6);
484
+ }
485
+ }
486
+ }
487
+
456
488
  // HOOK 9 (T2C): MATCH FLOW TIME-TO-CONVERT (funnel-post)
457
489
  // Elite users complete swipe→match→message funnel 1.4x faster
458
490
  // (factor 0.71); Free users 1.4x slower (factor 1.4).
@@ -550,7 +582,7 @@ const config = {
550
582
 
551
583
  // HOOK 2: WEEKEND SWIPE SURGE — Sunday swipes get heavy cloning
552
584
  // to overcome the soup DOW weight deficit. Evening swipes (18-23)
553
- // get 4 clones; daytime Sunday swipes get 2 clones.
585
+ // get 5 clones; daytime Sunday swipes get 2 clones.
554
586
  // No flag — discover via day-of-week chart.
555
587
  for (let idx = events.length - 1; idx >= 0; idx--) {
556
588
  const event = events[idx];
@@ -558,7 +590,7 @@ const config = {
558
590
  const dow = new Date(event.time).getUTCDay();
559
591
  if (dow === 0) {
560
592
  const hr = new Date(event.time).getUTCHours();
561
- const clones = (hr >= 18 && hr <= 23) ? 4 : 2;
593
+ const clones = (hr >= 18 && hr <= 23) ? 5 : 2;
562
594
  const etime = dayjs(event.time);
563
595
  for (let c = 0; c < clones; c++) {
564
596
  events.push({
@@ -261,6 +261,30 @@ const repoIds = v.range(1, 150).map(() => `REPO_${v.uid(6)}`);
261
261
  * REAL-WORLD ANALOGUE: Healthy CI cadence drives reliable deploys;
262
262
  * runaway builds signal a flaky pipeline that scares teams off ships.
263
263
  *
264
+ * ---------------------------------------------------------------
265
+ * 10. BUILD-DEPLOY TIME-TO-CONVERT (funnel-post)
266
+ * ---------------------------------------------------------------
267
+ *
268
+ * PATTERN: Enterprise and business tier users complete the Build-Deploy
269
+ * Pipeline funnel (build completed -> deployment completed -> monitoring
270
+ * dashboard viewed) 1.5x faster (factor 0.67). Free-tier users complete
271
+ * it 1.33x slower (factor 1.33). The hook intercepts funnel-post arrays,
272
+ * computes the time gap between consecutive steps, and scales each gap
273
+ * by the tier-specific factor before rewriting the step timestamps.
274
+ *
275
+ * HOW TO FIND IT IN MIXPANEL:
276
+ *
277
+ * Report 1: Build-Deploy Pipeline Median TTC by Tier
278
+ * - Report type: Funnels
279
+ * - Steps: "build completed" -> "deployment completed" -> "monitoring dashboard viewed"
280
+ * - Measure: Median time to convert
281
+ * - Breakdown: "subscription_tier" (superProp)
282
+ * - Expected: enterprise/business ~ 0.67x baseline; free ~ 1.33x baseline
283
+ *
284
+ * REAL-WORLD ANALOGUE: Enterprise CI/CD customers get priority build
285
+ * runners and dedicated deploy infrastructure, yielding faster
286
+ * end-to-end pipeline throughput.
287
+ *
264
288
  * ===============================================================
265
289
  * EXPECTED METRICS SUMMARY
266
290
  * ===============================================================
@@ -277,6 +301,7 @@ const repoIds = v.range(1, 150).map(() => `REPO_${v.uid(6)}`);
277
301
  * Enterprise Funnel Lift | funnel conversion | 40% | 60% | ~ 1.5x
278
302
  * Build-Count Magic Number | sweet deploys/user | 1x | 1.3x | 1.3x
279
303
  * Build-Count Magic Number | over deploys/user | 1x | 0.75x | -25%
304
+ * Build-Deploy TTC | median TTC by tier | 1x | 0.67/1.33x| ~ 2x range
280
305
  */
281
306
 
282
307
  /** @type {Config} */