* feat(android): remember new-session launch defaults per machine and agent Port of the web launch-preference persistence (`hapi:newSession:launchSettings:v1:<machine>:<agent>`): model, effort, reasoning effort and — for shared-permission-mode flavors only — the permission mode of a successfully spawned session are remembered per (machineId, agentFlavor) dimension and prefill the next create form for that dimension (fresh screen, agent switch, machine switch). - Storage: NewSessionPrefsData gains a nested `launchSettings` map inside the existing `hapi_prefs` DataStore blob; legacy blobs without the field decode to empty defaults, corrupt shapes keep the pre-existing whole-blob default degrade (DirectoryExpandPrefs contract). - Capture happens at spawn success only (web saves on every create-success path); grok renders the native select but its mode is deliberately not remembered (web `usesSharedPermissionModeState`). - Restore: resolvePreferredLaunchSettings validates claude's static model and effort lists, drops `xhigh` from opencode's reasoning efforts and coerces a removed permission mode to `default` — never a stale toggle; codex's dynamic model passes through for the existing settled-catalog reconciliation. - A restored in-progress draft outranks the remembered defaults until the user switches agent or machine (web `preserveRestoredDraftRef`). - Machine switches now also reset effort/reasoning effort/shared mode to the new dimension's remembered values (or sentinels), matching the web restore effect that re-runs on machineId change. Divergences from web: no `cursorSelectedBase` (no Android picker yet); agy's static model presets are not re-validated on Android (no v1 picker, the stored value is always `auto`). Tests: prefs round-trip/cold-start, legacy-blob tolerance, corrupt blob and corrupt-entry fallback (real temp-file DataStore, pure JVM); capture gating and resolve coercion logic; VM prefill per dimension, machine and agent switching, spawn-success capture, and draft precedence. Co-Authored-By: Claude Code <noreply@anthropic.com> via [HAPI](https://hapi.run) Co-Authored-By: HAPI <noreply@hapi.run> * fix(android): preserve launch selections across machine heartbeats --------- Co-authored-by: HAPI <noreply@hapi.run> Co-authored-by: weishu <twsxtd@gmail.com>
HAPI
Run official Claude Code / Codex / Cursor Agent / Grok Build / OpenCode / Kimi / Copilot / Antigravity / Pi / DeepSeek Harness sessions and control them remotely through native iOS / Android apps, Web / PWA, or Telegram Mini App.
Why HAPI? HAPI is a local-first alternative to Happy. See Why Not Happy? for the key differences.
Features
- Seamless Handoff - Work locally, switch to remote when needed, switch back anytime. No context loss, no session restart.
- Shared Codex Sessions - Use Codex from your terminal and phone at the same time. Requires Codex 0.154.0+. Usage and limits.
- Native First - HAPI wraps your AI agent instead of replacing it. Same terminal, same experience, same muscle memory.
- AFK Without Stopping - Step away from your desk? Approve AI requests from your phone with one tap.
- Your AI, Your Choice - Claude Code, Codex, Cursor Agent, Grok Build, OpenCode, Kimi, Copilot, Antigravity, Pi, DeepSeek Harness—different agents, one unified workflow.
- Terminal Anywhere - Run commands from your phone's browser or desktop web app, directly connected to the working machine.
- Voice Control - Use dictation in native apps, or talk to your AI agent hands-free with the web voice assistant.
- Workspace Browser - Opt-in via one or more
hapi runner start --workspace-root <path>flags: browse scoped file trees from the web and start sessions in allowed subdirectories.
Demo
https://github.com/user-attachments/assets/38230353-94c6-4dbe-9c29-b2a2cc457546
Getting Started
npx @twsxtd/hapi hub --relay # start hub with E2E encrypted relay
npx @twsxtd/hapi # choose an agent and start a session
hapi server remains supported as an alias.
Use hapi <agent> [options] to start an agent directly, for example hapi claude
or hapi codex. Scripts must specify the agent explicitly. hapi --help shows
HAPI's commands and supported agents.
The hub displays a URL and two QR codes. Open the web URL in a browser, or pair a native app using the companion QR. See Native apps for build and pairing instructions.
The relay uses WireGuard + TLS for end-to-end encryption. Your data is encrypted from your device to your machine.
For self-hosted options (Cloudflare Tunnel, Tailscale), see Installation
Docs
Native apps (iOS / Android)
The repository includes SwiftUI/UIKit and Kotlin Compose clients with chat, approvals, session creation, files, dictation, and push notifications. See the native app guide for capabilities, platform differences and pairing. Build instructions: iOS and Android. Developer protocol: client contract.
Build from source
Requires Bun 1.4.0.
bun install
bun run build:single-exe
Credits
HAPI means "哈皮" a Chinese transliteration of Happy. Great credit to the original project.