Personal Science Week - 260416 Sleep Food
How I used Claude to find a way to better sleep
Here at PSWeek, we write about sleep a lot because, well, who doesn’t like a good night’s rest? And if you believe in experiments, every night’s a new opportunity.
Now that I have an accurate HRV sensor (see PSWeek260409), I’ll describe some new ways I’ve been trying to optimize my sleep—and one surprising result from my data.
The Hypothesis I Didn’t Expect
I’ve known for years that I feel more rested all day when I wake up with a low resting heart rate. But how can I reliably get there? My first guess was magnesium—a common biohacker recommendation—because it seems connected to sleep in some people and latest blood magnesium tests showed I had, at best, average levels.
A good personal science rule of thumb is that when something works, it works, and you’ll notice a difference quickly. If you need to do a complicated statistical analysis to show an effect, well, there’s probably not much of an effect.
I noticed an immediate effect from the magnesium: diarrhea! Effect on sleep: not noticeable. Conclusion: not a good tradeoff.
After some additional searching, fortunately, I discovered that magnesium comes in many different forms. My gut issues went away immediately when I switched to magnesium bisglycinate (480mg). It can take a few weeks, though, for the body to absorb it enough to make a difference, so I figured that I might as well use that time to conduct a serious experiment. I started feeding weeks of detailed sleep, food, and activity data into a Claude project I’ve set up for my personal health.
After a week of this, an unexpected variable kept surfacing as the strongest predictor of my deep sleep duration: the amount of protein I ate the day before.
That, plus the type and intensity of exercise, seems to reliably affect my resting heart rate and how I feel the next morning.
How I Track All This
My setup combines several tools, each doing what it does best:
Sleep: Apple Watch (built-in sleep staging), plus a Polar H10 chest strap with the Kubios HRV app each morning. I put on the strap when I wake up, wait a few minutes for my body to settle, then run a 3-minute HRV reading. Kubios doesn’t have an export feature, so I just screenshot the result and show it to Claude.

Food: I use Grok for meal logging—it’s lightning-fast and I’ve prompted it to give me exactly the macronutrient breakdown I want. I’ll use a thread titled “April 9th” and come back to it each time I eat something. A typical entry: “½ cup Greek yogurt with a handful of pepitas.” At the end of the day, I paste Grok’s summary into Claude.
The AI workflow: This is where the true power comes in. I have a Claude project loaded with everything I can think of—blood test results, EHR records from clinic visits, optometrist and dental records, typical food diary, family history. At bedtime, I start a new thread, paste the day’s food log, and say I’m going to sleep. When I wake up, I share the Kubios screenshot and ask Claude to pull my Apple HealthKit data for the night, compare it to previous nights, and give me its analysis. I save a summary to Obsidian, and Claude consults that context the next time. Sleeping happens every night, so at that rate it doesn’t take long to build up a real dataset.
The Protein Signal
After 20 nights of tracking I learned that the variable that modulates N3 (deep sleep) duration most is dietary protein intake—and it’s not a subtle, linear dose-response. It’s closer to a step function with a threshold around 90g.
Last week provided a clean demonstration. Six consecutive nights, same bedtime, same supplements, same person. The only meaningful variation: prior-day activity load, diet, and the resulting sleep architecture.
Thursday night (Apr 10→11) was the best night of the week by nearly every metric—despite being the lowest-activity day (4,691 steps, half of Wednesday’s). It produced 52 minutes of N3 (the week’s high, +17 min above the mean), 96% sleep efficiency, only 14 minutes of wake-after-sleep-onset, and a resting heart rate of 55 bpm. I woke up feeling great. The dietary profile that day: high protein (~120g), simple meals (whey smoothie, pork, spinach salad, milk), dinner before 7 PM, no alcohol.
From the full 20-night dataset, here are the variables that seem to modulate my N3 duration, ranked by estimated effect:

Helpers: Adequate protein (>90g): +17 min. Rest day after a training block: +12 min. Total sleep time above 5.5 hours (a gate condition): +12 min. Resistance training same day: +7 min. Early dinner (before 7 PM): +6 min.
Hurters: Threshold-intensity exercise (Zone 3/4): −18 min. Low protein (<80g): −15 min. Late dinner (after 7 PM): −8 min.
Protein shows up as the largest lever in both directions—biggest helper when adequate, second-biggest hurter when deficient.
Why Might This Work?
The textbook explanation for diet and sleep is tryptophan: eat it, convert it to serotonin, then melatonin, then sleep better. But that story has problems. High-protein meals flood your blood with large neutral amino acids that compete with tryptophan for brain uptake, and only 1–2% of dietary tryptophan converts to brain serotonin anyway. Minor contributor at best.
A more compelling candidate is the GHRH pathway. Ask your own LLM to explain the details (or see this recent study in Cell), but the basic idea is that GHRH neurons modulate sleep architecture directly via circulating amino acids, and there’s a threshold involved. This would explain the step-function shape I see in my data. Below a protein threshold, the signaling system doesn’t fully engage, and N3 is suppressed. Above it, the system activates normally. It also explains why the best N3 nights cluster on days with both high protein AND prior resistance training—the brain monitors peripheral anabolic demand and adjusts accordingly.
My LLM also suggests other plausible mechanisms, each testable. For example, if it’s GHRH-driven, a bolus of high-protein whey 30 minutes before bed should acutely increase N3 independent of daytime intake. If it’s total anabolic demand, timing shouldn’t matter.
I’m testing those now.
The Skeptic’s Caveat
I should be clear about what this is and isn’t. It’s an n-of-1, 20-night observational dataset with a lot of confounders I can’t fully control. The “effect sizes” in my plots are estimates from my body, not from a randomized trial. Protein days might also be days when I ate better overall, or felt less stressed, or any number of other things.
And people’s bodies are dynamic. Even if this pattern is real today, it could shift as my training adapts, my diet changes, or I simply age another year. The history of personal science is full of interventions that “worked” for a while and then didn’t.
But that’s the point. The goal isn’t to discover a universal law—it’s to find what works for me right now, track it honestly, and update when the data says otherwise. Twenty nights of structured tracking with Claude as an analytical partner has already taught me more about my sleep than years of casually wearing a watch.
Personal Science Weekly Readings
Speaking of experiments with unexpected results, everyone knows that penicillin was discovered by ‘accident’, when an absent-minded Alexander Fleming left some mold out too long. A long Asimov article reviews the record and concludes it was actually a more deliberate search than he made it sound at the time. “Chance favors the prepared mind”.
An excellent Nature article Investigating the analytical robustness of the social and behavioural sciences, had hundreds of authors read academic papers and try to replicate them from the raw data. About half the replications got roughly the same results, but about 25% reached a different conclusion from the original.
Speaking of protein, a narrative review in Nutrients confirmed that higher-protein diets are associated with better objective sleep quality (more deep sleep, higher efficiency), though the mechanisms remain debated. Doherty et al., 2022 and higher-protein diets improved sleep quality scores in two randomized controlled trials of overweight adults. Interestingly, slow-wave sleep increased on the high-protein arm. Zhou et al., 2016
For previous PSWeek sleep experiments: I tested CBD (PSWeek241024—no effect), ProdromeGlia (PSWeek240111—significant deep sleep improvement), SleepScore sonar tracking (PSWeek251218), and compared AI research tools on my 3AM wakeup problem (PSWeek250612).
About Personal Science
Personal scientists approach sleep the way we approach everything: with open-minded skepticism and a willingness to experiment on ourselves. We track not because the numbers are perfect, but because tracking forces the attention that leads to insight.
We publish every Thursday. If you’ve found dietary patterns that affect your sleep, let us know.
