Borrowed Hands
Borrow locally granted Xcode builds and system info from a Mac you paired. The Mac connects outbound to this
Hermes, and the Mac decides what may run. The Mac helper and build sandbox are in the same repository. hands_screen_capture is a registered
placeholder: its handler is a stub and this helper has no screen-capture executor.
Tools: hands_find, hands_system_info, hands_xcode_build, hands_job, hands_screen_capture.
Command: /hands pair | status | doctor | unpair <name or id> (owner only; pair only in a direct message), and
/hands whoami, which in a direct message tells any sender their own platform:user_id and changes nothing.
Skill: borrowed-hands:xcode-build-pr (read-only).
hands_xcode_build takes every argument as optional, so "Build my demo project on my Mac" is enough. The Mac,
workspace, scheme, configuration and destination default from the Mac's grant when it allows one choice
(configuration falls back to Debug when granted). The repository URL defaults to the one remembered for that
grant: the Mac shares only a fingerprint, so the first build names the URL once. With no commit, the plugin
reads the granted repository's branch list and builds the tip of its only bh/* branch, or of the bh/<name>
given as branch. Several bh/* branches, or several granted values, return needs_input with the options
instead of guessing. The commit is resolved before the approval prompt: the prompt shows the first 10 characters
of the SHA that the signed contract binds in full, for example "Build at commit 3449717404 (latest on bh/fixed) on
Macbook Pro M5 Max. Allow Once: this build only. ... Settings: demo (scheme Demo, Debug, macOS arm64)". Those 10
characters catch mistakes; they are not proof against someone who can push to the branch shown and craft a commit
with the same prefix. The branch on the card, protecting people's bh/* branches and Allow Once bound that. A
commit that is not 40 lowercase hex, or a branch git would refuse, gets no approval prompt. A value that is not a
plain granted-style name appears quoted and shortened, with control characters and markup removed, so it cannot pass for another part of the prompt. The
Mac still checks its grants, its own remote and bh/* ancestry on every request. Hermes frames that reason with
its own fixed label for plugin approval rules, which the plugin cannot change.
Approval scope: a "session" or "always" answer covers the same Mac, workspace, scheme, configuration and
destination, never a broader one. It does not name the commit or the branch, so after such an answer a build of a
newer commit, or of the tip of a different bh/* branch of that granted repository, runs without a new prompt.
Answer "once" to approve each build separately. A build's approval reason normally says so in a fixed sentence right
after the commit and the Mac and before the other settings, because Hermes shortens long reasons from the end (not
the fail-safe reason shown after an internal hook error, whose approval never covers a later build). "Always" is stored for the whole Hermes
deployment, so it covers every chat on it.
GitHub operations use Hermes's existing Git tooling and a repository-scoped credential. Borrowed Hands handles Mac discovery, locally authorized Xcode execution, and structured build results.
Build results and the hands_job views of build jobs carry provenance: the commit the signed job builds, the bh/* branch the
call named (if any) and how the commit was chosen (latest on <branch>, explicit commit, or explicit commit; branch not checked). When the agent edits and pushes a repository itself, it passes its own bh/* branch or
pushed SHA, compares provenance.commit with what it pushed, and opens any pull request with Hermes's own Git or
GitHub tools: this plugin never pushes, opens pull requests or touches GitHub credentials. See
Hermes edits, the Mac compiles.
PR readiness: hands_job with check_pr_ready: true (status or wait) returns pr_ready first, with only
plugin-written job fields beside it (the Mac's result and error text is left out). pr_ready is a verdict the plugin
computes at that moment. ready is true only if the job is a build in state succeeded with a succeeded result,
its provenance names a branch, and the plugin's own fresh read of the granted repository's branch list shows that
branch's tip equal to the commit the signed contract binds. Otherwise ready is false with a reason:
build_not_succeeded (with state), superseded (a newer build of the same commit, workspace and repository
finished without success, so this older success is stale; superseded_by names it), no_branch, branch_moved (with the tip found), branch_missing,
refs_unavailable (with refs_reason), repo_not_granted, grant_disallows_build (the grant no longer allows
the scheme, configuration or destination built), repo_url_unknown, no_provenance, not_a_build or
check_failed; any error is "not ready". A ready verdict rests on the job's Mac reporting success: the result
carries no proof of which commit was compiled, and the plugin itself verifies only the branch tip. Grants are the
ones the Mac last advertised, so an offline Mac's last caps count. The job, grant and URL checks run again after the read and must give the
same result, including the grant's allowed values and expiry, so a grant revoked, expired or replaced while the
read was in flight is "not ready"; a grant revoked and re-added unchanged in between cannot be seen, because caps
carry no grant generation. The verdict names the commit, branch, tip, repo_url (normalized and
percent-encoded), checked_at and (when ready) confirmed_at, is never
stored, and holds only for that moment: the branch can move afterwards, and the plugin cannot see pull requests, so
the agent opens the pull request from that branch and then checks that its head SHA equals commit.
Disclosures (rule 13)
What this plugin does inside Hermes:
- Long-running background process: a network listener. When
listen.enabledis true and the process is
hermes gateway run, the plugin opens an HTTP and WebSocket listener (default0.0.0.0, port 8790) inside the
Hermes gateway process, on a background thread with its own event loop. Routes:/bh/v1/wsand/bh/v1/healthz.
Paired Macs reach it through the public WSS URL you configure (public_url). It is off by default and never
starts inhermes plugins validate, doctor or CLI processes. Limits are under Listener limits. - Long-running background process: an owner-notice worker. After
/hands pair, a second background thread
removes the pairing string from the pairing message and sends at most four short readiness replies to the
owner's DM, through Hermes's own messaging adapter. Its routes are memory-only and expire after 24 hours. - Stored credentials and data. In this plugin's directory under
$HERMES_HOME/plugin-data/: a generated
Ed25519 server private key (server_ed25519.key, mode 0600) and its lock file, and a SQLite database
(bh.sqlite3, mode 0600) holding paired Macs' public keys, pairing-code hashes (never the codes), signed job
contracts, job results including compiler diagnostics, owner notices, an audit log, the public repository
URL last named for each granted workspace, and for each build thebh/*branch the call named and how its
commit was chosen. The gateway process can read these files, so any route the agent has to the gateway's files
reaches them: a shell or file tool on the local terminal backend, and a chat reply. In Hermes's default media
mode, a reply with aMEDIA:<path>tag makes the gateway attach that file to the chat; for the key, a reply
that just names its absolute path is enough. Hermes's media, file-read and dangerous-command checks do not cover
plugin-data. SetHERMES_MEDIA_DELIVERY_STRICT=1on the gateway (see
residual risks). An agent that also holds a Git push credential could publish the
key as well (Hermes edits, the Mac compiles). - Reads outside its own data. Its own settings from Hermes config, and the non-secret environment fallbacks
BH_LISTEN,BH_PORT,BH_PUBLIC_URL,RAILWAY_PUBLIC_DOMAIN,BH_OWNERSandBH_TRUSTED_PROXY. It reads no
secrets: no API keys,.envfiles, Hermesauth.json, keychains or other tools' logins. - Network calls. One kind of outbound call of its own: the Hermes server contacts the host of the granted
public repository (for example github.com) over HTTPS to read its branch list, the same anonymous
GET <repo>/info/refs?service=git-upload-packrequestgit ls-remotemakes. It happens on two occasions only:
when a build request names no commit (before the approval prompt), and whenhands_jobis called with
check_pr_ready: true(one read per call, for that build's repository: the URL remembered for the fingerprint in
the job's signed contract, never a URL from the call). It only reads a repository whose fingerprint matches a
grant the Mac advertised (for the readiness check, an unexpired grant of the job's workspace in the caps the
job's own paired Mac last advertised). The host must be a DNS name (IP-address and
single-label hosts are refused; a Unicode name is used as its IDNA A-label only when that conversion is
lossless). The name is resolved once, every returned address must be public (loopback, private, link-local,
site-local, CGNAT, multicast, reserved and unspecified addresses, and IPv6 forms that embed one, are refused),
and the connection goes directly to that checked address, without a proxy, while TLS still verifies the
certificate for the name. It sends no credentials or cookies and follows no redirects. The tool call stops
waiting after 8 seconds, covering DNS, connection, TLS and the whole response (capped at 1 MiB); at that point
the connection is shut down and no request is sent after it. A lookup stuck inside the operating system's DNS
resolver cannot be cancelled: it keeps one background thread until the resolver gives up, at most 4 such
lookups are outstanding, and further reads are refused until one returns. Builds with an explicit commit make
no outbound call, andhands_jobmakes none unlesscheck_pr_readyis true. Otherwise it sends build and system-info requests only to Macs you paired, over
connections those Macs open, and makes no other third-party calls. Chat replies go through Hermes's configured
messaging adapter. Hermes itself still uses your configured model and chat services. - Shell commands. None. The plugin starts no processes.
- Bundled script the agent runs. The system prompt section tells the agent to run the bundled,
standard-library-onlytemplates/new_swiftui_app.pywith its own shell tool to write a new Xcode project
into its working directory. The script starts no process, makes no network call, overwrites and deletes
nothing, and prints abh grant addcommand that only the Mac's owner can run. - Bundled skill. The plugin registers one read-only skill,
borrowed-hands:xcode-build-pr
(skills/xcode-build-pr/SKILL.md), listed among the agent's available skills while the plugin is enabled. It
is text only: the order to call the tools in for a plain build, for edit, build, fix and pull request, and
for a new app, with the same rules as the system prompt section. It names no credential, path or variable of
any deployment, and Hermes does not copy it into your skills folder or let the agent edit it. A Hermes without
register_skillruns the plugin without it. - Hooks. A
pre_tool_callhook asks for Hermes approval beforehands_xcode_buildand
hands_screen_capture; for a build with no commit it first reads the branch list (see Network calls). A
post_tool_callhook discards the approval record of any call that did not complete normally (blocked,
failed, cancelled or timed out), only within that chat. Build and capture calls without a Hermestool_call_id
are blocked before approval; call them directly through the agent. Tickets bind the resolved execution scope,
including defaults and a resolved commit, and are consumed once, only by the tool call that created it: the
handler reads that call's id from Hermes's dispatch context (Hermes v0.22.7 does not pass it to handlers), and
without one it builds nothing. A build that cannot be resolved gets no approval prompt and returns its reason
instead. While one call waits for approval, an identical call in the same chat is refused rather than replacing
its ticket; once the approved call starts building, an identical call is a new request. Hermes approval is not
the security boundary: the Mac checks its own grants on every request. The plugin also adds a short system
prompt section and the/handscommand. - No telemetry. Nothing is reported to the author or any third party.
- No self-update. The plugin never downloads or replaces code. Updates arrive only as a new reviewed pin.
What the separate Mac install does. It is not loaded by Hermes; its source is in the same repository
(setup, dispatcher,
runner, sandbox notes):
- Shell commands and sudo.
bh setupprints each admin command before running it withsudo: it creates a
hidden macOS userbh-builder, installs a root-owned dispatcher and sandbox profiles in/opt/borrowed-hands,
and adds one syntax-checked sudoers drop-in file namedborrowed-hands. That file authorizes your
numeric uid for six exact dispatcher command lines as root: four timeout tiers (300,900,1800,3600)
with this Mac's fixed disk/memory budgets, plus--sweep-onlyand--cancel. There are no wildcard argument
grants. Setup checks an installed rule by comparing its bytes with the expected rule usingcmpundersudo.
At run time the helper callssudo -nwith only those command lines, andsudo -n -l --with each of them to
ask sudo whether it is permitted (permitted, not proven password-free). It reads system facts withsw_vers,
sysctl,scutil,xcode-select -p,xcodebuild -versionandxcodebuild -license check.launchctl
installs its service. If you turn on per-build confirmation,osascriptshows a local dialog.bh uninstall
also readsdsclrecords to verify the build user is gone. - Long-running background processes. The helper runs as you, as a user LaunchAgent. The dispatcher starts each
build as a system LaunchDaemon running asbh-builder; git materialization and Xcode run under separate sandbox
profiles. Repository-controlled code runs on the Mac only as build scripts and Swift compiler plugins (macros),
both confined by the same build sandbox. - Network calls. The helper opens one outbound WSS connection to your gateway. The runner fetches the granted
repository from its public HTTPS host. The Mac needs no inbound listener. - Stored credentials. The helper stores its device Ed25519 private key, pairing, grants and job state under
~/Library/Application Support/BorrowedHands, and logs under~/Library/Logs/BorrowedHands. - Screen Recording. Not requested. Setup skips capture and does not ask for Screen Recording in this version.
- "Administer your computer" prompt. Deleting the build user during
bh uninstallcan make macOS ask
whether your terminal app may "administer your computer"; the delete waits for the answer. Allow goes to that
terminal app, not to Borrowed Hands, and how long it lasts was not established. An unanswered prompt stays open
after the command ends and deletes the account whenever it is clicked (see the quickstart's Uninstall section).
Listener limits
Frames up to max_frame_bytes (default and maximum 16 MiB); before a connection authenticates, its first complete
frame must be at most 16 KiB and it has 10 seconds. There are at most 4 unauthenticated connections per client
address and 8 in total. The transport uses the full frame limit even before authentication, bounding incomplete
message payloads at 8 x 16 MiB = 128 MiB; parser copies, queued messages, decoded strings and socket buffers add
memory overhead, so this is not an RSS limit. The client address is the socket peer, or the last
X-Forwarded-For entry only when trusted_proxy: railway (BH_TRUSTED_PROXY=railway) says a Railway edge is in
front. When enabled, restrict ingress to that proxy. The full 16 MiB wire budget supports bounded build
diagnostics and screenshot results near the schema's 12 MiB base64 limit. The signed envelope adds base64
expansion and metadata: senders must truncate or return frame_too_large if the complete frame exceeds 16 MiB,
even when its inner result passes the schema.
Limits and residual risks
Builds accept only public HTTPS repositories, immutable commits reachable from bh/*, and locally granted
projects/schemes/configurations. Exact destinations are platform=macOS,arch=arm64 and
generic/platform=iOS Simulator, with signing disabled. Simulator support is compile-only; no boot, install, UI
or tests. Remote Swift packages are unsupported. One build runs with up to three queued per Mac.
Server key. A leaked server_ed25519.key lets its holder sign contracts and frames for every paired Mac. To
deliver them it also needs the Mac's connection: the Mac dials only its pinned wss:// endpoint, verifies TLS
and checks the pinned server key. The Mac still enforces its grants, so at most the holder gets what they allow:
builds of granted bh/* commits and system info. A leak needs no access to the host: a prompt-injected reply
that names the key's path (which is predictable) attaches the key in Hermes's default media mode, with no tool
call and no approval. In a single-owner DM it lands in the owner's own chat, and the default terminal tool is
already a stronger route to the file. In a group chat, or where terminal and file tools were turned off or moved
to a non-local backend to keep the key out of reach, it is the main route.
HERMES_MEDIA_DELIVERY_STRICT=1 reduces this exposure without closing it. It limits attachments to Hermes's own
trusted artifact directories (its caches and similar), HERMES_MEDIA_ALLOW_DIRS, and files modified within a
recency window (600 seconds by default). The key is written once, so strict mode blocks it except: for the
window after the key is created, including the new key made during recovery, or restored with a fresh
modification time; and whenever an allowed directory contains it. bh.sqlite3 and its -wal/-shm files can
be attached within the window after a write, or from an allowed directory. They hold no private keys or tokens,
but results, diagnostics, owner ids and the audit log can still be sensitive. Strict mode does not stop a shell
or file tool. If the key leaks, see If the server key leaks.
Code running as the Mac user can read its key and alter grants. The hosting edge can observe result contents and
disrupt service. Builds can read some host metadata. Diagnostics are untrusted compiler text; scrubbing is
hygiene, not a security boundary.
Recorded completed compiles reported cleanup_ok=true and wipe_ok=false, including an unlink-protected empty
trustd directory; full persistent-state removal is not established. See protocol residual risks.
No independent security review of 0.2 has been completed; this README makes no review or release-approval claim.
If the server key leaks
/hands rotate-key is not available in this version. Re-pair instead:
- Run
bh unpairon every Mac, while the gateway still runs (/hands statuslists them). A Mac that has not
unpaired keeps trusting the leaked key. - Stop the gateway and rename this plugin's directory under
$HERMES_HOME/plugin-data/, adding a dated suffix
such as.leaked-20261109T1530Zso an earlier copy is never replaced. Never rename it under a running
gateway; on Railway, rename it at startup (see the quickstart). Renaming keeps the audit log inbh.sqlite3;
the plugin creates a new key and database on start. - Start the gateway and check that the
listener uplog line shows a new server key id; if not, do not pair.
Then send/hands pairin a DM and runbh setupon each Mac. Pairing resets grants, so grant again. The
new key is attachable even in strict mode until it is older than the configured recency window (600 seconds
by default).
Settings
plugins.entries.borrowed-hands.settings in config.yaml: listen: {enabled, host, port}, public_url
(wss://<your host>/bh/v1/ws), owners (platform:user_id list), max_frame_bytes, trusted_proxy
(railway or unset). Environment fallbacks: BH_LISTEN, BH_PORT, BH_PUBLIC_URL, RAILWAY_PUBLIC_DOMAIN,
BH_OWNERS, BH_TRUSTED_PROXY.
Uninstall
hermes plugins remove borrowed-hands, then delete this plugin's directory under $HERMES_HOME/plugin-data/.
Paired Macs are refused from then on.
README from the reviewed commit 145cbc6; it updates when the author re-pins.

alext8900