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