Tcode runs on the machine that holds your projects, provider tools and terminal
processes. You can open that machine from another desktop, a phone, a tablet or
a browser. Native apps reach the machine over Traverse: one encrypted
connection per device, direct when the network allows it and through a relay
when it does not. The browser client is a direct-access page served by
tcode-headless on the same machine or LAN. For a shorter introduction, see
Use Tcode from other devices in the README.
The plan behind this model is #376.
| Term | Meaning |
|---|---|
| Machine | The computer where Tcode runs providers and terminals and stores projects and threads. It is the desktop app with Let other devices connect to this machine on, or tcode-headless serve. A machine is identified by a key it generates once and keeps in traverse.json in its data directory; the public half is its machine id (64 hex characters). |
| Device | A desktop, phone or tablet running the Tcode app that opens one or more machines. A device also has its own key, kept in device.json in its data directory. The machine keeps an allow list of device ids; every connection is authenticated by that key, so a device that is not on the list is refused before any application data flows. |
| Invitation | A tcode://pair?… link, shown as a QR code and copyable as text. It carries the machine id, a random 16-byte secret, the Traverse instances the machine publishes to, its current relay and its UDP port — never an IP address or the machine's name; the format is The invitation link. Scanning or pasting the link is the whole pairing: an invitation lasts five minutes, admits one device, is replaced by the next one and is invalidated after five wrong secrets. The machine enforces all of this; Traverse never sees an invitation. |
| Space | A named set of projects on one machine, with a reusable pairing link. A device paired through that link becomes a member and sees only the space's projects and threads. The owner manages the projects and members. |
| Group | Machines that admit the devices any of them admits, so a device paired with one member reaches every member. Off until a machine creates one; see Machine groups. |
| Traverse | The relay and lookup services a machine publishes to so devices off its network can find and reach it. A machine keeps a list of sources, each switched on or off: Official (always first, on by default) uses the relays and lookup service listed in the manifest bundled with Tcode; each Self-hosted source is your own tcode-traverse instance. With every source off the machine uses no service at all. Traverse sees only encrypted traffic; the machine authenticates devices itself. |
| Direct / Relay | How one live connection is carried. Direct means the two ends exchange UDP packets with each other; Relay means the packets go through a Traverse relay because no direct path was found. The connection banner and the machine's device list show which one is in use: LAN for a direct path on the local network, Tunnel for one punched across the internet, Relay for a relayed one. It can change while connected. |
Pair each device separately. Project files, provider processes and terminal processes stay on the machine; devices receive the thread content and other data they need to show and operate that work.
A space shares selected projects with trusted collaborators. Members run commands with this machine's agents and permissions. This is scoped visibility and control, not isolation: provider turns and terminals run under the machine's account and can access what that account permits.
- Open Settings → Shared spaces on the machine, or from a full-access device connected to it, and create a named space.
- Add existing projects in that section, or right-click a project or thread in the sidebar and choose Share to «X» for the space. Sharing a thread shares its project. Choose the checked item again to remove the project.
- Copy the space link or let the member scan its QR code. The Machines
page also shows the machine's spaces. A headless
serveprints available space links at startup. - Turn off Link enabled to pause new joins, or regenerate the link to replace its secret. Manage members in the space's expanded row: move a device to another space or remove it. Removing a member offers to regenerate the link as well, with that option selected by default.
Adding or removing a project, moving or removing a member, or deleting a space closes affected member connections. Devices reconnect with their current access; a removed member has to pair again.
Each space has its own permissions, under Permissions in the space's
dialog. They apply to every member of the space and to everything a member's
turn does through Tcode, including the subagents and tcode_control calls it
makes; the machine's own user is not bound by them.
- Agents members may use: the account profiles members can run, each with all its models or only the ones chosen, and for ACP the agents chosen. A profile, model or agent added later is not included until the owner adds it. A new space starts with none.
- Permission modes: Any mode; No unrestricted mode, which takes away modes that run everything without asking; or Automatic review only, which allows only modes where the agent's harness reviews actions itself (Claude Code's and Grok's Auto or Don't ask, Codex's Approve for me). Under automatic review, what the harness still asks during a member's turn is declined at once, and members answer no approval except leaving plan mode. pi, Cursor and ACP agents run everything unasked or in modes Tcode cannot tell apart, so they are unavailable under the last two settings. OpenCode's Normal mode counts as asking a person.
- Terminals, Push, pull and pull requests, Preview this machine's local services, Computer use in members' turns and Open in an editor: off in a new space.
A member cannot pick a profile, model or permission mode the space does not allow, or send to a thread the machine's user switched to one. A message a member queued waits, marked in the queue, while the space does not allow the thread as it is, and goes once it does. Changing the permissions reconnects the members; a turn already running finishes under the permissions it started with.
These permissions scope what Tcode offers; they are not isolation. A terminal or an editor gives a member a shell under the machine's account, from which a member can run any agent with any setting; the dialog says so on those switches. A space created before spaces had permissions keeps what its members could do then (every agent and mode, terminals and git) until its owner chooses agents.
Pair with the space link by scanning or pasting it like any invitation. The connection banner shows Space «X» · machine name, and the window shows the space's machine alone, in place of the device's other machines. The sidebar contains only the space's projects and threads, with no Add project action. Members can create threads and send turns in those projects, with what the space's permissions allow (see Space permissions). They can archive threads, but cannot delete threads or projects, or change host settings, providers, plugins or hosting. Settings contains device-local pages and Archived Threads. Sidebar preferences and read state stay on the device.
Each device belongs to at most one space in this version. A device already paired with the machine, fully or through a space, is refused as already a member and keeps the access it has; the owner can move a member to another space. The pairing screen says This device is already paired with that machine. Connect to it from Machines; to join this space instead, ask the owner. A paused, dead or missing space link says This space link is paused or no longer valid. Ask the owner to turn it back on or send a new one. A wrong secret says The machine rejected this invitation; create a new one there and paste it here. A connection failure that found no path to the machine asks for the machine's IP address (see When nothing finds the machine). A malformed link says That is not a Tcode invitation link. Pairing errors leave the device without new access.
A space link is reusable and does not expire after one join. It dies after five cumulative wrong secrets; the owner regenerates it to accept new members. Pausing or regenerating the link, including after it dies, affects only new joins. Existing members keep access until the owner removes them, deletes the space or revokes their device. A removed member can join again with the old link if it remains enabled and valid.
traverse.json is written as version 6, which adds what a machine accepts
from its group and what the group's devices may do on it. Versions 3 (spaces
and device access), 4 (the group) and 5 (space policies), written by earlier
releases, are read as they are, with Accept threads other machines start
here on, Accept projects other machines move here off and the group's
devices operating the machine;
an older build reads only the versions it knows, so it refuses a file this
build wrote. Loading a version 2 file migrates existing paired devices to
explicit full access and starts with no spaces. Existing devices do not become
space members as part of the migration.
A group is for one person's machines: a headless machine on a NAS, a desktop, a laptop. Pair a phone with any of them and it reaches all of them; remove a lost phone on any of them and every one refuses it. No machine is in charge. The machine that started the group can stop or leave, and the others carry on.
The risk is yours to take. Every member can admit devices into every other member and, while they accept threads, start threads on them, so a compromised member, or a leaked invitation, reaches the whole group. Groups are off until you create one; leave them off if you do not need them.
Inside a group there is one way in: a member's invitation. A device that pairs with it joins the group, and another machine joins with the same kind of invitation. Every full-access device of a member is a member; only space members stay with their own machine.
- On the first machine, open Settings → Machine group (on a headless machine, in its logged-in browser) and create a group. Tcode first lists the full-access devices paired with this machine: every member of the group will admit them.
- On each other machine, with hosting on, choose Join group in the same section and paste an invitation from a machine already in the group (its Machines page, or Settings → Remote in a headless machine's browser). The join spends that invitation, as a device's pairing would, and lists the devices this machine brings first. If the join finds no path to that machine, type its IP address, as when pairing a device.
- A desktop joins together with its own window: the window saves every member under its Machine group section on Machines and opens the group side by side (see Machines side by side).
While a machine is in a group, its invitation says so and names the group; the link carries the group's id. Creating, joining or leaving a group, or being removed from one, replaces an invitation that was outstanding with a new one for the group the machine is now in, or for none; the earlier link stops working.
Scan or paste any member's invitation: the device is paired with that machine, and the machine tells the others. The device saves every member under that group on Machines and opens the group's multi-host view without mixing in unrelated standalone machines (see Machines side by side). A space link never brings a device into the group.
Accept new devices governs the group too. While it is off on a machine, a device another member admits is not admitted there; it is listed in that machine's group section, with Admit, and stays out until you admit it.
Remove under Connected devices removes a full-access device from every member: each closes its connections and refuses it from the moment it hears of the removal. A member that is offline hears it when it next reaches another member, and admits the device until then. Only a new pairing brings the device back.
Leave group on a machine tells the members and forgets the group. The machine keeps every device on its allow list, and the other members keep theirs. A member can also remove another machine from the group; that machine leaves the same way the next time it hears of it.
Members reach each other over tcode/group/1 on their own UDP port: at the
relay and addresses each reports for itself and the ones a connection last
used, and through the lookups of the Traverse instances the dialling machine
publishes to. They exchange the group when it changes and every five minutes.
The members of a group also connect to each other over tcode/1, each under
its own machine key, to ask each other for work: to start a thread, to hand a
project over, to report back. A machine admits such a connection only from a
current member, serves it nothing a device opens, and refuses a device's
connection that asks as a machine. Each machine decides for itself what it
takes (see What a machine accepts) and what the
group's other devices may do on it (see
What the group's other devices may do).
An answer to something a machine itself sent out comes back whatever those
settings say.
Any member can give any machine of the group a label, and everyone in the group sees it. Set it in either place:
- Settings → Machine group: Rename on the machine's row under Machines.
- Machines: ⋯ → Set label… on the machine's row.
The dialog, Label for «‹name›», ends with Save. Leave the field empty and the machine goes by its own name again.
The label is shown wherever the machine is named: its heading in the sidebar, the Machines page, the move dialog, the cards of threads started on it, and on the machine's own pages (its ‹name› settings caption and a browser page opened on it). It does not change the machine's own name, which is Machine name in Settings → Remote on that machine; the group's row shows that name under the label as Machine name ‹name›.
Under the group's name in Settings → Machine group, each machine has two switches for what the group's other machines may ask of it:
| Switch | Default | What it allows |
|---|---|---|
| Accept threads other machines start here | On | Threads on the group's other machines may start threads on this machine. They run under this machine's accounts, Harnesses and permissions. |
| Accept projects other machines move here | Off | The group's other machines may move a project here together with its threads. |
The Machines list in the same section says what each other machine takes: Takes threads and projects from the group, Takes threads from the group, not projects, Takes projects from the group, not threads or Takes no threads or projects from the group. A machine that has not said, because it may run an older Tcode, reads Has not said what it takes; it may run an older Tcode. Moving a project offers only a machine that takes projects.
A switch applies at once. While the group's other devices may not operate a machine, both switches on it are off and cannot be changed (see below).
Other devices of the group, in the same section, sets what the group's other devices may do on this machine. It is a setting of this machine alone and covers every other device of the group, your own phone included.
| Choice | What a device can do |
|---|---|
| May operate | What the machine's own window can. This is the default. |
| May only view | Open the machine and read what is on it: its projects, threads and what is in them, files, Git status and diffs, settings. Every command is refused: no message, approval or answer, no new thread, no change to a project or a setting. No terminal, no upload, no Preview tunnel, no editor connection, no browsing of the machine's folders. |
| May not open | A device cannot connect. It shows the machine as Not open to the group's other devices, stops retrying, and is not offered Pair again: it is still paired. |
On a machine that only lets a device view it, the device's heading for the machine says View only, its composer is disabled with ‹machine› only lets other devices view., and approvals and questions show but cannot be answered, no rewind, fork, retry or plan option is offered, nor any action on a subagent, and the checkout row shows the branch as text.
The machine's own window is not affected: it operates the machine as before and can still open the group's other machines. Space members are not affected, and neither is a browser logged in to a headless machine.
Choosing a narrower level asks first (Let other devices only view this machine? or Close this machine to other devices?), because every full-access device of the group is disconnected at once and reconnects under the new level, a window that was already open included. Choosing a wider one does not ask. While a machine is below May operate it takes no threads and no projects from the other machines either, whatever its two switches held.
A thread can start a thread on another machine of its group, to run work
where that machine's code, tools or hardware are. A thread does this through
tcode_control, with two tools:
list_machineslists the group's machines: each one's id, its name, whether it answered, whether it takes threads and projects, and whether it runs the same protocol.start_thread_on_machinestarts a thread with a first message in a project that machine already has. The other tools that read threads and projects, send messages, interrupt or cancel, watch threads and answer a question take the machine too. A thread elsewhere is linked astcode-thread://<thread_id>@<machine_id>.
start_thread_on_machine is a tool of its own, separate from
start_thread: whether a call needs your approval is the Harness's
permission mode to decide for each of them, as for any other tool. A thread
is offered both tools only while Let threads use tcode_control and Let
threads start threads on other machines of the group are on in Settings →
Control (the second is on by default) and this machine is in a group. With
either off, threads on this machine are not offered them. Threads on other
machines can still ask this machine, unless Let threads use tcode_control
is off here.
The thread starts in a project the other machine already has, on that machine's code as it is there. Nothing goes with it but its first message: no files, no attachments. That machine's Harnesses, models, profiles and Settings → Control apply, including the models listed under Available models there, which limit the threads the group's other machines start. The other machine must have Accept threads other machines start here on, must let the group's devices operate it and must have Let threads use tcode_control on.
The thread runs as a thread this machine starts does: a subagent with the
permissions Who answers a subagent's approvals gives subagents in
Settings → Control on that machine, and its approvals answered as that
setting says; a thread started without subagent with the project's own
defaults there.
Started without subagent, the thread is an ordinary thread of that machine.
Started as a subagent, it is still an ordinary thread there, and its report,
approval requests and questions come back to the thread that started it as
messages. The started thread:
- is in the sidebar under its own machine's section, and any device open on that machine can answer it;
- says who started it: its log names the starting thread as ‹thread› on ‹machine›, and a subagent's header has an arrow back to its starter, which is disabled while that machine is not open in the window (‹machine› is not open in this window);
- has its approvals and questions answered there, in its own thread. On the starting thread's card they read Answer it in its thread on ‹machine›.
The starting machine can be off or out of reach meanwhile. A report made then is kept and sent again until the starting machine's thread has taken it; a cancel, an interrupt or a settle that cannot reach the machine is kept and sent when it can. The starting thread's card names the machine, and shows:
- Cannot be reached when the machine is out of reach and the thread was running when last heard, with ‹machine› has been out of reach since ‹time›; the thread may still be running (or ‹machine› cannot be reached; the thread may still be running);
- Will be cancelled when ‹machine› is back, Will be interrupted when ‹machine› is back or Will be settled when ‹machine› is back for what waits to be sent;
- Its machine left the group once the thread's machine is no longer a member.
A subagent started on another machine is a row in the Subagents view of its starter, which opens the thread on its machine and offers what a local subagent's row does, by its state: Stop subagent while it runs, Settle subagent once it reported or failed, and Cancel subagent (which asks Cancel this subagent? first) while it runs or waits to be settled. A full device alone can send them. When the machine cannot be reached the action is kept, the row says it will be done when the machine is back, and it is not offered again; nothing is offered once a cancel is waiting.
A machine learns that another has left the group when that machine refuses it as a non-member, and checks the group every ten minutes. When the machine that started a thread leaves or is removed from the group, the thread carries on there as an ordinary thread and owes no report.
A thread on another machine reaches this machine's projects, providers and models, and of its threads only those its own machine started here. Every other thread is not listed and is refused as unknown. On the threads its machine started here it may ask only for the following:
- read them, and search inside them;
- send a message to one;
- interrupt, cancel, steer a queued message or drop one;
- watch them, and cancel a watch;
- answer a pending question of one.
Beyond those it may start a thread here, and answer an approval or settle a subagent that its own thread started here. It may not delete or rewind threads, use Git, pull requests or terminals, change settings, create or move projects, search across threads, or start threads from here on a third machine. A message from another machine is never the user's consent: what it does here is done as an agent's, and it answers no approval except its own subagent's.
A space member's turn reaches no other machine: list_machines and
start_thread_on_machine are refused in it.
A project can move to another machine of its group with all its threads. Move to machine… is in the project's context menu in the sidebar (right-click the project row) on a full-access device of the machine that holds the project, once that machine's group has another member. Quick chats do not move. While a project is moving, the item reads Show move….
The dialog Move “‹project›” to a machine has these parts:
-
Machines: the group's other machines, each with what it says of projects: Can be moved to, Does not take projects from the group now (its Accept projects other machines move here is off, or its Other devices of the group is below May operate), or Has not said what it accepts; it may run an older Tcode. One is chosen by clicking it; the machine then says what stands in the way, under Cannot move now.
-
Location: the folder the project goes to, on the other machine. It is that machine's path (
~is that machine's home), which must not exist yet or be empty, and must not be inside one of its projects. It starts as the folder that machine keeps new projects in, with the project's name. -
Code: what goes: for a repository the number of branches and about how much (‹n› branches · about ‹size›), with how many checkouts have uncommitted changes; for a folder that is not a repository, its size; for a project inside a larger repository, Part of a larger repository.
-
Threads: how many, and how many of them archived.
-
Ignored files: the files
.worktreeincludenames that Git ignores, when there are any. Bring ‹count› ignored files along is on by default, and the dialog names the first six. Other ignored files stay. -
Path: Goes through a relay; a large project will be slow. when the other machine can be reached only through a relay; Move then asks Move over a relay? first.
-
Cannot move now: what the machine holding the project and the chosen machine say is in the way. Move is available once they have answered; pressed while something is still in the way, nothing starts and the dialog says why: the chosen machine's own reason when it refuses, or Something now stands in the way; see below. with the list asked for again. A reason is one of:
- Quick chats stay with their machine.
- The project's folder is inside a larger repository, which is not this project's to move.
- ‹n› threads are running. (A count of one reads in the singular: 1 thread is running., 1 approval or question is waiting., 1 thread has queued messages., 1 terminal is open.)
- ‹n› approvals or questions are waiting.
- ‹n› threads have queued messages.
- ‹n› terminals are open.
- A merge or rebase is unfinished in ‹path›.
- The thread “‹thread›” works in ‹path›, which is gone or is not part of this project's repository, so the move cannot take it along. A thread is never moved to some other folder in its place.
- ‹machine› does not take projects from the group now.
- ‹machine› cannot be reached.
- ‹machine› runs a different Tcode version.
After Move, the other machine can still refuse: ‹machine› already has one of this project's threads., or a folder that cannot take the project (That folder cannot take the project: ‹reason›). The dialog says so and stays open.
The move goes on after the dialog is closed. While it runs, the project is read-only on the machine it leaves: its threads can be read and not changed, no new thread starts in it, and its composer says This project is moving to ‹machine›. Nothing is removed there until the other machine has everything. The project's row shows how far the move is (Moving to ‹machine› · Preparing…, · ‹n›% while it sends, · Finishing…), and Show move… opens Moving “‹project›” with the same line, a bar and how many bytes are sent. A move over a bad link continues from what the other machine already holds. A move is kept in the machine's store: it resumes after an interruption and after a restart of either machine.
Cancel move asks Cancel moving ‹project›? and stops the move before the other machine finishes: nothing has been removed, the other machine discards what it received, and the project is as it was. If the other machine cannot be told then, it is told when it can be reached. If the move finishes while that question is open, it closes; a cancel that arrives after the move finished reads The move had already finished.
A paused move waits, and its line says why. Three reasons continue by themselves, trying again after five seconds at first and then at longer intervals up to two minutes: ‹machine› cannot be reached; the move continues when it can, ‹machine› no longer accepts projects; the move continues once it does and This machine reaches no group now; the move continues when it does. Three wait for you: Paused: ‹machine› runs a different Tcode version, Paused: ‹machine› is no longer in this machine's group and Paused: ‹reason› for any other failure. Press Try again to retry at once, or Cancel move. The line keeps its reason until the other machine answers. On the project's row it is shortened (‹machine› cannot be reached, ‹machine› takes no projects now, No group reached, Paused: different Tcode version, Paused: not in the group, or Paused); Show move… has the whole sentence. A machine that vanishes without closing its connection is noticed when the connection's idle limit of 30 seconds ends.
When the other machine was told to finish and has not answered, the move reads ‹machine› was told to finish and has not answered. This project stays read-only here until it does. The move keeps asking. Cancel move is replaced by Continue here anyway, which asks Continue with ‹project› here? and warns: If ‹machine› did finish, the project will exist on both machines.
The machine holding the project says how each move it ran ended, so a window that was away when a move ended still shows how. When the move ends and its progress dialog is open, the dialog says how: Moved to ‹machine›., The move was cancelled. or, after Continue here anyway, Continuing here. If ‹machine› finished, the project is on both machines. With no such dialog open, a notice says ‹project› moved to ‹machine›, with Open where the window has that machine open (a browser page shows one machine and has no Open), or Move of ‹project› was cancelled.
What a move could not clear away afterwards, on either machine (its parts, its temporary refs in the repository, what the other machine received), is reported as A project move left something Tcode could not remove: ‹what and where›. If the machine cannot read its own records of moves when it starts, it says so as for any file of its own it cannot read, and starts or takes no move until it can.
What arrives on the other machine:
- the project, at the location chosen, and every thread, archived ones included, with the same id, its history and its attachments; a thread keeps its profile where the other machine has it for the same Harness, and otherwise takes the Harness's own;
- for a repository, its history and every branch, and the state of each checkout as it was: uncommitted changes, what was staged and untracked files that are not ignored; the worktrees Tcode made for threads, each in the place that machine keeps them;
- the ignored files
.worktreeincludenames, unless left out.
What does not:
- Git LFS files and the contents of submodules;
- settings, logins and the project's icon and permission defaults;
- terminals (none can be open) and the Harness's own sessions: each thread starts a new session with its Harness on its next turn there and is given the conversation so far. A thread shows Moved in from ‹machine› where it arrived.
The folder on the machine it left stays on that disk as it was, and the project is no longer in Tcode there; the worktrees Tcode made for its threads go with the threads. A moved thread's old link, a pane showing it and the thread a window remembered follow it to the machine it is on when the window shows that machine. Otherwise the thread says This thread moved to ‹machine›. with Open ‹machine›, and a new thread that was being started in the project says This project moved to ‹machine›. A project inside a larger repository, and quick chats, do not move.
- Open the desktop app on the machine where your projects and agent CLIs live. Configure the providers and add your projects there.
- Open Settings → Remote and set Machine name (shown to devices). In Settings → Traverse, choose the Traverse sources: switch Official Traverse on or off, and add a Self-hosted Traverse by its base URL with Add self-hosted Traverse; each added instance has its own switch and can be edited or removed. Turning every source off leaves only the LAN and an address typed on the device. A switch, addition or removal applies at once and an edited URL when its field is left, restarting the endpoint if hosting is already on.
- Turn on Let other devices connect to this machine. The desktop binds its
Traverse endpoint to UDP port
47420on all IPv4 and IPv6 interfaces (IPv4 only where IPv6 is unavailable), so the invitation's port, firewall rules and the LAN lookup of paired devices survive restarts, and advertises the port on the local network as_tcode._udp(see Finding the machine again). Allow that UDP port through the machine's firewall for direct LAN connections; a relayed connection needs only outbound access. - Open Machines (the sidebar entry under the search field). Under Let other devices connect, scan the QR code with the phone, or use Copy invitation link and paste the link into Tcode on the other device. The QR is redrawn with the machine's current relay while the invitation is valid, so a link copied a minute later still works. Use New invitation when one expires or you need to add another device. While hosting is off, or Accept new devices is off, this section says so and leads to Settings → Remote.
- Check Connected devices in Settings → Remote after pairing. Each
row shows the device's name and operating system (for example
Xiaomi 15 · Android 15) and LAN, Tunnel, Relay (‹region›) or Offline; the list refreshes every two seconds. Use Remove to withdraw a device's access.
Hosting keeps running whatever machines this window shows, a space's machine alone included: devices that opened this machine continue working, and Let other devices connect to this machine stays available. The desktop app accepts native devices only; it does not serve the browser app.
For a NAS or homelab, use the published Docker images and the commented
Compose template. The Docker guide
covers persistence, agent selection, login and PUID/PGID ownership.
-
Download an archive from Releases. Names follow
tcode-headless-<version>-<platform>-<arch>: Linux uses.tar.gz, macOS and Windows use.zip; platforms arelinux,macos,windows, and architectures arex64orarm64. Windows containstcode-headless.exe. -
Extract the archive and install the executable. For Linux x64, replace
VERSIONwith the release version without its leadingv:tar -xzf tcode-headless-VERSION-linux-x64.tar.gz install -d "$HOME/.local/bin" install -m 755 tcode-headless "$HOME/.local/bin/tcode-headless"
-
Install and authenticate your agent CLIs under the account that will run Tcode. Ensure that account's
PATHincludes them and that it can access your project directories. -
Start Tcode with a persistent data directory:
"$HOME/.local/bin/tcode-headless" serve \ --name build-server \ --data-dir "$HOME/.local/share/tcode-host"
Startup prints
Machine id: …, then the invitation: its remaining lifetime,Relay: …(orRelay: none (LAN only)with Traverse off), the machine's currentAddresses:, thetcode://pair?…link and its QR code. The addresses are for you to read, not part of the link: type one on a device that cannot find the machine (see When nothing finds the machine). With Traverse on,servewaits up to five seconds for a relay before printing the invitation, so the link names one and works off the LAN. It then prints Set a password on first open or Password protected andBrowser: http://127.0.0.1:47420/, the browser page (see From a browser).--traverse official(the default) or--traverse https://traverse.examplenames a Traverse source; repeat the option to publish to several (--traverse official --traverse https://a.example --traverse https://b.example), or give--traverse offalone for none; see Traverse.--browser-listen ADDR:PORTbinds the browser page elsewhere;serverefuses a bind beyond loopback until a password exists and exits before starting anything else. To preset the browser password, supplyserve --password PASSWORDor setTCODE_PASSWORDin the service environment; the CLI option takes precedence. A preset updates the password on startup and keeps existing browser tokens. -
The headless machine binds its Traverse endpoint to UDP port
47420(serve --port PORTbinds another;servefails at startup when the port is taken, for example by the desktop app hosting on the same machine) and prints it asUDP port:. The port is fixed so that the invitation's port, firewall rules and the LAN lookup of paired devices survive restarts, and the machine advertises it on the local network as_tcode._udp(see Finding the machine again). For direct LAN connections allow inbound UDP to that port; a relayed connection needs only outbound access. -
To see the invitation again while it is still valid, run in another shell on the same machine:
"$HOME/.local/bin/tcode-headless" pair --data-dir "$HOME/.local/share/tcode-host"
pairreadsinvitation.json, whichservekeeps current in the data directory: written whenever an invitation is minted, at startup or from a paired device, and removed once it is used, expires, pairing is turned off orservestops.paircannot mint one: when it reports no valid invitation, create one from the logged-in browser's Settings → Remote → New invitation or restartserve. -
The logged-in browser's Settings → Remote shows this machine's invitation QR and link, creates a new invitation, lists connected devices with their path, and removes devices: the native devices, then the browsers logged in to this machine. A native device's own Settings → Remote configures that device's hosting, not this machine's. Accept new devices controls whether the machine accepts pairings; it defaults to on and is saved in
traverse.json. Turning it off discards the current invitation and does not disconnect already paired devices. -
Open this machine from another device using the instructions below. To prepare projects with the local desktop UI, stop
tcode-headlessfirst and open the desktop app with the same data directory. Do not run two local Tcode processes against the same directory.
On Unix, Ctrl-C requests shutdown and a store flush. The CLI reference is:
tcode-headless --helpAdd the installed directory to your PATH to use that short command. Help is a
top-level option; the subcommands do not accept --help.
To change or reset the browser password, stop the headless process, then run:
tcode-headless set-password --data-dir /path/to/tcode-host --password NEW_PASSWORDTCODE_PASSWORD also supplies the password for this command. Existing browser
tokens remain valid by default, so logged-in browsers stay logged in. Add
--revoke-tokens to invalidate every browser token, then restart the host.
Update any service preset too, or it will replace the password on the next
startup. Do not run this command against a data directory used by a running
process. The password and browser tokens are separate from native pairing:
set-password never changes the machine key or the device allow list.
The tcode-headless --data-dir option takes precedence over TCODE_DATA_DIR.
Without the option, TCODE_DATA_DIR selects the store; otherwise Tcode uses
~/.tcode on every platform. This includes settings,
threads, the machine key and allow list (traverse.json), browser login
records (remote.json), the cached Traverse manifest and the current
invitation. It does not move project working directories into the store.
For example, this selects the same store as the explicit path above:
TCODE_DATA_DIR="$HOME/.local/share/tcode-host" \
"$HOME/.local/bin/tcode-headless" serve --name build-serverKeep this directory across restarts and back it up: the machine key is the
machine's identity, and a device stays paired with that key, not with an
address. Use a separate directory for a separate machine identity. The desktop
app also honors TCODE_DATA_DIR, including as a device when adding or
connecting to a machine.
Earlier versions kept the data directory in the platform app-data directory
(~/Library/Application Support/tcode, ~/.local/share/tcode,
%APPDATA%\tcode). When neither the option nor TCODE_DATA_DIR is given, the
first start of this version moves that directory into ~/.tcode, provided
~/.tcode holds no data yet; serve prints its progress, Ctrl-C stops it
without losing anything, and the next start continues. LEGACY_TCODE_DATA_DIR
names another directory to move from, and moves it even into a data directory
chosen with --data-dir or TCODE_DATA_DIR. A name present in both
directories stops the move before anything is moved. Until the move is done,
set-password refuses to write into the new directory.
On a Linux system with systemd, create a user unit at
~/.config/systemd/user/tcode-headless.service. This example uses the
executable and data directory above. Extend PATH with the absolute directories
containing your agent CLIs; a service does not read your interactive shell
setup.
[Unit]
Description=Tcode without the desktop app
[Service]
Type=simple
WorkingDirectory=%h
Environment=PATH=/usr/local/bin:/usr/bin:/bin
ExecStart=%h/.local/bin/tcode-headless serve --name build-server --data-dir %h/.local/share/tcode-host
Restart=on-failure
RestartSec=5
KillSignal=SIGINT
KillMode=mixed
TimeoutStopSec=60
[Install]
WantedBy=default.targetSIGINT uses Tcode's shutdown-and-flush path. Stop any foreground Tcode process
using the same data directory, then load and start the service:
systemctl --user daemon-reload
systemctl --user enable --now tcode-headless.service
journalctl --user -u tcode-headless.service -fTreat the journal as sensitive: startup prints the invitation link, and the
link is the secret. Configure user lingering through your system administrator
if this service must run after logout. Reprint the invitation with the same
pair command above while it is valid.
Release archives include the browser bundle. For a source build, run these commands from the repository root:
rustup target add wasm32-unknown-unknown
# The CLI must match the wasm-bindgen version locked in Cargo.lock.
cargo install wasm-bindgen-cli --locked --version "$(sed -n '/^name = "wasm-bindgen"$/{n;s/^version = "\(.*\)"$/\1/p;q;}' Cargo.lock)"
crates/web/build.sh
cargo build -p tcode-headless --release --features webThe script optionally uses wasm-opt if installed. Build the bundle before the
tcode-headless binary: the web Cargo feature embeds index.html,
auth.mjs, tcode_web.js and tcode_web_bg.wasm from crates/web/dist. It
is a build option, not a serve flag. The resulting executable is
target/release/tcode-headless.
Without web, the browser listener answers static requests with 404 while
native devices still pair and connect over Traverse. The browser runs the same
shell as the desktop app; it lays itself out as a desktop does: the compact stack belongs to the iOS
and Android builds, so a browser tab gets the desktop split however narrow it
is, a phone's browser included.
A device's window shows every machine it keeps open side by side, each machine's projects and threads its own, never merged; see Machines side by side. Opening a machine adds it to the window; it does not replace the ones already there, except for a space's machine, which is shown alone.
- Open Machines on this device — the sidebar entry under the search field.
- Under Add a machine, choose Paste an invitation link and paste the
machine's invitation link (
tcode://pair?…). A link that parses is sent at once: the page shows Connecting to the machine…, and when the machine admits this device it joins the window, which returns to the threads with that machine's section open. A failure is shown under the field, and Connect retries. When nothing found the machine, the page also asks for its IP address (see When nothing finds the machine). - Choose a machine under Your machines to add it to the window. Choosing one the window already shows, or This machine, returns to the threads with its section open. A machine row's ⋯ → Disconnect takes that machine out of the window without removing it: it closes only this device's link to that machine, the window's other machines stay open, and Tcode keeps running on every machine. This machine cannot be disconnected. Opening Machines by itself opens or closes nothing.
- A space's machine is shown alone: choosing it replaces the window's machines with that one, and its ⋯ → Disconnect brings the others back.
You can also pair from the desktop executable. Replace the link with the machine's current invitation:
tcode --pair 'tcode://pair?v=3&id=…&secret=…&relay=…&port=47420'This saves the machine in this device's hosts.json and prints its machine
id. Replace MACHINE_ID below with the printed id:
tcode --connect MACHINE_ID--connect accepts a saved machine id, not an address. Use the same device
data directory for --pair and --connect.
- Install the Android debug APK or re-sign and install the unsigned iOS IPA.
- With no machine yet, the app opens on an empty threads list, No machines in this window, with Add a machine and Machines; later, the Machines button in the threads list's top bar opens the same page. Choose Scan a QR code and point the camera at the invitation on the machine, or paste the invitation link (Paste an invitation link on Machines). Allow camera access when the system asks. Native QR scanning uses AVFoundation on iOS and CameraX/ML Kit on Android; a simulator's permission and cancel flows do not prove that real camera recognition works.
- A scanned or pasted invitation pairs and connects in one step: the page shows Connecting to the machine… and then returns to the threads with the machine added beside any others. A failure is shown under the rows that started the attempt; when nothing found the machine it asks for the machine's IP address there.
- Open a thread from the list, or use + to start one; with several machines, + lists each machine's quick thread and projects under its name. Read replies, send or queue a message, steer a running turn, stop it, and answer approvals — the same views the desktop shows, laid out for the width. The + at the left of the message field opens Photo library, the system picker (PHPicker on iOS, the photo picker on Android 13 and later, the document picker below that). Images are fitted on the device before they leave it: no longer than 2048 pixels on either side, HEIC converted to JPEG, then stored in the thread's attachments directory on the machine. Over a LAN there is no further limit. Across the internet the device applies Attachment limit over the internet from its own settings (2 MB unless changed): a larger image asks before going over a direct path, and is refused over a relay, because a relay is shared with everyone on the service and the connection's other messages would wait behind it.
- Settings is the full settings page, not a reduced copy. Back from a thread returns to the threads list; neither it nor opening Machines closes a connection. The app reopens on the thread it last showed, on that thread's machine, while the device still has the machine saved.
A tablet wide enough for the split gets the split, and rotating it back to portrait returns to the stack with the same thread and draft. A desktop window never enters the stack, however narrow it is.
The browser client is for direct access: a tab on the machine itself, or on its LAN when you bind the listener there. It does not use Traverse and has no relay; to reach a machine from elsewhere, use the native app.
- Open the
Browser:link printed bytcode-headless. By default the page is served onhttp://127.0.0.1:47420/, reachable only from the machine. To use it from another device on the LAN, start with an explicit bind such as--browser-listen 0.0.0.0:47420and openhttp://<machine LAN address>:47420/.serverefuses that bind until a password exists (--password,TCODE_PASSWORDorset-password), so a LAN never sees the first-open setup page. - On first open, set a password with at least eight characters and confirm it. Later visits without a saved token show Log in. A successful login saves a browser token and opens Threads; a valid stored token skips the form.
- A rejected or revoked token returns to the login form. Five wrong passwords lock browser login for five minutes. Native pairing is unaffected by this lockout.
- Settings → Remote manages this machine's native pairing: Accept new devices, the current invitation QR and link, New invitation, and removing paired devices. Phones and other desktops always pair with an invitation, never with the browser password. The device list shows the native devices, then every browser logged in to this machine (browser · operating system, LAN while its tab is connected). Remove on a browser invalidates its token and closes its socket; that tab returns to the login form.
- The address is fixed to the page's origin: Machines lists the machine that served the page and offers no way to add another, and the sidebar shows that machine alone. Open another machine's URL to use that machine. The page always uses the wide layout, however narrow the tab.
The browser stores machines and tokens in this origin's localStorage under
tcode.hosts, the last machine under tcode.last_host, its device id under
tcode.device_id and pending writes under tcode.outbox.<machine id>.
Clearing site data means you must log in with the password again. The page
and the listener ship together: the page's first message carries the same
protocol version native devices use, and a listener of another version answers
Protocol mismatch until the page is reloaded from the running
tcode-headless. The page is
plain HTTP and its WebSocket is ws://; anyone who can capture that LAN
traffic can read the password, the token and the work. If you put a TLS
proxy or tunnel in front of it, that is your own setup: the WebSocket follows
the page's scheme, so https:// pages use wss://.
A native window shows one scope at a time
(active_scope,
members):
- This machine alone, on a desktop when chosen from Machines (or at launch while this machine is not in a group).
- One machine alone: any standalone machine, any individual member clicked under a machine group, or any shared space. Standalone machines never mix into a group's multi-host view.
- One machine group side by side: clicking a group's top row on Machines opens every member of that group (including This machine when this machine belongs to that group), in the order ⋯ → Move up and Move down give them, excluding members you chose Disconnect for (⋯ → Show in group brings a hidden member back).
On Machines, each machine group has its own section: clicking its top row opens the group's multi-host view, and clicking a member row beneath it opens that member alone. Unrelated standalone machines and shared spaces stay under Your machines and open alone.
With one machine the sidebar has no machine headings. With more (a machine group view), the Group by project layout gives each machine its own section under a heading with its name and connection state; a click on the heading folds the section, and the device remembers it. The flat list keeps one list in time order across every machine in the group. A heading's ⋯ menu starts a quick thread or a thread in one of that machine's projects, adds a project, sorts the projects, disconnects the machine from the group view (not This machine), and opens Machines with Manage machines.
A machine that is offline, or reconnecting after a failure, empties only its own section: its heading shows the state (in the flat list, above the threads), and the other machines keep their rows. A machine that refuses this device shows Pair again in its heading and on its Machines row; it opens Add a machine for a new invitation from that machine.
A new thread starts on the machine of the project it is started from: a project row's +, a project in a heading's menu, or a split beside the current thread. Where nothing names a project — the flat list's +, a phone's + — a window with several machines lists each machine's quick thread and projects under the machine's name, and the command palette names the machine in its new-thread entries.
Theme, language, whether the sidebar is collapsed, its layout, the device name
and the internet attachment limit belong to this device, not to a machine, and
stay the same whichever machines the window shows. A device that kept theme,
language or the sidebar settings on a machine before they were the device's
takes each one it has not set yet, once, from the first full-access machine
it opens (on a desktop, from This machine). The machines the window keeps,
their order and folded sections are kept with these preferences. Native apps
keep these preferences in mobile.json next to hosts.json in their own data
directory; the browser keeps them in localStorage. iOS seeds the device name
from the device name, Android from the device model; the name and operating
system are sent to the machine when pairing and connecting, and the machine's
device list follows them.
A machine has a list of Traverse sources, each on or off: Official,
always first and only ever switched off, and any number of Self-hosted
instances by base URL. On the desktop it is in Settings →
Traverse; headless repeats serve --traverse official|<url>, or takes
--traverse off alone. The machine's relay list is the union of every
enabled source's relays — iroh picks its home relay among all of them by
latency — and it publishes its lookup record to every enabled source's pkarr
URLs. Each source's manifest is loaded and refreshed on its own: one that
cannot be fetched is left out until it arrives, without holding back the
others. Devices need no Traverse setting: the invitation lists every enabled
source (no entry when only the official service is on, off with none
enabled; see The invitation link), and each saved machine
keeps its own list, so one phone can use an official-Traverse machine and a self-hosted one
at the same time. A device's own endpoint uses the relays and lookups of the
instances its saved machines publish to, and of a machine it is pairing with:
a device whose machines are all Off has no relay and contacts no service, and
the official manifest is loaded only while some machine uses the official
service. Adding or removing a machine applies this to the running endpoint.
While hosting, each enabled source's row in Settings → Traverse shows how
it is doing: a dot and a word for its manifest (live fetched by this run,
cached from an earlier run, bundled with Tcode, failed with none),
and a one-line summary such as 3 relays · best 42 ms (eu) · lookup ok.
Opening it lists every relay with the latency the machine last measured (—
before it has), marks the home relay and shows why its connection fails if it
does, and gives each pkarr URL's lookup check: shortly after every publish and
every five minutes the machine reads its own record back from that URL, and
the check fails if the record is missing, names another relay or has not been
rewritten for longer than the republish interval. tcode-headless serve
prints the same summary, one Traverse <source>: … line per source, once the
sources settle and again whenever a manifest, home relay or lookup outcome
changes.
A Traverse instance describes itself with a JSON manifest: a list of relays
(url, optional quic_port and region) and a list of pkarr lookup URLs.
Relay and pkarr URLs must be https. The machine builds its relay list from
the manifest and publishes a signed record of where it can be reached to
every pkarr URL in it; a device resolves the machine id through the same
pkarr URLs. Lookup is pkarr over HTTPS only; there is no DNS lookup. A
refreshed manifest is applied to the running endpoint: relays that
disappeared are removed, new ones added, lookup services rebuilt.
| Source | Machine | Devices | The service sees |
|---|---|---|---|
| Official (default) | Uses the manifest bundled with Tcode, refreshed from the repository. At the time of writing it lists n0's public relays (*.relay.n0.iroh.link, regions na-east, na-west, eu, ap, QUIC port 7842) and n0's pkarr relay (https://dns.iroh.link/pkarr). These are n0's infrastructure: n0 states that the public relays are rate-limited and offer no uptime guarantee, and that the lookup service is fine for production when its performance is acceptable. |
A device with a machine on the official service uses the same relay list for its own home relay and the same lookup service to resolve machines. There is no device-side switch. | Relays see machine and device ids, the encrypted connection and its volume. The lookup service stores, per machine id, the machine's signed record: its relay URL only, republished every five minutes; direct addresses are filtered out before publication and are exchanged over the encrypted connection instead. Anyone who knows a machine id can read that record. Devices publish nothing. |
| Self-hosted | Fetches <base>/relays.json from your instance and uses its relays and pkarr store. With nothing cached yet, hosting waits for one fetch; if the instance is unreachable it starts anyway without that instance's relays and lookup — the LAN and the other enabled sources still work, and with no other source the invitation names no relay — and applies the manifest to the running endpoint once a background refresh (once an hour) fetches it. It never falls back to the official service. |
A device takes the base URL from the invitation, fetches the same manifest, and adds that instance's relays and lookup to what its other machines brought. Until that manifest loads the device has no relay and no resolver for that instance, only the saved addresses and the LAN lookup. Its home relay is chosen among all of them; a device whose machines are all self-hosted never contacts the official service. | Your instance sees what the official one would. The official service is not used for this machine; it sees the device's end only if the device also has a machine on it. |
| All off | No relay and no lookup service: the endpoint publishes nothing beyond its LAN advertisement and dials nothing but direct addresses. The invitation names no relay (Relay: none (LAN only)). |
The device finds the machine through the LAN lookup, or at the IP address typed when nothing found it, and dials the addresses it learned on later connections. This machine brings no relay to the device's endpoint; with no other machine on a service, the device has none. | Nothing about this machine. |
A device that connected successfully saves how it reached the machine — the direct addresses that worked, newest first, up to 16, and the relay — from the pairing connection on, so the next launch starts from what worked last. On the same network a machine whose address changed is found again without any service; see Finding the machine again.
- The manifest cannot be fetched. The official mode keeps the cached copy
(
traverse-manifest-official.jsonin the data directory) or the bundled one; a manifest is fetched again once the copy in effect is an hour old, and a failed fetch is tried again an hour later, so an offline machine does not pay a network timeout on every check. A bundled manifest newer than the cache wins. A self-hosted machine keeps its cached copy; with no cache it hosts without a relay until the manifest arrives, see the table. - No route to a relay. The machine still hosts; the invitation names no relay, and devices on the same network connect directly.
- A relay is rate-limited or refuses a connection. Connections fall back to whatever path remains: a direct path if one exists, another relay from the manifest otherwise. Tcode does not show a separate error for this; the connection banner shows Reconnecting with the failure reason until a path works. A self-hosted instance is the way out of another operator's limits.
- The lookup record is stale or missing. A device keeps dialling the relay and addresses it saved from the last connection, so a machine that has not moved is still reachable without the lookup.
tcode-traverse is one binary that is a complete Traverse instance: an iroh
relay with QUIC address discovery on UDP 7842, a pkarr store for machine
lookup, and the relays.json manifest a machine reads. It is the same server
for any operator. Releases publish it as
tcode-traverse-<version>-<platform>-<arch> archives next to tcode-headless.
Configuration, TLS modes (Let's Encrypt, manual, reloading, or plain HTTP
behind your own proxy), the pkarr store limits, metrics, the optional region
lock and a Docker build are in the
server README.
Point a machine at it with Add self-hosted Traverse and the base URL on
the desktop, or tcode-headless serve --traverse https://traverse.example.org.
The official source stays on unless you switch it off (headless: list
--traverse official too to keep it), so a machine can publish to both.
Nothing is configured on devices; they take the URL from the invitation.
Windows, Linux and Android embedded previews use their machine's network for
all HTTP and HTTPS traffic. http://localhost:5173/app opens the dev server on
the machine, even when it listens only on loopback. The URL stays unchanged in
the address bar, redirects, scripts and preview_status. No dev-server port
needs to be exposed. The dev-server picks list the machine's own listeners,
not this device's, and a pick opens through the same routing.
Open-in-system-browser still opens on this device and cannot use the embedded
preview's routing.
Preview traffic rides the attachment's own Traverse connection: each browser
connection becomes one tunnel that names its host:port, and the machine
dials that address the way any local program would. There is no separate proxy
port, no proxy credential and nothing to configure in hosting settings; the
paired, end-to-end encrypted connection is the authority. Plain HTTP is
forwarded; HTTPS stays an opaque tunnel with certificate validation performed
by the client webview, without TLS interception. The machine connects directly
to destinations; OS routing and global TUNs apply. Tcode does not read
upstream-proxy environment variables or system proxy settings.
One attachment holds at most 56 tunnels at once. Dialling a destination times
out after 10 seconds; a tunnel stays open while both ends hold it. Revoking a
device or stopping hosting closes its connection and every tunnel on it; while
the attachment is reconnecting, opening a tunnel fails at once, and after it
reconnects new tunnels use the new connection. Connection logs contain the
destination host and port, never request bodies. For headless diagnostics use
RUST_LOG=tcode_traverse=info.
Android requires WebView's PROXY_OVERRIDE capability. It removes implicit
localhost bypasses, waits for the override before navigation, and clears it when
the attachment's views are destroyed. The override is process-wide, so embedded
preview views belong to one attachment.
macOS and iOS attached Preview use per-port forwarding for HTTP(S) loopback
URLs: localhost, IPv4 loopback addresses and ::1. WebKit applies a website
store's proxy configuration to public destinations but bypasses destinations on
the viewing device's own interfaces, so a proxy cannot keep loopback on the
machine. The requested host and port are sent unchanged in the tunnel's opening
line. The viewing device allocates its own loopback port, so a viewer service at
the remote port cannot collide with it. localhost reserves both IPv4 and IPv6
listeners at that port. Numeric loopback URLs need that same address to be
bindable on the viewing device; unassigned
addresses such as 127.0.0.2 can report an allocation error. Tcode does not
add loopback aliases to the OS. No OS DNS, hosts file or proxy settings are
changed. Public/LAN destinations are direct from the viewer, as the Preview
note explains; this is a remote dev server workflow, not arbitrary remote
browsing.
Each browser slot owns its forwarding table and a separate nonpersistent WebKit website store. Relative assets and WebSockets derived from the page's actual location use the same forwarded port. Top-level loopback links/redirects pass through the same mapper, including redirects to another port. The native request is retained when changing its URL; HTTP bodies, site authorization, WebSocket frames and TLS records are not interpreted by the forwarding transport. Closing the preview or changing attachment drops listeners and accepted tunnels; merely hiding a retained preview keeps them alive. A new attachment receives new routes and a fresh store.
The address bar, copy and stored URL retain logical remote intent. Native
back/forward/reload reuse the live mappings. preview_status.url and
preview_wait_for use the logical remote URL; actual_url is added when it
differs. preview_evaluate, page scripts and window.location see the
actual local URL. Open externally uses that live mapped URL and stops
working when the owning slot closes. Without a suitable live route, it reports
that Preview must open the page first, rather than opening the viewer's
unrelated original-port service.
Mapping preserves the requested hostname but changes its port. The HTTP Host header and browser Origin therefore contain the viewing port. HTTPS retains the hostname/SNI and normal WebKit certificate validation; a development certificate must already be trusted and cover that hostname. Port-sensitive host/origin allowlists, CORS, CSP and OAuth callbacks can need app configuration. Cookies are not isolated by port, which is why attached slots use separate website stores. There is no blanket certificate bypass or credential injection into site auth.
Absolute subresource URLs, hardcoded API/HMR ports and worker-owned endpoints are not automatically rewritten. Configure them to derive their endpoint from the actual page location or an explicitly resolved live forward; entering an additional page URL creates its mapping but does not rewrite application code. Navigation, transport and authentication failures use Preview's existing error surface and automation errors. Local macOS Preview retains ordinary direct networking and its existing store.
Windows uses WebView2's proxy configuration with implicit loopback bypass
disabled; Linux gives WebKitGTK's ephemeral context a custom proxy with no
ignored hosts; Android uses the WebView proxy override. All three point the
engine at
an attachment-owned loopback HTTP proxy that speaks CONNECT host:port and
absolute-form requests. The proxy opens one tunnel per browser connection,
rewrites an absolute-form request line to origin form, drops its own
hop-by-hop headers and copies everything else verbatim, WebSocket upgrades
included. It serves one request per connection and answers ambiguous
framing (chunked plus Content-Length, unknown transfer codings, origin-form
requests) with 400. Unsupported proxy facilities fail closed; there is no
direct-network fallback. Closing the attachment cancels the listener and
active connections. macOS and iOS keep their per-browser URL mapping over the
same tunnels.
When the main connection reconnects and its saved addresses change, existing Preview browsers follow the new connection: their local proxy/forwarding ports, URLs, history and website stores survive, connections made over the old connection end, and new ones use the replacement. Tcode does not replay interrupted requests or reload pages automatically: use the existing Reload action if a page was interrupted. Another machine cannot retarget an existing attachment's Preview.
The browser client cannot override its browser's proxy.
On the desktop, Open in Zed over Tcode (remote) on a thread on another machine, or on one of its paths, opens it with Zed's own SSH remote development, carried by the desktop's existing connection to the machine: the machine needs no SSH server and no open port, and Zed installs and runs its remote server there as it does over any SSH connection. A space member sees the entry only when the space's policy allows the editor.
The machine runs an SSH server inside Tcode for each such connection. It
accepts the device without a password or key, because the connection is
already the paired device's; commands run through the user's shell in the
home directory ($SHELL -c; on Windows %COMSPEC%, normally cmd.exe, with
/c, as Win32-OpenSSH does), SFTP is served, and port, X11 and agent
forwarding are refused. Its host key lives in the machine's data directory.
The entry first shows what it does; opening from there agrees to Tcode adding
one ssh_connections entry per paired machine to Zed's settings.json,
keeping everything else in the file, and Don't show this again skips the
note on this device from then on. The entries point Zed's ssh at ssh/config
in Tcode's data directory, whose tcode-<id> hosts run tcode ssh-proxy, so
plain ssh never sees them. Each connection counts towards the 56 tunnels of
an attachment but is not closed when idle.
The proxy hands its bytes to the running Tcode, which admits a Zed only
within a minute of Open in Zed for that machine; that Zed then keeps the
machine until it quits. The proxy must be started by ssh, itself started
directly by Zed's main process, which Tcode identifies by its code signature
on macOS and Windows and by its installation on Linux. On macOS and Linux the
ssh must also be Zed's ControlMaster connection (-o ControlMaster=yes), so
ssh commands typed into Zed's terminal or run by its tasks are refused unless
they imitate it; on Windows, where Zed opens a connection per command and
its commands carry nothing distinctive, anything Zed starts as ssh directly
is admitted (a shell in its terminal is not ssh, so its commands are
refused). Anything refused gets a one-line reason that Zed shows. None of
this stands between a user and their own programs: any program running as
the same user could imitate Zed. On Windows the pipe's name includes the
user's SID, and the proxy refuses a pipe served by another user.
Zed's ssh:// links name the folder by the link's path, which a Windows
machine's Zed server cannot resolve as a drive path, so on a Windows machine
Tcode opens only folders inside the home of the account Tcode runs as there,
as ~/.... Zed from Flatpak cannot use this: its ssh runs inside the sandbox,
where Tcode's executable cannot run.
Every native connection is a QUIC connection between the device key and the
machine key, encrypted end to end. A relay forwards packets between two ids;
it sees the ids, timing and volume, not the content. A direct connection on
your LAN is encrypted the same way. Traverse is never part of authentication:
the machine accepts a connection only from a device id on its allow list, and
answers anything else with unpaired and closes it.
The lookup service holds a public, signed record per machine: the machine's relay URL, never its IP addresses. It tells anyone who knows the machine id which relay reaches it; it does not let them connect, because the machine refuses unpaired devices. On the local network the machine's DNS-SD advertisement likewise tells anyone on the LAN its machine id, name and UDP port, and nothing more: a connection still needs a paired device key.
The browser client is different: it is plain HTTP on the machine's own listener, protected by the password and a bearer token. Keep it on loopback or a trusted LAN.
The machine's traverse.json holds its secret key, its name, the allow list
(device id, name, operating system, first-connection time), the Allow other
devices switch and, in a group, the group's machines and devices.
remote.json holds the browser side: the id and name browsers record this
machine under, the password hash (randomly salted PBKDF2-HMAC-SHA256, 600,000
iterations) and one record per logged-in browser with its token hash. The
password and the raw tokens are never stored, and nothing in remote.json is
part of the machine's identity. A headless machine upgraded from the previous
transport therefore gets a new machine id the first time it starts — the old
remote.json seed is not adopted — and every device pairs again with a new
invitation; the browser password and browser logins are kept.
A device's device.json holds its secret key, name and platform. hosts.json
holds the machines it paired with: id, name, Traverse URL, relay, direct
addresses, last connection time and group — routing hints, not credentials.
Pending writes are in outbox-<hex of machine id>.json. Phone records are in
the app's private data directory; Android uses its filesDir.
On Unix, Tcode writes these files with mode 0600. That is a filesystem
permission, not encryption. A stolen device.json is that device's
access: whoever holds the key can connect to every machine that lists the
device until the device is removed on each machine, or once on any member of a
group. A stolen traverse.json is the machine's identity: its holder can
run a machine that paired devices would trust and, in a group, admit devices
into every member. There are no per-device project permissions; a paired
device has the same access as the machine's own window, including Preview
tunnels to the machine's loopback and network, unless the machine lets its
group's devices only view it or not open it (see
What the group's other devices may do).
A group's trust is mutual. A member machine can start threads on another member, and the threads run there under the accounts, Harnesses and permissions of that machine's user, whenever that machine has Accept threads other machines start here on, which it has by default. Group only machines you would let act for each other. A thread started that way runs with the permissions that machine gives a thread it starts itself. On a machine that accepts threads, another member's threads can start threads, read and use the projects, providers and models, and read, message, interrupt, cancel, watch and answer questions only for threads their own machine started there. Every other thread is not listed and is refused as unknown; they cannot delete or rewind threads, run Git, pull requests or terminals, or change settings (see Start a thread on another machine). A message from another machine is never the user's consent, and a space member's turn reaches no other machine.
A project moved in is code and history written to the disk of the receiving machine, at a path the sending machine chose, within what the receiver checks: the path must be absolute there, absent or empty and not inside one of its projects, and the receiver takes a project only while Accept projects other machines move here is on, which is off by default. A repository's hooks and its settings other than where its remotes are and which remote branch each local branch follows stay behind.
Requests between machines are authenticated by the machines' keys over the same encrypted transport as a device's, and a machine refuses them from anything that is not a current member of its group. Removing a machine from the group, or its leaving, reaches a member that is offline only when it next syncs, as for a device: until then it still counts the machine as a member. Other devices of the group on a machine narrows what the group's devices may do there, and leaves what its members may ask of it to the two Accept switches.
On the machine, use Settings → Remote → Connected devices → Remove (on the desktop, or in the logged-in browser of a headless machine). The device is taken off the allow list and saved, its live connections are closed at once, and a new connection from it is refused from that moment. The device shows Access rejected · Pair again and stops retrying. Pairing it again needs a new invitation. A member of the machine's group is removed from every member of the group; see Remove and leave.
A browser logged in to a headless machine is listed after the native devices
in the logged-in browser's Settings → Remote; Remove there
invalidates its token and closes its socket at the next message or
keep-alive, and that tab returns to the login form. Native devices do not
list browsers; set-password --revoke-tokens on the stopped host removes
them all.
Remove under Your machines on a device only forgets that device's record; it does not withdraw anything on the machine.
There is no tcode-headless remove subcommand. To remove a device without a
paired client or the browser, stop tcode-headless, back up traverse.json,
remove the matching entry from its devices array, preserve its permissions,
and restart. Do not edit that file while Tcode is running: it holds the allow
list in memory and writes it back.
| Symptom | Action |
|---|---|
| That is not a Tcode invitation link | The pasted text is not a complete tcode://pair?v=3&… link (see The invitation link). A link from an older Tcode is not accepted either. Copy the link again from the machine or scan the QR. |
| The machine rejected this invitation | The invitation expired (five minutes), was already used, was replaced by a newer one, or five wrong secrets invalidated it. Create New invitation on the machine or restart serve; get a separate invitation for each device. |
| This machine is not accepting new devices | Turn on Accept new devices on the machine (desktop Settings → Remote, or the logged-in browser of a headless machine). |
| Pairing asks for Machine's IP address | The dial found no path to the machine: not through its relay, its Traverse lookup or the LAN lookup. The invitation is still valid. Check that Tcode is running, that the two are on the same network or the machine has a relay (Relay: in the serve output), and that the machine's UDP port is not blocked on the LAN; then type the machine's IP address in that field (see When nothing finds the machine). |
| Reconnecting to ‹machine›… (attempt N) stays up | The device keeps trying the saved relay and addresses with growing delays, and on every attempt looks for the machine on its own network (see Finding the machine again). If the machine moved to another network with Traverse off and the device did not move with it, pair again with a new invitation. Direct paths need UDP between the two ends; a relayed connection reaches the relay over HTTPS (TCP), so it still works where UDP is blocked, as long as the machine publishes to a relay. |
| Access rejected · Pair again | The machine no longer lists this device (removed, or the machine's data directory was replaced). Pair again with a new invitation if access is intended. |
| Protocol mismatch · Update the app | The machine and the device run different protocol versions. Update both. |
| Connected … · Relay when both are on the same LAN | Hole punching has not found a direct path yet, or the LAN blocks UDP between the two. The path can switch to LAN or Tunnel while connected; the machine's fixed UDP port (47420) allowed through its firewall helps. |
tcode-headless pair says there is no valid invitation |
The last one was used or expired, or serve is not running. Create a new invitation from the logged-in browser's Settings → Remote, or restart serve. |
A self-hosted machine hosts with Relay: none (LAN only) |
The instance's relays.json could not be fetched and nothing is cached; the machine is reachable on the LAN only until a background refresh (once an hour) gets the manifest. Check the URL, the instance and its certificate; Tcode does not fall back to the official service. |
| Browser password is wrong or forgotten | After five wrong attempts, wait five minutes. To reset it, stop the host and use set-password; add --revoke-tokens if logged-in browsers should lose access. |
| Browser page unreachable from another device | The listener binds 127.0.0.1:47420 by default. Start serve --browser-listen 0.0.0.0:47420 and open the machine's LAN address; serve refuses that bind until a password is set. |
| Browser shows Protocol mismatch | The page in the tab is from another build than the running tcode-headless. Reload the page. |
| Browser shows 404 | Use a tcode-headless build with web. The desktop app and builds without the bundle do not serve the browser app. |
| Preview cannot load a dev server | Check that the dev server runs on the machine, hosting is on, the device is still paired, and its WebView supports proxy routing. Use localhost for a machine-loopback server. If a request was interrupted by a network move, wait for the main connection to recover and use Reload. |
| A machine reads Not open to the group's other devices | That machine's Other devices of the group is set to May not open. The device is still paired and does not retry. Set it back to May operate or May only view in Settings → Machine group on that machine. |
| View only beside a machine, and its composer reads ‹machine› only lets other devices view. | That machine's Other devices of the group is May only view: you can read it and change nothing. Set it to May operate on that machine. Its own window, a space member and a headless machine's browser login are not affected. |
| A thread card reads Cannot be reached | The machine the thread was started on did not answer, and the thread was running when it was last heard from; it may still be running. A cancel, interrupt or settle waits (Will be cancelled when ‹machine› is back) and is sent when the machine can be reached. Its machine left the group means the machine is no longer a member. |
| A thread is not offered the tools to start a thread on another machine, or the other machine refuses it | Check that this machine is in a group and that Let threads use tcode_control and Let threads start threads on other machines of the group are on in Settings → Control. On the other machine check that Accept threads other machines start here is on, Other devices of the group is May operate and Let threads use tcode_control is on. |
| A move stays paused | The line says why. ‹machine› cannot be reached; the move continues when it can, ‹machine› no longer accepts projects; the move continues once it does and This machine reaches no group now; the move continues when it does continue by themselves, trying again up to every two minutes; Try again retries at once. Paused: ‹machine› runs a different Tcode version, Paused: ‹machine› is no longer in this machine's group and Paused: ‹reason› wait: fix the cause and press Try again in Show move…, or Cancel move. The project stays read-only meanwhile. |
| A project's composer reads This project is moving to ‹machine›. | The project is moving and stays read-only until the move ends or is cancelled. Show move… in the project's menu opens it. If it reads ‹machine› was told to finish and has not answered, wait for the machine, or use Continue here anyway knowing the project may then exist on both. |
| Move to machine… says a machine does not take projects from the group now | On that machine, in Settings → Machine group, switch on Accept projects other machines move here and set Other devices of the group to May operate. Under Cannot move now the dialog names anything else in the way. |
| A machine reads Has not said what it takes; it may run an older Tcode | It has not reported its two switches, which an older Tcode does not report. Choose it in Move to machine… to have it answer for itself under Cannot move now. |
Syncing… / 同步中 means the workspace is waiting for its baseline: applied Index and Settings snapshots, plus SessionStatus and SessionEvents for the selected thread. A newly opened machine shows neutral loading rows until these arrive; it never labels an unknown list as empty. Cached lists and thread content remain visible during reconnect, with Syncing until replay completes. Reconnecting · attempt N appears immediately when a connection is lost, with its failure reason. Retry delays grow exponentially from one to thirty seconds with ±20% jitter (and a final 30 s cap). Only a connection stable for at least 30 s resets backoff; a quick handshake followed by another disconnect does not. A network change reported by the device ends the current wait early and tries again at once.
A connection attempt ends when iroh ends it: when its lookups find nothing reachable, or when the handshake goes silent for the idle limit below. Once connected, both ends keep the connection alive with QUIC keep-alives every 10 seconds and drop it after 30 seconds without a packet; that is what notices a dead native link. A browser page cannot see WebSocket pings: the listener pings every 10 seconds and ends a socket that leaves two unanswered, and the page sends an application ping after 15 seconds of silence and reconnects if nothing answers within 20 seconds. Browser timers may be delayed in background tabs, and making the page visible or coming online wakes reconnection.
Native foreground cancels pending backoff. When the app goes to the background its link is parked: the connection closes and nothing dials or backs off until the app returns, since that return reconnects outright anyway and replays subscriptions from applied cursors. Foreground and Active from the same return reconnect once. A change of the device's own addresses, as iroh's network monitor sees it, cuts a pending backoff short; a live connection follows the change on its own, since iroh moves its paths. Android has no such monitor for native code: there the system's default-network callback (another network, a change of transport, validation or addresses, not a signal-strength update) and a resume that finds a different network than the callback last reported, and on iOS every return to the foreground, also tell the device endpoint to rebind its paths.
Outgoing commands and queries are bounded to 256 lines and 8 MiB per attachment,
including lines held for retry. A full queue rejects the new line with
queue_full (QueueFull) and logs the error; older lines are retained. Subscription
updates coalesce by topic outside those slots. The store exposes the pending
count through queued_outgoing().
A disconnected device keeps cached thread content for reading; unvisited threads may have only cached list information. Queries need a live connection, while retained writes follow the outbox policy and remain pending until acknowledged. Subscriptions resume after reconnecting. Temporary network failures keep retrying. A machine that refuses the device stops at Offline with Pair again; protocol mismatches stop with Update the app.
-
Each device selects its own thread independently. Navigating on your phone does not change the thread selected on another desktop. Actions still operate on the same machine's projects and threads; selection independence is not access isolation.
-
A device's terminal scrollback is the machine's retained ring, capped at 1000 rows. Older output is gone from the machine too, so no device can scroll further back than that. During a large output burst the visible screen keeps updating, while scrollback catches up after scrolling has stopped for 100 ms. This avoids repeatedly sending the whole retained ring between PTY reads.
-
Android and iOS have an embedded preview with history, JavaScript automation, navigation errors and visible-page PNG capture.
-
The browser client has no Preview tab. It already reaches the machine by address, so start the dev server listening on the LAN (for example
npm run dev -- --host) and openhttp://<machine-ip>:<port>/in a new browser tab. The agent's preview tools are answered by a native client attached to the same machine. -
Phones, tablets and browsers do not run providers, terminals or project files locally; the machine does. Every product view is present on them — threads, chat, approvals, the terminal, diff, plan, preview (except in the browser), search, import and export — and what differs is which operations the device can perform. A native file dialog, an embedded preview browser, macOS permission grants, dictation and "open in editor" need a capability the device either has or does not; where it does not, the view says which machine can do it and offers what it can (open externally, copy, type the value). Prepare projects and provider installations on the machine.
-
One machine holds at most 64 open streams per device connection, of which 56 may be Preview tunnels or editor connections; a device that opens more is refused with too many tunnels until one closes.
-
The Android arm64 APK is signed with the project's release key, so each release installs over the previous one. Android rejects an update signed with a different key: uninstall first when switching between a release and a local build, or from a release older than the key. To sign a local release build with the same key, export
TCODE_ANDROID_KEYSTORE(path to the keystore),TCODE_ANDROID_KEYSTORE_PASSWORD,TCODE_ANDROID_KEY_ALIASandTCODE_ANDROID_KEY_PASSWORDbefore runningcrates/android/host/build.sh --release; with none of them set, Gradle's per-machine debug keystore signs the build. The iOS IPA is unsigned: re-sign it with your own Apple ID, or install it with a sideloading tool such as AltStore or Sideloadly. For Android, enable USB debugging and authorize your computer, then replaceVERSIONwith the downloaded release version:adb install -r tcode-VERSION-android-arm64.apk
Opening a conversation subscribes to its latest 200 event records. A session
snapshot includes the absolute from offset and total record count; the client
can request older records with SessionHistoryPage { session_id, before, limit }.
The exclusive before cursor pages backwards; replies are always chronological
and include their absolute from. Backwards pages contain at most 200 records.
Each snapshot or history page is capped at 8 MiB including its serialized wire
envelope. The host shrinks the contiguous range and sets truncated when the byte
limit reduces the requested count. A record that cannot fit alone returns
history_record_too_large; records are never split or silently skipped.
Subscription.after remains the absolute next event cursor, not a count of loaded
records. A reconnect replays from that cursor exactly. Byte-limited forward tails
start at after; advancing the applied cursor obtains the next contiguous tail.
A fresh subscription (no cursor) starts at the latest history window. Switching
conversations retires its subscription request IDs, and stale replies cannot
replace the currently selected conversation.
Reads and writes have separate lifetimes. A transport-reported disconnect fails
in-flight queries immediately with disconnected; the workspace refreshes its
baseline during Syncing. A read issued without a connection fails the same way.
While connected, a query waits for its result.
Retained commands use a client-generated UUID v4 key. They remain in an ordered
outbox until Ack, including across reconnects, attachment changes and client
relaunch. Native clients atomically replace an outbox-<encoded machine id>.json
file beside hosts.json, with private file permissions; browsers use the
origin's tcode.outbox.<machine id> localStorage entry. Clearing client data
clears these pending writes. A write goes on the wire only once it is saved, so a
write that cannot be saved is a real failure, not a successful send. Terminal
input and the terminal drawer's height are not retained: they are sent as they
happen, held in memory across a reconnect, and never saved for a relaunch.
After hello and subscription replay, every unacknowledged write is sent in queue
order without waiting for the previous Ack; the stream and the host preserve that
order, and a rejected write fails only itself. The same key is used on every
redelivery. The outbox is bounded at 256 entries and 8 MiB of serialized
entries. The oldest surplus entry fails
with outbox_full. A write already received by the host cannot be recalled by
client-side eviction.
The runtime retains the last 512 completed command keys and Ack results per authenticated device, including rejected commands. Cache hits refresh their LRU position and return the original Ack without executing again. This cache survives a reconnect, but not a host-process restart or eviction from the 512-key window. Exactly-once redelivery applies within that window. Keys are scoped by the authenticated device id on the machine, never by a prefix the client supplies, so one device's cache cannot be shared with or spoofed by another.
A command waits for its Ack for as long as the connection is up; the
transport, not the command, decides that the link is lost. Losing it fails a
command that is not retained and leaves a retained one in the outbox for
redelivery. The browser's liveness constants are in
crates/client/src/heartbeat.rs.
A pending user message is muted with Sending…, or Waiting for connection… when the workspace is reconnecting or syncing. It becomes normal only after Ack. A rejected send or outbox overflow shows an inline error with Retry and Discard. Retrying a terminal failure creates a new action and key. An approval decision in the outbox disables the approval buttons and keeps a pending caption. Transient reconnects belong in the connection banner, not failure toasts.
A pairing identifies the machine by its key, independently of its address. After every successful connection the device saves the relay and the direct addresses that actually carried it — including a direct path found later by hole punching — so the next attempt starts from what worked last. Between attempts the lookup service (when the machine publishes to one) supplies the machine's current relay and addresses; a home relay lets the two ends learn each other's direct addresses and try hole punching, and the connection can move from Relay to LAN or Tunnel — or back — without reconnecting. The path shown in the banner and the machine's device list follows that change.
On the same network the device also looks the machine up itself, whatever the Traverse setting, so a paired machine is found again after a new DHCP lease, after both moved to another network, or after a restart, on a LAN with no internet and no Traverse. There is still no list of nearby machines: the device only ever resolves the ids it is already paired with, and only the machine advertises. Each attempt to connect uses exactly two sources, and nothing else:
- The addresses saved for that machine, handed over at once and dialled
together, in the order
hosts.jsonkeeps them: the address that carried the last successful connection first, older ones after it. - A DNS-SD browse for
_tcode._udp(multicast DNS, UDP 5353) that runs at the same time for about 2.5 seconds and adds every address it finds for the machine as it resolves. A machine advertises one instance of that type while it hosts — desktop and headless alike, whatever its Traverse sources — with its bound UDP port and a TXT recordv=1,id=<machine id>,name=<machine name>; loopback is never advertised, and the record follows the machine's interfaces when iroh's network monitor sees their addresses change. The device keeps only the instance whoseidis the machine it wants. This is a standard advertisement, sodns-sd -B _tcode._udpon macOS or Android'sNsdManagerlist it too; on iOS the app browses through the system's Bonjour daemon (theNSBonjourServicesentry inInfo.plist), and on Android it holds the Wi-Fi multicast lock for the browse.
A candidate address is never authorization: the QUIC handshake verifies the
machine's key, so nothing but the machine can answer. The lookup ends as soon
as the connection is up, and a change of the device's own interface addresses
starts it again at once. There is no subnet scan and no other fallback: where
the saved addresses are stale and multicast is blocked, the machine is not
found. Both the desktop app and tcode-headless bind UDP 47420 unless told
otherwise so that firewall rules and the invitation's port survive restarts.
With Traverse off there is no relay and no lookup service: the device has the addresses it saved and the LAN lookup. A machine that moved to a network the device is not on needs a new invitation.
An invitation names no address (The invitation link): a first
pairing reaches the machine through its relay, its Traverse lookup or the
DNS-SD browse above. Where none of them works — a LAN that blocks multicast
and has no internet, say — the first attempt ends without a path and the
pairing page asks for the machine's IP address instead of reporting
the transport's cause. The secret has not been sent, so the invitation is
still valid. Read the address off the machine (Addresses: in the
tcode-headless serve output, or the machine's network settings) and type
the address only, IPv4 or IPv6: the port comes from the invitation. Try
again (under the field on the Machines page) or Connect (on the paste
page) sends the same invitation again, dialling that address together with
everything the first attempt tried. If that address finds no path either,
the field says Nothing answered at ‹address›. The address that
carried the pairing is saved like any other, so the machine is reached there
again later. The machine's UDP port must accept
inbound traffic on the LAN for this to work.