feat(prompting): Phase B step 2 — wire the sharded poker prompt into the pipeline

build_messages now shards poker_cash: injects poker_prompts.BASE + exactly ONE
fragment chosen by classify(user_msg, roster_handles), replacing the ~100-line
_CASH_CARD monolith. Roster handles are fetched fail-safe from the live session so
the READ-vs-HAND split is reliable. CASH.card set to "" (monolith kept only as the
distillation source, superseded). Other modes' single-card path unchanged.

Verified end-to-end: TAG-limp→READ, his-hand→HAND, table-broke→TABLE, tilt→MENTAL,
bare-stack→LOG, all with BASE always present. 5 injection/pipeline tests. Full
suite 196 green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-07-05 02:57:30 +00:00
parent 5380a00395
commit 338c44361f
3 changed files with 49 additions and 6 deletions
+29 -1
View File
@@ -74,4 +74,32 @@ def test_mode_menu_note_suppressed_in_poker(mind):
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
assert "Your modes:" in build # still present in a non-poker mode
# --- Phase B: sharded poker prompt (BASE + one fragment, no monolith) ---
def _poker_blob(mind, msg):
from lyra import modes
return " ".join(m["content"] for m in mind.build_messages("s1", msg, mode=modes.CASH)
if m["role"] == "system")
def test_poker_injects_base_plus_the_matching_fragment(mind):
blob = _poker_blob(mind, "I flopped a set with 99 on 9h4c2d and bet the turn")
assert "LOG FIRST" in blob # BASE is always on in poker
assert "MESSAGE TYPE: HAND" in blob # the fragment for THIS message
assert "MESSAGE TYPE: STATUS" not in blob # and not the others
assert "MESSAGE TYPE: READ" not in blob
def test_poker_fragment_changes_with_message_type(mind):
status = _poker_blob(mind, "it's 11:50pm, waiting for a seat")
assert "MESSAGE TYPE: STATUS" in status and "MESSAGE TYPE: HAND" not in status
def test_poker_monolith_no_longer_injected(mind):
from lyra import modes
blob = _poker_blob(mind, "stack 350")
assert "You move between two registers" not in blob # the old _CASH_CARD opener is gone
assert modes.CASH.card == "" # card sharded out