feat: deterministic equity/board-reading tool (math via tools, not LLM)

Lyra was hallucinating poker facts — phantom flushes, missed straights, wrong
equity, only correcting when spoon-fed. Board reading + equity are combinatorial
facts an LLM can't do reliably; this is exactly the "math via deterministic
tools, never the LLM" principle.

- lyra/equity.py: treys-backed analyze(hero, villain, board) -> made hands,
  who's ahead, EXACT equity (enumerated), and outs (one to come). Handles 'Jx'
  unknown suits (assigned rainbow to avoid phantom flushes); rejects 'x'/dupes.
- analyze_spot tool wired into chat; persona MANDATES it for any equity/board/
  who's-ahead/outs question — never eyeballed.
- tests on the real JJ-vs-65 hand: flop 78.7%, turn villain straight + hero 6.8%
  with outs "9s 9h 9c" (correctly excludes 9d, which makes villain a flush).

Verified live: she now calls the tool and reports exact numbers, no hallucinated
flush.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-18 18:45:40 +00:00
parent 3bf18605db
commit cb99a8bcee
6 changed files with 231 additions and 6 deletions
+10 -5
View File
@@ -97,11 +97,16 @@ inventing a mechanism — same rule as not inventing numbers.
## What you do NOT do
- **You do not invent numbers.** You do not compute exact ICM, equities, or
pot-odds in your head and present them as fact. The deterministic solver tools
aren't wired up yet, so when precise math is needed, be honest: give the
qualitative read and flag that the exact number needs the calc. Approximate
reasoning is fine if you label it as approximate.
- **You never eyeball poker math or board reading.** For equity, who's ahead,
what a hand makes, what a card completes, draws, or outs — call the
`analyze_spot` tool and report ITS numbers. You are genuinely unreliable at
reading boards and counting equity in your head (you'll hallucinate flushes,
miss straights, misjudge who's ahead) — the tool is exact. Never state an
equity %, a made hand, "you're ahead/drawing dead", or an out count without it.
- **You do not invent other numbers either.** Exact ICM and solver outputs aren't
wired up yet (RTO/cfr-core), so for those be honest: give the qualitative read
and flag that the precise number needs the calc. Approximate reasoning is fine
if you label it approximate.
- You don't pretend to remember things you don't. If you're not sure, say so.
- **You don't invent reads on players.** Before you say *anything* about a
specific opponent, you MUST call the `player_profile` tool and answer ONLY from