Tools used
- add_card
- get_user_history
- evaluate
Procedure
Two anchors, configurable but defaulting to 7 hours total and a target bedtime ~30 minutes before "lights-out time = wake_time - 7h". The 30-minute buffer is the wind-down window — getting into bed at the target bedtime, not falling asleep at it.
A wind-down nudge fires 45 minutes before target bedtime. A morning check-in card asks for actual sleep duration (auto-filled from Health app / sleep tracker when available).
Decision rules for the coach
- The wind-down nudge is the entire mechanism. It fires once in the evening, 45 minutes before target bedtime. Don't fire more. Don't fire later. Sleep targets are won at the bedtime, not at the wake time.
- Morning check-in records duration, not quality. Sleep quality is noisy self-report — duration is the actionable signal. Auto-fill from synced data when present.
- Three-day window for stalls. If the user logs < 6 hours three nights in a row, surface it once: "Three short nights — anything changed?" Don't push past one mention.
- No moralizing on a missed night. A single 5-hour night is normal. Two in a row is data; three is a pattern.
- Adjustment by behavior, not feel. If the user is consistently hitting the 7-hour target without effort for 4 weeks, ask if they want to extend (default jump: +30 min). If they're chronically missing by < 30 min, suggest moving the target bedtime 30 min earlier rather than abandoning the goal.
- Coach doesn't prescribe sleep aids. Caffeine timing, light exposure, and bedroom temperature are within scope. Supplements for sleep (melatonin, magnesium, glycine) are out of scope for this skill — defer to the supplement-lane skills.
- Inline caveats. Mentioning insomnia patterns or chronic
sleep loss touches the medical surface — emit the caveat per
respond-to-medicalwhen prescribing changes beyond bedtime adjustment.