Skip to content

Design the clipboard bridge between the mac and exe.dev VMs - #18

Open
nonreagent wants to merge 3 commits into
mainfrom
clipboard-bridge
Open

nonreagent wants to merge 3 commits into
mainfrom
clipboard-bridge

Conversation

@nonreagent

@nonreagent nonreagent commented Sep 7, 2026

Copy link
Copy Markdown
Owner

Problem

Clipboard traffic between a mac running kitty and an exe.dev VM running tmux only works in one direction. Text highlighted in tmux copy-mode reaches the mac clipboard (OSC 52, already working). An image on the mac clipboard cannot be pasted into Claude Code running inside tmux on the VM: Claude Code on Linux shells out to xclip/wl-paste, the VM has no display server, and tmux swallows the replies of every in-band terminal clipboard protocol.

Motivation

Agent sessions run remotely in tmux, and a screenshot is the fastest way to show Claude a UI problem. Today that means scp games. exe.dev's gateway was verified to relay reverse ssh forwards, which opens a clean out-of-band path.

Proposed Solution

The VM half of the clipboard bridge, plus its design: the spec (docs/superpowers/specs/2026-09-07-clipboard-bridge-design.md, in this PR's files), the implementation plan, and overlay/bin/wl-paste, a shim that answers the two calls Claude Code makes on ctrl+v (-l, --type image/png) by asking the mac over 127.0.0.1:2224, the port the mac's ssh config reverse-forwards into every *.exe.xyz session. It declines every other call so text reads fall through. A python fake responder covers the protocol in test/clipboard-shim.test.sh, wired into test/run.sh.

The mac half (socket-activated launch agent, ssh include, tmux y cleanup) is a separate PR on nonrational/dotfiles; this PR is useful only once that one is deployed, and harmless before it (the shim fails closed).

Feedback

  • Trust tradeoff. While a session is connected, and for up to four hours after the last window closes (ControlPersist keeps the master and its forward alive; ssh -O exit <vm>.exe.xyz ends it early), any VM process can read the mac clipboard image on demand. Text is never served and the bridge has no write path. Is image-only exposure acceptable for the agent VM?
  • Fail-closed behaviour. Every failure (no session, agent unloaded, text-only clipboard) is a silent no-op ctrl+v. Is silent the right default, or should the shim log somewhere?
  • Deferred: clipfan's image-as-path fallback for tools whose ctrl+v needs X11 (Codex). One tee line if ever needed.

@nonreagent
nonreagent force-pushed the clipboard-bridge branch 2 times, most recently from d43ca7d to 113e94a Compare September 7, 2026 18:17
@nonreagent
nonreagent marked this pull request as ready for review September 7, 2026 18:52
nonreagent and others added 3 commits September 7, 2026 20:06
Two flows: tmux copy-mode text to the mac clipboard (already works over
OSC 52; drop the dead pbcopy pipe on Linux) and mac clipboard images
into Claude Code inside remote tmux (pull on demand over a reverse ssh
forward, launchd socket activation on the mac, a wl-paste shim on the
VM). Records the probes that fixed the design and why clipfan was not
adopted.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Eight tasks across both repos: the wl-paste shim and its test here, the
launchd responder, plist, ssh include and tmux change upstream, the two
PRs, and the post-merge rebuild. Every task carries its test, exact file
contents, and expected output, so it can run task-by-task in fresh
sessions.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude Code on Linux falls back to `wl-paste -l` and `wl-paste --type
image/png` for ctrl+v once xclip fails without a display. The shim
answers both by asking the mac through 127.0.0.1:2224, the port the
mac's ssh config reverse-forwards into every exe.dev session, and
declines every other call so text reads keep falling through. A python
fake responder covers the protocol in test/clipboard-shim.test.sh.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
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.

1 participant