Understanding the dynamic neural mechanisms of sleep-wake cycles is a major challenge in sleep science and neuroengineering.