feat: thought loop closer to her vision — wander grist, continuity, seeding, lifecycle

Four additions so the loop is "more what she wanted" (think to herself, unprompted):

- Wander grist (#1): think() new-thread mode now draws the same varied seeds
  reflect() uses (self_state.wander_seed: own curiosity/existence/disagreement or
  a resurfaced memory) + an anti-restate block of her recent thoughts + a list of
  existing open-thread titles to avoid. Directly counters the RLHF "supportive
  presence serving Brian" drift visible in her first thoughts.
- Continuity: thoughts.context_note() injects her active threads into every chat
  turn, so she's aware of her own ongoing mind and can reference it anytime — not
  only when a thought crosses the surface bar.
- Bidirectional: new think_about tool (in _BASE, all modes) lets her spawn a
  thread from conversation to develop on her own later. Conversations seed her
  solo thinking.
- Lifecycle: thoughts.decay() rests stale active threads (>48h) and decays their
  salience, sparing pending-response ones; runs each dream cycle (no LLM). Frees
  the open-thread cap and keeps the feed current.

Also: thoughts feed no longer wipes a reply you're mid-composing (skip poll
re-render while a textarea is focused/non-empty; force-refresh after send).

61 tests passing, ruff clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-21 23:28:15 +00:00
parent 5176c706b6
commit 951788f9ec
8 changed files with 215 additions and 12 deletions
+7
View File
@@ -206,6 +206,13 @@ def _idle_focus() -> str:
return random.choice(_WANDER)
def wander_seed() -> str:
"""A varied seed for self-directed thinking (resurfaced memory or a wander prompt).
Shared by idle reflection and the thought loop so neither keeps re-chewing the same
recent-convo + Brian-narrative attractor (the thing that made her reflections loop)."""
return _idle_focus()
def reflect(backend: Backend | None = None, session_id: str | None = None,
source: str = "manual") -> dict:
"""Reflect on recent activity and update the self-state. Returns new state.