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

remote-access.md

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