Simulation · Swift
The new engine nudged every overdue friend within 4 days; the old rules took up to 80
A Swift package that picks which friends to remind you about and when to send each reminder, played out over one simulated year against a re-implementation of the rules it replaces.
Synthetic: 40 invented contactsOne seed (42) for the comparisonOld rules re-implemented from a description
New engine vs the old rules
Against the old rules, the longest wait in each ring drops from 48 / 80 / 54 days to 2 / 3 / 4
The old rules capped how high an overdue friend's priority could climb and let snoozes last forever, so some contacts waited weeks. The engine keeps raising priority and keeps at most one reminder per contact.
Every ring's worst case falls from weeks to days
Longest wait (days), including episodes still open at year end · seed 42 · cap 3 · quiet 22:00–08:00
One seed, rebuilt baseline. This comparison is a single simulated year (seed 42), and the old rules were re-implemented from a description, not the original code. Read it as a check of the rules, not a measurement of the old app.
Quiet hours
With quiet hours that don't cross midnight, the old planner delivered 82 of 244 nudges inside them
The page uses two quiet windows on purpose. The default, 22:00–08:00, crosses midnight; there the old planner put 2 of 238 nudges inside quiet hours and the engine none of 608. The old planner's arithmetic assumes the window crosses midnight, so the second window, 01:00–07:00, is a stress test that does not.
With quiet hours 01:00–07:00, only the old planner delivers inside the shaded band
Nudges delivered per hour of day over one year · seed 42 · cap 3
New engine · 0 of 638 inside
Old rules · 82 of 244 inside
Choosing the daily cap
At cap 3, 90 % of waits end within 1 day; raising the cap adds few nudges
Pooled over 20 seeds (42–61), the inner ring's p90 wait is 17 days at cap 1 and 1 day at cap 3. From cap 3 up, no ring's p90 exceeds 1 day, while nudges per day rise only from 1.70 to 1.72.
Waits fall steeply up to cap 3, then flatten
20 seeds × 365 days per cap · quiet 22:00–08:00
p90 wait by ring
Nudges sent per day
Explore one cap
At every cap from 1 to 10, the engine delivers nothing inside quiet hours
Choose a cap to see its waits and delivery times for seed 42.
Waits and delivery times at the selected cap
Wait from overdue to nudge (days)
Deliveries by hour, quiet 22:00–08:00 shaded
Methodology
How the simulation works
Each run plays 365 days of 2026 in America/Los_Angeles for 40 invented contacts in four rings. Inner, close and outer friends fall overdue after 10, 20 and 40 days without contact; distant friends never do. The simulated user opens the app once a day at a random minute and replies to a nudge with probability 0.6.
The engine and the old rules see the same contacts and random draws. The old rules: a hard cap of 3, drift priority capped at 80, no per-contact dedupe, snoozes that never expire, and delivery times computed on one calendar day, which assumes quiet hours cross midnight. They were re-implemented from a description, not the original code.
The comparison and the cap views use seed 42. The cap sweep reruns seeds 42–61 at every cap and pools the waits before taking p90. CI reruns the simulation and checks that results.json matches byte for byte.
What this shows
- On one synthetic year (seed 42, cap 3), the engine's longest wait is 4 days against 80 days for the re-implemented old rules.
- At seed 42, the engine never delivered inside quiet hours at any cap, nor with a window that doesn't cross midnight.
- Pooled over 20 seeds, cap 3 keeps the inner ring's p90 wait at 1 day, against 17 days at cap 1.
What it doesn't show
- Real friend groups: contacts, reply and snooze rates are invented.
- How the shipped old app behaved: its rules were re-implemented from a description.
- Seed-to-seed spread of the before/after table, which comes from one seed.
- Spread across the 20 sweep seeds: waits are pooled before taking p90.
Reproduce
Run it yourself
git clone https://github.com/allenwang0/nudge-scheduler.git
cd nudge-scheduler
swift build
swift test
swift run -c release nudge-sim --seed 42 --out site # about 55 sNeeds Swift 6 (Xcode 16 or later). No dependencies. Raw output: results.json.
Simulation settings · 10 rows
| Setting | Value |
|---|---|
| Seed (comparison, cap views) | 42 |
| Seeds (cap sweep) | 42–61 |
| Simulated span | 365 days of 2026, America/Los_Angeles |
| Contacts | 40 invented (5 inner, 10 close, 15 outer, 10 distant) |
| Reply probability | 0.6 |
| Default quiet hours | 22:00–08:00 |
| Stress quiet hours | 01:00–07:00 |
| Old rules | hard cap 3, drift priority capped at 80, no per-contact dedupe, snoozes never expire, same-day window arithmetic |
| Generated from commit | d3bf9244fe8c |
| Data | site/results.json |