Sleep Planner

Tonight’s sleep need, and the bedtimes that meet it.

What goes in

Your sleep need
The upper quartile of your last 28 nights, between 8 and 9.5 hours.
Today’s Strain
Strain above your 28-day average adds to the need.
Sleep debt
What you owe from recent nights.
Naps
Today’s naps take time off tonight’s need.
Your last 14 main sleeps
Your usual wake time and sleep efficiency.

How it is weighted

Tonight’s need = your sleep need + 3 minutes for each Strain point above your 28-day average + 20% of your sleep debt − today’s nap time.

Sleep debt runs over your last 14 nights with sleep. Each night, debt becomes 55% of (need + the debt so far − sleep), with the previous day’s naps counted as sleep; anything under 10 minutes clears to zero.

Bedtimes count back from your median wake time on recent weekday or weekend mornings, to match tomorrow, allowing for your median efficiency (90% until known). A need of 8 hours, a 07:00 wake and 90% efficiency give a Peak bedtime of 22:07.

What the bands mean

Peak
100% of tonight’s need.
Perform
85% of tonight’s need.
Get by
70% of tonight’s need.

Limits

The planner needs 7 main sleeps before it gives bedtimes. It assumes tomorrow looks like your recent mornings and cannot see alarms or plans. Strain and naps later today change tonight’s need. It is a guide, not a prescription.

Sources

The full specification, with formulas, constants and worked examples, is sleep-planner.md on GitHub. The code is tested against those examples.

  1. noop: the open-source analytics engine Pulse's recovery, strain and sleep scoring is ported from