Open History to see the last commit
1# Remote access
2
3Connect a phone, browser, or another desktop app to T3 Code running on a different
4machine. That machine must stay running and reachable while you work.
5
6## T3 Connect
7
8T3 Connect makes an environment available to your other devices without setting
9up router forwarding. In the desktop app on the host, open **Settings →
10Connections**, sign in, and enable **T3 Connect** for that environment.
11
12For a command-line host, run:
13
14```bash
15t3 connect
16```
17
18Follow the sign-in instructions. Setup offers a
19[background service](./background-service.md); if you decline it, start the
20server with `t3 serve`. Saving your sign-in alone does not make the machine
21reachable.
22
23On your other device, sign in to the same T3 Connect account and choose the
24environment. On the app.t3.codes home page with no computer added yet, signing
25in adds compatible computers linked to your account. Over SSH, the CLI prints a
26browser link and a short code. Open the link on any device, confirm the code
27matches, and approve. The CLI continues on its own, so you do not need to forward
28an OAuth callback port.
29
30T3 Connect renews access credentials when needed without disconnecting a healthy
31connection. Pull request diffs and provider settings keep working after the
32previous credential expires. A failed renewal affects that request; it does not
33disconnect an otherwise healthy conversation.
34
35## Pair over a LAN or private network
36
37Use direct pairing when the other device can reach the host's network address.
38
39On a desktop host, open **Settings → Connections**, enable **Network access**,
40then create a pairing link using an address the other device can reach. Changing
41network access restarts the desktop app. You can turn it off in the same place.
42
43For a command-line host, replace `<private-ip>` with the host's LAN or tailnet
44address:
45
46```bash
47t3 serve --host <private-ip>
48```
49
50If a server is already running, generate a fresh link without restarting it:
51
52```bash
53t3 pair
54```
55
56Scan the QR code on your phone or paste the pairing URL into **Add environment**
57in the receiving app. Connection settings are under **Settings → Connections**
58on web and desktop and **Settings → Environments** on mobile. A loopback address
59such as `127.0.0.1` reaches only the device opening the link.
60
61Pairing authorizes that device for future connections. Use a fresh one-time link
62for each new device; you do not need the original token to reconnect. Links
63created in Settings can only be copied from the client that created them while
64its Connections page stays open. If you leave or reload that page, create
65another link to share.
66
67### Reach one machine several ways
68
69A machine can have more than one route: LAN, Tailscale, another VPN, a public
70URL, SSH, or T3 Connect. Tailscale shares its `100.64.0.0/10` address range with
71other VPNs such as Cloudflare WARP, so an address in that range shows as VPN
72unless the machine confirms it is on Tailscale. To add a route, choose **Add
73route** in the machine's route list, or next to it in the T3 Connect list.
74Pairing the same machine again over another address also adds a route instead
75of a second machine. A new route is placed by speed, in that order, and you can
76reorder routes at any time.
77
78While connected through T3 Connect or a paired address, T3 Code also learns the
79machine's current LAN and Tailscale addresses and adds them as routes, so
80pairing once through T3 Connect is enough to use the LAN at home. When the
81machine's LAN address changes, for example after it joins another Wi-Fi network,
82the learned route follows it. The machine must allow network access for its LAN
83address to be learned. The [background service](./background-service.md#local-network-access)
84allows it on private networks by default. You can reorder a learned route, but not remove it; it
85goes away with the route it was learned through, or when the machine stops
86reporting that address.
87
88T3 Code connects over the first route that answers. Away from home, a LAN
89address that does not answer is checked briefly and skipped. It is only tried
90again, after the other routes, if none of them connect. While connected over a
91later route, T3 Code checks the earlier ones when your network changes, when you
92return to the app, and every minute, and moves back as soon as one works.
93
94On web and desktop, select the route count under the machine's name in
95**Settings → Connections** to see its routes. Drag a route to change the order,
96or remove it. On mobile, open the machine under **Settings → Environments** and
97choose **Edit**. Signing out of T3 Connect removes only that route; a machine
98you can still reach another way stays saved.
99
100Open **Permissions** next to **Routes** in web or desktop, or **Your permissions**
101in the mobile route details, to see what your current connection can do on that
102environment. For a remote environment, this is in its route details. Permissions
103shown there apply only to the route marked **In use**; other routes are not
104checked. Direct pairing and T3 Connect have separate sessions and may grant
105different permissions.
106
107### Balance new threads across machines
108
109Auto balance is off by default. On web and desktop, enable it in
110**Settings → Connections → Load balancing** to automatically choose a machine for
111new threads in projects grouped across connected environments. The section
112appears once two or more machines are switched on.
113Each machine starts at **Normal**. Choose **Prefer** to favor it when it has CPU and
114memory available, **Less often** to reduce its share, or **Manual only** to exclude
115it from automatic selection. These are preferences, not fixed traffic percentages.
116Preferences are saved separately in each client.
117
118The composer checks eligible machines when choosing a draft's environment, then keeps
119that choice stable. Choose **Auto balance** again to check current resources, or choose
120a specific machine to override it. Choosing a branch or worktree also keeps the draft
121on that machine. Existing threads stay where they started. If resource checks are
122unavailable or all eligible machines are full, choose a machine manually to continue.
123Mobile keeps its manual environment selection.
124
125### Tailscale HTTPS
126
127Join both devices to the same tailnet. In the desktop app, enable **Tailscale
128HTTPS** in **Settings → Connections**. Turn it off there to remove that route.
129
130To start a command-line server with Tailscale HTTPS:
131
132```bash
133t3 serve --tailscale-serve
134```
135
136For an already-running server:
137
138```bash
139t3 pair --tailscale
140```
141
142The pairing link uses an address such as `https://machine.tailnet.ts.net/`.
143The mapping created by `pair --tailscale` persists across restarts. Remove its
144default-port mapping with:
145
146```bash
147tailscale serve --https=443 off
148```
149
150If that port is already in use, choose another with
151`--tailscale-serve-port`. See `t3 pair --help` for other pairing options.
152
153### Hosted web app
154
155[app.t3.codes](https://app.t3.codes) needs an HTTPS endpoint. It connects directly
156to your server; a hosted pairing link does not make an unreachable backend
157reachable or convert HTTP to HTTPS.
158
159For a plain HTTP LAN endpoint, use the direct pairing URL in a browser that can
160open it, or pair from the desktop app. On mobile, an IP address entered without a
161scheme uses HTTP, so include `https://` when your server uses HTTPS.
162
163## Desktop-managed SSH
164
165In the desktop app, open **Settings → Connections → Add environment**, choose
166**SSH**, and enter a host or SSH alias such as `user@example.com`. T3 Code starts
167or reuses a server there and opens the port forward for you. Projects, provider
168credentials, and agent work stay on the remote machine.
169
170The remote host must be Linux or an Apple Silicon Mac with `curl` or `wget`,
171`tar`, `sha256sum` or `shasum`, and [provider setup](./install.md#providers).
172The first launch downloads T3 Code's server to `~/.t3/runtime` on the host, so
173it takes longer than later ones.
174Provider CLIs must be on the `PATH` of a non-interactive login shell there;
175check with:
176
177```bash
178ssh user@example.com 'sh -lc "command -v claude codex"'
179```
180
181If SSH reconnecting fails after an app update, retry the launch once. Removing
182the connection stops a server that T3 Code launched; a server that was already
183running is left alone.
184
185Each desktop app keeps one session on the host for its SSH connection and reuses
186it when it reconnects. Revoke sessions you no longer use in **Settings →
187Connections** on the host, or on a headless host with `t3 auth session list` and
188`t3 auth session revoke <id>`. A desktop that can still sign in over SSH pairs
189again on its next connect.
190
191For Antigravity's Google callback on a remote host, see
192[remote sign-in](./providers-antigravity.md#sign-in-from-a-remote-device).
193
194## Browser on a remote environment
195
196Browser tabs belong to the environment, so you and your agents see the same
197tabs from any device. The desktop app shows its own environment's tabs
198directly. Every other device, and the desktop app for other environments,
199streams them from the host. Agents keep using them while no device is
200connected, and `localhost` addresses reach servers on the host.
201
202The first tab downloads a headless Chrome, about 120 MB, into the T3 home. It
203is the same browser [HTML renders](html-renders.md) use, so a host downloads it
204only once. Some Linux hosts need [setup](#browser-host-setup) before it can
205start.
206
207Agent tabs have separate storage and share a Chromium process. Take control before
208typing into an agent's tab, then release control when you want the agent to
209continue. Read-only connections can watch without changing the page.
210
211While you have control, the tab works with your device: text the page copies or
212cuts goes to your clipboard, a file picker on the page opens your device's
213picker, and a finished download is offered for you to save. Popups such as
214sign-in windows open as their own tabs. Downloads stay on the host until the
215tab closes. Audio does not play on your device.
216
217On a phone, tap the floating preview's corner dot to show its controls, then
218**Pop into separate window** to keep watching in picture-in-picture over other
219apps.
220
221### Browser host setup
222
223macOS, Windows, and Linux desktops run the browser as is. Some Linux hosts need
224one-time setup: Ubuntu 23.10 and later block the sandbox the browser runs in,
225and minimal images and containers lack libraries it loads. When that happens,
226the server says so at startup, and browser tabs and HTML previews show the
227command to run on the host:
228
229```sh
230sudo t3 browser setup
231```
232
233The server shows the exact line for how you started it, such as
234`sudo npx t3 browser setup`, and keeps your `PATH` when Node is installed only
235for your user. Where `t3` is not on your `PATH`, such as with only the
236desktop app installed, it names the full path of the app's own `t3` instead. It allows Chrome's sandbox with an AppArmor profile and installs
237any missing libraries and system fonts with apt; pages that load without text
238can mean the host has no fonts. It is safe to run again. Without `sudo`, it only
239reports what it would change.
240
241The browser always runs in Chrome's sandbox. Where you cannot change the host,
242set `T3CODE_SERVER_BROWSER_SANDBOX=0` for the environment to run without it.
243
244## Connect an outside agent
245
246Claude Code, Codex, ChatGPT and other agents T3 Code did not start can drive
247threads on an environment through its MCP server. See
248[outside agents](./outside-agents.md) for setup.
249
250## Manage or revoke access
251
252On the host, **Settings → Connections** lets authorized administrators create
253pairing links and revoke client sessions. Revoking an unused link prevents new
254pairings; revoke a device's session to remove its existing access. Command-line
255management is available through `t3 auth --help`.
256
257A session with an open connection stays listed after its access credential
258expires.
259
260To choose a token's permissions, pass `--scope` once for each scope you want:
261
262```sh
263npx t3 pair --scope orchestration:read --scope relay:read
264```
265
266The selected scopes replace the default permissions. The same option works with
267`npx t3 auth pairing create` and `npx t3 auth session issue`; each command's
268`--help` lists the available scopes. Without `--scope`, pairing tokens and issued
269bearer sessions get every permission, including managing access and T3 Connect.
270A terminal or a full-access agent on the host can reach those as well, so a
271client that should not manage access also needs to go without `terminal:operate`
272and `orchestration:operate`.
273
274To change an existing client's permissions, create a fresh pairing link with the
275scopes it needs. In a browser opened directly on the environment, open that link
276to replace the browser's current grant. For mobile or a saved remote environment
277in web or desktop, use **Add Environment** with the fresh link or code; pairing
278the same environment replaces its saved grant. Reconnecting alone does not change
279permissions.
280
281Grouping checkouts does not combine their permissions. Shared project settings
282require `orchestration:operate` on every member environment; actions on one
283checkout use that checkout's permissions.
284
285`source-control:write` covers direct Git and pull request changes made from the
286client: pushing, switching or creating branches, cloning, and removing
287worktrees. It does not restrict what a task does. Starting a task in a new
288worktree still creates that branch and worktree with `orchestration:operate`,
289and the agent it runs can use Git however the environment allows.
290
291Settings changes, provider management, environment maintenance, access
292management, and T3 Connect management can each be granted separately. New
293pairings without `--scope` include all of them. Existing clients keep the
294permissions they paired with and can stay connected after an update, but newly
295separated features may require pairing again with the permissions they need.
296Older clients may show controls that the server denies. Create a fresh pairing
297link to change a client's permissions.
298
299`filesystem:read` allows browsing host files, opening workspace files, and viewing
300local changes. Add `filesystem:write` to allow editing files or saving plans to
301the workspace. These scopes control direct file access from the client.
302
303To remove an environment from T3 Connect, open your account menu's **T3 Connect**
304page, or **Settings → T3 Connect** on mobile, and choose **Deregister**. This
305revokes its cloud access and frees its host space even when the environment is
306offline or has been wiped. When T3 Connect rejects a host's link, the host
307shows that it was removed from T3 Connect. To link it again, turn on
308**T3 Connect** in **Settings → Connections** on a desktop host, or run
309`t3 connect link` on a command-line host and then restart T3 Code there. A
310command-line host that released its tunnel when it last stopped may link itself
311again on its next start; run `t3 connect unlink` on that host to keep it off.
312Removing an environment from a device's connection settings only forgets it on
313that device; it stays registered to your account.
314
315When idle tunnel cleanup is enabled, T3 Connect removes a linked environment's
316tunnel after it stays offline for several minutes. The environment stays linked
317and keeps the same address. When the host starts again or wakes, T3 Connect
318creates a replacement tunnel on its own. You do not need to pair again. Cleanup
319usually runs five to ten minutes after the tunnel goes down.
320
321T3 Connect also removes the tunnel of an environment running an older version of
322T3 Code once it has been offline for seven days. That environment shows a message
323asking you to update. Start T3 Code on that computer and update it to the latest
324version; it reconnects at the same address without pairing again.
325
326On a command-line host, `t3 connect unlink` disables exposure while retaining
327your login; `t3 connect logout` also clears that login. Background-service
328[removal](./background-service.md#manage-the-service) is separate.
329
330Treat pairing URLs and authorization codes as passwords. Do not include them in
331screenshots, logs, or bug reports.
332
333## T3 Connect troubleshooting
334
335When a T3 Connect connection fails, see
336[T3 Connect troubleshooting](./t3-connect-troubleshooting.md). It explains each
337error, where the problem is, and how to fix it.
338
339## Using the Desktop App as a Remote Only
340
341If a computer should only drive work running elsewhere, turn off its local environment. In the
342desktop app, open **Settings → Connections** and switch off **Local
343environment**. T3 Code restarts without a local server: no local agents or terminals run, WSL
344backends stay off, and other devices can no longer connect to this computer. Your projects,
345history, and saved connections are kept, and you keep working through pairing, T3 Connect, or SSH.
346
347Switch **Local environment** back on in the same place to restart with your previous local
348settings.