Skip to content

teams: opt-in team sharing between paired computers - #2080

Merged
AbirAbbas merged 18 commits into
devfrom
feat/teams-on-relay
Oct 31, 2026
Merged

AbirAbbas merged 18 commits into
devfrom
feat/teams-on-relay

Conversation

@AbirAbbas

@AbirAbbas AbirAbbas commented Oct 30, 2026 •

Copy link
Copy Markdown
Collaborator

What this changes

Two paired computers can now share their teams. Before this, internal/teams imported no sync package, so a team made on one computer did not exist on the other.

It is off until you turn it on. Settings → General → share teams is a local switch, off by default, and it is not a synced preference. Teams travel only between two paired computers that have both turned it on. With it off, or on an unpaired computer, codeaf reads, writes, delivers and polls exactly as before.

With sharing on, on both computers:

  • Teams ride the existing sealed profile vault field by field: names, members, handles, manager, nesting, colours and settings. Deletes stay deleted. Merged files repair parents, handles and managers the same way on every computer.
  • Traffic from the other computer is history only.
    • It is written to a separate display file (teams/<id>/elsewhere.jsonl) beside the log, and delivery never reads that file. The local traffic.jsonl still holds only lines written on that computer, so nothing from another computer can deliver, start, stop or wake anything here.
    • Each computer publishes only its own lines, at most once every 30 seconds: up to 32 lines and 16 KiB per team, 64 KiB per device across all teams, text cut at 2 KiB.
  • A member chat held on the other computer opens through Home's existing Continue this chat here? question, from the Teams dropdown, the Teams page, Traffic links, the @ list and chat tabs. Hosted surfaces (--host/--at) say which computer has the chat instead.
  • A send that cannot arrive is refused before anything is written. A send to a single member or manager known to be on the other computer is refused with a sentence naming that computer. A mixed send reaches the local recipients once and names the ones it did not reach. If the lookup fails, the send is delivered locally, exactly as before.
  • Delivery positions stay on their computer. A continued chat whose position file came from another computer starts that team the way a chat meeting it for the first time does, so the directive that roused it is still delivered.

Stability (Abir's rule: "Dont mess anything up, stability is most important")

  • Off by default (NEEDS ABIR: the brief assumed automatic sharing). Turning it on by default later is a one-line change.

  • Existing vault carriers are unchanged. Credentials, provider keys, preferences and memories keep origin/dev's equal-stamp rule, removal rule and apply rule. The team carriers opt into their own guarded rules by scope and by constructor (GuardedKeys). Tests pin a non-team equal-stamp merge and a provider-key removal tombstone to origin/dev's answers.

  • With sharing off, two paired homes run several rounds and a member continue, and afterwards:

    • teams.json, the Traffic logs and .cell/team.json keep origin/dev's bytes;
    • the vault holds no team value;
    • directory requests equal the existing polling count.

    With A on and B off, B leaves A's team values in the vault byte for byte.

  • The surface reads the switch once at boot and after a panel save. It never reads the switch from disk on its update loop.

  • The model's prompt and tool descriptions are origin/dev's, so nothing the model is told changes for anyone.

  • Older builds sharing a profile. They never read elsewhere.jsonl or the new vault scopes. With sharing off nothing new is written. With it on:

    • the local log keeps its lines;
    • the cursor file gains a device field, which older builds ignore;
    • a member can gain sync_id/start_origin, which dev's member reader already keeps and writes back as unknown fields.

Validation contract

  1. With sharing on for both: a team created on A shows on B (dropdown, Teams page, @ list) with the same members and handles.
  2. A rename on B shows on A, with one name only.
  3. A delete on A while B is offline stays deleted when B returns, and a stale rename does not bring it back.
  4. Concurrent member adds on both computers keep both members.
  5. A Traffic line written on A shows once in B's Traffic and is never delivered on B.
  6. On B, opening a member chat that A holds goes through Continue this chat here?.
  7. With sharing off on either computer, nothing travels. Off is the default.
  8. An unpaired computer behaves exactly as before and makes no relay request.
  9. The manual answers all of the above, including "do my teams show on my other computer" and "how do I turn on team sharing".

Also covered:

  • A mirror failure never stops a vault round.
  • A relay outage never blocks local team messages.
  • An unchanged round scans no session world.
  • A continued chat gets the next local directive exactly once.

Proof

  • New tests in teams, vaultsync, keys, config, identity, manual, pair, remote, syncsetup, session and tui3. The pairing tests pair two homes through a real loopback relay, with real signing and encryption.
  • make test-laws passes, and the PR gate (check and every touched leg) and the Full check are green on f7a82da (rebased onto dev 9be6706; the rebase was clean and touched none of this PR's files).
  • Hand walk in tmux on a binary built from the head: done on 50247ad. Two throwaway homes were paired through a local relay with the scripted model stub.
    • Sharing off on both (the default): A made a team; after 45 s B had none, and neither home had a team ledger or a mirror (item 7).
    • A on, B off: A published, and after 30 s B still had nothing.
    • B turned on through Settings → General → share teams: the team reached B in 2 s and showed in the Teams page and the @ list (item 1).
    • A rename on B reached A with one name (item 2).
    • A Traffic line from A appeared once in B's elsewhere.jsonl, and B had no local log (item 5).
    • A member card on B raised Continue this chat here?. leave it there changed nothing (same teams.json bytes on both). continue here moved the chat in 17 s and rebound B's membership to the local copy (item 6).
    • B off again: a rename on A did not reach B, and B kept its team.
    • B on again: B caught up to A's latest name. During this step the local relay stalled for 34 s and then answered unreachable until restarted, and B caught up 4 s after the restart. This is relay behaviour under load, in code this PR does not touch.
    • Items 3 and 4 (an offline delete stays deleted; concurrent adds keep both) were walked by hand on the previous head (31d6128), and are pinned on this head by the loopback-relay pair tests.
  • Hello's Mac check: PASS on f7a82da. Hello's answer, verbatim:

PR #2080 PASS @f7a82daf7: build, handcheck (sharing off), L5's test loop and the sharing-on hand check all pass. make build PASS (11s).
(1) Handcheck with sharing left off: PASS, same as dev 9be6706.

  • B's Home shows "● alpha" and "running on alpha now", with 3 of 3 rows. Continues KIWI, MANGO and PINEAPPLE and a-continue-back PASS. doctor a and b say "nothing wrong". quit A and B EXIT=0, relay cells 3/3, nothing reappeared.
  • One line, b-continue-again, is a llama flake, not the PR. The chat moved ("Moved from alpha in 700ms. Everything as you left it."), but llama answered the follow-up with a stray JSON tool call ("proposetheask … Pineapple") instead of the word.
    (2) Sharing ON on both a and b: PASS. Settings → General → share teams changed only teams.share, and both sides showed "share teams • on". The times run from Enter on one side to the first screen frame showing the change on the other:
  • Create a→b: PASS, 11.8s. On a: team "kestrel" with 2 chats. On b: "● kestrel" on the AI teams page and in the Teams dropdown, with the same members "@response" and "@agenda" and the same titles, held as remote. teams.json had it after 10.1s.
  • Rename b→a: PASS, 9.9s. b saved "osprey"; a shows "● osprey" on the AI teams page and in Chats ("● osprey ×", tabs "@response @agenda").
  • Delete a→b: PASS, 10.0s. a: "osprey is forgotten; its conversations stay in your history". b went back to the empty AI teams page, and its dropdown shows only "+ New from this session".
    (3) L5's script, run as the same go test -count=1 -run <regex> ./internal/<pkg> loop: all 11 packages ok (teams, vaultsync, keys, config, identity, manual, pair, remote, syncsetup, session, tui3), with no reds to attribute. git status stayed clean after every package.

Two read-only adversarial reviews ran over the change, and their findings are fixed in it.

Follow-ups

  • Crew settings on relay (dropped from this PR). An earlier revision made crew seat routes and disabled providers synced preferences. It is dropped because preferences travel for every paired pair with no switch, so it would have changed what syncs for people who already pair and never asked for it. That is against the stability rule. Done right, it rides the same opt-in switch, or a switch of its own. Seat model pins already travel with synced preferences, as on dev.
  • The desktop app's crews (its SQLite store) are separate and out of scope.
  • A link from the other computer's history to a message inside a chat continued here says that the message is in the other computer's history. It does not yet translate the reference.
  • Traffic values written by a revoked computer stay in the vault (bounded at 64 KiB) until a revoke-time cleanup exists. Mirrors already ignore them.
  • Before Home has learned the other computer's name, a member card can say "the other computer".
  • On the computer that does not hold a chat, opening a stale local copy of it can open the copy directly when Home's cached reading is old. Typing in it still reaches Continue this chat here?, so nothing is sent from the copy.

🤖 Generated with Claude Code

AbirAbbas added a commit that referenced this pull request Oct 30, 2026
AbirAbbas added a commit that referenced this pull request Oct 31, 2026
@AbirAbbas
AbirAbbas force-pushed the feat/teams-on-relay branch from 31d6128 to 50247ad Compare October 31, 2026 05:40
@AbirAbbas AbirAbbas changed the title Teams, Traffic and crew routes show on every paired computer teams: opt-in team sharing between paired computers Oct 31, 2026
AbirAbbas and others added 18 commits October 31, 2026 02:12
A value each device writes only for itself (Traffic windows) gets its own carrier with rate limiting and removal when its collection goes; a restore keeps an edit made while a pull was in flight; removal honours Holds; equal-stamp live entries converge by content; optional extras never fail a vault round.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ly Traffic mirror

Members carry a portable identity, merged files repair parents, handles and managers the same way on every computer and list teams by creation, and Traffic from another computer lives in elsewhere.jsonl beside the log: delivery never reads it. Export windows are bounded (32 lines, 16 KiB per team, 64 KiB per device, text cut at 2 KiB).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Team records and each device's Traffic window ride the existing sealed vault rounds; unchanged rounds scan no session world; a continued chat's membership is rebound best effort; replacing a paired profile moves local teams aside and keeps Traffic.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…own computer

A send, start, rouse, decision or escalation to a chat known to be on another computer is refused before anything is written; mixed sends reach local recipients and name those not reached; a failed lookup delivers locally as before. Cursor files record their device, and a foreign or past-the-end position starts that team again as a chat meeting it for the first time.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…how other computers' Traffic

Every member gesture reaches Home's own Continue this chat here? lifecycle; hosted surfaces say where the chat is instead; the Teams dropdown and @ list refresh from the file stamp without writing; mirrored Traffic lines are drawn read-only with their computer's name.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Pinned crew routes and providers turned off are preferences, so they travel with the seat pins that already did.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The manual answers whether teams, deletes, Traffic and crew settings show on another computer, with the real limits; PERF records the Traffic budgets.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…y rules

Only the team scopes opt into the content tie-break, the ownership check on
removal and the cross-round baseline (GuardedKeys). Credentials, provider keys,
preferences and memories behave exactly as on dev. Optional sharing runs
through BestEffort so its failures never block other carried state.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Making crew seat routes and disabled providers synced preferences would change
what travels for every paired pair, with no switch. Dropped; a follow-up can
ride the team sharing switch or one of its own.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Settings -> General -> share teams. It is not a synced preference: each
computer decides, and teams travel only when both paired computers have it on.
The surface reads it at boot and when profile settings are adopted, never on
its update loop.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…un only with sharing on

With the switch off a paired computer captures, restores, replaces and polls
exactly as on dev, and preserves another computer's team values untouched.
The pair test moves to package pair_test, breaking the test import cycle with
syncsetup.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…h sharing on

With the switch off a team send, raise, escalate and decide never asks the
directory, and the cursor file keeps dev's bytes. The prompt and tool
descriptions are dev's.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… only with sharing on

With the switch off the @ list, Home recents and the Teams interaction panel
behave as on dev, and no refresh clock turns.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The dev box pages shifted the corpus enough that a team-manager section
outranked it for "what is the squiggly line at the start of a card".

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant