ADR 0034: Remote Tool Execution on the User's Machine over a Tailnet
Proposed
3 min read
This is a migrated reference document from the original Anvio source repo. Content is preserved as-is; canonical documentation lives in the sections above in the sidebar.
Original path: docs/adr/0034-remote-tool-execution-over-tailnet.md
Status
Proposed
Context
slaude's /remote points a thread at the user's own machine: from the next message, shell and file tools (Bash, Read, Write, Edit, Glob, Grep) run there, while the conversation, model credentials, MCP credentials, knowledge base and transcript stay on the server. Connectivity is tailcat plus an ed25519 key pair generated per workspace and user; the private key never leaves the server. Transport failures carry a started flag so a command that may already have run is never retried automatically. It is off by default (SLAUDE_REMOTE=1).
Anvio today:
packages/runtimes/src/ssh/ssh-runtime.ts(SshRuntimeProvider) advertisessupportsTools: falseand only runs a single command overssh; it cannot host an agent tool loop.packages/runtimes/src/remote/remote-runtime-stub.tsis a stub.- Tool execution lives in
packages/tools/packages/execution, always on the gateway host.
The useful split is not "run the whole runtime remotely" but "run the model loop locally, run file/shell tools remotely".
Decision
Introduce remote tool execution as a tool-execution target, not a new runtime:
ExecTargetport inpackages/core:exec(cmd, \{ stdin, timeoutMs, login, maxOutput \})returning\{ stdout, stderr, code, truncated, timedOut \}, plus file read/write/list. The default target is local;packages/toolsfile and shell tools call the port instead ofnode:child_process/fsdirectly.TailnetSshTargetinpackages/runtimes/src/remote/implementing the port over SSH to a tailnet address (tailcat or plain Tailscale SSH). Keys are ed25519, generated per(workspace, user)and stored through the encrypted connection broker (workspace/connections/, same as runtime OAuth in ADR 0009). Only the public key is ever shown.- Error semantics. Transport errors are typed (
REMOTE_UNREACHABLE,REMOTE_AUTH_FAILED) with astartedflag; the tool gateway never auto-retries a started command. - Binding. A harness slash command
/remote <addr> <dir>//remote offbinds the target per session;/remote keyreturns the public key privately. Binding is stored with the session, so resume keeps it. - Off by default. Requires
execution.remote.enabled: trueinanvio.yaml; remote targets are always subject to the harness approval policy for mutating tools.
SshRuntimeProvider is left as-is (single-shot command runtime) and documented as distinct from remote tool execution.
Consequences
- Credentials, model keys and memory never leave the Anvio host; only tool I/O crosses the tailnet.
- Refactoring tools onto
ExecTargetis the main cost and also benefits the sandboxedexecutionpackage (one seam instead of several). - Works with every runtime that uses Anvio's tool gateway (
local, and vendor runtimes only where Anvio tools are bridged); vendor CLIs with their own built-in shell tools (e.g. Claude Code's) are unaffected and must have those tools disabled when a remote target is bound. - Adds Tailscale/tailcat as an optional user-side prerequisite; nothing changes at Level 1 when disabled.
Alternatives considered
- Extend
SshRuntimeProviderto run the full agent remotely. Rejected: would move model credentials and memory to the user's machine. - Reverse tunnel initiated by the user's machine. Deferred: avoids exposing SSH but needs a long-lived agent process on the user side.
Reconciliation note (2026-10-25)
Still Proposed. Partially implemented: a tailnet SSH target exists (packages/runtimes/src/remote/tailnet-ssh-target.ts). End-to-end remote tool execution was not verified. Acceptance is left to the owners. Original decision text above is unchanged.
Last updated on