Sleep Dream Replay

During wake, episodes accumulate — each tagged with a cycle and an emotional valence. During sleep, the agent samples episodes for replay, weighted by (|valence| + 0.05) × 0.5^(age/half_life): emotional + recent memories dream more often than calm + ancient ones. Sampled episodes’ SPOs flow back into working memory as dream-provenance fragments — the substrate from which the next day’s reasoning starts.

Current cycle: 0  ·  Episodes: 0
recency half-life 50
samples/sleep 3
Record episode at current cycle
/ /
val +0.50

Wake timeline (hover for SPO · click to inspect)

Episodes

No episodes yet.

Working memory — dream fragments

Sleep to populate.
awaiting first event
How it works. Two probabilities multiplied: emotional charge |valence| + 0.05 (the floor lets calm episodes still dream occasionally), and recency decay 0.5^(age/half_life) (each half_life ticks of age, the weight halves). The product is each episode’s sample weight; weighted random selection draws n with replacement, dedupes, and tops up uniformly. Sampled SPOs land in working memory tagged dream — they expire normally via the WM’s TTL, but while they’re live they bias the next reasoning pass toward salient past content.

Tie to Eddy. This is memory/episode_log.py:sample_dream plus the dream-replay step of cognition/sleep.py. The sleep cycle has more steps (WM sweep, saturation, axiom-formation, shape cascade); this lab isolates the sampling — the part that asks, of everything you’ve experienced, which memories the night will revisit. Salient + recent wins. Lab 14’s weight × rate decay shapes the facts; this lab’s (|val|+0.05) × 0.5^(age/h) shapes the episodes that re-enter awareness.