Methodology
The rules, in the open.
CircaShift is a planning model. It is not a circadian lab and it does not know your melatonin curve. Every clock time on a plan comes from the rules below. Where a number is a judgment call, it says so.
What this is for
The tools are for healthy adults arranging sleep, light, naps, and caffeine around a shift. They do not diagnose shift work disorder, insomnia, or sleep apnea, and they are not a fitness-for-duty test. Medication and melatonin are not scheduled here. If sleep is poor most weeks, or you are drowsy while driving, that is a clinical problem.
Anchor sleep
After a night shift, the main sleep starts when you get home: shift end, plus the commute, plus 30 minutes to wind down. It runs for your sleep target, default 7.5 hours. The same window on consecutive nights is the point of an anchor — the clock gets one consistent daytime signal instead of a moving target.
If the next shift starts before that block can finish, the sleep is cut so you still have the commute and 45 minutes to get out the door. The plan says when that happens. A block under an hour is dropped and called out, because pretending a sleep exists is worse than showing the gap.
The 7.5-hour default sits inside the American Academy of Sleep Medicine and Sleep Research Society consensus that adults should sleep 7 or more hours on a regular basis. It is a planning target, not a prescription. You can set anything from 4 to 10 hours. Sleeping more than 9 hours on a regular basis is a separate question the consensus leaves with a clinician.
Days off: bridge or stay nocturnal
“Protect days off” is on by default. After the last night, the morning sleep is capped at 4 hours (or your target, if that is shorter). You get up, get afternoon light, and take a full sleep that night from 11:00 p.m. An optional 20-minute nap sits in the afternoon only when it can finish at least five hours before that bedtime.
This is a practical pattern so the first day off is usable. It is not a claim that one bridge sleep resets a circadian clock. Turn the switch off if you would rather keep the daytime anchor through the days off, which is the other common choice for people going straight back to nights.
Day shifts
Sleep is placed the night before. Wake time is shift start, minus the commute, minus 45 minutes. Bedtime is that wake time minus your sleep target. Morning light is the half hour after waking. A 20-minute nap at 1:30 p.m. is added when the shift still has two hours on either side of it.
Naps and sleep inertia
The pre-shift nap is 90 minutes, about one adult sleep cycle, and it ends two hours before the shift. The two hours are a buffer for sleep inertia — the grogginess after waking — plus the commute. NIOSH’s training for nurses describes inertia as often lasting 30 to 60 minutes, and longer when someone is short on sleep. A longer nap in the early morning, around 4 to 5 a.m., produced a longer fog in the research NIOSH summarizes. That is why the mid-shift nap is 20 minutes, placed at 3:30 a.m. only when that moment is at least two hours after the start and two hours before the end.
On a run of nights, the planner skips the 90-minute nap if anchor sleep ended within four hours of the next shift. You just woke up. Another nap stacked on that wake-up is not a plan.
NIOSH’s day-shift module is equally direct about the short nap: about 20 minutes, because sleeping longer is what brings the grogginess. The post-lunch nap follows that length.
Light
For night shifts, the first half of the shift is the bright-light block and the second half steps down to dimmer, warmer light where the job allows. From clock-out until you are in the dark bedroom, the plan calls for amber or blue-blocking glasses. The sleep itself is a blackout window: dark enough that the room does not read as morning.
That shape comes from the shift-work light literature, in particular the review by Burgess, Sharkey, and Eastman: bright light at work and a dark morning commute can move the clock in the useful direction, and ordinary morning sun pulls it back. CircaShift does not prescribe a lux dose, a light-box distance, or melatonin. A 10,000-lux box is listed as gear for workplaces that are simply dim. You do not stare at it.
NIOSH makes the alertness point in plainer language: bright light helps you stay awake, including between 3 and 5 a.m., and you do not have to look straight at the source. Day-shift plans put outdoor light in the first half hour after waking, which is the ordinary daytime signal.
Caffeine
Concentration after a dose is modeled as exponential decay:
remaining = dose × 0.5 ^ (hours / half-life)
The half-life bands are planning ranges, not a genotype test. NIOSH describes caffeine’s half-life as about 5 to 6 hours, and longer in some people. CircaShift uses 4 hours (fast), 5 hours (average), and 7 hours (slow) so a person who already knows they are wired at midnight can move the cutoff without pretending the app measured them.
The cutoff is the clock time when a dose would fall to about 50 mg at the start of the protected sleep:
hours before bed = half-life × log2(dose / 50)
Fifty milligrams is a planning target so a moderate dose is mostly gone. It is not a blood level from a guideline. The reason the cutoff moves with the dose is the Drake, Roehrs, Shambroom, and Roth study: 400 mg of caffeine at bedtime, 3 hours before bed, or 6 hours before bed all disturbed sleep, and the 6-hour dose still cost more than an hour of total sleep on an objective monitor. People did not always notice. A single “stop six hours before bed” rule is not enough for a large dose, and it is more than a cup of tea needs.
Drink presets are typical labeled amounts — about 95 mg for 8 ounces of drip coffee, in the neighborhood of the FDA’s 80–100 mg figure for that cup — and the dose field is editable because a “cup” is not a lab assay. If the dose is already under 50 mg, the tool says there is no cutoff.
Sleep debt
Debt is the sum of (target − hours) on days you actually logged, over the last 7 or 14 days. Unlogged days are blank. They are not treated as zero, because a missing entry is not a sleepless night. Surplus on long nights is shown separately from shortfall. Recovery text asks for an extra hour or a 90-minute nap, then for two protected sleeps, and it tells you to talk with a clinician when the hole is deep or repeating. It never suggests repaying the week in one sleep.
Calendar file
Exports are iCalendar files as specified in RFC 5545: VCALENDAR version 2.0, Gregorian, oneVEVENT per block, folded at 75 octets, with commas and semicolons escaped. Times are floating local times (no Z, no timezone id) so a 7:00 p.m. shift stays 7:00 p.m. when you import it into Google Calendar or Apple Calendar. A caffeine cutoff is a 15-minute event so it is visible on the grid.
What is deliberately left out
- Melatonin timing and dose. The Eastman-group papers study it. This app does not tell you to take it.
- A personal phase estimate. Without dim-light melatonin onset or a validated diary model, a phase angle would be theater.
- Fitness for duty. A green bar on the debt chart is not clearance to drive or to work a safety-critical post.
- Alcohol as a sleep aid. It is not in the plan.
Sources
- National Institute for Occupational Safety and Health. NIOSH Training for Nurses on Shift Work and Long Work Hours.Module 6, caffeine and preparing for sleep; Module 6, using light; Module 7, sleep inertia; Module 8, day-shift alertness. Centers for Disease Control and Prevention.Caffeine,prepare for sleep,light,sleep inertia,day shift.
- Burgess HJ, Sharkey KM, Eastman CI. Bright light, dark and melatonin can promote circadian adaptation in night shift workers.Sleep Medicine Reviews. 2002;6(5):407–420. doi:10.1053/smrv.2001.0215.PubMed 12531129.
- Drake C, Roehrs T, Shambroom J, Roth T. Caffeine effects on sleep taken 0, 3, or 6 hours before going to bed.Journal of Clinical Sleep Medicine. 2013;9(11):1195–1200. doi:10.5664/jcsm.3170.PMC3805807.
- Watson NF, Badr MS, Belenky G, et al. Recommended amount of sleep for a healthy adult: a joint consensus statement of the American Academy of Sleep Medicine and Sleep Research Society.Sleep. 2015;38(6):843–844.PMC4434546.
- U.S. Food and Drug Administration. Spilling the beans: how much caffeine is too much.FDA consumer update. Used for the ballpark that an 8-ounce cup of coffee is often around 80–100 mg.
- RFC 5545. Internet Calendaring and Scheduling Core Object Specification (iCalendar).rfc-editor.org/rfc/rfc5545.