Skip to content

feat: linked devices with agent profiles, teams, and scheduled work - #44

Merged
lgalabru merged 31 commits into
mainfrom
docs/agent-profiles-and-instances
Nov 27, 2026
Merged

lgalabru merged 31 commits into
mainfrom
docs/agent-profiles-and-instances

Conversation

@lgalabru

@lgalabru lgalabru commented Nov 26, 2026 •

Copy link
Copy Markdown
Owner

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|code pairs 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 a reviewer (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|--rename settles the rest, and name lookups refuse to pick until then. Migration 16 adds merged_into.

  • Teams (RFD 0005). axel team new|edit|show|ls|rm. Teams add team skills, a roster in each member's prompt, and team/lead reach.

  • Scheduled work (RFD 0006). axel schedule add|ls|rm|tick. Each run is an ordinary inbox message; tick is meant for cron.

  • A one-question first run. axel setup asks only for a name and takes defaults for the rest, so the power features above never get in a newcomer's way. --custom keeps every choice; --yes asks nothing.

Migrations 13 to 16 change agents into 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".

  • Docs first. The first commits revise RFD 0004 around profiles and instances, and pair over any route that proves the far end, since Jon runs SSH on NetBird. They also add RFD 0005 for teams and RFD 0006 for scheduled work.
  • Linked devices. Built first, because teams depend on profiles.
    • The key decision: a machine's existing key is its device key. Authorization resolves every signer to the owner it speaks for, so a home linked under another owner brings its threads and agents with no re-signing.
    • Sync reuses axel host rpc. $AXEL_SSH lets an integration test stand a directory in for a second machine, so the test runs the real binary.
  • Teams and schedules. Each was built in its own worktree, then merged here, with migrations renumbered and kinds 123 and 124 made owner records.
  • Review. An independent review of the authorization code found two critical holes: anyone could claim any key as their device, and anyone could take over another owner's profile by naming its id. It also found three smaller problems: revocations could be undone, other owners' records were kept, and a rebuild could end differently from incremental appends. All five are fixed, each with a test.
  • Test runs. cargo test --workspace and cargo clippy --workspace --all-targets -D warnings pass. Run locally, three existing tests need git signing off and this session's AXEL_* variables unset.
  • Jon's review. Fixed in six commits: verify a device before copying skills or saving it, Mac ↔ Linux hosts through the release installer, symlinked skills, one thread replay per synced batch, and the two-home merge above.
  • Signing. The commits are unsigned: the 1Password signing agent couldn't be reached from this session.

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`.
@vercel

vercel Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
axel Ready Ready Preview Nov 27, 2026 4:20pm UTC

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.
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.
@lgalabru lgalabru changed the title docs: agents as profiles with an instance per machine, teams, schedules feat: linked devices with agent profiles, teams, and scheduled work Nov 26, 2026
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.
@jonleopard

Copy link
Copy Markdown
Contributor

Tested 0250f1a against my Mac (Darwin arm64) + Linux (Linux x86_64) setup (axel 0.3.164) and isolated temp v12 homes. The profile/instance split, teams, and inbox-based schedules all make a lot of sense — a few concrete issues caught in testing plus thoughts on the open questions:

Pairing (axel device link)

Happy paths (--route ssh, --route confirm --code, --route wireguard --code) worked and synced both ways via $AXEL_SSH, and --route rex_tailscale failed cleanly as expected. Two issues:

  1. Blocked on Mac ↔ Linux: axel device link <linux> fails immediately with:
    … is Linux x86_64, this machine is Darwin arm64: copying this axel binary won't run there
    device::link() calls host::add() (crates/axel/src/cmd/device.rs:25), which still bails on mismatched uname -sm (crates/axel/src/cmd/host.rs:525-529) even when axel 0.3.164 is already installed on the Linux machine. Happy to send my cross-platform host add branch (using the Linux release binaries from feat(release): ship Linux binaries and let the installer use them #39, or skipping the copy when axel is already installed) if you want that ahead of or alongside this.
  2. Trust-order bug on --route confirm / --route wireguard: host::add() runs before check_route(). Passing a wrong code rejects the link ("Nothing was linked"), but by then host::add() has already copied the binary + ~/.config/axel/skills to the remote and saved the host in hosts.

Merging two existing v12 homes & profile/instance split

Tested with two isolated v0.3.164 (schema v12) homes that both already had a reviewer (identical harness/model) and a coordinator (different harness/model):

  1. Migrations v12 → v15 ran cleanly and wrote axel.db.v12.bak per ADR 0011.
  2. Colliding agent names stay duplicated instead of merging: Because migration 13 gives each existing agent profile_id = 'p-' || pubkey, linking two homes that share a multi-agent setup duplicates every shared name into two separate live profiles — even when harness and model are identical (reviewer appears twice in axel agent ls, axel agent show reviewer hides the second profile, and axel team new silently picks whichever profile_by_name() returns first via ORDER BY created_at, profile_id LIMIT 1, leaving the second machine's instance out of the team). Looks like axel device merge from RFD 0004 phase 7 (or deduplicating/prompting during link) is still needed for merging two existing homes cleanly.
  3. Scale note on multi-agent DBs: My Mac DB is ~1.4 GB (61k events, 230k items, 495 threads, 21 agents). Sync batching (2000 × 500) handles those counts fine with saved cursors, but owner::project() (crates/store/src/owner.rs:144-146) calls replay_all_threads() on every incoming OWNER_DEVICE / AGENT_ANNOUNCE event. Batching replay_all_threads() once per ingest() call would avoid replaying every thread once per announced agent during initial link.
  4. Cross-OS harnesses (ADR 0012): Keeping harness/model on the synced profile is great when both machines run the same harnesses. Worth deciding up front whether an instance should ever be able to override harness/model when a tool is only available on one OS, or if profiles assume identical harnesses across devices.

Teams, schedules & Home repo pattern (RFD 0005 / 0006)

  • Teams (lead reach): In my current hub-and-spoke setup, non-lead agents use reach: nobody (replies return automatically without needing reach), whereas lead also lets members initiate messages to the lead — fine if intentional, just worth noting. Members do occasionally run solo, though always-on team skills aren't an issue for me.
  • Schedules (RFD 0006): Yes — a bounded once-only MCP schedule tool (within budget) is something my coordinator would use for delayed follow-ups without polling. Fixed UTC offset for daily works fine for me (no DST here), though worth keeping in mind for DST zones.
  • Home repo pattern: I follow Matt Pocock's Home repo pattern — one git-versioned home repo holding my global AGENTS.md (repo map + standing rules), coding standards, workflows, and shared skills, symlinked across harnesses and machines. Axel's always: true global skills and axel thread attach already play well with it; curious how you see a git-backed home repo fitting alongside DB-synced profiles and teams (e.g., whether profiles/teams stay CLI-managed in the log only, or could also be declared/synced from a home repo — and note copy_dir in host.rs:613 uses tar -cf without -h, so symlinked skills from a home repo copy as broken absolute symlinks across macOS ↔ Linux).

Once the Mac ↔ Linux host::add check and colliding-profile merge are sorted out, I'm happy to test a real-data merge on copies of both homes.

Happy Thanksgiving 🦃

@jonleopard

Copy link
Copy Markdown
Contributor

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.
@lgalabru

Copy link
Copy Markdown
Owner Author

Thanks for testing this so thoroughly, Jon.

Pairing

  1. Mac ↔ Linux host add: addressed with b1a31d1. On another platform it keeps an axel of our version that is already there, and otherwise runs the release installer for our version. A source build has no release, so it uses whatever axel is there and warns that the versions differ. That covers both routes you suggested. Happy to compare with your branch if it handles a case this doesn't.
  2. Trust order on confirm / wireguard: addressed with 3a359c6. Skills are copied and the host is saved only after the code check and the device's consent. The binary still goes first, because it is what answers with the key.

Merging two homes

  • Colliding names: addressed with 0c7de32 and 9e7837c. device link merges identical profiles into the oldest one, and team seats move too. Profiles that differ are listed, and name lookups refuse to pick between them until axel device merge NAME --keep PROFILE or --rename PROFILE NEW_NAME settles them. For your homes that are already linked, axel device merge on its own does the identical merges.
  • replay_all_threads per record: addressed with 69c0733. Each synced batch now replays each thread once. With 300 threads × 40 events, 1 link and 20 announcements went from 996 ms to 66 ms.

Home repo

  • copy_dir and symlinks: addressed with 995110a. Links are followed in Rust rather than with tar -h, because GNU and BSD tar disagree on dangling links. Dangling links and loops are skipped with a warning.

Per-instance harness overrides across OSes, the bounded once MCP schedule tool, and how a home repo fits next to synced profiles and teams are product calls for @lgalabru, so I'm leaving those open for him.

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.
@lgalabru

Copy link
Copy Markdown
Owner Author

@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.

@lgalabru
lgalabru merged commit ac22552 into main Nov 27, 2026
4 checks passed
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.

2 participants