Sleep gains a depth: the wake threshold rides FLP-11 and the unspent pressure - #207
Merged
Merged
Conversation
…pressure Arousability across a real bout is graded, not flat -- thresholds rise as sleep deepens and fall again near its natural end (Nichols et al. 2017). Both halves of that curve were already in the homeostat's state: FLP-11 is slow to accumulate, so the bout's start is shallow, and the discharged pressure is spent by the bout's end, so its close is shallow again. Depth is their product, and the wake threshold is arousal_touch plus arousal_depth times that -- no new state integrated, and exactly zero in an animal that has never slept, which keeps the never-slept trajectory bit-identical. Measured on the shipped clock the threshold runs 0.74 -> 1.13 -> 0.86 at 2/20/35 s into a bout. The new behaviour test pins the curve and the inversion it buys: a gentle prod (delivering ~0.95 summed touch) wakes the dozing ends of a bout and rolls off its deep middle, while the canonical hard prod (3.0, delivering ~1.7 within 0.3 s) always wakes -- a depth that defended sleep against emergencies would be paralysis, and the margin is checked at the compressed-clock fixture's operating point too (threshold 1.35 there). The flat baseline this replaces woke at every instant of a bout at any strength >= 1.0, measured before the change. Ported to the WASM runtime in the same change (the depth term in the sleep cascade, arousal_depth in the payload); the conformance sleep scenario still sleeps and still wakes, and the port reproduces Python to 5e-13 mm / 6e-11 mV. Closes #204. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CBroMXcYdfkyb5buJPcKvL
YesterdaysLemon
marked this pull request as ready for review
August 26, 2026 20:28
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #204.
What
Arousability across a real sleep bout is graded, not flat — thresholds rise as the bout deepens and fall again near its natural end (Nichols et al. 2017, graded arousability across sleep in C. elegans). The model's arousal was a hard constant: measured before this change, a poke at any strength ≥ 1.0 woke the animal at every instant of a bout, identically.
The mechanism (no new state)
Both halves of the depth curve were already in the homeostat's state:
flp11_tau), so the bout's start is shallow — the depth on the way in;depth = flp11 × clip((pressure − threshold_off)/(threshold_on − threshold_off)), and the wake threshold isarousal_touch + arousal_depth·depth. Nothing new is integrated, and depth is exactly zero in an animal that has never slept — the never-slept trajectory stays bit-identical.Measured
On the shipped clock the threshold runs 0.74 → 1.13 → 0.86 at 2/20/35 s into a bout. The new behaviour test pins the curve and the inversion it buys:
Runtime parity
The depth term is ported into the WASM sleep cascade and
arousal_depthrides the payload. The conformance sleep scenario still sleeps and still wakes, and the port reproduces Python to 5e-13 mm / 6e-11 mV, multi-animal included.On the site: a deeply-asleep worm is now genuinely harder to wake than a dozing one. 💤
🤖 Generated with Claude Code
https://claude.ai/code/session_01CBroMXcYdfkyb5buJPcKvL
Generated by Claude Code