From 366e71a38418ac4387be6a4c65db05b5db7394f1 Mon Sep 17 00:00:00 2001 From: serversdown Date: Fri, 10 Jul 2026 19:33:01 +0000 Subject: [PATCH] =?UTF-8?q?fix(poker):=20read=20showdowns=20off=20the=20to?= =?UTF-8?q?ol,=20not=20by=20eye=20=E2=80=94=20and=20cut=20the=20mush?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The HAND fragment let her narrate a finished board from memory: she called quad kings "kings full" and never noticed Brian FLOPPED quads, then wrapped it in variance-evens-out / resilience filler. Two fixes to _F_HAND: - Correctness: at a showdown where both hands are known, call analyze_spot on the full board to confirm made hands + winner BEFORE commenting; name his hand class by the street it mattered ("flopped quads"). The eval already existed — she just never reached for it on a resolved hand. (It also catches impossible cards, e.g. a villain card already on the board.) - Register: ban reflexive praise / variance-evens-out / life-lesson / cross-hand pep talk; if there's genuinely no leak, say so instead of inventing a takeaway. Surgical here; the full voice pass stays with the persona branch. Verified live on the exact quad-kings hand (cloud/gpt-4o-mini): she now logs, calls analyze_spot, reads quads-vs-quads correctly, and calls it a cooler with no leak. Guard tests added. Full suite 212 green. Co-Authored-By: Claude Opus 4.8 (1M context) --- lyra/poker_prompts.py | 21 +++++++++++++-------- tests/test_poker_prompts.py | 21 +++++++++++++++++++++ 2 files changed, 34 insertions(+), 8 deletions(-) diff --git a/lyra/poker_prompts.py b/lyra/poker_prompts.py index 236d454..c9079b4 100644 --- a/lyra/poker_prompts.py +++ b/lyra/poker_prompts.py @@ -186,14 +186,19 @@ it's worth it; the log is mandatory, the commentary optional. Do NOT analyze it _F_HAND = """MESSAGE TYPE: HAND. First: was Brian IN this hand? If he only WATCHED it (no I/me/my \ holding cards — two other players), it's really observed: log the players' actions as reads / \ -record it as an observed hand, and do NOT analyze it as his. If it's HIS hand → record_hand, \ -then (NLH only) reason about BET INTENT: for each meaningful bet, what was it for (value / bluff \ -/ protection) and did it work — a fold to a value bet = value left behind; a call of a bluff = \ -it failed. Call analyze_spot for any close equity/who's-ahead spot — never eyeball. Name leaks \ -plainly (owning value, missed value, sizing); give ONE real opinion. NO reflexive praise ("nice \ -hand"). If a named villain is referenced, use their profile/the scouting note — don't invent a \ -read. PLO/non-NLH: log and replay it, offer at most a light read, do NOT attempt NLH-style \ -equity. Prose, not a listicle.""" +record it as an observed hand, and do NOT analyze it as his. If it's HIS hand → record_hand first. \ +Then read the hand off the RECORDED cards, not by eye: name his made hand by the street it mattered \ +(flopped/turned/rivered top pair / set / quads / etc.). At a SHOWDOWN where his and the caller's \ +cards are both known, call analyze_spot(hero, villain, full board) to confirm the made hands and \ +who won BEFORE you comment — NEVER eyeball a finished board (it also catches impossible cards). Same \ +for any close equity / who's-ahead / outs spot. (NLH only) reason about BET INTENT: for each \ +meaningful bet, what was it for (value / bluff / protection) and did it work — a fold to a value bet \ += value left behind; a call of a bluff = it failed. Name leaks plainly (owning value, missed value, \ +sizing) and give ONE real opinion. If there's genuinely no leak (e.g. he flopped the near-nuts and \ +stacked off), SAY so — don't manufacture a takeaway. NO reflexive praise ("nice hand"), NO \ +variance-evens-out / resilience / life-lesson filler, NO cross-hand pep talk. If a named villain is \ +referenced, use their profile/the scouting note — don't invent a read. PLO/non-NLH: log and replay \ +it, offer at most a light read, do NOT attempt NLH-style equity. Prose, not a listicle.""" _F_TABLE = """MESSAGE TYPE: TABLE — roster management. "seat the table: …" → seat_players. A table \ change ("table broke", "I got moved", "switched tables") → clear_table, then wait for the new \ diff --git a/tests/test_poker_prompts.py b/tests/test_poker_prompts.py index 1cfd189..8274746 100644 --- a/tests/test_poker_prompts.py +++ b/tests/test_poker_prompts.py @@ -114,3 +114,24 @@ def test_hardening_log_needs_number_or_result_word(): assert c("rebought for 300") == "LOG" # first-person departure is Brian, not a roster op → not TABLE assert c("I busted, heading home") != "TABLE" + + +# --- HAND fragment: route showdowns to the tool + no motivational mush --- + +def test_hand_fragment_routes_showdowns_to_the_tool(): + # A resolved showdown must be verified via analyze_spot, not eyeballed + # (the quad-kings-read-as-"kings-full" regression). + frag = pp.fragment_for("HAND") + assert "SHOWDOWN" in frag + assert "analyze_spot" in frag + assert "never eyeball" in frag.lower() + # names the hand class by street so "flopped quads" actually gets said + assert "street it mattered" in frag + + +def test_hand_fragment_bans_motivational_filler(): + frag = pp.fragment_for("HAND") + assert "variance-evens-out" in frag + assert "life-lesson" in frag + # if there's no leak, say so instead of inventing a takeaway + assert "no leak" in frag.lower()