HQ Mobile

Run HQ on an Android phone: install, first run, pairing and what to expect.

Checked on 2026-11-19 against build v0.9.1-main.648. See this page on GitHub.

The mobile profile is the edition of HQ for an instance that lives on a phone. It is Full HQ for a machine with no shell sandbox, no git and no way to replace its own binary, plus a data saver for people who pay for every megabyte. An Android build runs as this profile by default.

What each edition does

Item Full Lite Mobile
Web app, tasks, vault, search, import yes yes yes
Chat with a model, sub-agents yes no yes
Telegram and Discord relays (they only dial out) yes no yes
Drives coding agents on remote hosts (a laptop, a server) yes no yes
Agent shell inside an OS sandbox yes no no (a phone has no sandbox backend, so the shell is refused)
Git tools, the binary self-updater yes no no
Starts only with the egress it lists no yes no
Embeds note text for semantic search yes no yes, on the device (with remote, only with the data saver off)

Lite stays the edition for a machine you do not control. Mobile does not make Lite’s promise of no outbound traffic: a phone instance is allowed to talk to its model provider and its relays.

Choosing it

On an Android build a config left at the default (profile: full) runs as Mobile, and a config that asks for profile: lite keeps Lite. Elsewhere, ask for it:

profile: mobile
mobile:
  data_saver: true   # the default

Environment: HQ_PROFILE=mobile, HQ_MOBILE__DATA_SAVER=false. Both are read when HQ starts. The running daemon does not change edition on a config reload, as with Lite, and it refuses a change of mobile.data_saver the same way (the embedding worker and the task list are fixed at start, so a half-applied switch would keep sending note text after you turned it off). Restart to change either. Full cannot be chosen on an Android build: a config left at profile: full runs as Mobile.

The data saver

With data_saver: true:

  • No note text is sent to an embedding provider. With the default local embedder, notes are still embedded on the phone: the only data it uses is one model download of about 31 MB. With daemon.embedding_provider: remote, notes are not embedded and only the keyword (full-text) index follows each edit.
  • The scheduler skips memory-consolidation and email-poll, the timers that call a model or a mail API without being asked. It skips inbox-triage too under remote; with the local embedder that task asks no model and keeps running.

Turn it off (data_saver: false) on Wi-Fi or an unmetered plan to get those timers back. A phone app that knows the connection type can set HQ_MOBILE__DATA_SAVER before it starts HQ.

What Mobile removes from Full

  • Tool categories git and self_update, in the MCP registry and in the chat agent’s own tool set alike, so no transport and no chat turn offers them (MOBILE_REMOVED_TOOL_CATEGORIES and Profile::drops_tool_category in crates/hq-core/src/config/profile.rs, used by crates/hq-mcp/src/registry.rs and crates/hq-agent/src/builder/tools.rs).

  • The scheduled task disk-watchdog, which watches the disk and package caches of a development machine (crates/hq-cli/src/commands/start/daemon/mod.rs).

  • The notice about a missing shell sandbox at start-up: there is no sandbox backend on a phone, so the agent’s shell is refused (governance.bash.sandbox stays at its default, required) and nobody needs telling at every start.

  • Most tool schemas from each chat request. Every tool’s full schema rides in every request, which on Full is about 114 KB. On Mobile only the daily tools send schemas (notes, tasks, the web, session status and messages, skills, notify_owner; MOBILE_EAGER_TOOLS in crates/hq-agent/src/builder/tools.rs). The rest are listed by name with a short hint, and the agent loads one with tool_search when it needs it; from then on it is declared like the others. A Mobile request is about 42 KB instead of 122 KB (a_mobile_turn_sends_a_small_fixed_prompt keeps it there).

The coding-agent tools, the session supervisor and the host event loops stay: they are how a phone instance runs sessions on a host somewhere else. A built-in host on the phone itself is not something to run; point agent_host.default_host at a configured remote host.

Building for Android

.github/workflows/android.yml builds hq-cli for aarch64-linux-android with --profile release-small and a pinned NDK, and fails when any LOAD segment is aligned below 16 KB (scripts/check-android-alignment.sh), the page size Google Play requires of native code in apps that target Android 15 or newer. OpenSSL is built from source for Android as it is for Linux (crates/hq-cli/Cargo.toml).

To build by hand, point the C compiler, archiver and linker for the target at the NDK’s aarch64-linux-android26-clang and llvm-ar, then run cargo build -p hq-cli --profile release-small --target aarch64-linux-android --locked.

The Android build also turns on the tunnel feature (--features tunnel), which adds hq net tunnel: the phone as a userspace WireGuard peer with no system VPN slot. It is off in every other build, nothing starts it on its own, and the app that runs it is separate work. The commands, the files and the security notes are in docs/PRIVATE_NETWORK.md (“A phone without the WireGuard app”) and docs/security/NETWORK.md, section 9.

It turns on the bridge feature too (--features tunnel,bridge), which adds hq bridge, the QR pairing of docs/PAIRING.md. The app drives it through hq bridge run, described next.

Installing the APK without the Play Store

Each release build of main also publishes a signed Android app: agent-hq-android.apk (app id online.agenthq.app) on the release page, with its .sha256. Download it on the phone from the GitHub Releases page and open it. Android asks once to allow “Install unknown apps” for the browser or file manager you used. Check the signing certificate with apksigner verify --print-certs; its SHA-256 must be the one in apps/android/README.md and docs/security/RELEASE_CHECKLIST.md.

After that the app updates itself: Settings, Updates, “Check for updates” (and once a day while the hub service runs, and on opening the app once the last check is six hours old) reads the signed android-channel.json of the stable channel, or of every main build if you turn on “Follow every build of main”. A version that is ready shows as a line under the top bar on every screen, “AgentHQ 1.4.2 is ready to install”, with Update and Not now (seven days, or until a newer version), as well as on the Settings card. The signature is checked by the hq inside the app against the release key, the APK against the hash in that signed file, and Android against the app’s own signing key. You still confirm each install. How it is built and signed: apps/android/README.md.

The signed file also carries size, release notes (per language, up to three lines), a seq that only rises (the signing time; a phone refuses an older file), issued_at, a rollout share, urgent and a withdrawn list of versionCodes. Promote builds a new file from the release’s verified one with its own rollout and seq and signs it again. The manual “Android withdraw” workflow adds a versionCode to withdrawn (and can set rollout to 0) and signs again, so phones on that version move off it and none installs it.

Google plans to require developers to be verified for apps installed outside the Play Store from 2026 on certified devices, country by country. It is not enforced in Uganda before 2027. The project owner registers the app id and signing key before then, so these installs keep working; that is not done yet and nothing in the app depends on it today.

First run on the phone

A phone with nothing set up opens a short flow in the app before the shell, and no adb or computer is needed. It is shown once, while no AI service key is stored and no earlier launch has run, and it picks up where it stopped if Android closes the app half way.

  1. Welcome. Choose “Set up a new HQ” or “Restore from a backup”.
  2. Your AI model. Pick OpenRouter, Anthropic or “Other OpenAI-compatible” (which asks for a base URL and saves it in files/hqhome/config.yaml as a backend), then paste the key. The key is sealed in the Android Keystore as it is saved and is never written to a file. “Check key” makes one request to the service and says whether it was accepted; it is optional.
  3. Chat apps (optional). Paste a Telegram or Discord bot token, or skip. A stored bot token switches its relay on for the hq child, so no config edit is needed. Linking an account to the bot is done after the flow, in Settings, Messaging apps.
  4. Start. Writes active to files/mode and restarts hq, which then runs hq start all. Run it on one machine only: a second copy on the same data would poll the same bots twice.

Restore. Choose the .hqbak file and either type its passphrase or choose its key file. The app copies them into its cache, stops hq, runs hq restore into a new folder beside the vault, and swaps that folder in only after the whole backup verified, so a failed restore leaves the vault as it was. The passphrase and the key reach hq restore through a private file (mode 0600), never on a command line, and the copies are overwritten and deleted afterwards. Then continue to Start. Backups are made with hq backup (docs/BACKUP.md). Restoring on Android has not yet been run on a phone.

Keys later. Settings, “Keys on this phone” lists the names of the sealed credentials (never the values), and adds, replaces or removes one. hq restarts to read the change.

Which model a sealed key gets. The app hands sealed keys to hq as environment variables (OPENROUTER_API_KEY, ANTHROPIC_API_KEY) and never writes a model into config.yaml. So on the Mobile profile a default nobody chose (the relay alias or a local model) follows the keys at load, by the rule hq env and the web setup use: an OpenRouter key gets setup’s cheap OpenRouter model, an Anthropic key alone gets Anthropic’s. Nothing is written back, and a model the owner picked is left alone. Settings, “Your keys” shows such a key as set outside the app. The relay alias also has a paid OpenRouter route behind its free one, so a host whose only key is OpenRouter’s still answers when the free model does not.

Helpers. Claude, Codex and the other helpers run on a computer, never on the phone. With no computer paired, the start sheet shows the one line to run on the computer (Copy, or “Send to my computer” through the share sheet) and a Scan the code button that opens the pairing scanner; the sheet asks HQ again when the owner comes back to it. See “One command, for the phone app” in JOIN_A_MACHINE.md.

Start a helper. The sheet lists HQ Coder and then the agents the chosen computer really has: each computer looks along the PATH its agents start with (host.programs), and a computer too old to answer lists every agent HQ knows. Any helper can start connected to a note (added to its first message, up to 8000 characters), a task (the task records its work) or a repository (named in its first message). With a task attached, the words are optional.

HQ Coder. The start sheet also offers HQ’s own worker, which needs no computer. After GitHub’s install page, “Back to HQ” (hq://helpers/github) reopens the sheet, which says the connection worked. Connect GitHub makes the person’s own private GitHub App in a Custom Tab; its key stays in <hq dir>/github/ on the phone (mode 0600, outside the vault), and nobody else, the HQ project included, holds a way in. HQ fetches the repository, a sub-agent edits it, GitHub’s CI tests the hq/ branch and the person reviews and merges. A repository whose workflows use secrets, or that has a preview host, waits for the owner’s confirmation. The same sheet, also under Settings, takes the job: pick a repository, say what should change and press Start, with the task’s budget in view. Pressing Start is the owner’s yes to the first task. Plan and phone results: plans/mobile-helpers.md.

The bridge on the phone

The phone can pair with another machine of its owner by QR code and then be reached by key, with no account and no VPN (docs/PAIRING.md, docs/security/PAIRING.md). The app has three parts for it, all new files (apps/android/.../bridge/, ui/pairing/):

  • hq bridge run, a child process of the hub service. It owns the iroh endpoint and the paired list. The app talks to it in JSON lines on its standard input and output: no socket, no port, so nothing but the app can reach it, and it ends when the app’s end of the pipe closes.
  • The pairing screen (PairingActivity): show a code, scan one with the camera, paste a link, type the six digits, list the paired devices, remove one. Removing closes that device’s open connection at once.
  • The hqpair:// link handler (PairLinkActivity): a QR code read by the stock camera, or a link in a browser, opens the app on a confirmation screen. Nothing is dialed until the owner presses Pair, because anyone can send a link.

Off by default. The child binds a UDP socket and accepts paired devices, so it runs only after the owner turned “Paired devices” on in the pairing screen. Showing a code or scanning one starts it for that pairing only; it is remembered (and the hub service starts it again with the app) once a pairing succeeds, and leaving the screen without one stops it again. A link the owner confirmed but that failed therefore leaves the phone as it was. Turning the switch off stops the child, and kills it if it has not gone in three seconds.

The relay. Pairing and reconnecting need a relay to find the direct path from behind a phone’s address translation. The default is n0’s public relays (--relay default), which are for development and testing, not production; a release uses a relay the household runs (the hq edge co-hosted relay). Put none, default or a relay URL on one line in files/bridge_relay to change it. With a relay the ticket carries no IP addresses (--no-addrs), which makes the QR code about half the size.

The control protocol. One JSON object per line. Commands, from the app: open (show a ticket; ttl_secs optional), cancel, digits (the digits the person typed for a waiting device), join (a link), peers, revoke, network_change, ping, keep, keep_stop, quit. cancel ends the ticket on show and a join in progress. Events, from hq: ready, ticket, request (a device waits for digits: its name and id, never the digits), decision (paired once the device is on the list, declined, or too late), ticket_closed, digits (what the phone shows while it joins), joined, join_failed, peers, revoked, ping, keep, error, bye. The six digits are compared inside hq: the app forwards what was typed and never learns the right answer, so a “yes” button cannot be built on it. Unknown events are skipped, so a newer hq does not break an older app. The code is crates/hq-cli/src/commands/bridge_control.rs (the loop works over any reader and writer and is tested end to end with two machines) and apps/android/.../bridge/BridgeWire.kt.

Why a child process needed a fix. iroh reads Android’s DNS servers through JNI (ndk-context), and a child process has no JVM. The call panics, the release profiles abort on panic, so the first endpoint bind ended hq with SIGABRT (measured on an Android 16 emulator; the spike’s unwinding build only printed the panic). hq now sets a null ndk-context on Android (crates/hq-cli/src/android_runtime.rs; netdev, which also asks, checks it and skips what needs the JVM) and gives every bridge endpoint a resolver that asks getaddrinfo first and iroh’s public resolvers second (hq_bridge::dns), so the JNI read is never reached. A new iroh endpoint anywhere in hq must be given that resolver.

Network changes. Android does not tell native code when the network changes. The app watches the internet networks that are not a VPN (NetworkWatcher; the default network is the VPN on a phone that has one, and does not change when Wi-Fi gives way to mobile data under it) and sends network_change, which calls Endpoint::network_change. A connection that hq bridge run holds also gets a probe when the network changes while a call waits, and is dropped and dialed again if the probe goes unanswered for 1.5 s (a Wi-Fi to mobile data switch went from about 17.5 s of silence to 4 to 6 s on a phone). See docs/plans/native-bridge/w4-measurements.md, and for keep, the diagnostic that holds a connection to a paired device and traces its round trips into files/bridge.log (a line a second until it is stopped).

Keeping the connection with the app in the background. The bridge child lives inside the existing foreground service, so it runs for as long as hq does. What a sleeping phone then does is in docs/plans/native-bridge/w4-measurements.md and in the risk section of docs/plans/native-bridge-sprint.md.

Claude on the phone. The app has no Connect Claude screen: the public claude.ai connector is retired (docs/plans/native-bridge-sprint.md). Settings, under Your accounts, says that Claude Code and Claude Desktop reach HQ through the owner’s laptop while it is paired with the phone.

Diagnostics for adb, on the pairing screen’s intent (it needs a permission only adb holds): --es keep <device id> starts the keep trace, --es keep "" stops it, --ez watch false stops the app from reporting network changes (for a before and after), --es screen show|scan|paste opens a screen. -Phq.appId=<id> builds a copy that installs beside the real app for a phone test; it is never a release id.

Not part of this edition

The app that runs this binary as a foreground service and shows the web app in a WebView, backup and restore, and an updater for Android. They are separate work; the profile only makes the binary behave correctly once something runs it. A way for other devices to reach a phone is the bridge above.