AI-aware thermal governor + gaming engine + on-device AI studio for rooted Android.
A tiny root daemon that sustains on-device LLM inference and maximizes game FPS — safely —
plus a private, offline AI studio (local chat + image generation) and a RAM manager,
wrapped in a neo-brutalist app with a floating performance HUD.
Install · AI studio · Using the app · How it works · Build · Architecture · Safety
On-device AI is throttled by thermals: run a local LLM (llama.cpp, MediaPipe, ONNX
Runtime, QNN Genie) for a minute and GPU/CPU clocks collapse (680 → 300 MHz) as the phone
protects itself. Gaming thermal mods exist, but they chase short FPS bursts, not
sustained AI workloads — and nobody ships a governor that reshapes thermal behaviour
specifically for NPU/CPU-heavy inference.
Kelvin does both. It detects whether you're gaming or running inference and loads the right frequency/thermal curve in real time:
- 🎮 Game — burst: raise the GPU + big-core floors for frame stability.
- 🧠 AI-Sustained — soak: hold clocks flat at a raised-but-bounded ceiling so inference throughput doesn't cliff after a few runs. (The genuinely new part.)
- ⚖️ Balanced / 🔋 Battery — stock-ish / efficiency.
All behind a hard temperature ceiling, a stock-config backup, and a bootloop watchdog — Kelvin reshapes the thermal curve, it never removes the safety net.
A neo-brutalist Kotlin + Compose companion: live telemetry, one-tap profiles, per-app rules, a safety panel, a draggable floating HUD you can pin over any game or LLM front-end, plus a full on-device AI studio (local chat + image generation) and a RAM manager. Smallest-possible APK — no analytics, offline-first.
Dashboard · Live sensors · Safety · Per-app profiles — all streaming from the root daemon over a local socket.
Kelvin isn't just a governor — it ships a fully local, private AI studio that runs entirely on your phone. No cloud, no account, no data leaves the device. And because Kelvin is the thermal governor, it flips itself into AI-Sustained the moment inference starts, so your tokens/sec and image steps don't thermally cliff.
AI hub · Local chat (llama.cpp) · Image studio (Stable Diffusion) — 100% offline, on-device.
- 💬 Local LLM chat (
llama.cpp/ GGUF). Real streaming chat with any GGUF model, token by token, over a bundledllama-server. Multi-turn history that persists to disk, a searchable History screen (rename / delete), a Stop button, and Offload to free RAM. Tool-calling is wired so the model can ask the image engine to draw a picture mid-conversation. - 🎨 On-device image generation (Stable Diffusion 1.5 / stable-diffusion.cpp). Type a prompt, get a real image — no gradient placeholders. A persistent server loads the model once (device-specific compute compiled at load, like a warmed-up LLM), then generations run instantly after. A per-device backend picker (Auto / GPU / CPU) is discovered from your actual hardware, with load → generate, Reload / Offload, Stop, and one-tap Save to Photos. Private gallery — nothing touches your camera roll until you export it.
- 📦 Model manager. Browse a curated catalog or paste any HuggingFace link; downloads are resumable, cancellable, and foregrounded, with an optional token for gated models. Delete models to reclaim storage, and fetch a curated NPU-optimized build when your SoC supports it.
- 🧮 RAM manager (root). Real per-process PSS/USS from
smaps_rollup, safe force-stop of a heavy app behind a server-side deny-list (system-critical processes are protected), and a genuine Clear cached RAM (drop_caches+ compact) — the honest "free RAM", not a fake booster.
Why root helps AI: Android's phantom-process killer SIGKILLs a CPU-heavy inference child the instant it spikes; Kelvin launches its engines as a root-owned process that survives, and holds AI-Sustained clocks so throughput stays flat. Everything degrades gracefully without root — chat and images still run, you just lose the governor + full RAM manager.
A root module can't draw a UI; an app can't write /sys. So Kelvin is split, and the two
halves talk over a root-owned abstract AF_UNIX socket (@kelvin, line-delimited JSON):
kelvind— a tiny (~31 KB) native C daemon in a Magisk/KernelSU/APatch module: the workload detector, profile engine, safety layer, and per-SoC path providers.- Kelvin app — a Kotlin + Compose companion: floating HUD (FPS, clocks, temps,
tokens/sec, RAM), one-tap profiles, per-app rules, a safety panel, and launcher-icon
hide/show. It renders what the daemon reports and sends it commands — it never touches
/sys.
See docs/architecture.md and the socket contract in protocol/README.md.
kelvin/
├── daemon/ native C governor (kelvind) + RAM manager + per-SoC providers ← the core
├── module/ Magisk/KernelSU/APatch packaging
├── app/ Kotlin + Compose companion — HUD, dashboard, per-app profiles, safety,
│ AI studio (local chat + image gen), RAM manager
├── protocol/ daemon↔app control-socket contract
├── docs/ architecture · safety · SoC matrix · ai-engine · tooling
├── scripts/ build-daemon.sh · build-sd.sh (NDK cross-compile)
└── .github/ CI: daemon build · app build · tag → signed release
Each ~5 Hz tick, the daemon: reads sensors → detects the workload (foreground app + a /proc
scan for inference-engine signatures) → runs the safety interlock → resolves a profile
(with hysteresis to avoid clock thrash) → applies only safe, reversible knobs (cpufreq
scaling_min/max, GPU devfreq min/max) → publishes stats to the app. Full write-safety
rules: docs/safety.md.
On-device finding: the vendor thermal-engine continuously rewrites
scaling_max, so max-caps are best-effort — raising the floor (scaling_min) is the authoritative lever, which is exactly why the AI-Sustained curve holds.
- Download
kelvin.zipfrom Releases. - Flash it in Magisk / KernelSU / APatch Manager.
- Reboot.
- (Recommended) install the companion app: grab
Kelvin-<version>.apkfrom the same release and open it. It's signed and offline — no Play Store, no internet permission.
Requires root (Magisk 20.4+, KernelSU, or APatch). Fully systemless and reversible — disable or remove the module to restore stock.
- Onboarding. On first launch Kelvin checks that the root daemon is reachable
(
kelvind detected — you're linked), then walks you through granting the display-over- other-apps permission (for the HUD) and the notification permission. - Dashboard. See live skin / SoC / GPU temperature, thermal headroom against the ceiling, and per-cluster clocks. Leave Auto-Switch on to let the daemon pick the profile from the detected workload, or tap Game / AI-Sustained / Balanced / Battery to pin one.
- Floating HUD. From the HUD tab, launch the overlay: a draggable, snap-to-edge strip of FPS · clocks · temps · tokens/sec · RAM. Tap it to toggle compact/expanded; tune opacity, corner, refresh rate, and which stats show.
- Per-app profiles. In Apps, assign a profile to any package — it auto-loads whenever that game or your llama.cpp front-end comes to the foreground.
- Safety. View the bootloop-watchdog / interlock status, lower the skin-temp ceiling within the daemon's hard limit, and one-tap Restore stock.
- AI studio (AI tab). Tap Add model to download a GGUF chat model or a Stable Diffusion image model (or paste a HuggingFace link). Open a model to chat (streaming, saved history), or the Image studio to pick a compute backend (Auto / GPU / CPU), Load the model once, then Generate — save to Photos when you like it. RAM tab: stop a heavy app or clear cached RAM.
- Hide the icon (Settings). Kelvin can drop its launcher icon; reopen it with the
Quick Settings tile or the dialer secret code
*#*#5358#*#*.
Toolchain setup (Ubuntu): docs/tooling.md.
Daemon (module):
export ANDROID_NDK_HOME=/path/to/ndk
bash scripts/build-daemon.sh # → module/bin/{arm64-v8a,armeabi-v7a}/kelvind
cd module && zip -r ../kelvin.zip . # package (CI does this on a v* tag)Host sanity build (no NDK): gcc -std=c11 -D_GNU_SOURCE -Wall -Wextra -Idaemon/include daemon/src/*.c daemon/soc/*.c -o kelvind.
App:
cd app && ./gradlew assembleDebug # or assembleRelease (signed when a keystore is present)AI engine binaries (bundled in the APK, git-ignored + CI-built like kelvind): the chat
engine is llama.cpp's llama-server and the image engine is stable-diffusion.cpp's sd-server.
Reproduce the image one with scripts/build-sd.sh [cpu|vulkan] → app/src/main/jniLibs/arm64-v8a/ libstable-diffusion-server.so.
Tag a version (git tag v0.6.0 && git push --tags) and CI cross-compiles both ABIs, packages
kelvin.zip, builds a signed Kelvin-<version>.apk, and publishes the GitHub Release.
| v1 (now) | Qualcomm Snapdragon — 8 Gen 2 (SM8550; RedMagic 8/8S Pro test bench) and 8 Elite Gen 5. |
| v2 (roadmap) | MediaTek (Dimensity 9500), Samsung Exynos (2600 + HPB), gaming-phone fans (RedMagic/ROG/Legion). |
On unsupported SoCs the daemon runs read-only (telemetry only) — it never guesses write paths. Full targeting map: docs/soc-matrix.md.
Kelvin runs as root and writes /sys. It enforces an absolute skin/junction/battery ceiling,
backs up stock config before the first write, restores it on exit or thermal interlock, and
holds stock config for a boot if the previous boot looked unstable. It never writes
emul_temp, never disables a critical thermal zone, and never removes the last
software thermal layer. Read docs/safety.md before touching write paths.
Confirm or request your chipset via the device-support template (include the sysfs probe). New SoCs are drop-in providers — see docs/soc-matrix.md.
MIT © 2026 Abdul Moez (@Anonym0usWork1221). See LICENSE.
⚠️ Kelvin changes CPU/GPU/thermal behaviour on rooted devices. It ships extensive safeguards, but you run it at your own risk.
Keywords: on-device AI · local LLM · offline AI chat · llama.cpp · GGUF · on-device Stable Diffusion · stable-diffusion.cpp · local image generation · Magisk module · KernelSU · APatch · AI thermal governor · CPU/GPU frequency scaling · sustained inference · gaming performance · FPS boost · tokens/sec · Snapdragon 8 Gen 2 / 8 Elite · Adreno · Hexagon NPU · QNN · rooted Android · Android RAM manager · drop_caches · floating performance HUD · Kotlin Jetpack Compose.







