Skip to content

Image paste and clipboard

Agents often need a screenshot or a mockup. An agent in a Zentri session reads files from its own worktree, so the way in is to copy the file there and hand the agent the path. zt upload does the copy. The optional terminal kit binds one key that saves the clipboard image and runs zt upload for you.

  • A live session started with zt start on this machine. zt upload reaches only sessions started on the machine where you run it.
  • For the terminal kit: tmux 3.2 or later, or WezTerm, plus a clipboard tool for your OS (see step 3).
Terminal window
zt upload ~/Downloads/mockup.png

zt copies the file into the session’s .zentri/uploads/ and prints the copy’s absolute path:

/home/ana/.local/share/zentri/worktrees/reports/add-csv-export-to-the-reports-page-<id>/.zentri/uploads/mockup.png

Paste that path into your prompt to the agent. Git ignores .zentri/, so an upload is never committed.

The rules:

  • The session is --session, else $ZENTRI_SESSION_ID, else your only live session on this machine. With two live sessions, name one: zt upload --session 1a2b3c4d spec.pdf.
  • The file must be a regular file of at most 50 MiB. A symlink is refused: upload the file it points to.
  • The copy keeps the file’s name, with every character other than letters, digits, ., -, and _ replaced. When the name is taken, the copy gets -1, -2, and so on.
  • For a session in an OpenShell sandbox, zt copies the file into the sandbox’s .zentri/uploads/ and prints the path the agent sees inside the sandbox. A file of the same name there is replaced.

The kit lives in integrations/terminal/ in the Zentri repository. It is opt-in: zt installs none of it, so copy or link the files you want.

File What it does
zt-paste The macOS and Linux script, in POSIX sh. Saves the clipboard image, runs zt upload, and prints the path.
zt-paste.ps1 The same for Windows PowerShell 5.1 and PowerShell 7.
tmux.conf Binds prefix C-v in tmux 3.2 or later.
wezterm.lua Binds CTRL+SHIFT+ALT+V in WezTerm, inside or outside tmux.
test.sh A smoke test with stub tools. It touches no clipboard, tmux server, or network.

Put zt-paste on the tmux server’s PATH, then source the snippet from your tmux config. From a clone of the Zentri repository:

Terminal window
ln -s "$PWD/integrations/terminal/zt-paste" ~/.local/bin/zt-paste
echo "source-file $PWD/integrations/terminal/tmux.conf" >> ~/.tmux.conf
tmux source-file ~/.tmux.conf

Or name the script directly, before the source-file line in ~/.tmux.conf:

set-option -g @zt_paste /path/to/zentri/integrations/terminal/zt-paste

Press the tmux prefix, then Ctrl-v. Because the binding sits behind the prefix, the agent still gets a bare Ctrl-v. The script types the uploaded path into the pane as plain text.

In ~/.wezterm.lua or ~/.config/wezterm/wezterm.lua:

local wezterm = require('wezterm')
local config = wezterm.config_builder()
local zt_paste = dofile('/path/to/zentri/integrations/terminal/wezterm.lua')
zt_paste.apply_to_config(config, { zt = '/path/to/zentri/bin/zt' })
return config

Press CTRL+SHIFT+ALT+V. WezTerm’s normal paste keys stay as they are. Pass key and mods to apply_to_config to pick another key.

  • On macOS, WezTerm started from the Dock has a short PATH. Pass zt, or path, when zt is outside /opt/homebrew/bin and /usr/local/bin.
  • When the pane runs a tmux client, the module finds that client and uploads to its session.
  • On Windows, the module runs zt-paste.ps1 with powershell.exe. Pass powershell = 'pwsh.exe' for PowerShell 7, and set ZT as a user environment variable when zt is not on PATH.

zt-paste uploads to the session in the tmux environment of the pane it pastes into, where zt start sets ZENTRI_SESSION_ID. When that finds nothing, it uses $ZENTRI_SESSION_ID, and without that, zt upload picks your only live session or fails. Set ZT to the path of zt when it is not on PATH.

OS Needs
macOS osascript, which ships with macOS. PNG and TIFF images both work.
Linux, Wayland wl-paste from wl-clipboard.
Linux, X11 xclip.
Windows Nothing extra.

On Linux, zt-paste uses wl-paste when WAYLAND_DISPLAY is set and wl-paste is installed, and xclip otherwise. The clipboard must offer image/png.

Run the smoke test from the Zentri repository to check the script itself:

Terminal window
sh integrations/terminal/test.sh

zt-paste must run on the machine that holds both the clipboard and the session. Over SSH it cannot see your local clipboard:

  • With tmux on the remote host, the binding runs zt-paste there, where there is no clipboard with your image.
  • With WezTerm on your laptop, the module runs zt-paste on the laptop, where zt upload finds no session.

Copy the file to the host yourself, then upload it there:

Terminal window
scp ~/Downloads/mockup.png devbox:/tmp/mockup.png
ssh devbox zt upload /tmp/mockup.png

The path zt upload prints is on the host, which is where the agent runs.

When the kit fails, nothing is typed into the pane. zt-paste exits 1 and prints one line on stderr. tmux shows it in the status line for five seconds. WezTerm shows it as a notification.

Line Cause
zt-paste: no image on the clipboard The clipboard holds text or nothing.
zt-paste: zt not found; put zt on PATH or set ZT to its path zt is missing.
zt-paste: osascript not found macOS without osascript.
zt-paste: no clipboard tool: install wl-clipboard (Wayland) or xclip (X11) Linux without either tool.
zt-paste: no display: DISPLAY is unset (tmux keeps the environment it started with) The tmux server started without X11. Restart it from a graphical session.
zt-paste: zt upload failed: <reason> zt upload refused, for example with no live session or more than one.
zt-paste: zt upload printed no absolute path zt upload printed something other than a path.

zt upload itself can refuse with:

Message Cause and fix
session ... is done; zt upload copies only into a live session Start a new session, or name a live one with --session.
... is a symlink; upload the file it points to Pass the real file.
... is over the 50 MiB upload limit Shrink or split the file.
... live sessions on this machine; name one with zt upload SESSION Pass --session.

The kit saves the image in a 0700 temp directory with mode 0600, under %TEMP% on Windows, and removes it whether the upload works or not. It never runs clipboard data through the shell.

  • No real tmux, WezTerm, PowerShell, or clipboard has run the terminal kit. test.sh runs zt-paste against stub tools only. Treat every key binding as untested on your terminal.
  • zt start runs each agent in tmux. No run of zt start on native Windows is recorded, so zt-paste.ps1 has nothing tested to upload into there.
  • Neither key works over SSH. Use scp and zt upload on the host, as in step 4.
  • zt upload copies files. Whether the agent can look at an image depends on the agent, not on Zentri.