From ad1087e6305ac1554ca13d03259f9aa03bb3ec25 Mon Sep 17 00:00:00 2001 From: serversdown Date: Sat, 4 Jul 2026 23:25:16 +0000 Subject: [PATCH] =?UTF-8?q?feat(prompting):=20Phase=20A=20=E2=80=94=20supp?= =?UTF-8?q?ress=20the=20two=20mush=20sources=20in=20poker=20mode?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Per docs/superpowers/specs/2026-07-01-poker-prompts-design.md, Phase A. Two independent pipeline fixes that reduce mush at the table, ahead of the classifier: 1. _mode_menu_note is no longer injected in poker_cash — mid-session she should not be offering to switch modes. 2. _route skips the register/mood nudge in poker_cash — the lexicon heuristic misfired (neutral logistics like "table broke, 11:50pm" read as tilt/fatigue). Poker register will come from the Phase B MENTAL fragment instead. Non-poker modes keep the nudge unchanged. 2 tests. Full suite 180 green. Co-Authored-By: Claude Opus 4.8 (1M context) --- lyra/mind.py | 11 ++++++++++- tests/test_perceive.py | 23 ++++++++++++++++++++++- 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/lyra/mind.py b/lyra/mind.py index c91de57..8c0b90b 100644 --- a/lyra/mind.py +++ b/lyra/mind.py @@ -159,7 +159,10 @@ def build_messages(session_id: str, user_msg: str, # Mode awareness: she can offer to switch when the work clearly shifts (she decides # when — better than a keyword guess). One line, on his yes she calls set_mode. - messages.append({"role": "system", "content": _mode_menu_note(mode)}) + # Suppressed at the live table (poker_cash) — mid-session she shouldn't be offering + # to change modes; it's pure noise when the job is logging and coaching. + if not (mode and mode.key == "poker_cash"): + messages.append({"role": "system", "content": _mode_menu_note(mode)}) # Live ritual state (e.g. Alligator Blood ON) — dynamic, rides with the card. state_note = _mode_state_note(mode) @@ -337,6 +340,12 @@ def _route(ctx: TurnContext) -> TurnContext: a charged emotional moment adds a per-turn register nudge (deterministic). Most turns are neutral and get no note — that's the point (don't over-narrate).""" ctx.mode = modes.get(memory.get_session_mode(ctx.session_id)) + # At the live table the register comes from the poker prompt fragments (esp. the + # MENTAL one), not this lexicon nudge — which misfired, reading neutral logistics + # ("table broke, it's 11:50pm") as tilt/fatigue. Resolve the mode, but skip the + # register/note block in poker_cash. Non-poker modes keep the nudge unchanged. + if ctx.mode and ctx.mode.key == "poker_cash": + return ctx m = ctx.moment or {} note = None if m.get("tilt", 0) >= _TILT_BAR: diff --git a/tests/test_perceive.py b/tests/test_perceive.py index 51a3914..0a6f4b9 100644 --- a/tests/test_perceive.py +++ b/tests/test_perceive.py @@ -53,4 +53,25 @@ def test_route_injects_tilt_nudge(mind): def test_route_quiet_on_neutral_turn(mind): turn = mind.assemble("s1", "what did we decide about the schema yesterday?", "cloud", None) assert turn.register is None # neutral -> no nudge - assert not (turn.moment or {}).get("note") \ No newline at end of file + assert not (turn.moment or {}).get("note") + + +# --- Phase A pipeline fixes: poker mode suppresses the two mush sources --- + +def test_poker_mode_suppresses_tilt_nudge(mind): + from lyra import memory + memory.set_session_mode("s1", "poker_cash") + turn = mind.assemble("s1", "ugh I'm steaming, fucking coolered again!!", "cloud", None) + assert turn.register is None # at the table, register comes from fragments + sys_blob = " ".join(m["content"] for m in turn.messages if m["role"] == "system") + assert "on tilt" not in sys_blob.lower() # false-positive lexicon nudge suppressed + + +def test_mode_menu_note_suppressed_in_poker(mind): + from lyra import modes + poker = " ".join(m["content"] for m in mind.build_messages("s1", "stack 350", mode=modes.CASH) + if m["role"] == "system") + build = " ".join(m["content"] for m in mind.build_messages("s1", "let's refactor", mode=modes.get("build")) + if m["role"] == "system") + assert "Your modes:" not in poker # no "offer to switch" note at the table + assert "Your modes:" in build # still present in a non-poker mode \ No newline at end of file