feat: she can suggest + switch modes (set_mode tool + mode awareness)

"She suggests, you confirm" — instead of brittle keyword→mode mapping, she's given
awareness of her modes + the ability to switch, and her judgment decides when to
offer (the model reads "should I drive to Cleveland?" vs "should I fold the river"
far better than a lexicon could).

- tools: set_mode(mode) — switches the session's mode; in _BASE (all modes).
- mind: a per-turn mode-menu note listing her modes + "offer a switch when the work
  clearly shifts; on his yes, call set_mode; don't nag."
- Sticky mode stays manual otherwise; Poker still auto-engages on session start.
- test: set_mode switches + rejects unknown. Suite 97 green, ruff clean.

Note: server-side switch takes effect next turn; the UI badge syncs on next mode
load (cosmetic lag).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-24 16:32:42 +00:00
parent 17ab95dc98
commit 8a3c9b2701
4 changed files with 49 additions and 1 deletions
+10
View File
@@ -47,6 +47,16 @@ def test_every_mode_tool_exists(lyra):
assert set(mode.tools) <= set(tools.TOOLS), f"{mode.key} references unknown tools"
def test_set_mode_tool_switches_session(lyra):
memory, _, _, tools = lyra
memory.ensure_session("s1")
out = tools.dispatch("set_mode", {"mode": "decide"}, {"session_id": "s1"})
assert "Decide" in out and memory.get_session_mode("s1") == "decide"
# unknown mode is handled, session unchanged
assert "unknown" in tools.dispatch("set_mode", {"mode": "nope"}, {"session_id": "s1"}).lower()
assert memory.get_session_mode("s1") == "decide"
def test_work_modes_present_and_gated(lyra):
_, _, modes, tools = lyra
# the full set Brian chose