feat: dream cycle — drives-driven unattended consolidation + reflection

Lyra's inner loop for when no one's talking to her. Each pass senses her own
backlog/novelty, lets four drives build from real signals, and acts on those
past threshold:
- continuity -> summarize sessions with new turns
- coherence  -> rebuild profile/eras/narrative (stale once new gists land)
- curiosity  -> reflect() and evolve the self-state
- stability  -> readout of how caught-up she ended up

Drives are rendered into chat context so she can feel them. Causal chain:
consolidation creates gists -> coherence rises -> integration fires next.

- lyra/dream.py: dream_cycle() + lyra-dream CLI (--force, --loop SECONDS)
- memory: backlog_stats(), profile_sessions_covered(), WAL + busy_timeout
  so a separate dream process coexists with the web server
- self_state: DEFAULT_DRIVES baseline + drives in render_for_context
- tests/test_dream.py: backlog sensing + a full forced pass (LLM stubbed)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-17 00:52:44 +00:00
parent f89849801b
commit 4f40e2d57e
5 changed files with 307 additions and 7 deletions
+1
View File
@@ -22,6 +22,7 @@ lyra-profile = "lyra.profile:main"
lyra-era = "lyra.era:main"
lyra-narrative = "lyra.narrative:main"
lyra-reflect = "lyra.self_state:main"
lyra-dream = "lyra.dream:main"
[dependency-groups]
dev = [