Live Integration — Session Startup & Audit Checklist

# Live Integration — Session Startup & Audit Checklist

Updated 2026-06-23.

## 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 Kilo 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`
- **Bot selection**: `configs/live_bots.toml`
- **Cash NL bot**: `configs/bots/cash_nl.toml` — Gen 3: ng_preflop + g3_postflop_rollout
- **Hero name**: `torn/src/config.ts` → `heroName: "Bolsa"`

## Browser Setup

> **IMPORTANT:** TamperMonkey does NOT auto-reload the userscript on page refresh.
> The userscript has no `@updateURL`/`@require` and a static version, so TamperMonkey
> keeps its installed copy. 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**
   - Alternative: TamperMonkey dashboard → edit script → paste file contents → Ctrl+S
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

## 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 — SB derivation off-by-one), `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 (not stuck at 0)
- **Position labels**: BTN/SB/BB/UTG/CO should match actual positions
- **Bet sizing**: Should vary (40%, 67%, 75% pot) with randomization
- **Preflop range**: ng_preflop should play ~15-25% VPIP (wider than old Gen 2)
- **Too-tight folds**: B7 issue — bot folds strong hands too easily (see Hands Audit notebook)

## Known Open Issues (see "Live Audit — Open Issues Tracker" note)
1. **B7**: Bot too passive (bet_adj_cap=2.0 too high) — folds/calls too tight
2. **B8**: `num_callers` inflation — counts SB post + limpers
3. **B1**: 4-bet = AllIn without stack-depth check
4. **D1**: Missing ante events — pot undercounted
5. **U4**: Player names containing "flop"/"turn"/"river" misclassified

## Resolved Issues
- ✅ D4: Dealer button (SB derivation + chip confirmation + server correction)
- ✅ U3: k/M suffix parsing
- ✅ U1: seenTexts clearing across hands
- ✅ D3: SB amount=0 in synthesized blinds

## Tuned Parameters (cash_nl.toml, Gen 3)
| Parameter | Value | Purpose |
|-----------|-------|---------|
| call_base | 0.50 | Looser calls vs loose field |
| call_adj_cap | 1.2 | Call threshold adjustment cap |
| bet_adj_cap | 2.0 | ← **needs lowering (B7)** |
| bet_flop_base | 0.52 | Flop betting threshold |
| bet_turn_base | 0.70 | Turn betting (more aggressive) |
| raise_base | 0.80 | Value raise threshold |
| bet_value_fraction | 0.67 | Dry board value bet sizing |
| bet_wet_fraction | 0.75 | Wet board sizing (deny equity) |
| bet_bluff_fraction | 0.40 | Bluff bet sizing |
| raise_w_bluff | 0.30 | Bluff raise threshold discount |
| raise_w_draw | 0.50 | Draw raise threshold discount |

## 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, BotAction, ProfilePlayer
- **Bots** (holdem_bots): Gen 3 — ng_preflop + g3_postflop_rollout, first_applicable voting

id: 0c9396f040cf4ba794f8fe0dbf0c6c8e
parent_id: 2c8da247905946c3aa19eb4936e16323
created_time: 2026-06-16T14:23:37.263Z
updated_time: 2026-06-23T14:29:32.177Z
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-06-23T14:29:32.177Z
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