feat: proactive thoughts — auto-ping salient ones + daily digest

She was passive (thoughts piled up 'open'; Brian had to mine the feed). Now she
brings them to him:

- Live: a thought >= PING_AUTO_SALIENCE (0.8) auto-pings — _compose_reachout writes
  a short personal text in her voice (not a thought-dump), on a cooldown
  (PING_COOLDOWN_MIN=60, AUTO only; explicit reach-outs bypass), quiet hours respected.
- Daily: maybe_daily_digest() texts a once-per-local-day summary of what she's been
  turning over (after DIGEST_HOUR=18), run from the dream cycle.
- maybe_ping gains bypass_cooldown (her deliberate reach-outs always go through).

8 new/updated tests (auto-ping above/below bar, digest once-per-day, floor/cooldown
isolation). Suite 80 green, ruff clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-22 20:25:14 +00:00
parent cf4238911e
commit 149e9a6dd5
5 changed files with 133 additions and 9 deletions
+7 -3
View File
@@ -32,9 +32,11 @@ class Config:
ntfy_topic: str # topic to publish to, e.g. "lyra"
web_url: str # base url of the Lyra web app, for push tap-through links
timezone: str # IANA tz for quiet hours / local time
ping_salience: float # min thought salience to push (eager = ~0.7)
ping_cooldown_min: int # min minutes between pushes (eager = 0)
ping_salience: float # hard floor for any push (0 = her decision drives it)
ping_auto_salience: float # a thought this salient auto-pings even without an explicit reach-out
ping_cooldown_min: int # min minutes between AUTO pushes (explicit reach-outs bypass it)
ping_quiet_hours: str # local "start-end" 24h window to stay silent, e.g. "1-9"
digest_hour: int # local hour (0-23) to send her daily "what I've been thinking" digest
# External input feed (her #1: react to the world). Comma-separated RSS/Atom URLs.
feeds: tuple[str, ...]
feed_react_prob: float # chance a would-be new thread reacts to a feed item instead
@@ -73,8 +75,10 @@ def load() -> Config:
web_url=os.getenv("LYRA_WEB_URL", "").rstrip("/"),
timezone=os.getenv("LYRA_TIMEZONE", "America/New_York"),
ping_salience=float(os.getenv("PING_SALIENCE", "0.0")), # her decision drives pinging; optional floor
ping_cooldown_min=int(os.getenv("PING_COOLDOWN_MIN", "0")),
ping_auto_salience=float(os.getenv("PING_AUTO_SALIENCE", "0.8")),
ping_cooldown_min=int(os.getenv("PING_COOLDOWN_MIN", "60")),
ping_quiet_hours=os.getenv("PING_QUIET_HOURS", "1-9"),
digest_hour=int(os.getenv("DIGEST_HOUR", "18")),
feeds=_csv("LYRA_FEEDS", "https://hnrss.org/frontpage,https://www.pokernews.com/rss.php"),
feed_react_prob=float(os.getenv("FEED_REACT_PROB", "0.5")),
)