How I get *almost* perfect sleep (without doing anything crazy)

David Shapiro
8 min readSep 22, 2024

--

I struggled with insomnia for years. Sleep is the keystone of good health (along with diet.) I hope to bestow the gift of good sleep on you.

Very Short Preamble

This is a departure from my normal topics of AI, technology, writing, and philosophy. The reason is because I believe that I have, over time, gleaned valuable insights to sleep and I want to share those.

For some proof, here’s my sleep data for the last 4 weeks.

With a few exceptions, you can see that my sleep score has been near 100 for almost a month straight. The dip a month ago was the intense course of antibiotics I was for H. pylori. The dips in the last week were due to OpenAI’s Strawberry.

Overview of My Strategy

For me, good sleep starts at around noon. Here’s a simple breakdown of everything I’ve learned over the last couple of years of working on my sleep.

For some background, during the worst of my burnout, I was operating on 5 to 6 hours of sleep every night, and getting a sleep score of 80 was a godsend. Most nights I was in the 60’s or 70’s. Today, if I’m not in the 90’s, I consider it an “off day.”

  1. It takes my brain a good 5+ hours to calm down, so I have a “hard stop” alarm set at 3PM. If I do any kind of intense mental work past this point, it destroys my ability to sleep. Generally, I try to stop working by noon. Keep in mind I usually get out of bed and start working at 6AM or 7AM.
  2. By 7PM or 8PM we’re in winding-down phase of the night. My wife and I generally watch a movie or TV show together, or just have a cozy hour with some light “coffee shop jazz” playing. I also try not to eat past 6PM or 7PM if I can help it.
  3. Bedtime, for me, is between 9PM and 10PM. This is scientifically grounded, as around 9:30PM seems to be the optimal time (on average), so in this respect, I’m a median human.
  4. I do melatonin (which honestly probably doesn’t help) and CBN oil (which is scientifically validated to improve sleep architecture).
  5. Sleep hygiene is important: a dark room, white noise generator, one red night light (red doesn’t interfere with circadian rhythms) and no screens in the bedroom.
  6. I usually wake up after one or two sleep cycles (90 minute phases of sleep) so I keep a half a glass of Dr. Bergs electrolyte drink on my nightstand, with some lemon in it. This helps me get back to sleep the rest of the night.

Mental Inertia: Slowing the flywheel

The first big thing I learned was about “inertia” which is often related to autism. They call it “autistic inertia” but also people with ADHD tend to have inertia as well. To borrow from Newton: A neurospicy person at rest will prefer to stay at rest, resisting any change to that status. A neurospicy person at work will prefer to stay at work, again resisting any effort to alter that state of being.

I tend to hyperfocus.

Long story short, this level of mental activity is not something that I can just switch on or off. It takes me hours of doing other stuff to get those high energy cycles out of my brain.

I have repeatedly tested the necessity of my “hard stop” rule. You can see in the data above, a few really awful nights of sleep in the last week. Those were nights that I made an exception and allowed myself to work on Raspberry (my open source version of OpenAI’s Strawberry) later into the day.

My big powerful brain is like an industrial flywheel. Once it gets up to speed, it does not want to slow down, and the brakes very quickly overheat.

Because of all this, I generally must get my intellectual work done early in the day and then spend the rest of the day doing other stuff. Watching movies with my wife, going hiking, playing Cyberpunk, and so on. I can’t even read books that are remotely stimulating, otherwise that flywheel starts turning again.

Coffee Shop Hour

After dinner is pretty much wind-down time for us. My wife stays up later than me, often spending a couple hours writing. She’s a night owl, so her prime creative time is in the late evening. However, we do spend the evening together most nights, often watching a period drama or some Star Trek. Other times we just have some nice light music on in the background. Below is our current favorite:

What’s most important at this time is:

  • No more eating. Digestion hurts sleep, plus it increases the risk of reflux. Bryan Johnson (the tech bro behind the “Don’t Die” movement) famously doesn’t eat past 11AM so that he’s not digesting at all. He boasts a 100 sleep score for the last 6 months straight. I’m not trying to get that good.
  • Light reading only. Anything technically engaging or germane to personal growth or my career is too stimulating. I might read a few pages of The Tragedy of Great Power Politics, which is understandably dry and a naturally self-terminating activity. After a few pages my brain is like “OMFG I get it, time to go to sleep!”
  • Low lights, dim screens. If we’re using spotify on the TV for music, we set it to dark mode. Turning most of the lights off allows the natural circadian rhythms to take over.

Basically, it feels like a slow, gradual slide into sleep time.

Bedtime Rituals

Regular bedtime rituals, I think, are more important than people realize. Take your meds, brush your teeth, etc. Sure. But my wife and I always have a brief check-in with each other. Sometimes we trade massages, or at least snuggle a bit and say good night. It might sound a little childish, but it’s very nice to have that regular loving connection and it seems to help with sleep.

Beyond the normal stuff, I have a litany of other little things I do:

  1. Plug my phone in my office. I learned a long time ago that having a phone in the bedroom is just no good. So my phone sleeps in my office.
  2. Noise generator on. The only electronics I have in the bedroom is my Sony portable speaker, which serves as my noise generator. I use an app on my phone, connected by bluetooth. The sound profile I made for sleep is called Box Fan/Gray Noise, which my wife insists is a great name for a black ambient metal band.
  3. Lights off, except the night light. I prefer to sleep in pitch black but my wife wanted a night light in case she wakes up, and to help navigate. The compromise was a red night light, which has minimal impact on sleep.
  4. Fan on. Circulating air is helpful, particularly for those of us who run hot.

I have a bunch of other stuff that may or may not be relevant. For instance, we have an extra firm mattress that we put a 3 inch memory foam topper on. I also got a fancy memory foam pillow and a 20 pound weighted blanket. Other than physical comfort, I don’t think any of those directly improved my sleep duration or architecture.

Below is my actual sleep data from last night.

“Sleep architecture” is the natural variation between the normal phases of sleep, including light, deep, and REM. Good sleep is supposed to be front-end loaded with deep, switching between light and deep, then switching between REM and light later. (BTW, this was my sleep last night as of writing this article: over 10 hours of sleep, sleep score of 96, over 2 hours of deep restorative sleep)

The two things that really improved sleep architecture for me were adding CBN oil (a cousin of CBD) as well as the electrolyte drink, which is like super-gatorade.

I’ve mentioned the electrolyte drink a few times, which is critical. I stumbled upon this entirely by accident. I was increasing my protein intake at the recommendation of my dietician, and that threw off my electrolytes (it takes time for your metabolism and kidneys to adapt to a sharp rise in protein intake) so I kept some electrolytes handy to stay hydrated.

That also dramatically improved my sleep. So now, just in case I wake up, I keep the drink handy.

This is the exact drink I use. I add some real lemon juice (helps with the kidneys) and this puts me right back to sleep. My doctor suspects it’s because of the magnesium, but magnesium on its own doesn’t really help.

TLDR

Unless you’re Bryan Johnson with millions of dollars and can completely rearrange your life around perfect health, then his protocol might not work for you.

However, I’m just an ordinary guy who had sleep trouble. I have had, in my life, both kinds of insomnia (delayed onset and terminal). Terminal insomnia is in some ways the worst because you might start off the night with a great sleep cycle. I got to the point where I could reliably fall asleep. However, staying asleep was much harder. I didn’t want to use potentially addictive drugs with side effects either.

Insomnia is hell.

8 months straight of perfect sleep… we should all be so lucky

Checklist to Follow

There’s only two things you probably need to buy:

  1. CBN oil
  2. Dr. Berg’s sports electrolytes (other brands don’t seem to work due to the balance of electrolytes)

From there, there’s just a few steps to good sleep (at least in my case)

  1. Start winding down your day by 3pm
  2. Stop eating by 6pm or 7pm
  3. Switch to a mellow vibe the last hour or two before bed
  4. Have a cozy bedtime ritual
  5. Take the CBN oil right before bed
  6. Keep the electrolyte drink handy just in case you wake up

--

--