Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
4a3094f
Principles: the machines of a group start threads on each other and h…
Tryanks Nov 26, 2026
b014337
Machine groups: members ask each other over tcode/1, and each machine…
Tryanks Nov 26, 2026
e46e24d
Machine groups: a device that may only view does not walk the machine…
Tryanks Nov 26, 2026
7afddb8
Machine groups: a project moves to another machine with all its threa…
Tryanks Nov 26, 2026
e83ab9a
Machine groups: the gate test reads an answer from the host as having…
Tryanks Nov 26, 2026
c04825f
Machine groups: a project inside a larger repository is named as a re…
Tryanks Nov 26, 2026
c0ebc21
Machine groups: a project inside a larger repository does not move
Tryanks Nov 26, 2026
660fbdf
Machine groups: each machine sets what it takes and who may operate i…
Tryanks Nov 26, 2026
d62ba5b
Machine groups: a thread starts a thread on another machine of its gr…
Tryanks Nov 26, 2026
12fbb56
Machine groups: a subagent on another machine is proven over the grou…
Tryanks Nov 26, 2026
8265e52
Machine groups: a project is moved to another machine from its row, a…
Tryanks Nov 26, 2026
066b825
Machine groups: a thread started on another machine of the group show…
Tryanks Nov 26, 2026
359b8da
Docs: remote.md says what machines of a group do for each other
Tryanks Nov 26, 2026
d55bf3f
Machine groups: a subagent elsewhere is stopped, cancelled and settle…
Tryanks Nov 26, 2026
3cf8f8e
Docs: remote.md says what another machine's threads reach, how a paus…
Tryanks Nov 26, 2026
066bcbd
Machine groups: a finished move leaves nothing behind, and a paused m…
Tryanks Nov 26, 2026
c4224db
Machine groups: a machine of a group is called by its label on its ow…
Tryanks Nov 26, 2026
b887740
Machine groups: the move dialog says what is true of the machine and …
Tryanks Nov 26, 2026
88f97fe
Docs: remote.md names Settings pages, move endings, paused reasons an…
Tryanks Nov 26, 2026
087cd51
Browser listener: its wire comment names the protocol constant, not a…
Tryanks Nov 26, 2026
29e0108
Machine groups: an invitation outstanding when the group changes give…
Tryanks Nov 27, 2026
37dbc22
Machine groups: a move's confirmation, its paused row, a moved draft …
Tryanks Nov 27, 2026
d959e41
Machine groups: keeping a move clears the mark that its confirmation …
Tryanks Nov 27, 2026
e7548b6
Docs: remote.md says an outstanding invitation follows the group, and…
Tryanks Nov 27, 2026
c8dfbc4
Merge remote-tracking branch 'origin/main' into claude/group-machines
Tryanks Nov 27, 2026
bb8e653
Machine groups: the label dialog and a thread elsewhere's card take w…
Tryanks Nov 27, 2026
9a7e3ff
Machine groups: the move dialog lets the host say what stands in a mo…
Tryanks Nov 27, 2026
e619ff4
Machine groups: a failed MovedThread query is shown, not taken for a …
Tryanks Nov 27, 2026
44e632c
Machine groups: the host's refusals for a moving project and a view-o…
Tryanks Nov 27, 2026
582a81c
Machine groups: a thread started from another machine runs under this…
Tryanks Nov 27, 2026
e9ef37c
Machine groups: a machine may preview settling its own subagent
Tryanks Nov 27, 2026
dc2795a
Machine groups: the dispatch tests run over the group's real transpor…
Tryanks Nov 27, 2026
6195023
Machine groups: a move's reads and clean-ups that fail say so instead…
Tryanks Nov 27, 2026
f0bd938
Machine groups: the move tests stop at a step the laptop decides, wit…
Tryanks Nov 27, 2026
4169437
Machine groups: the two-machine test harness keeps stopping and resta…
Tryanks Nov 27, 2026
9accd72
Docs: remote.md says a thread started from another machine runs as on…
Tryanks Nov 27, 2026
c0f6f19
Machine groups: a restore that cannot ask where its thread went says …
Tryanks Nov 27, 2026
f4402c9
Machine groups: the group info reports what this machine takes now, f…
Tryanks Nov 27, 2026
17e46cc
Machine groups: a thread another machine started here reports its exe…
Tryanks Nov 27, 2026
eca8994
Machine groups: MachineInfo no longer derives a wire format nothing uses
Tryanks Nov 27, 2026
7ca1311
Machine groups: the wire note above PROTOCOL_VERSION names the roster…
Tryanks Nov 27, 2026
5f16dd7
Machine groups: the switches test is named for the label it also proves
Tryanks Nov 27, 2026
0775b10
Machine groups: a move's cancel question is asked inside its progress…
Tryanks Nov 27, 2026
122330b
Machine groups: a thread on another machine is named in a callback by…
Tryanks Nov 27, 2026
9796012
Slop audit: what the round over machine groups met, kept and got wrong
Tryanks Nov 27, 2026
b2d4f8a
Machine groups: a machine's caller no longer carries a permission mod…
Tryanks Nov 27, 2026
0178e54
Machine groups: a Pong says only that the machine answered, since a m…
Tryanks Nov 27, 2026
6e17e95
Machine groups: the client's MachineInfo names itself, and the runtim…
Tryanks Nov 27, 2026
815e1ba
Machine groups: the settings page draws the switches the host reports…
Tryanks Nov 27, 2026
b9da762
Machine groups: a thread on another machine stands as its host's agen…
Tryanks Nov 27, 2026
3f24d5e
Machine groups: a moved thread records the machine it came from by na…
Tryanks Nov 27, 2026
66e1af4
Machine groups: resuming a paused move is its own command
Tryanks Nov 27, 2026
c34be42
Machine groups: a thread whose worktree is gone blocks the move inste…
Tryanks Nov 27, 2026
bea52c0
Machine groups: what a move could not clear away is reported, with wh…
Tryanks Nov 27, 2026
c1683a7
Machine groups: records of moves that cannot be read at start are an …
Tryanks Nov 27, 2026
8b804d5
Machine groups: the host says how a move ended, and the client stops …
Tryanks Nov 27, 2026
ecaf92b
Protocol: move_left_behind is noted under Unreleased, not in a releas…
Tryanks Nov 27, 2026
2076e39
Docs: remote.md names the missing-folder reason, how a window that wa…
Tryanks Nov 27, 2026
3220cee
Machine groups: the move dialog says a machine could not be asked whe…
Tryanks Nov 27, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
83 changes: 83 additions & 0 deletions .agents/skills/slop-audit/PATTERNS.md
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,46 @@ the windows that draw its calls):
lead and so itself; what a rule incidentally holds up is found before it
goes.

From the round over machine groups (#1199, the pull request's diff only):

- **A host's verdict rebuilt for a thread elsewhere**: the host gave no agent
status for a thread another machine started, so the window rebuilt the
host's precedence from activity flags; the copy had already lost
*Interrupted*. The host now reports it.
- **An outcome inferred from a disappearance**: how a move ended was worked
out from an entry leaving a list, the index and the last phase seen. A move
that ended while the client was away stayed "departing" for good. The host
says how each move ended.
- **A command overloaded, with made-up arguments**: starting a move was reused
to resume one, so Try again sent an empty path and a `false` the host
ignored. Resuming is its own command.
- **A fallback that moves the work**: a thread whose worktree was not carried
arrived at the project's root and continued there. It is a reason the move
cannot start.
- **A field written and never read**, filled by a lookup ending in
`unwrap_or_default()`, so a thread's stored log could name an empty machine.
- **Closing whatever is on top**: a dialog closed "the topmost dialog" when
its move ended, trusting a mark cleared by `on_close`, which the alert's
footer Cancel never calls. The question is asked inside the view now.
- **A copy of a switch's effective value**: the settings page drew
`operate && switch`, the rule the host applies to what it announces. The
host reports what is in effect.
- **Text the host wrote, split again by the window**: `thread@machine` was
rewritten into a callback header by one crate and cut apart by another. The
module that owns the header format writes and reads it.
- **A router standing in for the transport** while the same file's last test
already ran two real hosts over real endpoints. The tests moved to the real
peer; one now waits out the transport's 20-second dial to a stopped machine,
the only real proof that a kept cancel reaches it later.
- **A race turned into a step the test decides**: a 48 MB transfer the test
had to interrupt in time became a commit the target refuses (a folder
planted where an attachment lands) and a staged file cut to half, which is
what an interrupted send leaves. Each test went from 6–17 s to about 2.
- **A permission ceiling of Tcode's own between machines**: a thread started
from another machine was held to its starter's permission class. Deleted
under the `tcode_control` ruling below; admission between machines stays
(Principle 5).

## What the audit did wrong

- **It added tests by symptom before finding the contract's owner** (#1096).
Expand Down Expand Up @@ -428,6 +468,18 @@ the windows that draw its calls):
judged and brought to the bar, and what it meets beyond the diff is listed
for a later round, not changed.

- **Two lanes shared a test harness, and one pruned what the other used.**
The move lane deleted the stop and restart of a machine's endpoint once its
own tests no longer needed them; the dispatch lane had just started using
them. Taking the lanes in one by one with the workspace built after each
caught it. A shared test file belongs to one lane, and the others list what
they need from it.
- **A lane's change failed a test elsewhere, and the cause was the change.**
A query failure now raised a warning; on a cold start a dropped link failed
that query, so the user would be warned about a thread they never asked
for. The test's window had no root for the warning, which is how it showed.
It was not the driver.

## Families beyond the defence

Named by the maintainer, not yet inventoried:
Expand Down Expand Up @@ -474,6 +526,25 @@ What is known without an inventory:
never opened interactively. Kept; the maintainer was unsure, and a run
comparing both seeds has not been done.

- **Admission between the machines of a group**: a member is admitted on
`tcode/1` under its machine key; every request passes the protocol version
and this machine's switches by kind; on the target a machine reaches only
the threads its own machine started there; the allow-list of tools is an
exhaustive match. Principle 5 and the maintainer's word.
- **Hand-written peers in admission tests**: an endpoint speaking the wire by
hand to prove a device opens no machine stream, or a removed member is
refused. Only a test can be the hostile peer for a security check; this is
not the misbehaving peer only a test can be.
- **A move's retry, 5 seconds doubling to 2 minutes**: a move is long and its
link drops; the retry only continues what the user started, who can press
Try again or cancel. No maintainer word on the numbers.
- **1 MiB chunks of a moved project**: the protocol line limit is 16 MiB and
a chunk goes as base64 on one line.
- **The machine probe's 5 seconds**: the listing waits on it and the user has
no cancel for it. It stays until one exists.
- **A fixed identity on snapshot commits**: `commit-tree` fails on a machine
with no git identity.

## Where the inventory was wrong

The rewrite round overturned or corrected these. They are the reason every
Expand Down Expand Up @@ -624,6 +695,18 @@ On checks before a push:
> Add Clippy to your own checks. — the maintainer, and then: there is no
> need to run all three platforms here; this machine runs its own.

On what the group's other devices may do on a machine, when a single switch
was proposed:

> Split it into whether they can look and, on top of looking, whether they
> can operate. That is necessary: if a bug left it so that a device cannot
> look but can still operate, say a conversation left open from before, that
> is a problem. — the maintainer

So the level is one choice of three that has no state for "cannot look, can
operate", the host decides it on every request, and a change closes the
connections it affects.

## Defects met on the way

Not defences; fixed or reported as their own entries.
Expand Down
21 changes: 18 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,18 @@ is derived from it. **Process** is how to build, check and submit work.
(Principle 3) whose only protocol is standard ACP, which today is
Antigravity alone. For such a harness Tcode synthesizes the features it
lacks instead of staying a thin wrapper. An agent that merely connects
over ACP gets none of this.
over ACP gets none of this. Hosts, projects and threads are Tcode's own:
operating them, on one host or between the hosts of a group, is not a
harness capability, even where a harness has something similar between its
own sessions.

2. **Host and client.** A Tcode host owns all of its state: providers, threads,
terminals, projects. Every client — the desktop window, a phone, a tablet, a
terminals, projects. A thread belongs to exactly one host at a time. The
hosts of a group work with each other directly: a thread on one may start a
thread on another and hear back from it, and a host may hand a project and
its threads over to another, after which they are that host's. What a host
keeps of another host's thread is a reference and its last known status,
never its content. Every client — the desktop window, a phone, a tablet, a
browser tab — is a screen for one or more hosts and speaks the same protocol
to each, whether it runs on the same machine or across a network; it shows
their state side by side and never merges it. Layers depend strictly
Expand All @@ -48,7 +56,14 @@ is derived from it. **Process** is how to build, check and submit work.
machine and does not use iroh. There is no automatic discovery: a device's
first contact with a machine, or with a group of machines, is always an
invitation, scanned or pasted; a machine admits only devices it paired or
that a machine in its group admitted. An official service, **Traverse**,
that a machine in its group admitted. The machines of a group reach each
other over the same transport, each under its own key. A machine's user
decides, by a switch for each, whether its threads may start threads on the
machines of its group, whether it takes the threads they start on it, and
whether it takes the projects they move to it; the last is off until
switched on. What a machine itself sent out comes back to it whatever those
switches say.
An official service, **Traverse**,
provides lookup and relay fallback: no accounts, on by default,
self-hostable, sees only ciphertext, and never required — on a LAN, direct
connections give the full product without it. Abuse is limited without
Expand Down
9 changes: 9 additions & 0 deletions crates/agent/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3157,6 +3157,12 @@ pub enum AgentEvent {
#[serde(default, skip_serializing_if = "Option::is_none")]
parent_item_id: Option<String>,
},
/// The thread came to this machine with its project from the machine of the
/// group called `from_machine_name`. Never emitted by an adapter; the runtime
/// records it when the move is committed here.
ThreadMoved {
from_machine_name: String,
},
/// The harness waits for the host to create or remove a git worktree, as
/// Claude Code does through its `WorktreeCreate` and `WorktreeRemove` hooks
/// for every worktree it works in. Answered by
Expand Down Expand Up @@ -3998,6 +4004,9 @@ pub enum ChildRequestAnswer {
pub struct ControlAction {
pub actor_thread_id: String,
pub actor_title: String,
/// The machine of the group the actor thread is on, when it is not this one.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub actor_machine: Option<String>,
/// A semantic key from `tcode_core::control::action`, which clients put in words.
pub action: String,
/// Data only (a title, an id, a name, a count, someone's own words), never a sentence.
Expand Down
7 changes: 6 additions & 1 deletion crates/app/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -197,16 +197,21 @@ fn start_local(
store: SessionStore,
login_shell_unread: Option<String>,
) -> std::io::Result<(SpawnedHost, HostMux)> {
// The machine this window starts while hosting serves the host's way
// to the other machines of its group.
let machines = tcode_client::machines::MachineLink::new();
let mut host_services = HostServices {
background_startup_probes: true,
ai_title_generation: true,
login_shell_unread,
machines: Some(machines.clone()),
..HostServices::default()
};
host_services.start_mcp_servers(true);
let host = spawn_host(store, host_services)?;
let mux = HostMux::new(host.attachments.clone(), host.from_host.clone())
.with_original_backend(std::sync::Arc::new(host.clone()));
.with_original_backend(std::sync::Arc::new(host.clone()))
.with_machine_link(machines);
Ok((host, mux))
}

Expand Down
12 changes: 11 additions & 1 deletion crates/client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
pub mod attachment;
pub mod heartbeat;
pub mod host;
pub mod machines;
pub mod original;
pub mod outbox;
pub use original::OriginalTransfer;
Expand Down Expand Up @@ -60,11 +61,20 @@ pub enum ConnectionFailure {
AuthenticationRejected,
ProtocolMismatch,
HostClosed,
/// The device is still paired, but the machine admits none of its
/// group's other devices now.
AccessClosed,
}

impl ConnectionFailure {
/// Whether dialling again cannot help until something changes on either
/// side. A machine closed to its group's devices stays closed until its
/// user opens it.
pub fn is_terminal(&self) -> bool {
matches!(self, Self::AuthenticationRejected | Self::ProtocolMismatch)
matches!(
self,
Self::AuthenticationRejected | Self::ProtocolMismatch | Self::AccessClosed
)
}

/// Older hosts did not send machine-readable rejection reasons.
Expand Down
150 changes: 150 additions & 0 deletions crates/client/src/machines.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
//! How a machine's host reaches the other machines of its group. The host
//! asks through a [`MachineLink`]; the transport that keeps the group serves
//! the link for as long as it runs, so a call made while this machine hosts
//! nothing, or is in no group, fails at once instead of waiting.
use std::sync::{Arc, Mutex};

use tcode_protocol::{MachineRequest, MachineResponse, ProtocolError};

/// One machine of this machine's group, this one included.
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct MachineInfo {
pub id: String,
pub name: String,
/// What the group calls it, when anyone gave it a label.
pub label: Option<String>,
pub this_machine: bool,
/// What the machine says it takes; `None` while it has not said.
pub accepts_threads: Option<bool>,
pub accepts_projects: Option<bool>,
/// Filled by a probe: whether it answered, whether its protocol is this
/// machine's, and whether a relay carried the answer.
pub reachable: Option<bool>,
pub protocol_ok: Option<bool>,
pub relayed: Option<bool>,
}

impl MachineInfo {
/// What the group calls the machine: its label, else its own name.
pub fn title(&self) -> &str {
self.label.as_deref().unwrap_or(&self.name)
}
}

/// What the transport serving a [`MachineLink`] is asked.
pub enum MachineCall {
Request {
machine: String,
request: Box<MachineRequest>,
reply: async_channel::Sender<Result<MachineResponse, ProtocolError>>,
},
Machines {
probe: bool,
reply: async_channel::Sender<Result<Vec<MachineInfo>, ProtocolError>>,
},
}

/// The host's way to the other machines of its group. Clones share whoever
/// serves it.
#[derive(Clone, Default)]
pub struct MachineLink {
serving: Arc<Mutex<Option<async_channel::Sender<MachineCall>>>>,
served: Arc<Mutex<Vec<async_channel::Sender<()>>>>,
}

impl MachineLink {
pub fn new() -> Self {
Self::default()
}

/// Serve this link's calls from the returned receiver from now on, in
/// place of whatever served them. Once it is dropped, calls fail with
/// [`NO_GROUP`] until the next one serves.
pub fn serve(&self) -> async_channel::Receiver<MachineCall> {
let (sender, receiver) = async_channel::unbounded();
*self.serving.lock().unwrap() = Some(sender);
self.served
.lock()
.unwrap()
.retain(|served| served.try_send(()).is_ok() || !served.is_closed());
receiver
}

/// Hears once each time something starts serving this link, and at once
/// when something serves it now: when what this machine could not send
/// its group may go.
pub fn serves(&self) -> async_channel::Receiver<()> {
let (sender, receiver) = async_channel::unbounded();
let mut served = self.served.lock().unwrap();
if self
.serving
.lock()
.unwrap()
.as_ref()
.is_some_and(|serving| !serving.is_closed())
{
let _ = sender.try_send(());
}
served.push(sender);
receiver
}

/// Send `request` to `machine` of the group and wait for its answer. A
/// machine that cannot be reached answers [`MACHINE_UNREACHABLE`].
pub fn call(
&self,
machine: &str,
request: MachineRequest,
) -> impl Future<Output = Result<MachineResponse, ProtocolError>> + Send + 'static {
let (reply, answer) = async_channel::bounded(1);
let sent = self.send(MachineCall::Request {
machine: machine.to_owned(),
request: Box::new(request),
reply,
});
async move {
sent?;
answer.recv().await.unwrap_or_else(|_| Err(stopped()))
}
}

/// The machines of the group; with `probe`, each other one is pinged
/// first and its answer filled in.
pub fn machines(
&self,
probe: bool,
) -> impl Future<Output = Result<Vec<MachineInfo>, ProtocolError>> + Send + 'static {
let (reply, answer) = async_channel::bounded(1);
let sent = self.send(MachineCall::Machines { probe, reply });
async move {
sent?;
answer.recv().await.unwrap_or_else(|_| Err(stopped()))
}
}

fn send(&self, call: MachineCall) -> Result<(), ProtocolError> {
let serving = self.serving.lock().unwrap().clone();
match serving {
Some(serving) => serving.try_send(call).map_err(|_| stopped()),
None => Err(stopped()),
}
}
}

/// This machine is in no group, or hosts nothing that reaches one.
pub const NO_GROUP: &str = "no_group";
/// The other machine could not be reached, or the connection to it failed.
pub const MACHINE_UNREACHABLE: &str = "machine_unreachable";
/// The other machine is not a member of this machine's group.
pub const NOT_MEMBER: &str = "not_member";
/// The other machine runs another protocol version.
pub const PROTOCOL_MISMATCH: &str = "protocol_mismatch";
/// The other machine's switches do not take this kind of request.
pub const MACHINE_REFUSES: &str = "machine_refuses";

fn stopped() -> ProtocolError {
ProtocolError {
code: NO_GROUP.into(),
message: "this machine is not hosting a machine group".into(),
}
}
Loading
Loading