Cross-machine session visibility and agent messaging (daemon peering) #1804
chrisb4096-alt
started this conversation in
Feature requests
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
I run prime-agent on a fleet: a macOS laptop as the control machine, a Linux hub, and a few GPU boxes, all on a tailnet. Each machine runs its own daemon with live sessions. Two things I want and can't have today:
Before writing this I read the 0.8.1 source to understand what exists, what almost works, and what's actually missing. Summary below, then a proposal in two increments.
What the current architecture does
Everything routes through one daemon per machine:
DaemonClientwrapsnet.createConnection(socketPath)). No TCP, no multi-socket.buildAgentFamilyRoster), and enforces reach on agent-origin sends (assertAgentFamilyReach).What almost works today
prime-agent --daemon-socket <path>plus SSH Unix-socket forwarding gets surprisingly far. I can open the full agents view against the hub's daemon from my laptop, attach, and interact.prime-agent send --daemon-socket <fwd>even delivers through the same agent-message machinery local sessions use, including the wake path for passivated sessions.What this cannot give:
agent_message.list_agents()on my laptop can never show a hub session, and there is no host-qualified way to address one.origin: "cli"and a CLI sender key.--fromonly resolves sessions on the target daemon, so a verified remote sender identity is impossible.execute_bash, so granting fleet visibility to another person means granting shell.I built the obvious workaround (persistent forwards,
listaggregation, identity declared in the message body) and it works, but it reimplements delivery guarantees the daemon already has, one layer up and worse.Proposal
Increment 1: multi-endpoint agents view
Let the agents view attach to a list of named daemon endpoints (local socket plus forwarded sockets) and tag rows by endpoint. The merge machinery already exists:
buildUnifiedSessionIndexandreconcileUnifiedSessionscombine multiple summary sources today. No protocol change, no new trust decision beyond what socket forwarding already implies, and it makes fleet visibility real on its own.Increment 2: daemon peering for agent messaging
An explicit peer list in settings: name plus socket endpoint, nothing discovered automatically. Peered supervisors exchange verified sender blocks, so a hub session can message a laptop session and arrive as
hub/session-namewith daemon-stamped identity instead of an anonymous CLI send. Addressing becomes host-qualified (peer/session). Reach policy extends to peers as an opt-in, and capability tiers keep it honest: a peer grant for visibility, a grant for messaging, and full control only if someone really wants it.Two changes in flight make this a better fit than it would have been a month ago. #1748 moves workers to on-demand authoritative roster queries against the supervisor, which is exactly the query shape a peer supervisor needs. And #1700's connect-then-send-exactly-once split is the right delivery contract for a peer link, where lost confirmations are routine.
Transport stays out of scope. Users already have SSH, tailscale, or whatever they trust to forward a Unix socket between machines. The daemon should never grow a TCP listener by default; peering rides on sockets the operator already chose to connect.
Why this is worth having
An RLM agent that spawns subagents and messages across a family tree stops at the machine boundary, and for anyone running more than one machine that boundary is arbitrary. Concrete cases from my own fleet: a long job on the hub notifying my laptop session when it finishes instead of me polling; one screen showing what every machine's agents are doing; a colleague granting me session visibility on his machine without granting shell. The security model is the interesting design problem, and I'd rather have it designed in the daemon, where identity and reach already live, than bolted on outside it, which is what everyone running a fleet will otherwise do.
Happy to prototype either increment in a fork if this fits the roadmap. Per CONTRIBUTING.md I'm asking for scope feedback first, not sending code.
All reactions