feat: split introspection backend from consolidation (trial Dolphin for her voice)

reflect()/think() can now run on a different model than memory consolidation:
INTROSPECTION_BACKEND / INTROSPECTION_MODEL (default to SUMMARY_BACKEND, so unset =
unchanged). Consolidation (summaries/profile/narrative) keeps the capable model;
her *voice* (reflections, thoughts) can run a steerable tune. dream.py lets
reflect()/think() self-resolve to the introspection backend; both now thread a
`model` override into llm.complete.

Trial live: introspection -> dolphin3:8b on the 3090; consolidation -> Qwen-32B
on the MI50. Suite 73 green, ruff clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-22 06:09:12 +00:00
parent c2cee3be4d
commit 05ae98abdb
6 changed files with 47 additions and 12 deletions
+18 -1
View File
@@ -30,7 +30,8 @@ def lyra(tmp_path, monkeypatch):
# Canned LLM: tests set `box["next"]` to the dict think() should "generate".
box = {"next": {}}
monkeypatch.setattr(thoughts.llm, "complete", lambda messages, backend=None: json.dumps(box["next"]))
monkeypatch.setattr(thoughts.llm, "complete",
lambda messages, backend=None, model=None: json.dumps(box["next"]))
# Keep the loop offline + silent by default: no feed fetch, no push.
monkeypatch.setattr(thoughts.feeds, "next_item", lambda **k: None)
monkeypatch.setattr(thoughts.notify, "push", lambda **k: False)
@@ -274,6 +275,22 @@ def test_ping_salience_floor_is_optional(lyra, monkeypatch):
assert th.maybe_ping(1, "hey", 0.8) is True
def test_think_routes_to_introspection_backend(lyra, monkeypatch):
_, th, box = lyra
monkeypatch.setenv("INTROSPECTION_BACKEND", "local")
monkeypatch.setenv("INTROSPECTION_MODEL", "dolphin3:8b")
seen = {}
def cap(messages, backend="local", model=None):
seen["backend"], seen["model"] = backend, model
return json.dumps(box["next"])
monkeypatch.setattr(th.llm, "complete", cap)
_gen(box, content="a thought")
th.think(force_mode="new")
assert seen["backend"] == "local" and seen["model"] == "dolphin3:8b"
def test_no_ping_without_ntfy(lyra, monkeypatch):
_, th, _ = lyra
sent = []