Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

remote-access.md

547 lines27.8 KB

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