Repository navigation
feat: linked devices with agent profiles, teams, and scheduled work - #44
Conversation
An agent row mixed what the agent is (name, harness, model, prompt) with what one machine holds (its key). Split them: the profile is the owner's and syncs to every device; each device runs an instance with its own key, attested by that device. This removes the name clash from issue #40 without renaming anyone. Pairing now asks for a route that authenticates the far end (Rex Tailscale, SSH host key, WireGuard with a confirm code, or a confirm code alone) instead of Tailscale's caller identity, since Rex over SSH reports only `kind: peer`.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
An agent is now a profile (what it is: name, harness, model, skills, prompt, owned by its owner and the same on every device) and its instances (that profile on one machine, with its own key). Migration 13 turns each agent into a profile plus its one instance, keeping the pubkey and attestation, and drops the global `name UNIQUE`: names are unique per owner, so two owners' `reviewer`s no longer collide (#40). Three owner-wide envelope kinds, on no thread: - 120 `owner.device` links, revokes or labels a machine; - 121 `agent.announce` lists an instance a device runs; - 122 `agent.profile` carries a whole profile, newest wins. Authorization resolves a signer to the owner it speaks for (device, then owner, at most four links), so a linked machine, or a whole home adopted by another owner, acts for its owner on every thread with no re-signing. A revoked device authorizes nothing signed after its revocation. Records that arrive before what they depend on are stored rejected and revived when it lands.
Eight digits derived from both keys, for pairing over a route that proves nothing about the far end (NetBird, plain WireGuard): the owner checks the same code shows on both machines.
`axel device link LABEL` installs Axel on the machine over SSH, checks the far end is the machine meant (its SSH host key, or a code compared on both screens with `--route confirm`), signs the link and syncs. `axel device ls`, `revoke` and `code` complete it. Linked machines sync every thread and every owner record; a host of another owner still gets only the threads shared with it, plus device links. Sync signs what changed here first: profiles edited, instances made, this machine's label. A profile that runs on a device for the first time gets that device's own instance, and a job sent to a linked device runs its instance instead of a delegation. The human's inbox counts messages to any key that speaks for the owner. `$AXEL_SSH` replaces ssh, so the tests can stand a directory in for another machine and run the real binary over `axel host rpc`.
A schedule is a signed log entry that names its thread in its content, so a run may open a new thread (RFD 0006).
Kind 124 envelopes project into `schedules`; run notes tagged ["sched", id, n] are recorded in `schedule_runs` at ingest, and a second run with the same number is dropped there. plan_run does the hand-rolled time math (once, every, daily at a fixed offset) with "now" passed in, coalescing missed runs; check_schedule also waits while the previous run's session is working. One migration, appended last.
A run goes through the same path as axel send (send_from: reach, chatter, sign, post, live note or summon), as the schedule's author, tagged with its run number and stamped with the tick's clock. Only the schedule's device fires it; a new_thread schedule records a fresh thread per run.
Supersedes ADR 0004.
A team is the owner's, like a profile: a named set of profiles with skill sources and a reach rule. Kind 123 is projected latest-wins per team_id, its signer must speak for the owner, and a record naming a profile not received yet is revived when the profile arrives. Migration 14 adds teams and team_members; local edits stay unsigned until published. Reach gains team and lead. An agent's effective reach is the stricter of its own rule and its teams', with the agents it names allowed on top, and the summon check uses it.
axel team new/edit/show/ls/rm name members by agent and store profile ids; each change is signed with the owner key and appended as kind 123, so it syncs. --reach team|lead also works on axel agent edit. A member's launch installs every skill of its live teams, between project and agent skills, through the same SkillSource parsing and install path, and its appended system prompt gets a roster of each team. axel agent show prints what each team adds to the agent's reach, and sends, summons and remote jobs all go by the effective reach.
A review of the linked-device authorization found that anyone could claim any key as their device, and take over another owner's profile by naming its id. Now: - a link carries the device's signature agreeing to it; - each link is its own row, so a revocation is never undone by a later link, and any key of the owner may revoke; - a revocation takes back profiles, teams and instances the device signed after it, even ones that arrived first; - a profile's or team's owner never changes, and an instance can't join another owner's profile; - links longer than authorization walks are refused; - a rebuild replays device links from scratch and settles every record as arriving one by one did.
… out `axel device link` asks the machine to sign its consent over `axel host rpc` and checks it came from the key it announced. Sync keeps profiles, teams, instances and schedules only from keys that speak for this machine's owner, and sends a host of another owner only our own device links. A profile of another owner never gets an instance here, and `axel device revoke` only finds our own machines.
The first run used to ask six things (name, harness, skills, colour, mode, what next) after a list of every harness's path and adapter. Now it says what matters in a few lines (the harness it will use and whether it is logged in, then only what needs attention), asks for a name, and takes the defaults for the rest: the first harness found, every skill, the next colour, autopilot. It ends on one thing to try. - `axel setup --custom` keeps every choice, and more agents in a row. - `axel setup --yes` asks nothing, for scripts, and never edits Claude Code's settings without being asked. - Claude Code's and Codex's logins are checked where they keep them, so the login hint shows only when it is needed. - With no harness, it shows two install commands and names the rest.
|
Tested Pairing (
|
|
Oh, quick note on why I'm bringing up that Home repo pattern: not pushing a design, just flagging a pattern other multi-repo users likely use. Why symlink? Because Axel runs delegated worktree lanes inside individual repos instead of inside the home repo. |
`axel device link --route confirm|wireguard` ran `axel host add` before checking the code, so a wrong code was refused only after our skills had been copied to the machine and it had been saved as a host. `host add` is now `reach` (place the binary, ask the key) and `adopt` (copy skills, install tools, save the host). `device link` adopts only after the route check and the device's consent. The binary still goes first: it is what answers with the key, and it is a public build.
`axel host add` and `axel device link` refused any machine whose `uname -sm` differs from this one, even with the right axel already installed there, so a Mac could never link a Linux box. On another platform we now keep an `axel` of our version already in `~/.local/bin`, or run the release installer for our version, which checks the download's sha256. A source build has no release: an axel already there is used with a warning that the versions differ, and with none `host add` stops and says how to install one.
`copy_dir` ran `tar -cf` without following symlinks, so skills linked in from a home repo arrived on the host as absolute links to paths that exist only on this machine, broken across macOS and Linux. We now stage a plain copy that follows the links, then tar that. We follow them ourselves rather than with `tar -h`, because GNU and BSD tar treat a dangling link differently. A dangling link, or a loop back up to a directory that holds it, is skipped with a warning. The copy is bounded in depth, files and bytes.
Every incoming link or agent announcement replayed every thread, and every thread envelope replayed its whole thread, so the first sync of a large home (495 threads, 21 agents) replayed everything once per agent. `Store::append_all` stores a batch in one transaction and owes the replays to its end: each touched thread once, every thread at most once when who may sign changed. Outcomes are read after the replays, so a note revived by a link later in the same batch reports as projected. Sync's `ingest` uses it with a `keep` that still drops other owners' records. On 300 threads of 40 events, one link and 20 announcements took 996 ms one at a time and 66 ms as one batch.
Linking two homes that each made a `reviewer` left one owner with two live profiles of one name, and `profile_by_name` silently returned the oldest (#44 review). A kind-122 record may now carry `merged_into` (migration 16 stores it). The merged profile is archived; every device moves its instances to the survivor, clears the announcement of its own moved instances so the next publish announces them again, and lands any late announcement on the survivor. The target must be another profile of the same owner and must not lead back. `name_clashes`, `merge_profile`, `rename_profile` and `AgentProfile::same_definition` give the CLI what it needs, and `profile_by_name` refuses to pick between two of one owner. New names are checked against the owner's profiles as principals, so a linked home's profiles count.
`axel device link` now merges profiles that share a name and a definition (harness, model, effort, skills, prompt, mode; not colour) into the oldest, so every device picks the same survivor, and lists the names that still differ. `axel device merge NAME --keep PROFILE` merges the others into the one kept, team seats included, and `--rename PROFILE NEW_NAME` renames one. `axel device merge` alone merges identical ones again, which also settles homes linked before this change. `axel agent show` says when another agent shares the name.
|
Thanks for testing this so thoroughly, Jon. Pairing
Merging two homes
Home repo
Per-instance harness overrides across OSes, the bounded |
Merge main after the Ladybird web panes landed. Keep device and web commands, both translation sets, and the RFD index entries. Adapt the session chart fixture to the profile model.
|
@jonleopard, we're moving ahead with landing this feature because the profile/instance changes are invasive and touch a lot of code paths. Keeping a shared base on main will make it easier to refine the behavior as we go. Please feel comfortable sending patches for anything that needs refining, including the Mac/Linux and SSH workflows you've been testing. Those improvements are welcome after this lands; we don't need to settle every detail in this PR. I've resolved the conflicts with the web-pane changes in #47 and pushed the integration commit. The device commands, web-pane commands, translations and design records are all preserved. |
TL;DR
Implements the three features from #40, with tests:
Linked devices (RFD 0004, now ADR 0012). An agent is a profile, which is yours and syncs, plus one instance per machine with its own key.
axel device link|ls|revoke|codepairs a machine over SSH, or with a code you compare on both screens, and needs the machine's own consent signature. After that the machine's key acts for you on every thread, and an existing home brings its threads along. Two owners can each have areviewer(the Discussion: multi-machine orchestration: shared threads, agents across homes, scheduled work #40 name clash).Two homes, one name (RFD 0004 phase 7). Linking merges identical agent profiles into the oldest;
axel device merge NAME --keep|--renamesettles the rest, and name lookups refuse to pick until then. Migration 16 addsmerged_into.Teams (RFD 0005).
axel team new|edit|show|ls|rm. Teams add team skills, a roster in each member's prompt, andteam/leadreach.Scheduled work (RFD 0006).
axel schedule add|ls|rm|tick. Each run is an ordinary inbox message;tickis meant for cron.A one-question first run.
axel setupasks only for a name and takes defaults for the rest, so the power features above never get in a newcomer's way.--customkeeps every choice;--yesasks nothing.Migrations 13 to 16 change
agentsinto profiles plus instances. The database is copied aside first, as ADR 0011 requires. Not done on purpose: an offline owner key (RFD 0004 phase 8), and Rex's Tailscale identity as a pairing route.Agent Trajectory
The owner asked for #40 to become a PR, with one change to the model: an agent may be an instance of an agent profile on a given machine. Then: "the PR should be fully functional with the 3 features implemented and tested".
axel host rpc.$AXEL_SSHlets an integration test stand a directory in for a second machine, so the test runs the real binary.cargo test --workspaceandcargo clippy --workspace --all-targets -D warningspass. Run locally, three existing tests need git signing off and this session'sAXEL_*variables unset.