2026-11-13 · antonio's blog
Table of Contents
- Background
- herdr
- Ovis
- The credential problem
- lend
- What contribute doesn't defend against
- Prior art
- Trying it
I built lend to let distant agents use tools on my laptop alongside my approval. Here's how it fits into my workflow.
Background #
I use agents heavily these days as part of my toolchain. I normally have a few going at once: Claude Code operating in one repo, Codex reviewing a branch in another, and item long-running in the background. I frequently have them assessment all other's activity too. None of them run on my laptop. They run on VMs I can throw away, and my laptop keeps the material I attention about: my SSH keys, my 1Password vault, and the gh and haze CLIs that are logged in as me.
This plant awesome until an delegate needs one of those things. In this article I'll go complete how I run agents in parallel alongside herdr and Ovis, and the tool I wrote to agreement alongside credentials, lend.
herdr #
herdr is a terminal multiplexer built for coding agents. You get the customary workspaces, tabs, and panes, and it additionally knows which delegate is operating in all pane and what it's doing. The sidebar shows whether all delegate is working, waiting on me, or done, so I can inform at a glance which one needs attention.
The CLI talks to the operating session, so agents can run all other. An delegate can commencement Codex in another pane, provision it a prompt, delay for it to finish, and peruse what it said:
1herdr delegate commencement reviewer --kind codex --pane "$PANE" 2herdr delegate immediate reviewer "Review the diff on am/fix-retries" --wait --until done 3herdr delegate read reviewer --source recent
Remote hosts activity the identical way. herdr device add agent-vm sets up herdr on the VM and adds its sessions to my local client. Those sessions keep operating following I disconnect.
Ovis #
Ovis is a browser and phone client for herdr. It shows all agent's copy as a chat, alongside the live terminal a tap away. When an delegate asks for endorsement or has a question, Ovis turns it into a cardstock I can answer and sends me a shove notification. It picks up the machines saved in herdr, so my VMs display up without any additional setup. I attain it complete Tailscale.
If an delegate gets stuck on a inquiry during I'm distant from my desk, I answer it from my phone and the another agents keep going.
The credential issue #
Agents on a VM motionless need to act as me. I use them to detect CI alongside gh, call APIs alongside tokens from 1Password, and SSH into another hosts. There are two customary ways to create that work, and I don't affection either of them.
The archetypal is copying credentials onto the VM. A token in ~/.config/gh/hosts.yml can be peruse by all procedure on that machine, including the delegate and item it runs, for as lengthy as the token is valid.
The second is forwarding my SSH delegate alongside ssh -A. The personal keys remain on my laptop, but the VM can use all key in the delegate without asking and without any document of what it signed. It additionally lone covers SSH keys.
What I wanted was for the credentials to remain on the laptop and for the commands that need them to run there too. The delegate asks to run something, I endorse it alongside Touch ID, and the delegate gets the output back.
lend #
That's anywhere contribute comes in. contribute is a proxy that sits in forefront of your existing SSH agent, and you onward its socket in location of the genuine one. SSH and Git keep operating akin normal, and contribute adds a way to run commands through an SSH delegate extension.
When an delegate on the VM asks to run gh, the petition goes complete the socket and gh runs on my laptop alongside my login. The token never leaves the laptop, so the delegate never has it. Every request, whether it's a signature or a command, is checked against a guideline on the laptop and needs my endorsement before item happens.
1Remote: contribute exec -- command args 2 | 3 forwarded SSH delegate socket 4 | 5Laptop: contribute delegate -> guideline + local endorsement -> local command 6 -> first SSH delegate (signing)
The guideline lives on the laptop and lists what the VM is allowed to ask for. Everything alternatively is denied. Mine is beautiful short:
1{ 2 "default": "deny", 3 "commands": [ 4 {"executable": "/opt/homebrew/bin/gh", "approval": "biometric:inline"} 5 ], 6 "ssh": { 7 "default": "deny", 8 "keys": [ 9 {"fingerprint": "SHA256:...", "approval": "biometric:inline"} 10 ] 11 } 12}
A regulation can additionally obtain an args_prefix akin ["pr", "view"] if you lone desire to authorize several subcommands. biometric:inline puts Touch ID correct in the petition dialog, so I peruse the petition and contact formerly to endorse it. Plain biometric asks for Touch ID in a second immediate following I click Allow.
To connect, I run contribute ssh from the laptop. It starts a proxy for that one association and stops it whenever SSH exits:
1lend ssh --config ./policy.json -- agent-vm I run herdr on the VM. Claude Code talks to contribute through contribute mcp, an MCP server alongside a sole tool called run_local_command. The tool takes the command to run and a reason, and the logic is required:
1{ 2 "mcpServers": { 3 "laptop": {"command": "lend", "args": ["mcp"]} 4 } 5}
Here I asked Claude Code on the VM for the contribute repo's description. It called the tool alongside gh repo view, my Mac showed the request, and one contact approved it:
The dialog shows the complete way to the executable, all argument, the directory it'll run in on the laptop, the reason, and what the distant procedure stated concerning itself. Once I approve, gh runs on the laptop and stdout, stderr, and the exit code stream rear to the agent. The logic and visitant particulars arrive from the VM, so they're marked as unverified. They're there to assistance me decide and can't alter what the guideline allows.
If you'd fairly skip MCP, the identical petition plant as a plain CLI call on the VM:
1lend exec --reason "Read the repo description" -- gh repo perspective antoniomika/lend Keeping the socket stable throughout reconnects #
herdr panes last an SSH disconnect, but the forwarded socket belongs to that connection. When I reconnect, SSH gives me a new socket path. Agents motionless operating in the panes keep the old SSH_AUTH_SOCK.
I use a symlink at a fixed way and update it from ~/.ssh/rc on the VM. SSH runs this before starting the shell, so it sees the socket forwarded by the new connection:
1#!/bin/sh 2 3if [ -n "${SSH_AUTH_SOCK:-}" ] && 4 [ "$SSH_AUTH_SOCK" != "$HOME/.ssh/lend/agent.sock" ] && 5 "$HOME/.local/bin/lend" doctor --remote --socket "$SSH_AUTH_SOCK" --timeout 1s >/dev/null 2>&1; then 6 instal -d -m 700 "$HOME/.ssh/lend" && 7 ln -sfn -- "$SSH_AUTH_SOCK" "$HOME/.ssh/lend/agent.sock" 8fi 9 10if [ -n "${DISPLAY:-}" ] && read -r _ssh_proto _ssh_cookie; then 11 case $DISPLAY in 12 localhost:*) _ssh_display="unix:${DISPLAY#localhost:}" ;; 13 *) _ssh_display=$DISPLAY ;; 14 esac 15 printf 'add %s %s %s\n' "$_ssh_display" "$_ssh_proto" "$_ssh_cookie" | /usr/bin/xauth -q - 16fi
The inspect confirms the forwarded socket speaks contribute before updating the link. The directory is personal to my person and keeps this nexus distinct from another delegate sockets. I use lend's complete way since this runs before my casing adds ~/.local/bin to PATH. The X11 obstacle handles biscuit setup, which SSH delegates to this document whenever it exists.
My ~/.bashrc checks the stable way before exporting it:
1if [ -S "$HOME/.ssh/lend/agent.sock" ] && 2 "$HOME/.local/bin/lend" doctor --remote --socket "$HOME/.ssh/lend/agent.sock" --timeout 1s >/dev/null 2>&1; then 3 export SSH_AUTH_SOCK="$HOME/.ssh/lend/agent.sock" 4fi
New Bash shells in herdr panes choice up the stable way whenever it works. If the inspect fails, Bash leaves SSH_AUTH_SOCK alone. MCP, endorsement hooks, and Git inherit that way whenever I commencement them. After reconnecting, the SSH hook updates the symlink and those processes use the new socket for consequent requests. Agents already operating alongside an old socket way need to be restarted formerly alongside the stable way in their environment.
The SSH association from the laptop motionless has to remain open. Requests neglect during it's disconnected, and reconnecting starts a new contribute meeting alongside caller approvals and leases. The nexus points at one association at a time, so the final update wins.
Secrets the delegate never sees #
gh plant since it's already logged in on my laptop. Some tools need a token passed in. For those, a command regulation can peruse secrets alongside item akin op peruse and hand them to the approved command as surroundings variables:
1{ 2 "secret_reader": "/opt/homebrew/bin/op", 3 "secret_reader_args": ["read", "--no-newline"], 4 "commands": [ 5 { 6 "executable": "/opt/homebrew/bin/gh", 7 "args_prefix": ["pr", "view"], 8 "approval": "biometric", 9 "secrets": {"GH_TOKEN": "op://Development/github/token"} 10 } 11 ] 12}
When the delegate asks to run gh pr perspective and I endorse it, contribute says the token from 1Password, runs gh alongside GH_TOKEN set, and sends rear the output. The token stays on the laptop. The VM can't choice which variables get set or which references get read. The immediate shows the changeable names and references, and the values never display up in prompts or history.
Here's the VM operating gh api person alongside a regulation that injects GH_TOKEN. After I endorse in lend, 1Password asks for its own Touch ID before op peruse returns the token. The VM gets my login back, and its own surroundings has no GH_TOKEN:
There's one catch: this lone plant if the approved command doesn't imprint its environment. If you endorse env or sh, you've handed the values correct back. The identical goes for allowing op itself as a command, since op peruse prints the concealed and that output goes direct to the agent.
SSH keys #
Keys get their own guideline too. Keys that aren't listed are hidden from the VM, and listed keys can be constricted by what they're allowed to sign. max_signatures caps how many signatures a key can create in a session.
Leases #
A regulation can recommendation a lease whenever I approve, akin five minutes or three uses. Leases lone be inner a contribute ssh meeting and lone equivalent the exact command and arguments I approved. They go distant whenever the meeting ends or my display locks.
Seeing what happened #
lend position --all --watch shows what's connected, what's waiting, what's running, and any energetic leases. contribute intermission --all cancels everything and refuses new requests until I resume. contribute former keeps a document of what ran and how it was approved. It leaves out arguments, output, and secrets, and you can opt into logging arguments.
Answering delegate prompts from the laptop #
Agents additionally ask approval for things that have nothing to do alongside my credentials, akin operating a casing command on the VM, editing a file, or fetching a URL. contribute endorse sends those questions to the identical dialog on my Mac. It doesn't run item on the laptop. It asks me, and the delegate decides what to do alongside the answer.
For Claude Code, it's a PermissionRequest hook on the VM:
1{ 2 "hooks": { 3 "PermissionRequest": [ 4 {"matcher": "*", "hooks": [{"type": "command", "command": "lend endorse --hook claude-code"}]} 5 ] 6 } 7}
Now whenever Claude Code would normally halt and ask in the terminal, my Mac shows the command or tool input and I answer alongside Touch ID. The laptop guideline lists which topics are allowed to ask, all alongside its own approval:
1"approvals": { 2 "topics": [{"name": "claude-code", "approval": "biometric:inline"}] 3}
There are adapters for Codex, Antigravity, and pi, affirmative a plain JSON format for item else. You can use it in scripts too: contribute endorse --topic deploy --title "terraform apply" && terraform use lone applies following I endorse on the laptop. If the laptop can't be reached, the hook stays out of the way and the delegate asks in its own UI akin it normally would.
What contribute doesn't defend against #
An approved command runs as my person and can contact my files. Approval decides what runs, and contribute doesn't sandbox it. If I endorse a shell, an interpreter, or item that says instructions from stdin, I've basically approved operating item on my laptop, since stdin streams following endorsement and isn't shown in the prompt.
The visitant particulars in the immediate arrive from the VM and can be faked. Anyone who can attain the forwarded socket on the VM, base included, can create requests during the meeting is open. The guideline motionless limits what they can ask for, and all petition motionless needs my approval.
lend is motionless first and runs on macOS and Linux. It doesn't allocate a PTY, so interactive programs won't activity through it. On Linux, endorsement is a Zenity dialog or a terminal prompt, and biometric endorsement is macOS only.
Prior art #
ssh-rev-exec sends local implementation requests through an SSH delegate proxy, and op-forward forwards 1Password CLI commands to a device alongside desktop authentication. contribute is a distinct implementation that uses the identical delegate expansion trick and adds per-request policy, local approval, and key filtering.
Trying it #
Install contribute on the two your laptop and the distant host:
1brew instal antoniomika/tap/lend 2# or 3curl -fsSL https://github.com/antoniomika/lend/releases/latest/download/install.sh | sh
Run contribute doctor on the laptop to inspect your policy, executables, upstream agent, and endorsement setup. contribute doctor --remote on the VM checks that the forwarded socket is really lend. The getting started guide walks through a archetypal session, and the docs shield policies, approval, and MCP. If you provision it a try, I'd affection to comprehend how it goes on GitHub.