> ## Documentation Index
> Fetch the complete documentation index at: https://hyperscape-ai-mintlify-docs-update.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# February 2026 Updates

> Comprehensive changelog for February 2026 - Memory leak fixes, performance optimizations, and streaming improvements

# February 2026 Updates

This document covers all major changes pushed to the `main` branch during February 2026, including critical memory leak fixes, client performance optimizations, streaming infrastructure improvements, and agent system enhancements.

***

## Critical Memory Leak Fixes

A comprehensive memory leak audit identified and fixed **20+ memory leaks** across the codebase. All fixes follow the established `SystemBase` cleanup pattern.

### Server-Side Leaks (HIGH Priority)

<AccordionGroup>
  <Accordion title="ModelCache - GPU Memory Leak (CRITICAL)">
    **Issue**: GPU memory accumulated during hot reload and cache invalidation

    **Fix**: Added geometry disposal on `clear()` and `remove()` methods

    **Impact**: Prevents GPU memory exhaustion in long-running sessions

    ```typescript theme={"theme":{"light":"github-light","dark":"tokyo-night"}}
    // ModelCache.ts
    clear() {
      for (const entry of this.cache.values()) {
        entry.geometry?.dispose(); // NEW: Dispose GPU resources
      }
      this.cache.clear();
    }
    ```
  </Accordion>

  <Accordion title="EventBridge - 50+ Listener Accumulation (HIGH)">
    **Issue**: World event listeners never removed, causing listener accumulation on hot reload

    **Fix**: Added `destroy()` method to clean up all registered listeners

    **Pattern**: Track listeners in Map, iterate and remove on destroy

    ```typescript theme={"theme":{"light":"github-light","dark":"tokyo-night"}}
    destroy() {
      for (const [event, handlers] of this.listeners) {
        handlers.forEach(handler => world.off(event, handler));
      }
      this.listeners.clear();
    }
    ```
  </Accordion>

  <Accordion title="GameTickProcessor, TradingSystem, AgentManager (HIGH)">
    **Issue**: Event handlers not cleaned up on destroy/shutdown

    **Fix**: Store bound event handlers, cleanup in `destroy()` method

    **Files Fixed**:

    * `GameTickProcessor.ts` - Tick event handlers
    * `TradingSystem/index.ts` - PLAYER\_LEFT/LOGOUT/DIED handlers
    * `AgentManager.ts` - COMBAT\_DAMAGE\_DEALT listener
    * `AutonomousBehaviorManager.ts` - Agent lifecycle handlers
  </Accordion>

  <Accordion title="RTMPBridge - WebSocket Listeners (HIGH)">
    **Issue**: WebSocket server listeners not cleaned up on close

    **Fix**: Call `removeAllListeners()` before closing WebSocket servers
  </Accordion>

  <Accordion title="AggroSystem - Unbounded Maps (MEDIUM)">
    **Issue**: playerSkills, combatLevelCache, and aggro maps growing unboundedly

    **Fix**: Clean up player-specific data from Maps on disconnect
  </Accordion>

  <Accordion title="StarterChestEntity - Unbounded Set (MEDIUM)">
    **Issue**: lootedByCharacters Set growing unboundedly over server lifetime

    **Fix**: Add size limit (10k) with LRU pruning
  </Accordion>
</AccordionGroup>

### Client-Side Leaks (MEDIUM-HIGH Priority)

<AccordionGroup>
  <Accordion title="GPU Resource Hygiene">
    **XPDropSystem**: Object pool for CanvasTexture/SpriteMaterial reuse, warn on pool exhaustion

    **DuelCountdownSplatSystem**: Pre-render count textures once, pool sprite/material pairs

    **HealthBars**: Add destroy() to clear hideTimeout handles and dispose InstancedMesh/texture/geometry

    **ProjectileRenderer**: Track pending setTimeout handles in Set, cancel all on destroy(), reference-counted geometry disposal
  </Accordion>

  <Accordion title="Component Lifecycle">
    **PlayerTokenManager**: Named beforeUnloadHandler property enables proper removeEventListener on dispose()

    **EmbeddedGameClient**: Guard async state updates with cancelled flag to prevent setState on unmounted component

    **ThreeResourceManager**: Add teardown() to stop dev monitor interval and reset WeakSet on hot-reload

    **ClientLiveKit**: Properly clean up voices Map and room listeners in destroy()
  </Accordion>

  <Accordion title="World Initialization Race Condition">
    **Issue**: world.destroy() could race world.init() mid-await during fast navigation/hot-reload

    **Fix**: Two-flag handshake (initComplete + needsCleanup) ensures destroy() runs exactly once after init() completes

    **Impact**: Prevents resource leaks from partial initialization
  </Accordion>
</AccordionGroup>

### Memory Management Best Practices

When creating new systems or managers:

1. **Track All Resources**: Store references to intervals, listeners, handlers
2. **Implement Cleanup**: Add `destroy()`, `shutdown()`, or `stop()` methods
3. **Follow SystemBase Pattern**: Use the same cleanup patterns as SystemBase
4. **Clean Up on Hot Reload**: Ensure resources are released during development
5. **Test for Leaks**: Monitor memory usage during long-running sessions

Example cleanup pattern:

```typescript theme={"theme":{"light":"github-light","dark":"tokyo-night"}}
class MySystem {
  private listeners: Array<() => void> = [];
  private intervals: NodeJS.Timeout[] = [];

  init() {
    const listener = world.on('event', this.handleEvent);
    this.listeners.push(listener);
    
    const interval = setInterval(this.tick, 1000);
    this.intervals.push(interval);
  }

  destroy() {
    // Clean up listeners
    this.listeners.forEach(remove => remove());
    this.listeners = [];
    
    // Clear intervals
    this.intervals.forEach(clearInterval);
    this.intervals = []
  }
}
```

***

## Client Performance Optimizations

### Movement System Overhaul

<CardGroup cols={2}>
  <Card title="Immediate Move Processing" icon="zap">
    Bypasses ActionQueue for instant response to player clicks (eliminates 0-600ms latency)
  </Card>

  <Card title="Pathfinding Rate Limit" icon="route">
    Raised from 5/sec to 15/sec to match tile movement limiter
  </Card>

  <Card title="BFS Iterations" icon="expand">
    Increased from 2000 to 8000 (\~44 tile radius vs \~22 tile)
  </Card>

  <Card title="Path Continuation" icon="arrows-split-up-and-left">
    Seamless long-distance movement with automatic re-pathfinding when BFS limit reached
  </Card>
</CardGroup>

**Skating Fix**: Server-side pre-computation + client-side path appending eliminates stop-lurch at segment boundaries

**Multi-Click Feel**: Optimistic target pivoting + pending move queue ensures last click always reaches server

**Per-Frame Allocation Elimination**: Pre-allocated buffers and squared distance comparisons in hot paths

### Minimap Rendering Optimization

<Steps>
  <Step title="Async Terrain Generation">
    Chunked sampling (50×50 grid) runs off RAF callback via setTimeout(0) yields

    **Impact**: Zero RAF blocking - terrain generation happens in background macrotasks
  </Step>

  <Step title="Canvas Rotation Transform">
    Decouples terrain regeneration from camera rotation (only regenerates on player move/zoom)

    **Terrain Overshoot**: √2 × 1.1 sampling ensures corners stay filled at any rotation angle
  </Step>

  <Step title="Layer Synchronization">
    All layers (terrain, roads, buildings, pips) use same camera snapshot

    **Cached Contexts**: Canvas 2D contexts cached in refs to avoid getContext() DOM queries
  </Step>

  <Step title="Performance Results">
    Reduced terrain sampling from up to **40,000 pixels to 2,500** (16× reduction)
  </Step>
</Steps>

### Client Memory Optimizations

* **Machine ID Caching**: Browser fingerprint cached in `_cachedMachineId` (avoids canvas allocation on every token operation)
* **Activity Debouncing**: 500ms debounce on saveSession() localStorage writes (was synchronous on every interaction)
* **XP Drop Listener**: Store bound handler so destroy() can call world.off() (eliminates leak that survived world teardown)
* **Stale Health Bar Sweep**: Reverse iteration to remove bars for despawned entities

***

## Streaming Infrastructure Improvements

### WebGPU Initialization & Diagnostics

<CardGroup cols={2}>
  <Card title="Adapter Request Timeout" icon="clock">
    30s timeout on `navigator.gpu.requestAdapter()` to prevent indefinite hangs
  </Card>

  <Card title="Renderer Init Timeout" icon="hourglass">
    60s timeout on `renderer.init()` to detect GPU driver issues
  </Card>

  <Card title="Preflight Testing" icon="flask">
    `testWebGpuInit()` runs on blank page before loading game content
  </Card>

  <Card title="GPU Diagnostics" icon="stethoscope">
    `captureGpuDiagnostics()` extracts chrome://gpu info for debugging
  </Card>
</CardGroup>

### Vast.ai Deployment Architecture

The streaming pipeline requires specific GPU setup:

#### 1. GPU Rendering Modes (tried in order)

<Steps>
  <Step title="Xorg with NVIDIA">
    Best performance, requires DRI/DRM device access
  </Step>

  <Step title="Xvfb with NVIDIA Vulkan">
    Virtual framebuffer + GPU rendering via ANGLE/Vulkan (non-headless Chrome)

    <Note>Xvfb mode uses **non-headless Chrome** connecting to virtual display (WebGPU requires window context)</Note>
  </Step>

  <Step title="Headless Vulkan">
    Chrome `--headless=new` with `--use-vulkan` and `--use-angle=vulkan`
  </Step>

  <Step title="Headless EGL">
    Direct EGL rendering without X server using `--headless=new --use-gl=egl`
  </Step>

  <Step title="Ozone Headless">
    Experimental mode using `--ozone-platform=headless` with GPU rendering
  </Step>

  <Step title="SwiftShader">
    Software Vulkan fallback (poor performance, last resort)
  </Step>
</Steps>

Deployment detects Xorg swrast software rendering and switches to alternative modes.

#### 2. Deployment Validation

<Accordion title="Early Display Driver Check">
  * Checks nvidia\_drm kernel module
  * Checks DRM device nodes (/dev/dri/)
  * Queries GPU display\_mode via nvidia-smi to verify display driver support
  * Provides clear guidance to rent instances with `gpu_display_active=true` on Vast.ai
</Accordion>

<Accordion title="Vulkan ICD Validation">
  * Checks Vulkan ICD availability at `/usr/share/vulkan/icd.d/nvidia_icd.json`
  * Logs actual ICD content and VK\_LOADER\_DEBUG output for diagnostics
  * **XDG\_RUNTIME\_DIR**: Required for Vulkan/EGL initialization (set to `/tmp/runtime-root`)
</Accordion>

<Accordion title="WebGPU Pre-Check Tests">
  Runs 6 WebGPU tests with different Chrome configurations:

  1. Headless Vulkan
  2. Headless EGL
  3. Xvfb Vulkan
  4. Ozone Headless
  5. SwiftShader
  6. Playwright Xvfb

  Extracts Chrome GPU info (WebGPU/Vulkan status) during deployment
</Accordion>

<Warning>
  Deployment **FAILS** if WebGPU cannot be initialized (no soft fallbacks)
</Warning>

#### 3. Vast.ai CLI Provisioner

New automated provisioner script: `./scripts/vast-provision.sh`

<Steps>
  <Step title="Search">
    Searches for instances with `gpu_display_active=true` (REQUIRED for WebGPU)
  </Step>

  <Step title="Filter">
    Filters by reliability, GPU RAM, price
  </Step>

  <Step title="Rent">
    Automatically rents best available instance
  </Step>

  <Step title="Wait">
    Waits for instance to be ready
  </Step>

  <Step title="Output">
    Outputs SSH connection details and GitHub secret commands
  </Step>
</Steps>

```bash theme={"theme":{"light":"github-light","dark":"tokyo-night"}}
./scripts/vast-provision.sh
```

Ensures only instances with NVIDIA display driver support are rented.

#### 4. Stream Capture Improvements

* **Chrome Executable**: Set `STREAM_CAPTURE_EXECUTABLE` to explicit Chrome path (e.g., `/usr/bin/google-chrome-unstable`) for reliable WebGPU
* **Browser Restart**: Automatic browser restart every 45 minutes to prevent WebGPU OOM crashes
* **Page Navigation Timeout**: Increased to 180s for Vite dev mode (production build recommended)
* **Resolution Tracking**: Automatic viewport recovery on resolution mismatch
* **Probe Timeout**: 5s timeout on probe evaluate calls to prevent hanging

#### 5. macOS WebGPU Support

* **Metal Backend**: macOS uses Metal (not Vulkan) for WebGPU
* **System Chrome Required**: Auto-detects and uses system Chrome on macOS for WebGPU support
* **Playwright Limitation**: Bundled Chromium doesn't have proper WebGPU support on macOS
* **No Vulkan ICD**: Don't set `VK_ICD_FILENAMES` on macOS (not applicable)
* **Chrome Flags**: Remove Vulkan from feature flags on macOS (Metal is the backend)

***

## Agent System Improvements

### Dynamic Combat Progression

<CardGroup cols={2}>
  <Card title="Monster Escalation" icon="arrow-up-right">
    Agents progress from goblins → bandits → barbarians as combat level grows
  </Card>

  <Card title="Combat Style Rotation" icon="rotate">
    Agents cycle attack → strength → defense (train lowest skill)
  </Card>

  <Card title="Cooking Phase" icon="fire">
    Agents cook raw food immediately instead of waiting for full inventory
  </Card>

  <Card title="Gear Upgrade Phase" icon="hammer">
    Agents smith better equipment when they have materials + levels
  </Card>
</CardGroup>

### Stability Fixes

<Accordion title="Critical Crash Fix">
  Fixed `weapon.toLowerCase is not a function` crash in `getEquippedWeaponTier` that broke **ALL agents every tick**

  **Root Cause**: Weapon could be an object instead of string

  **Fix**: Added type guard and proper string extraction
</Accordion>

<Accordion title="LLM Error Fallback">
  **Old Behavior**: Agents derailed to explore on LLM errors

  **New Behavior**: Idle + retry when agent has active goal

  **Impact**: Agents maintain goal focus through temporary LLM failures
</Accordion>

<Accordion title="Quest Goal Detection">
  Added quest goal status change detection for proper quest lifecycle transitions

  Agents now properly detect when quest objectives are completed
</Accordion>

### Configuration Improvements

* **Combat Food Threshold**: Increased from 5 → 10 for better survival
* **World Data Manifest Loading**: Monster tiers and gear tiers loaded from world-data
* **Short-Circuit Dashboard Sync**: All agents show activity logs even when skipping LLM
* **LLM Rate Limiting**: Exponential backoff for API calls (5s base, max 60s)
* **Consecutive Failure Tracking**: Resets on successful tick

***

## Combat System Stability

### Duel System Improvements

<CardGroup cols={2}>
  <Card title="Combat Retry Timer" icon="clock">
    Aligned with tick system (3000ms = 5 ticks) for consistent timing
  </Card>

  <Card title="Phase Timeout" icon="timer">
    Reduced grace periods from 30s to 10s for faster failure detection
  </Card>

  <Card title="Combat Stall Nudge" icon="hand">
    Tracks last nudge timestamp instead of cycle ID to allow re-nudging when combat stalls again
  </Card>

  <Card title="Damage Event Cache" icon="database">
    Cleanup every tick (was every 2 ticks), cap lowered from 5000 to 1000, evict 75% when exceeded
  </Card>
</CardGroup>

***

## Gold Betting Demo - Mobile UI

### Mobile Responsive Overhaul

<CardGroup cols={2}>
  <Card title="Resizable Panels" icon="arrows-left-right-to-line">
    Desktop layout with useResizePanel hook + ResizeHandle component
  </Card>

  <Card title="Mobile Detection" icon="mobile">
    useIsMobile hook gates JS inline styles so CSS media queries control layout
  </Card>

  <Card title="Mobile Layout" icon="rectangle-vertical">
    16:9 aspect-ratio video, bottom-sheet sidebar, touch-friendly tab targets, dvh units
  </Card>

  <Card title="Mobile Header" icon="bars">
    Stacked HYPERSCAPE/MARKET logo, phase strip above video, SOL + EVM wallet buttons
  </Card>
</CardGroup>

### Data Integration

* **Real Data Integration**: Live SSE feed from game server (devnet mode) replaces mock data
* **Simulation Mode**: Available via `bun run dev:stream-ui` (dev mode uses real endpoints only)
* **Tab Reordering**: Trades tab moved first for better mobile UX

### Console Noise Reduction

<Accordion title="Recharts Warning Fix">
  Raised `.hm-chart-container` min-height to 120px (eliminates width/height=0 warnings)
</Accordion>

<Accordion title="EventSource Auto-Reconnect">
  Close EventSource on onerror to stop browser's built-in reconnect loop
</Accordion>

<Accordion title="Exponential Backoff">
  useDuelContext switched from fixed setInterval to setTimeout with backoff (3s → 6s → 60s cap)
</Accordion>

***

## Testing Infrastructure

### E2E Journey Tests

New comprehensive end-to-end tests in `packages/client/tests/e2e/complete-journey.spec.ts`:

<Steps>
  <Step title="Login Flow">
    Full authentication and character selection
  </Step>

  <Step title="Loading Screen">
    `waitForLoadingScreenHidden` helper for reliable test synchronization
  </Step>

  <Step title="Spawn">
    Character spawns in world with proper initialization
  </Step>

  <Step title="Walk">
    Movement and pathfinding validation
  </Step>

  <Step title="Screenshot Comparison">
    Utilities to verify game is rendering correctly
  </Step>
</Steps>

**Real Browser Testing**: Uses Playwright with actual WebGPU rendering (no mocks)

### Test Stability Improvements

* **GoldClob Fuzz Tests**: 120s timeout for randomized invariant tests (4 seeds × 140 operations)
* **Precision Fixes**: Use larger amounts (10000n) to avoid gas cost precision issues
* **Dynamic Import Timeout**: 60s timeout for EmbeddedHyperscapeService beforeEach hooks
* **Anchor Test Configuration**: Use localnet instead of devnet for free SOL in `anchor test`
* **CI Build Order**: Build impostors/procgen before shared (dependency fix)

***

## Model Cache & Rendering

### Index Buffer Type Preservation

<Warning>
  **Critical Fix**: Model cache now preserves original index buffer type (Uint16Array vs Uint32Array)
</Warning>

**Issue**: Silent geometry corruption and RangeError crashes on cached model restore

**Fix**: Cache version bumped to 4 to invalidate corrupt entries

**Impact**: Affects all GLB models loaded via ModelCache (resources, NPCs, items)

***

## Resource Management

### Activity Logger Queue

* **Max Size**: 1000 entries with 25% eviction to prevent memory pressure
* **Eviction Policy**: LRU-style pruning when limit exceeded

### Session Timeout

* **30-Minute Max**: Via MAX\_SESSION\_TICKS for zombie session cleanup
* **SessionCloseReason**: Added "timeout" to type for proper session termination tracking

***

## Breaking Changes

<Warning>
  **Safari 17 Support Removed**: Safari 18+ (macOS 15+) is now required for WebGPU support
</Warning>

### API Changes

<Accordion title="ResourceVisualStrategy.onDepleted()">
  Now returns `boolean`:

  * `true` = strategy handled depletion (instanced stump)
  * `false` = ResourceEntity should load individual depleted model

  New optional method: `getHighlightMesh(ctx)` for instanced entity highlighting
</Accordion>

<Accordion title="TileMovementState">
  Added new required fields:

  * `requestedDestination: TileCoord | null`
  * `lastPathPartial: boolean`
  * `nextSegmentPrecomputed: boolean`

  These fields are always initialized by `createTileMovementState()` - optional typing was removed
</Accordion>

<Accordion title="tileMovementStart Packet">
  Added optional `isContinuation?: boolean` field for path continuation support
</Accordion>

***

## Migration Guide

### For Developers

<Steps>
  <Step title="Update Dependencies">
    ```bash theme={"theme":{"light":"github-light","dark":"tokyo-night"}}
    bun install
    bun run build
    ```
  </Step>

  <Step title="Review Memory Cleanup">
    If you've created custom systems, ensure they implement proper cleanup:

    * Add `destroy()` or `shutdown()` methods
    * Track and cleanup all event listeners
    * Clear intervals and timeouts
  </Step>

  <Step title="Test Movement">
    Movement system changes may affect custom pathfinding logic:

    * ActionQueue no longer buffers move requests
    * Path continuation handles long-distance clicks automatically
  </Step>

  <Step title="Update Safari Requirements">
    Update browser compatibility documentation to require Safari 18+ (macOS 15+)
  </Step>
</Steps>

### For Vast.ai Deployments

<Steps>
  <Step title="Use Provisioner Script">
    ```bash theme={"theme":{"light":"github-light","dark":"tokyo-night"}}
    ./scripts/vast-provision.sh
    ```

    This ensures you rent instances with `gpu_display_active=true`
  </Step>

  <Step title="Update GitHub Secrets">
    ```bash theme={"theme":{"light":"github-light","dark":"tokyo-night"}}
    gh secret set VAST_HOST --body 'your-host'
    gh secret set VAST_PORT --body 'your-port'
    ```
  </Step>

  <Step title="Trigger Deployment">
    ```bash theme={"theme":{"light":"github-light","dark":"tokyo-night"}}
    gh workflow run deploy-vast.yml
    ```
  </Step>
</Steps>

***

## Performance Metrics

### Before vs After

| Metric                       | Before        | After         | Improvement         |
| ---------------------------- | ------------- | ------------- | ------------------- |
| **Move Click Latency**       | 0-600ms       | \~0ms         | Instant response    |
| **Pathfinding Range**        | \~22 tiles    | \~44 tiles    | 2× radius           |
| **Minimap Terrain Sampling** | 40,000 pixels | 2,500 pixels  | 16× reduction       |
| **Memory Leaks Fixed**       | 20+ leaks     | 0 known leaks | 100%                |
| **Browser Restart Interval** | 60 min        | 45 min        | Prevents OOM        |
| **Combat Retry Timer**       | 1500ms        | 3000ms        | Tick-aligned        |
| **Phase Timeout**            | 30s           | 10s           | 3× faster detection |

***

## Files Changed

### Core Engine (packages/shared/)

<AccordionGroup>
  <Accordion title="Movement System">
    * `systems/shared/movement/TileSystem.ts` - Path continuation, immediate processing
    * `systems/client/TileInterpolator.ts` - Skating fix, optimistic targeting, allocation elimination
    * `systems/ServerNetwork/tile-movement.ts` - Server-side pre-computation
    * `systems/ServerNetwork/mob-tile-movement.ts` - Mob movement state updates
  </Accordion>

  <Accordion title="Rendering & GPU">
    * `utils/rendering/ModelCache.ts` - Index buffer type preservation, geometry disposal
    * `systems/client/XPDropSystem.ts` - Object pooling
    * `systems/client/DuelCountdownSplatSystem.ts` - Texture pre-rendering
    * `systems/client/HealthBars.ts` - Timeout cleanup, stale bar sweep
    * `systems/client/ProjectileRenderer.ts` - Reference-counted geometry
    * `lib/ThreeResourceManager.ts` - Teardown method
  </Accordion>

  <Accordion title="Memory Management">
    * `components/ColliderComponent.ts` - Collision handler cleanup
    * `entities/npc/MobEntity.ts` - PLAYER\_SET\_DEAD listener cleanup
    * `platform/shared/Socket.ts` - WebSocket handler cleanup
    * `systems/client/ClientLiveKit.ts` - Voice Map and room listener cleanup
  </Accordion>
</AccordionGroup>

### Server (packages/server/)

<AccordionGroup>
  <Accordion title="Systems">
    * `systems/GameTickProcessor.ts` - Event handler cleanup
    * `systems/TradingSystem/index.ts` - Player lifecycle handler cleanup
    * `systems/ServerNetwork/event-bridge.ts` - Listener tracking and cleanup
    * `systems/ServerNetwork/action-queue.ts` - PlayerQueues cleanup
    * `systems/ServerNetwork/ScriptQueue.ts` - Queue cleanup methods
    * `systems/shared/combat/AggroSystem.ts` - Player data cleanup on disconnect
  </Accordion>

  <Accordion title="Entities">
    * `entities/world/StarterChestEntity.ts` - Bounded lootedByCharacters Set
  </Accordion>

  <Accordion title="Infrastructure">
    * `startup/shutdown.ts` - Rate limiter and idempotency service cleanup
    * `streaming/rtmp-bridge.ts` - WebSocket listener cleanup
    * `streaming/stream-capture.ts` - Browser restart, timeout improvements
    * `systems/ServerNetwork/services/Logger.ts` - Cleanup interval tracking
  </Accordion>

  <Accordion title="Eliza/Agents">
    * `eliza/AgentManager.ts` - COMBAT\_DAMAGE\_DEALT listener cleanup, LLM rate limiting
    * `eliza/managers/autonomous-behavior-manager.ts` - Event handler cleanup
  </Accordion>

  <Accordion title="Duel System">
    * `systems/DuelSystem/index.ts` - Combat retry timer, phase timeout
    * `systems/StreamingDuelScheduler/managers/DuelOrchestrator.ts` - Combat stall nudge
  </Accordion>
</AccordionGroup>

### Client (packages/client/)

<AccordionGroup>
  <Accordion title="Game Client">
    * `game/EmbeddedGameClient.tsx` - Cancelled flag for async state
    * `game/hud/Minimap.tsx` - Async terrain generation, canvas rotation, layer sync
    * `auth/PlayerTokenManager.ts` - beforeUnloadHandler cleanup, machine ID caching, activity debouncing
  </Accordion>

  <Accordion title="Tests">
    * `tests/e2e/complete-journey.spec.ts` - NEW: Full journey tests
    * `tests/e2e/utils/visualTesting.ts` - Screenshot comparison utilities
  </Accordion>
</AccordionGroup>

### Scripts

* `scripts/vast-provision.sh` - NEW: Automated Vast.ai provisioner
* `scripts/deploy-vast.sh` - Enhanced WebGPU validation and diagnostics

### Gold Betting Demo (packages/gold-betting-demo/)

* `app/src/App.tsx` - Mobile responsive UI
* `app/src/AppRoot.tsx` - Mode routing (stream-ui vs normal)
* `app/src/lib/useResizePanel.ts` - NEW: Resizable panel hook
* `app/src/components/ResizeHandle.tsx` - NEW: Resize handle component
* `app/src/spectator/useStreamingState.ts` - EventSource auto-reconnect fix
* `app/src/spectator/useDuelContext.ts` - Exponential backoff polling
* `keeper/src/db.ts` - NEW: Persistence layer

***

## Documentation Updates

This changelog itself is a new addition. Additional documentation updates needed:

<CardGroup cols={2}>
  <Card title="AGENTS.md" icon="file-code">
    Already updated with all memory leak fixes and performance optimizations
  </Card>

  <Card title="README.md" icon="book">
    Needs update for vast-provision.sh script
  </Card>

  <Card title="CLAUDE.md" icon="file-text">
    Needs update for new architecture patterns
  </Card>

  <Card title="Deployment Guides" icon="rocket">
    Needs update for Vast.ai provisioner workflow
  </Card>
</CardGroup>

***

## Next Steps

<Steps>
  <Step title="Monitor Memory">
    Use the new cleanup patterns in all future systems
  </Step>

  <Step title="Test Streaming">
    Validate WebGPU initialization on your target platform
  </Step>

  <Step title="Update Deployments">
    Use `vast-provision.sh` for new Vast.ai instances
  </Step>

  <Step title="Review Agent Behavior">
    Monitor agent combat progression and gear upgrades
  </Step>
</Steps>

***

## Related Documentation

<CardGroup cols={3}>
  <Card title="Memory Management" icon="memory" href="/devops/troubleshooting#memory-leaks">
    Troubleshooting memory issues
  </Card>

  <Card title="Streaming Setup" icon="video" href="/guides/deployment#streaming">
    Configure streaming infrastructure
  </Card>

  <Card title="Agent Development" icon="bot" href="/guides/ai-agents">
    Build custom AI agents
  </Card>

  <Card title="Combat System" icon="swords" href="/concepts/combat">
    Understanding combat mechanics
  </Card>

  <Card title="Testing Guide" icon="flask" href="/guides/development#testing">
    Writing E2E tests
  </Card>

  <Card title="Performance" icon="gauge" href="/guides/development#performance">
    Optimization techniques
  </Card>
</CardGroup>
