Routes:
- GET / → menu.html (new home/menu).
- GET /ai-vs-ai → old index.html (AI-vs-AI live game).
- GET /play → same index.html; app.js detects the human side from
bindings and enables chessground move input on that side only.
- GET /games → unchanged.
Backend:
- coordinator: 'human' is now an allowed agent type alongside claude/codex.
start_new_game accepts overrides[side].agent = 'human'. _send_first /
_send_turn / watchdog skip human sides.
- POST /api/human-move: humans submit moves from the browser (UCI/SAN
+ optional comment); rejected if it's not their turn or side isn't human.
- /api/options now also returns 'all_agents' = AI agents + 'human' for the
human-vs-AI configurator.
- pane-agent.sh: when binding agent is 'human', the pane just prints a
note and sleeps — no claude/codex is launched for that side.
Frontend menu (new public/menu.{html,css,js}):
- 'underground tournament' aesthetic: Major Mono Display title, JetBrains
Mono body (Google Fonts), warm gold (#c0a060) / crimson (#c04040)
accents, subtle film-grain overlay.
- Three big mode cards: 01 AI×AI, 02 HUMAN×AI, 03 GAMES·STATS.
- Inline configurator below the cards: WHITE / VS / BLACK columns with
agent / model / persona selects, persona description preview, swap +
randomize tools, abort-current warning that links to /api/abort-game.
- Start button routes to /ai-vs-ai or /play depending on whether a human
side was picked. Enter submits.
- HUD strip with tmux / stockfish / games-played counters.
app.js changes:
- Chessground constructed with viewOnly toggling; renderBoard rebuilds
movable.color + dests = legal moves at the live FEN from chess.js for
the human's turn only; board is read-only when scrubbing history,
during the AI's turn, or in AI-vs-AI.
- humanSide() helper reads bindings; orientation auto-flips when the
human plays black.
Agents that outlive the backend desync with state.game (in-memory only)
— they keep calling MCP move on a server that has no idea what game is
being played. Simpler than persisting game state across restarts:
backend startup kills any leftover 'chess' tmux session, backend
shutdown kills the current one. start.sh will spawn fresh agents that
are aligned with the empty server state on each launch.
If the stockfish child dies mid-game (e.g. user pkill'd it, OS OOM
killed it), eval_bridge silently lost analyses. Now:
- StockfishEngine.is_alive() checks the process' returncode.
- _analyze_and_publish() retries once: on first failure, drops the dead
handle and calls start() before the second attempt.
- On lifespan startup, _backfill_missing_evals() replays the current
game's history via python-chess to derive each FEN and analyzes any
position that's missing from state.eval_cache. This catches the gap
that opens whenever stockfish dies under a running game.
Doesn't help across backend restarts (state.game is still in-memory
only) — for that we'd need a per-move snapshot of the active game.
55 → 61 tests still pass; engine smoke test now uses is_alive() too.
Backend:
- prompts.py: 5 personality presets (уличный_гопник default, профессор,
поэт, молчун, шут). Each provides voice + label + description.
build_system_prompt accepts `preset` parameter; the MCP-tools section
+ must-call-move rule is shared common tail.
- coordinator: `start_new_game` now accepts `overrides` ({white: {agent,
model, prompt}, black: {...}}) — missing fields filled randomly.
MODEL_OPTIONS published per agent.
- AppState.prompts tracks the preset id per side; persisted into game's
agents dict and PGN.
- AppState.eval_cache cleared on new_game (was per-life-of-process before).
- persistence.save_game now stores full history (with comments) and the
per-position eval cache in the game JSON.
- ChessGame.abort() — manual game termination with result='*' and
Termination='aborted'.
- New endpoints:
• GET /api/options — agents, models per agent, prompt presets.
• GET /api/stats — leaderboard aggregated from games/*.json:
per (agent, model) and per persona, with score = wins + 0.5*draws.
• POST /api/abort-game — force-end current game.
- POST /api/new-game now returns 409 when a game is in progress.
- GET /api/games[/{id}[/pgn]] also 409 while in progress — gallery is
hidden behind the one-game-at-a-time rule.
Frontend:
- New setup dialog: per-side agent / model / persona selects, swap +
random shortcuts, persona description preview, abort button inline
when current game blocks the start.
- 'games & stats' link in the board footer; greyed out while a game is
active.
- /games page reworked: leaderboard (player × model + by persona),
games table with persona labels, replay panel showing eval per ply
with prev/next/first/last + arrow-key nav.
- chess.js loadPgn → load_pgn fix consolidated; replay prefers saved
history (comments + side) over PGN parse when available.
Layout (after iterative feedback):
- Two columns: board+eval (left, square) | chat full-height (right).
- Moves row floats just under the board as a compact one-row strip with
the controls (new game / settings) — replaces the old right sidebar.
- Board sized imperatively via fitBoard + ResizeObserver; eval bar height
matches the board exactly (no overflow into neighbours).
Eval bar:
- 36px wide (was 28); text fits without pill background.
- System sans-serif, 10.5px / 700 weight, tabular-nums.
- Text positioned on whichever side is winning (bottom-white-half when
white ahead → dark text; top-black-half when black ahead → light).
- Sign now correct: backend stores raw cp from side-to-move; frontend
flips when FEN says "b" so the bar always reflects white POV.
Replay:
- evalByFen on the client gets backfilled from /api/state's new `evals`
list (backend keeps state.eval_cache per game). Clicking past bubbles
now restores the stockfish eval for that ply.
- renderBoard clears stockfish arrow when no eval is known yet for the
shown FEN, so the arrow no longer 'lags' onto the next position.
Auto-focus:
- Latest played move is highlighted in both the chat bubble list and
the moves strip when in live mode (viewPly === null).
- scrollIntoView keeps the active bubble/SAN visible after each move.
UI rewrite per user feedback:
- Remove agent terminal panels entirely (tmux runs headlessly).
- Left column: chat with colored bubbles per move (white→light, black→
dark, click to jump to ply, label shows agent+side+SAN).
- Right column: SAN move history (lichess style, click to jump).
- Center: board, untouched, but now constrained so it stops overflowing.
- Eval bar between chat and board, vertical with cp/mate text; the
earlier visual issue was pure CSS (no explicit height) — bar fills
full column height now.
- Keyboard nav: ←/→/space.
- Bottom log strip kept (compact).
Backend: TmuxTailer no longer started in lifespan (UI doesn't need
term_chunk events). Stockfish + eval_bridge now log explicit errors
to backend.log on startup failure.
- mcp_post: notifications (no `id` field) → HTTP 202 with empty body,
per streamable-HTTP MCP transport spec. Fixes rmcp 'transport channel
closed' on codex's notifications/initialized.
- start.sh: don't attach to tmux; print URL only. Backend + tmux session
run in background. UI is the only viewing surface.
- scripts/stop.sh: convenience teardown.
- coordinator: use `ulid.new().str` (ulid-py 1.x API), not `ULID()`
- coordinator._submit: swallow tmux errors so game logic continues
- app: split first-prompt dispatch into POST /api/dispatch-first
- start.sh: POST /api/dispatch-first ~12s after tmux create
- test_coordinator: isolate GAMES_DIR via tmp_path
Implements build_app() with REST endpoints (/api/state, /api/games,
/api/settings, /api/new-game, /api/agent-binding), WebSocket /ws for
realtime events, and custom JSON-RPC MCP transport at /mcp/{side}
supporting initialize, tools/list, and tools/call with proper
content-wrapping and isError flag. Static UI mount guarded by
PUBLIC_DIR existence check. All 5 e2e tests pass.