Skip to content

One link flow: connect two machines once, for messages and actions #1004

Closed

Description

@Jacksondr5

Problem

Settings → Connections offers two ways to connect two machines: upstream's Linked environments (an agent here acts on another machine) and J5's Peer servers (agents on the two machines message each other). A person can't tell which one they need, and nobody has found a reason to want one without the other. Starting a Peer Agent on another machine (#956) needs both, set up in two places, with different directions, lifetimes and removal behaviour.

The split is a fact about who owns the code. It shouldn't be visible to users.

Decisions (Jackson, 2026-11-09)

Made in the thread "Peering vs linking: where to draw the line". The comparison that led here is #925, in the artifact planning/linking-vs-peering-ux.md.

  1. One feature for users. Peering and links stay separate in the code. Users see one thing, called a link.
  2. J5 takes over upstream's link UI on web and desktop. This changes upstream's product, so it needs a new entry in the register of divergences (docs/j5/product/upstream.md). The reason is J5's own: J5 has peering, and users shouldn't see two ways to do one job. Underneath, a link still creates upstream's link and J5's peer record.
  3. Add environment stays upstream's. When it succeeds, and the person is an Owner on the new machine and on at least one other J5 machine, J5 offers the link flow straight after, with the new machine already picked. It can be skipped, and the same flow is reachable from Settings.
  4. No pasted pairing code in the link flow (Compare the setup UX of linked environments and peering #925's first idea). A machine that isn't in the browser is added the normal way first.
  5. The flow is choose, check, then link.
    • A checklist of the person's other machines.
    • Two levels, one per direction ("agents on Laptop may, on these machines" and "agents on these machines may, on Laptop"), chosen once for every ticked machine, with a per-machine override on its row.
    • The reachability check runs for every ticked pair together. A pair the check settled needs nothing more. A pair with a problem gets a button on its own row.
    • Link does every ticked pair. A pair that fails shows its error and the others still link.
  6. Levels: Messages only, then upstream's five (Read only, Supervised, Auto-accept edits, Auto, Full access). Both dropdowns start on Supervised, as upstream's does. The picker says what Full access adds: it is needed to start Peer Agents on the other machine and to act on that machine's own threads.
  7. The Labs switch. Picking a level above Messages only turns on Linked environments on the machines involved, and the screen says so. Upstream's default stays off for anyone who never links machines.
  8. Expiry. Upstream's link lasts 30 days. The pair's row shows when its actions expire and has a Renew button that covers both directions. An agent's link request card renews it from the thread. J5 does not renew automatically.
  9. Remove. One Remove ends the whole link on both machines: the peer records, the links in both directions and the link sessions. The confirmation says what is lost (messages and Exchanges still waiting, and delegated tasks on the other machine that stop being followed). A browser that manages only one side warns as peering does today. Setting a direction to Messages only drops that direction's actions and keeps messaging.
  10. The agent's request card keeps upstream's shape (reason, machine, level, approve) and t3_environment_link keeps its name. Approving it sets up messaging plus the one direction the agent asked for; the other direction stays on Messages only. The check result shows before approval. "Another address…" is replaced by "Add it to this browser first". On a pair that is already linked, the card raises that direction's level or renews an expired link.
  11. Mobile is parked. Mobile keeps upstream's link card and link list as shipped. A link approved there has no messaging, so the web row needs a state that reads "Actions work. Messaging isn't set up", with a Set up messaging button where the other machine runs J5. The same state covers links made before this ships and a T3 Code machine that isn't J5.
  12. Words. Settings has one section, "Linked environments", with one row per pair. "Peer servers" and "Add peer" leave the UI. "Peering" stays the internal name for the message path, in the spec and the code.
  13. Sequence. After Reverse route: let the VM reach a laptop that can't be reached, over a line the laptop opens #951 (reverse route) and before j5_spawn_agent starts a Peer Agent on another J5 machine (environment_id) #956 and Delegate a persona to another J5 machine #957.

To settle in the definition

Not decided yet; the definition should propose an answer for each.

How to do it

  1. Rewrite the definition first: the Peering and "Starting work on another machine" sections of docs/j5/product/cross-device.md, a new register entry, the peering and linking paragraph in docs/j5/product/upstream-convergence.md, and a short section in J5's user docs on what a link does in J5 (upstream's guides describe one direction and actions only). Jackson reads docs and UI before a build starts.
  2. Build on web and desktop. Upstream-owned files it reaches include apps/web/src/components/settings/AddEnvironmentDialog.tsx (one hook where it finishes), LinkedEnvironmentsSettings.tsx, LinkAccessPicker.tsx and the link request card; J5's side is apps/web/src/j5/peering/. Record every upstream edit in FORK.md.
  3. Live-test between two J5 test servers (setup-agent-live-test.ts --peer), including an agent's card, an expired link, Remove from a browser that manages one side, and a link made on mobile showing as "Messaging isn't set up" on web. Before and after captures for every state.

Related

#925 (the comparison; closed by this), #951 (reverse route), #956 and #957 (Peer Agents and persona delegates on another machine), #953 (Crews across machines), #772 (linked environments in the v0.1.7 advance).

Claude Fable 5.2

Activity

  1. Jacksondr5 commented on Nov 20, 2026

    @Jacksondr5
    OwnerAuthor

    The definition is in #1098 (Jackson's LGTM, 2026-11-19): cross-device.md "Environment links", AC36–AC48, and register entry D47. Build against those.

    Settled there, from this issue's "To settle in the definition" list:

    • The check has no Fix button. A server that polls holds a line (Reverse route: let the VM reach a laptop that can't be reached, over a line the laptop opens #951), so actions take the route messages take, and the check states the result for each direction.
    • Existing pairs show as they are, with nothing migrated. A pair that was only peered gains actions in one step, by raising a level on its row (Jackson: "a simple UX, not something that requires a repair").
    • The route for messages is unchanged.
    • The command line keeps j5 environment link and j5 a2a peer.
    • A server's first link is made by the person, because upstream hides the link tools from agents while Linked environments is off.

    For the build's docs: the user-guide section is on the branch docs/unified-link-user-guide, held back because it describes screens that don't exist yet. docs/j5/user/j5-peering.md needs its rewrite with the build too. Linking from mobile is #1097.

    Claude Fable 5.2

  2. Jacksondr5 commented on Nov 20, 2026

    @Jacksondr5
    OwnerAuthor

    Build design, agreed with Jackson on 2026-11-19 from sketches in the build thread. Words a person reads say tools where the definition says actions, and a direction with none reads Off (the definition's Messages only).

    Rulings that change the definition

    • The agent's card stays as upstream on a live link: the agent hears linked and no card is raised. The card links a new pair and renews an expired one; levels change only on the pair's row. AC45's "the card raises that direction's level" is reworded with the build.
    • A J5 server-side addition to find and revoke a link's session on the other server is fine.

    Settings section. Title "Linked environments", tag line "Link two of your servers so their agents can message each other and use tools on the other server."

    Pair row. A Messages line (how they travel) and a Tools block with one picker for each direction, reading "Home's agents on Work". Levels: Off, then upstream's five. Under them, when tool access runs out. Renew is a button only in the last 5 days and after expiry, and sits in the ••• menu before that with Edit address and Remove. A pair with tools off both ways has a hint line saying to choose a level. A pair with upstream's link and no peering shows only the direction that exists, with Set up messaging; for a T3 Code server it says messaging needs J5 Code there.

    Link dialog. One screen, not a wizard. "How does this work?" is in the dialog's tag line. "Link [server] with", a checklist of the other servers, and two Tools pickers that apply to every ticked server. Each ticked server has one line saying how messages will travel, with Change. The dialog asks nothing: it takes the safe route and Change overrules it. Change opens that server's line in place with the ways messages can travel, one marked Recommended ("Sent directly both ways · both always on and reachable"), and a Tools block for that pair's own levels. A server that cannot be linked stays listed, greyed, with the reason. One note names the servers Linked environments is turned on for. After Link, one result line for each pair; a direction whose tools could not be made is left Off with the reason.

    Changing a pair. A level change applies at once. It asks first only when it has to turn on Linked environments, and names the servers. Setting a direction to Off asks nothing. A change that fails leaves the direction as it was, with the reason under it. Renew covers every direction that has tools. Remove keeps the three confirmations (both servers, the other already ended it, here only) with the tools consequences added. A server this app cannot manage has its picker disabled with the reason.

    Agent's card. The card in the thread is upstream's, unchanged. J5 owns the dialog behind it: the link dialog's server line and one Tools picker, for the direction the agent asked for; the other direction is shown and not editable. "Another address…" goes: a server that is not in the app is named, with adding it as the step to take.

    After Add environment. The link dialog opens by itself once the new server has connected, with that server fixed (no dropdown), every other manageable server ticked, and "Not now" in place of Cancel. No offer for an added route, or for a server this app cannot manage.

    Explainer page. j5.codes/peering moves to /linking, with /peering redirecting, and is rewritten around a link.

    Build shape. Four layers: the server's link-session service and the unreachable text without the line's address; the Settings section and row; the link dialog, the offer and the card's dialog; then one docs PR.

    Claude Fable 5.2

  3. Jacksondr5 commented on Nov 21, 2026

    @Jacksondr5
    OwnerAuthor

    Upstream v0.1.11 changes two decisions here (2026-11-21)

    Decision 5 (choose, check, then link). Upstream shipped batch linking in pingdotgg/t3code#39426. Settings → Linked environments has Link several… once the app has two other saved machines: a checklist of them, one access level, one confirm. For each ticked machine it mints a one-use pairing code there and makes an ordinary single link, with no batch RPC. A machine can't be selected, and shows why, when it's already linked, the app isn't connected to it, the session lacks access:write, or the app has no address another machine can reach. The CLI gained t3 environment link --from <file>.

    The definition should build J5's flow on this rather than design its own checklist. Two things are still J5's to add:

    • Messaging, which needs the peer record.
    • The line address, for a machine nobody can dial. Upstream marks that machine "no address another machine can reach", which is exactly the laptop on ZPA.

    Decision 8 (expiry). In pingdotgg/t3code#39399, links now renew while they're used. The receiving side moves its session's expiry 30 days out at most once a day, and the linking side stores the T3-Link-Expires-At header that comes back. "Upstream's link lasts 30 days", the Renew button and "J5 does not renew automatically" no longer match upstream. A link expires only after 30 days unused, or one side runs an older version. Follow upstream: drop J5's own renewal, and keep only what upstream shows for an expired link.

    Claude Opus 5.5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions