Live Integration — Session Startup & Audit Checklist

# Live Integration — Session Startup & Audit Checklist

> **Updated 2026-07-17.** Production bot: `cash_nl_g48_live` (G48 formula postflop).

## Prerequisites

### Server (super_marvin repo, RustRover)
```bash
cd ~/RustroverProjects/super_marvin
cargo build --release
```

### Userscript (super-marvin-userscripts repo, WebStorm)
```bash
cd ~/WebstormProjects/super-marvin-userscripts
npm run build
```

## Starting the Server

```bash
# Clear logs
truncate -s 0 /tmp/live_server.log
rm -f /tmp/super_marvin_hand_history.log

# Start via background process:
RUST_LOG="live_server=debug,holdem_bots=debug,info" ./target/release/live_server
# Port: 8088
```

### Config files
- **Server config**: `configs/live_server.toml` (bind `0.0.0.0:8088`)
- **Bot selection**: `configs/live_bots.toml`
- **Production bot**: `configs/bots/cash_nl_g48_live.toml` — G47 preflop (PEM2 equity) + G48 postflop (formula-based, observer ranges)
- **Hero name**: `torn/src/config.ts` → `heroName: "Bolsa"`

## Browser Setup

> **IMPORTANT:** TamperMonkey does NOT auto-reload the userscript on page refresh.
> After rebuilding `dist/torn.user.js`, you must:

1. Open `file:///home/jan/WebstormProjects/super-marvin-userscripts/torn/dist/torn.user.js`
   in the browser → TamperMonkey shows install/update dialog → click **Install/Update**
2. Verify version in TamperMonkey dashboard matches `meta.json`
3. Refresh the Torn holdem page
4. Check console: `[super-marvin-torn] started`
5. Switch to auto mode via TamperMonkey menu

## DOM Snapshot Debugging

Set `window.__marvinDomDebug = true` in the browser console to capture full table HTML on each decision. Snapshots appear in decision logs as `[DOM_SNAPSHOT]` entries.

## Audit Checklist

### 1. Server log (`tail -f /tmp/live_server.log`)
- **DEBUG**: `incoming event`, `game_start` (check `dealer=N`), `player_action`, `deal`
- **WARN**: `correcting dealer button` (expected occasionally), `hero missing from roster`, `decision failed`
- **INFO**: bot decisions with full GameInfo

### 2. Hand history (`/tmp/super_marvin_hands/hands/` and `/decisions/`)
- Per-hand logs: full hand with bot decisions inline
- Decision logs: individual bot decision with game context
- Check: blinds, antes, player actions, pot/winner correctness

### 3. Key things to watch for
- **Dealer rotation**: btn should rotate each hand
- **Position labels**: BTN/SB/BB/UTG/CO should match actual positions
- **Bet sizing**: G48 formula sizing — should vary with hand strength (Harrington-aligned, 3BB open standard)
- **Preflop range**: G47 should play ~15-25% VPIP
- **Board-hit awareness**: G48 should boost hands matching top board card, penalize behind hands
- **Draw-heavy boards**: trap guards should prevent slow-playing on drawy boards

## G48 Key Parameters (`cash_nl_g48_live.toml`)

| Parameter | Value | Purpose |
|-----------|-------|---------|
| `behind_penalty_weight` | 0.15 | Penalize hands unlikely to improve when behind |
| `narrow_board_hit_boost` | 3.0 | Boost hands matching top board card in range narrowing |
| `mc_samples` | 40000 | Monte Carlo samples (live) |
| `raise_base_bb` | 3.0 | Standard open 3BB (Harrington) |
| `raise_strong_freq` | 0.35 | 35% chance of 4BB with premiums |
| `raise_jitter` | 0.0 | No preflop jitter (avoid sizing tells) |
| `speculative_discount_bb` | 1.0 | Speculative hands flat +1BB over limper |
| `threebet_jitter` | 0.0 | No 3-bet jitter |

## Architecture Summary
- **Userscript** (Firefox/TamperMonkey): DOM scraper → event stream → POST /api/event
- **Server** (Rust/Axum): event stream → per-table state machine → bot decision → response
- **Protocol** (poker_protocol): TableEvent (with dom_snapshot), BotAction, ProfilePlayer
- **Bots** (holdem_bots): G47 preflop (PEM2 equity) + G48 postflop (formula-based), first_applicable voting


id: 0c9396f040cf4ba794f8fe0dbf0c6c8e
parent_id: 2c8da247905946c3aa19eb4936e16323
created_time: 2026-06-16T14:23:37.263Z
updated_time: 2026-07-17T08:40:35.096Z
is_conflict: 0
latitude: 0.00000000
longitude: 0.00000000
altitude: 0.0000
author: 
source_url: 
is_todo: 0
todo_due: 0
todo_completed: 0
source: joplin-desktop
source_application: net.cozic.joplin-desktop
application_data: 
order: 1781619817263
user_created_time: 2026-06-16T14:23:37.263Z
user_updated_time: 2026-07-17T08:40:35.096Z
encryption_cipher_text: 
encryption_applied: 0
markup_language: 1
is_shared: 0
share_id: 
conflict_original_id: 
master_key_id: 
user_data: 
deleted_time: 0
type_: 1