feat: session modes (Talk/Cash) + live session HUD

Lyra now switches register based on what she's doing at the table instead of
being a wishy-washy companion mid-session.

Modes (lyra/modes.py):
- Talk (default companion) + Cash (live cash copilot); a mode = prompt card +
  tool allow-list. Tool gating via tools.specs(allow=).
- Two-register Cash voice: act-first one-line logging when fed facts; full warm
  companion voice for strategy / tilt / mental game.
- mode persisted per chat session (new sessions.mode column); auto-switch into
  Cash when start_session fires; UI forces cloud backend in Cash (tools only
  fire there).

Stack tracking + HUD:
- log_stack tool + poker_stack_log table; live net while sitting (stack - buy-in).
- poker.hud() bundle; /session HUD page (stack sparkline, hands, villains, notes,
  stats) polling /session/data every 5s; Talk/Cash switcher + Session nav.

Endpoints: /session, /session/data, GET/POST /sessions/{id}/mode, /modes.
tests/test_modes.py (gating, mode roundtrip, stack/HUD); 36 tests green. v0.3.0.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-19 05:28:15 +00:00
parent d9f5055ec1
commit dfb6425395
14 changed files with 829 additions and 32 deletions
+30
View File
@@ -1,5 +1,35 @@
# Changelog
## 0.3.0 — session modes + live HUD
Lyra stopped being a wishy-washy companion during live poker. She now switches
register based on what she's actually doing at the table.
### Conversation modes
- **Two modes** — 💬 **Talk** (the companion, default) and ♠ **Cash** (live cash
copilot). A mode bundles a prompt card + a tool allow-list (`lyra/modes.py`).
- **Two-register Cash voice** — quiet, act-first logging when Brian feeds facts
(stack, hand, read → logged in one line, no narration); full warm companion
voice when he asks for strategy or signals tilt/card-dead/steaming. Mental game
and strategy never get clipped.
- **Tool gating by mode** — Talk offers journaling + read-only poker lookups;
Cash unlocks the full live toolset. `tools.specs(allow=…)` does the filtering.
- **Auto-switch** — opening a session (`start_session`) flips the chat into Cash
mode automatically; the UI badge/HUD follow. Manual switch overrides anytime.
- Mode persists per chat session (new `mode` column); Cash mode forces the cloud
backend, since tools only fire there.
### Session HUD
- **Live HUD** at `/session` (bottom-nav tab on mobile, header link on desktop) —
polls every 5s: header (venue/stakes/elapsed/live net), stack with
**stack-over-time sparkline**, hands this session (tap → replay), villains seen,
her notes, and session stats.
- **Stack tracking** — new `log_stack` tool + `poker_stack_log` table → current
stack, **live net while still sitting** (stack buy-in), and the sparkline series.
### Next
- Strategy RAG (poker books/notes) plugs into Cash's coaching register.
## 0.2.0 — first working system
The leap from "chat + memory baseline" to a working, persistent companion with a