PhoneCLI: The Mobile Agent That Compiles Your App Before It Clicks

Instead of rethinking every screen with a vision model, PhoneCLI maps mobile navigation once, replays it as deterministic commands, and falls back to a model only when the UI is genuinely unfamiliar.

9 min read • View on GitHub • More from HKUDS

A wide editorial illustration showing a phone app transformed from a tangled screen map into a clean command strip. The left side looks like a cluttered navigation maze, while the right side collapses into a deterministic path and compact command flow. It explains how PhoneCLI turns repeated navigation into something more like compiled software than live reasoning.
PhoneCLI shifts the expensive part of mobile automation from repeated visual reasoning to a reusable navigation artifact.
Key Takeaways

The Hidden Tax in Mobile Agents

Most mobile agents still pay the same tax on every step. They look at a screen, ask a model what changed, pick an action, then repeat the whole loop on the next screen. That works, but it is wasteful when the task is a familiar path like opening settings, toggling Wi-Fi, or finding a menu item that never moves.

PhoneCLI starts from a simpler idea: navigation is usually ordered, repetitive, and stable enough to compile. If a path already exists, you should replay it. Save the model for the part that actually needs judgment.

PhoneCLI Turns UI Paths Into Callable Commands

The repo’s central move is the app map. PhoneCLI crawls an app offline, discovers screens and interactive elements, and records the paths between them. Those paths become replayable commands, so the agent can jump straight to a known destination without re-solving the route from scratch.

The app map is the bridge between messy UI discovery and cheap, repeatable execution.

A close-up editorial illustration of an app map drawn like a subway map or circuit board. Several screen nodes are connected by replay paths, with one route highlighted as the shortest way to a familiar setting. A small model cloud sits off to the side, connected only by a dashed line for exceptional cases. It explains that the map handles routine navigation while the model handles novelty.
The app map is not a log of taps. It is a reusable route system for screens.
task: turn_on_wifi
route:
  - launch: Settings
  - tap: Wi-Fi
  - tap: toggle_on
fallback:
  - if_not_found: ask_vlm
  - if_replay_fails: verify_and_retry

The Three-Tier Execution Ladder

Once the map exists, runtime becomes a routing problem. PhoneCLI tries the cheapest layer first: deterministic CLI replay. If the path is not in the map, or the replay fails, it escalates to an on-device model. Only then does it reach for a cloud model.

LayerNavigation strategyRuntime costPrivacy postureFailure modeBest fit
Deterministic CLI replayUse the compiled app map and execute a known routeLowestHighestFails when the task is new or the UI changedRoutine navigation
On-device modelAnalyze the screen locally and choose a new actionModerateHighCan still miss novel layouts or long-horizon tasksUnmapped but local tasks
Cloud VLMSend the hard case to a larger remote modelHighestLowestMore capable, but slower and costlierRare, complex, or ambiguous cases

That ladder matters because it changes what the model is for. The model is no longer the default navigator. It becomes a fallback tool for novelty, ambiguity, and edge cases.

Our 3B model is: Edge-Optimized: Efficient enough for commodity GPUs and next-generation mobile NPUs. Privacy-First: All computation stays on your device. Cost-Free: No cloud inference and no ongoing API fees.

Chao Huang, Assistant Professor at HKU · HKUDS/OpenPhone Project Description

Why the App Map Matters More Than the Model

This is the conceptual center of the project. The app map is not just metadata. It is the mechanism that turns repeated navigation into lookup and replay. That is why PhoneCLI feels more like systems software than prompt engineering.

A model-heavy agent has to re-perceive the world at every step. PhoneCLI says that is the wrong abstraction for a lot of mobile work. If the route is known, stop paying inference costs for it.

OpenPhone Adds the Training Stack

PhoneCLI is only one layer of the broader OpenPhone stack. The larger project pairs the navigation harness with a 3B mobile foundation model and a training pipeline that moves from supervised fine-tuning to GRPO. The goal is simple: keep capable interaction on-device as much as possible, and escalate only when necessary.

That makes the repo interesting in two directions at once. PhoneCLI is the execution trick. OpenPhone is the training and orchestration system wrapped around it.

Compared With Screenshot-Loop Agents

The cleanest way to understand PhoneCLI is by contrast. Many mobile agents still behave like visual slot machines. They inspect a screenshot, infer an action, and pay the same reasoning cost again one step later. PhoneCLI changes that economics by compiling predictable navigation away first.

ProjectNavigation strategyRuntime costPrivacy postureFailure modeBest fit
PhoneCLI inside OpenPhoneCompile app paths into deterministic commands firstLow for known paths, higher only on fallbackStrong, because local execution is the defaultUnmapped screens or changed UI structuresRepeatable navigation with selective reasoning
AppAgent / Mobile-AgentScreenshot loop with prompting and explorationHigher on every stepUsually weaker, because cloud reasoning is commonEvery step re-enters the visual loopGeneral mobile tasking
UI-TARS / Qwen-style mobile agentsUnified vision-language reasoning across tasksOften higher per actionMixed, depending on deploymentPowerful, but still inference-firstBroad multimodal interaction
Screenshot-loop baselineLook, infer, act, repeatHighest repetitive costLowest by default if cloud-hostedSlow and expensive on routine pathsProof-of-concept automation

The point is not that the alternatives are bad. It is that they keep treating navigation as an inference problem. PhoneCLI treats it as compiled infrastructure.