A machine that should run coding agents for your HQ (a laptop, a workstation, a WSL2 install on Windows) joins it by pairing with the phone: scan, type six digits, done. Pairing sets up both sides with no configuration (PAIRING.md, “What pairing sets up”). The older path over Tailscale with a join code still works; it is at the end of this page.
One command, for the phone app
On a Mac or a Linux computer (on Windows, inside WSL2), with the phone app open on Helpers:
curl -fsSL https://agent-hq.online/install.sh | bash -s -- --pair
It installs hq from a signed release (without the web UI: the phone holds HQ) and runs
hq bridge pair --setup, which:
- turns on the host’s gate at
127.0.0.1:7747for loopback (left alone if you setagent_host.gate_listenyourself) and starts the host as a login service; - shows a QR code. On the phone, in Helpers, tap Scan the code. The phone shows six digits; type them on the computer;
- after the pairing, runs
hq bridge serveas a login service (LaunchAgentcom.hq.bridgeon macOS, user unithq-bridge.serviceon Linux), so the phone reaches the computer whenever it is on.
The computer is named after itself (the Mac’s name, else its host name) and uses the phone app’s
relay (--relay default, n0’s public relays) unless you pass --relay. The coding agent must be
installed and signed in on the computer; the command says so when it finds neither Claude Code nor
Codex. Where a service cannot be installed (no systemd user session), it says which command to keep
running instead. hq bridge join --setup does the same from the other direction, with a link the
phone shows.
The phone app shows this line, with Copy and “Send to my computer”, when Helpers has no computer.
Step by step
You need: an hq binary on the machine built with pairing (~/.local/bin/hq, from a
release), and the coding agent you want (for example
Claude Code) installed and signed in on the machine.
Get hq on the machine
Pick the newest tag on the releases page, then
(linux-x86_64, linux-aarch64, darwin-aarch64 or darwin-x86_64 for the platform):
V=0.9.1-main.81
curl -fsSL -o hq.tgz "https://github.com/CalvinMagezi/hq/releases/download/v$V/hq-$V-linux-x86_64.tar.gz"
tar xzf hq.tgz && mkdir -p ~/.local/bin && install -m 755 hq ~/.local/bin/hq
Releases ship a SHA256SUMS file next to the archives; check the archive against it.
Pair the machine with the phone
-
On the machine, let the host’s gate listen on loopback, where bridge traffic arrives, in
~/.hq/config.yaml:agent_host: gate_listen: 127.0.0.1:7747 gate_allowed_sources: [127.0.0.1]and install the host as a login service (
hq host install; a host already running needs a restart to read the change). -
On the phone, open paired devices and show the pairing code. On the machine:
hq bridge joinand paste or scan the link. The machine shows six digits; type them on the phone.
-
On the machine, keep the bridge up (as a login service, or in a terminal):
hq bridge serve
The phone now lists the machine as a host, its agents call back to the phone’s HQ, and hq task on
the machine reaches the phone’s tasks. Revoking the machine on the phone, or the phone on the
machine (hq bridge revoke <id>), undoes it.
Older setup: Tailscale and a join code
For an HQ that is not on a phone, or a machine without pairing, the machine and the HQ can be on the same Tailscale tailnet instead, joined in four steps. A person or an agent can do all of them; the commands print what to do next.
1. On the machine
hq host join
Installs the host as a login service (a LaunchAgent on macOS, a systemd user service on Linux and
WSL2) and prints a join code that starts with hqjoin1.. The code holds the machine’s name, user and
tailnet address, nothing secret. Give --addr <tailnet address> when tailscale cannot be asked, or a
name as the first argument to choose the host name (hq host join dev-wsl).
It also creates the machine’s HQ folder, Documents/HQ under the home directory (on every
operating system, including a headless Ubuntu server that has no Documents yet). Agents started
from the Workbench page in the web app run there, or in a folder inside it. The host creates the
folder again each time it starts, so deleting it is harmless. On macOS the system may ask whether
hq can use your Documents folder the first time; choose Allow (or turn it on later under Privacy and
Security, Files and Folders). Until then the Workbench page shows that computer as unable to start
agents here and says why.
2. On the HQ
hq host add hqjoin1.…
or have the HQ’s agent call the host_add tool with the code. It creates a key for the machine,
records it as a host, and prints one command that starts with hq host authorize.
The join code names the host itself. When a host of that name is already set up and points
somewhere else, host_add refuses unless it is called with replace: true, and the approval
request you get for it spells out the name, user@address and system the code carries, since
the code itself is unreadable. hq host add in your own terminal replaces it and says so.
3. On the machine
Run that hq host authorize … command. It lets the HQ’s key (and only that key, and only from the
HQ’s address) call the host.
4. On the HQ
hq host check <name>
or the host_check tool. When it says reachable, start a session with host: <name>. When it
does not, it names the likely cause.
The key can start any command as you on that machine, like an ssh login, so only pair machines you
control. Agents there run in a sandbox: they cannot read the host’s own files, ~/.hq or your
credentials directories, but otherwise work as you would in a terminal on that machine. For agents
nobody watches, set agent_host.sandbox.profile: strict: they then reach only the sites the HQ
allows (agent_host.sandbox.allow_domains; denied sites are logged so you can add what you need)
and read and write only a short list of paths. See AGENT_HOST.md.
Windows
The host runs on Linux and macOS, so on Windows it runs inside WSL2 (Ubuntu). The WSL2 setup, including the Tailscale and sandbox settings WSL2 needs, is in WINDOWS.md; once Ubuntu is ready, pair from inside it as above (or follow the older steps 1 to 4).
If you are an agent setting this up
Run the commands exactly as written, in order, and read each one’s output before the next. With
pairing, the person types the six digits on the phone; never type them for them. On the older path,
the join code goes to the HQ and the authorize command comes back to the machine. Do not run
hq host serve --allow-unsandboxed or edit authorized_keys by hand; hq host authorize writes the
pinned line. If hq host install refuses the binary’s location, copy hq to ~/.local/bin and run it
from there.