Behind the algorithm

How Reliefr detects stress

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

The empirical anchor

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.

+20 bpm
Heart-rate jump during a mental arithmetic task — our medium-sensitivity threshold
TSST, Allen et al. 2014
+25 bpm
Jump during a public-speaking task — what our low-sensitivity setting catches
Petrowski et al. 2021
8,452
Healthy adults across 171 TSST studies in the meta-analysis we calibrated to
Psychoneuroendocrinology, 2025
~30 min
How long heart rate stays elevated post-stressor — why we wait 60 min after exercise
Kudielka et al., Springer

Part 1 · Inputs

Three signals from Health Connect

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

Two ways to get the baseline wrong

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

+20 bpm above awake calm

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

What it looks like in practice

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 athlete4256 (42+14)7676Yes
Recreational fit5869 (58+11)8989Yes
Sedentary office7078 (70+8)9898Yes

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

Workouts get a pass

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

Best effort, not a clinical instrument

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

Everything stays on your device

Read locally, never uploaded

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

Why humor in the first place?

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

References

Every citation on this page links to the original peer-reviewed source.

  1. Allen AP, Kennedy PJ, Cryan JF, Dinan TG, Clarke G. Biological and psychological markers of stress in humans: Focus on the Trier Social Stress Test. Neuroscience & Biobehavioral Reviews (2014). pmc.ncbi.nlm.nih.gov
  2. Helminen E et al. Physiological and psychological responses to acute stress: A meta-analysis of 171 studies of the Trier Social Stress Test including 8,452 healthy adults. Psychoneuroendocrinology (2025). sciencedirect.com
  3. Petrowski K, Schmalbach B, Kliem S, Hinz A, Brähler E. The Trier Social Stress Test elevates blood pressure, heart rate, and anxiety, but a singing test or unsolvable anagrams only elevate heart rate, among healthy young adults. Journal — Psych (2021). mdpi.com
  4. Kudielka BM, Buske-Kirschbaum A, Hellhammer DH, Kirschbaum C. Differential heart rate reactivity and recovery after psychosocial stress (TSST) in healthy children, younger adults, and elderly adults: The impact of age and gender. International Journal of Behavioral Medicine. link.springer.com
  5. Schubert C, Lambertz M, Nelesen RA, Bardwell W, Choi JB, Dimsdale JE. The persistent effect of acute psychosocial stress on heart rate variability. EXCLI Journal. pmc.ncbi.nlm.nih.gov
  6. Kim HG, Cheon EJ, Bai DS, Lee YH, Koo BH. Stress and heart rate variability: A meta-analysis and review of the literature. Psychiatry Investigation (2018). pmc.ncbi.nlm.nih.gov
  7. Gonzales TI, Westgate K, Strain T, Hollidge S, Jeon J, Christensen DL, Jensen J, Wareham NJ, Brage S. Resting heart rate as a biomarker for tracking change in cardiorespiratory fitness of UK adults: the Fenland Study. Population-based study, n=10,865. pmc.ncbi.nlm.nih.gov