# SI Core for Mobile Gaming — Technical Analysis

## Steam on Phone (DroidDeck)

N8toriousAi runs Steam on his phone. This adds layers the SI Core must manage:

### The process tree problem

Steam isn't one process — it's a tree:
```
steam (client)
├── steamwebhelper (multiple — UI rendering)
├── proton/wine (translation layer)
│   └── game.exe (the actual game, via Box64 if x86)
```

The SI Core must tag the **game process**, not the launcher.
Vera's intent routing identifies the game by window focus + process
hierarchy, then tags the leaf game process (and its render threads)
to Brood. Steam's webhelpers get deprioritized — they're just UI.

### Translation overhead

- **Proton/Wine**: API translation (DirectX → Vulkan) runs on CPU.
  These threads need Brood priority — they're in the render path.
- **Box64** (x86 → ARM): dynamic recompilation is CPU-intensive,
  especially during the first minutes (code cache warming).
  The SI Core gives Box64's JIT threads elevated priority during
  warmup, then relaxes once the cache is hot.
- **Shader compilation stutter**: first-time shader compiles cause
  hitches. Seer (foresight) + per-game learning: after one session,
  the SI Core knows which shaders a game compiles and pre-warms
  the pipeline on launch.

### What this means for scheduling

Steam gaming on ARM is more CPU-constrained than native Android
gaming. The Brood scheduler's job is harder:
- Game render thread: highest priority
- Proton/Wine translation threads: high priority (render path)
- Box64 JIT threads: high during warmup, normal after
- Steam client/webhelpers: background
- Android system: minimum to keep the phone alive

The quantum micro (QWATCH_PID) monitors the game process specifically,
not the Steam tree. Frame-time feedback targets the leaf.

## The problem with mobile gaming today

Mobile gaming on Android is fighting the OS. The problems:

1. **Thermal throttling** — sustained load heats the SoC, CPU/GPU
   clock down mid-game, frames drop off a cliff
2. **Scheduler interference** — background apps steal CPU from game
   threads; Android's scheduler is fair, not game-aware
3. **Notification interruptions** — calls and messages break
   immersion at the worst moment
4. **Memory pressure** — 8GB RAM shared between game, OS, and
   background apps; LMK kills are blunt
5. **Static "game mode"** — current solutions are on/off switches,
   not adaptive systems
6. **Input latency** — touch → compositor → render pipeline has
   no priority awareness

## How the SI Core addresses each

### 1. Adaptive thermal management (not just throttling)

Current: thermal driver hits a trip point, clocks drop, game stutters.

SI Core approach:
- Quantum micro (QMETER_RES) monitors thermal zones continuously
- Soul-layer (Seer, 650Hz) predicts throttling 30-60s before it hits
  based on thermal slope + game load pattern
- HiveMind proactively shifts to a degraded-but-smooth profile:
  background Brood workers deprioritized, game threads hold priority
- Result: graceful degradation (stable 45fps) instead of cliff (60fps → 20fps)

The key: prediction, not reaction. The soul-layer's foresight feeds
the kernel's scheduling before the thermal driver panics.

### 2. Game-aware scheduling (proven)

Already built and verified in Harakiri:
- Game process detected → Vera routes intent → PID tagged to Brood
- Brood scheduler applies boost (nice 0 → -10, proven in QEMU)
- Background processes explicitly deprioritized during gaming mode
- Untag on game exit restores original priorities

SI Core adds the closed loop:
- Soul-layer learns each game's thread pattern (render thread,
  audio thread, network thread get different priorities)
- Spider (slow eval) tunes the boost table per game over sessions
- Mouse (fast path) handles sudden load spikes (boss fight, scene change)

### 3. Notification gating (Mira's Gate)

- Gaming mode active → Mira holds all notifications at the Gate
- Pre-approved callers (N8toriousAi defines the list) ring through
- Everything else queues silently, delivered on game exit
- No system UI overlay, no interruption, no frame drop from
  notification rendering

This is already in the Harakiri design. The SI Core makes it
automatic: Vera detects game launch → mode switches → Gate activates.

### 4. Memory pressure with intelligence

Current: LMK kills background apps by oom_score, game can still stutter
during the kill + reclaim.

SI Core approach:
- PretaPath (ABSORB) as quantum micro monitors memory pressure
- Before critical: freeze (not kill) background apps via cgroup freezer
- Game gets a reserved memory floor; background apps get compressed
- On game exit: unfreeze, no app restart needed, no data loss

Freezing is faster than killing + relaunching, and preserves state.

### 5. Frame-time feedback loop

This is where the SI Core goes beyond anything in stock Android:

```
Game renders frame → QWATCH_PID measures frame time
  → telemetry via Minnoe → HiveMind analyzes
  → if frame time degrading: boost render thread, shed background load
  → if frame time stable: hold current policy
  → soul-layer (Witness, 425Hz) logs the pattern for next session
```

Per-game learning: after 3-4 sessions, the SI Core knows that
Game X needs aggressive render thread priority in combat scenes
but can relax in menus. No manual tuning.

### 6. Input latency reduction

- Touch input threads tagged as critical during gaming mode
- Mouse fast path ensures input handling never waits on scheduler
- Compositor thread gets elevated priority (it's in the render path)
- Target: <16ms touch-to-photon for 60fps games

### 7. Battery-aware performance

Not all gaming needs max performance:
- Spider learns: this game is GPU-bound (boost GPU, relax CPU)
  vs. this game is CPU-bound (boost CPU, GPU can clock down)
- Per-game DVFS profiles built over sessions
- Result: same frame rate, less battery drain

## What stock Android can't do

| Capability | Stock Android | SI Core |
|------------|---------------|---------|
| Game thread prioritization | Manual (Game Mode API) | Automatic via Vera intent |
| Thermal prediction | No (reactive throttling) | Yes (Seer + slope analysis) |
| Per-game learning | No | Yes (Spider + world state) |
| Notification gating | DND (manual) | Automatic (Mira's Gate) |
| Frame-time feedback | No | Yes (QWATCH_PID loop) |
| Background app freezing | No (kill only) | Yes (PretaPath + cgroup) |
| Mode persistence | No | Yes (world state) |

## Honest limitations

- **Adreno GPU drivers are closed.** We can influence GPU via sysfs
  freq controls (if exposed) and by managing CPU-side load, but we
  cannot rewrite the GPU scheduler. The userspace driver is Qualcomm's.
- **Thermal physics is real.** We can smooth the curve, not eliminate
  it. A phone will still get warm; the win is consistent frames, not
  cold silicon.
- **Requires the Harakiri kernel on device.** All of this depends on
  the phone flash (unlock → backup → flash). QEMU-proven, not
  phone-proven yet.
- **Per-game learning needs sessions.** First play of a new game is
  generic gaming mode. Intelligence builds over time.

## The pitch (for Foreskie)

Stock Android treats games as just another app. The SI Core treats
gaming as a first-class system mode with a closed feedback loop:
perceive (frame times, thermals, input) → deliberate (which threads
matter, what mode) → act (schedule, prioritize, gate) → observe
(did frames improve?) → persist (remember for next time).

It's not a game booster app. It's the OS itself becoming game-aware.
