Sleep is one of the most consistently associated triggers in peer-reviewed migraine research. Both too little and too much sleep can precipitate attacks, and the pattern matters as much as the total duration. This page covers what the published cohorts show, the specific thresholds Hermly uses, and the asymmetric relationship between sleep and attack timing.
What the research consistently finds
Several large prospective cohort studies converge on the same relationship between sleep and migraine:
- Lateef 2024 (Neurology, n=477, 4×/day EMA) — lower average sleep quality and a same-day drop in sleep quality each independently predicted next-morning headache. The effect was larger for morning headaches than for later-day ones.
- Houle 2017 (HAPRED-I) — though the headline 2-feature model used only stress + current state, sleep was tested and contributed signal as an ancillary feature.
- Kapustynska 2024 — XGBoost on Empatica E4 wearable data ranked nocturnal sleep duration and efficiency among the top predictive features.
The takeaway: it’s not a marketing claim. Sleep-migraine association is one of the most replicated findings in headache prediction research.
The threshold Hermly uses
Hermly compares last night’s sleep against your 30-day rolling median rather than a one-size-fits-all “8 hours” target. Some people thrive on 6.5 hours; some need 9. What matters is the deviation from your own baseline.
- Sleep below 75 percent of baseline → contributes a “Sleep” factor to today’s risk. For a 7.5-hour baseline that threshold is roughly 5.6 hours.
- Sleep above 105 percent of baseline → flagged as a “protective” signal (rare but real — well-rested days carry slightly lower attack probability in cohort data).
- Sleep in the middle band → neutral; the card shows the value but contributes neither up nor down to risk.
A baseline takes ~14 days of HealthKit sleep data to stabilise. For new users, Hermly falls back to a population median (~7.5 hours) until enough personal data accumulates.
Why “irregular” matters as much as “short”
Weekend oversleeping — sleeping in by 2+ hours on weekends after short weekday nights — is a recognised migraine pattern. The mechanism is likely circadian disruption: the timing of sleep matters as much as the duration.
Hermly does not yet derive a “circadian regularity” score from HealthKit sleep timing (it’s on the v2 roadmap), but the same-day “sleep ratio” signal partially captures it. A user who normally sleeps 11pm–7am and instead sleeps 2am–11am has a low sleep ratio on the morning after the disrupted night, even if total hours are similar.
What sleep tracking adds (beyond duration)
If you wear an Apple Watch to bed, Hermly reads more than just total time:
- Sleep efficiency — asleep time / total in-bed time. Drops in efficiency predict next-day headache independently of duration.
- Deep sleep fraction — proportion of total sleep in deep (slow-wave) stages. Low fractions correlate with poorer recovery.
- Wake-after-sleep-onset (WASO) — fragmentation matters; one 6-hour night with no wakings reads better than one with several awakenings.
If you don’t wear a Watch to bed but log sleep manually (or via another tracker that writes to HealthKit), Hermly reads the duration only. The model handles missing detail gracefully.
Asymmetric direction — sleep affects migraine, but migraine also affects sleep
The relationship runs both ways. A migraine attack often disrupts the next 1–2 nights of sleep (postdrome fatigue, residual photophobia, medication side effects). That creates a feedback loop where short post-attack sleep contributes to the next attack risk.
Hermly’s attacksPast30d and hadHeadacheLast36h features capture
the recent-attack-load context, so the model isn’t surprised when
a high-stress, post-attack week shows persistently short sleep.
What this isn’t
Not a sleep hygiene tutorial — there are good ones already (CBT-I resources, AASM guidelines). And not a recommendation to take sleep medication during a forecast spike — that’s a real medical conversation about benzodiazepines, melatonin, prescription Z-drugs, or behavioural interventions, none of which Hermly will recommend.
What Hermly does is surface the correlation: when last night’s sleep is well below your baseline, the Today screen will say so, and the risk number will reflect it.