Behind the algorithm
An honest look at what's under the hood.
If you've enabled the "When stressed" toggle, the app reads heart-rate signals from Health Connect to figure out when you might genuinely need a laugh. This page walks through how that works — what we read, why we read it, and why the obvious approach is wrong.
At a glance
Numbers we calibrated against. All from peer-reviewed acute-stress research, primarily the Trier Social Stress Test (TSST) — the gold-standard laboratory paradigm for inducing psychological stress.
Part 1 · Inputs
Health Connect is Android's privacy-respecting bridge between fitness apps. When you grant Reliefr permission, the algorithm reads three things from it:
Every read happens locally on your device. None of these numbers are uploaded, stored on a server, or shared. They're held in process memory just long enough to make one decision, then discarded.
Part 2 · The trap
The percentage trap. The intuitive approach is: "flag stress when current HR is more than 30% above resting." This is what a lot of older stress trackers did. It sounds reasonable, and it's quietly broken for anyone whose resting heart rate isn't average.
Take an endurance athlete with a resting HR of 42 bpm. Just sitting upright at a desk pushes their HR to 55 — already 31% above baseline. The percentage model fires constantly. A sedentary user with RHR 70 doesn't trigger until they hit 91. Same algorithm, wildly different sensitivities, both wrong.
The wrong-baseline trap. Switching to an absolute offset (say, +20 bpm) is the right structural move — sympathetic nervous system activation produces a roughly user-independent jump in heart rate, not a fractional change. But there's still a baseline question: above what?
The sleep-derived resting heart rate your wearable reports is the lowest HR during sleep — typically 10-25 bpm below your normal awake-sedentary state. The Fenland Study measured awake-seated HR at 67.6 bpm vs sleeping HR at 56.9 bpm in the same 10,865 subjects, and the gap scales with fitness: athletes have larger awake-vs-sleep deltas.7 Comparing a TSST-derived +20 bpm offset directly to sleep RHR therefore over-triggers for fit users (their normal upright HR already crosses the line) and under-triggers slightly for sedentary users.
The fix is to estimate the user's awake-sedentary baseline from their sleep resting plus a fitness-scaled gap, then apply the TSST offset above that. The +20 bpm TSST figure was always measured against awake-seated rest in the laboratory — this just lines up the comparison with the literature the offsets came from.
Part 3 · The science
The Trier Social Stress Test (TSST) is the most widely-validated laboratory paradigm for inducing acute psychological stress. Across 171 studies covering 8,452 healthy adults — every age, sex, fitness level, and ethnicity studied — the heart-rate response is remarkably consistent.1 2
| Stressor task | Mean HR increase above awake-seated baseline |
|---|---|
| Mental arithmetic challenge | +20 bpm |
| Public speaking task | +25 bpm |
| Combined TSST protocol | +26 bpm (mean across all studies) |
That's not a percentage — it's a fixed bpm jump that holds for athletes, office workers, students, and retirees alike. The effect size in healthy adults is 0.96, which in research terms means the response is universal: virtually everyone reacts.3
Crucially, in every one of those studies the +20 bpm was measured from a seated 5-minute pre-task baseline — awake calm, not sleep. That's the comparison point Reliefr now uses. Medium sensitivity fires when your recent average sits +20 bpm above your estimated awake baseline — calibrated to the same response a researcher would observe when subjects do mental arithmetic in the lab. Low sensitivity raises that to +25 (only fires on heavier reactions). High sensitivity drops it to +15 (catches mild stress).
Your awake baseline is estimated from your sleep resting heart rate plus a population-norm gap (from the Fenland Study7) that scales with fitness:
| Your sleep resting HR | Estimated awake-sedentary gap |
|---|---|
| under 50 bpm (athletic) | +14 bpm |
| 50-59 bpm (fit) | +11 bpm |
| 60-69 bpm (average) | +10 bpm |
| 70+ bpm (sedentary / older) | +8 bpm |
Athletes get a larger gap than sedentary users — which is exactly how the underlying physiology works. Fitter people have more parasympathetic dominance at rest and a larger sympathetic activation when upright.
Part 4 · Walk-through
Three users hitting the same actual stress level (mental arithmetic during a tough meeting, medium sensitivity = +20):
| User | Sleep RHR | Awake baseline | Threshold | Their HR during stress | Fires? |
|---|---|---|---|---|---|
| Endurance athlete | 42 | 56 (42+14) | 76 | 76 | Yes |
| Recreational fit | 58 | 69 (58+11) | 89 | 89 | Yes |
| Sedentary office | 70 | 78 (70+8) | 98 | 98 | Yes |
Same physiological event. Same algorithm. Different absolute numbers because the people are different — and the awake-vs-sleep gap is factored in, so a normal upright office HR of 60 bpm no longer trips the athlete's threshold the way it did under earlier versions of this algorithm.
Part 5 · The recovery rule
Heart rate doesn't snap back to resting the moment you stop exercising. Across the same body of acute-stress research, post-stressor HR remains elevated for up to 30 minutes after the stressor ends.4 Exercise recovery follows a similar curve, often longer.
So if your last workout finished within the last 60 minutes, Reliefr deliberately skips stress evaluation entirely. The trade-off is conscious — better to miss a real stress moment during a bike ride than fire a "you seem stressed" joke when you just left the gym and your heart is still cooling down.
The algorithm also drops any HR sample above your resting + 40 bpm from the recent-window average. Walking briskly across the office is movement, not anxiety. Filtering out activity samples keeps the average honest about what your resting state actually looks like right now.
There's also a hard absolute floor: nothing fires below 70 bpm in the recent-window average, regardless of what the delta-from-baseline math says. Below 70 you're effectively not in sympathetic arousal — TSST post-stress HR sits at 78-82 bpm, and healthy seated awake rarely exceeds 70.
Part 6 · Honest limitations
Heart-rate-based stress detection running passively in the background isn't an instrument-grade signal. Caffeine, hurrying up a flight of stairs, an animated conversation, a tense email exchange — these can all elevate your heart rate enough to fire a delivery even when nothing about your day actually qualifies as stressful.
We accept that trade. The alternative is asking you to tell the app when you're stressed, which defeats the whole point of a passive trigger that just shows up when something might be going on. And — practically — getting an unexpected joke isn't the worst thing that can happen to your afternoon.
If a delivery feels wrong, dislike it on the card. The algorithm learns from your ratings and tunes what fires when.
Part 7 · Privacy
The full evaluation runs in process memory on your phone. Health Connect data is read, the decision is made, the data is discarded. Nothing about your heart rate, sleep, or workout history ever touches our servers.
If you ever want to see exactly what state the app holds about you, open Settings → Privacy → Your data in the app for a live inventory.
If you don't want any of this, just leave the "When stressed" toggle off. The app works fine with calendar-based or random-time delivery alone.
Read next
If you're curious about the broader research on humor, stress, and wellbeing — what the science actually says about laughing your way out of a hard moment — that's covered separately.
Sources
Every citation on this page links to the original peer-reviewed source.