feat: session_state read tool so she can see the HUD

She could write everything the HUD shows but not read most of it back (stack,
live net, alligator state, scar/confidence entries) — so "what's my live net?"
or "what's in my confidence bank?" was a memory guess.

- session_state tool returns the same bundle the HUD renders, as a readable
  summary; added to the Cash toolset.
- Cash card tells her the HUD exists, that she and it share the same data, and to
  answer where-am-I questions from session_state, never memory.
- test_modes.py +1; 42 green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-19 23:16:40 +00:00
parent 974ee33f71
commit 35c973df05
3 changed files with 55 additions and 2 deletions
+30
View File
@@ -187,6 +187,29 @@ def _end_session(args: dict, ctx: dict) -> str:
return f"Session #{s['id']} closed — net {s['net']:+.0f} over {s['hours']}h{hourly}."
def _session_state(args: dict, ctx: dict) -> str:
h = poker.hud()
if not h:
return "No live session right now."
s, st, r = h["session"], h["stack"], h["rituals"]
L = [f"{s.get('stakes') or '?'} {s.get('game') or ''} @ {s.get('venue') or '?'} "
f"{h['stats']['hands_logged']} hands logged"]
if st.get("current") is not None:
L.append(f"Stack ${st['current']:g} (in {st['buy_in']:g}, live net {st['net']:+.0f})")
else:
L.append(f"Stack not logged yet (in {st['buy_in']:g})")
L.append("🐊 Alligator Blood is ON" if r["alligator"] else "Alligator Blood: off")
if r["confidence"]:
L.append("Confidence bank: " + " | ".join(c["content"] for c in r["confidence"][-4:]))
if r["scars"]:
L.append("Scar notes: " + " | ".join(
sc["content"] + (f" [{sc['classification']}]" if sc.get("classification") else "")
for sc in r["scars"][-4:]))
if r["resets"]:
L.append(f"{len(r['resets'])} reset(s) this session")
return "\n".join(L)
def _session_stats(args: dict, ctx: dict) -> str:
st = poker.session_stats()
if not st:
@@ -402,6 +425,13 @@ TOOLS.update({
"session_stats": {"handler": _session_stats, "spec": _f(
"session_stats", "Get money + hand summary for the current/most-recent session.",
{}, [])},
"session_state": {"handler": _session_state, "spec": _f(
"session_state",
"Read back the CURRENT live-session state — the same data Brian sees on his HUD: "
"stack, live net, whether Alligator Blood is on, and the scar notes / "
"confidence-bank entries so far. Use whenever he asks where he's at, what's in "
"the bank, his stack or net, or if gator mode is on — answer from THIS, not memory.",
{}, [])},
"running_stats": {"handler": _running_stats, "spec": _f(
"running_stats",
"Cumulative results across closed sessions (net, $/hr, by stake). Optionally filter.",