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.
Before you start
Section titled “Before you start”- A live session started with
zt starton this machine.zt uploadreaches 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).
1. Upload a file
Section titled “1. Upload a file”zt upload ~/Downloads/mockup.pngzt 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.pngPaste 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,
ztcopies 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.
2. Install the terminal kit
Section titled “2. Install the terminal kit”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:
ln -s "$PWD/integrations/terminal/zt-paste" ~/.local/bin/zt-pasteecho "source-file $PWD/integrations/terminal/tmux.conf" >> ~/.tmux.conftmux source-file ~/.tmux.confOr name the script directly, before the source-file line in ~/.tmux.conf:
set-option -g @zt_paste /path/to/zentri/integrations/terminal/zt-pastePress 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.
WezTerm
Section titled “WezTerm”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 configPress 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. Passzt, orpath, whenztis outside/opt/homebrew/binand/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.ps1withpowershell.exe. Passpowershell = 'pwsh.exe'for PowerShell 7, and setZTas a user environment variable whenztis not onPATH.
Which session gets the image
Section titled “Which session gets the image”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.
3. Check the clipboard tool
Section titled “3. Check the clipboard tool”| 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:
sh integrations/terminal/test.sh4. Over SSH
Section titled “4. Over SSH”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-pastethere, where there is no clipboard with your image. - With WezTerm on your laptop, the module runs
zt-pasteon the laptop, wherezt uploadfinds no session.
Copy the file to the host yourself, then upload it there:
scp ~/Downloads/mockup.png devbox:/tmp/mockup.pngssh devbox zt upload /tmp/mockup.pngThe path zt upload prints is on the host, which is where the agent runs.
What can go wrong
Section titled “What can go wrong”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.
Limitations
Section titled “Limitations”- No real tmux, WezTerm, PowerShell, or clipboard has run the terminal kit.
test.shrunszt-pasteagainst stub tools only. Treat every key binding as untested on your terminal. zt startruns each agent in tmux. No run ofzt starton native Windows is recorded, sozt-paste.ps1has nothing tested to upload into there.- Neither key works over SSH. Use
scpandzt uploadon the host, as in step 4. zt uploadcopies files. Whether the agent can look at an image depends on the agent, not on Zentri.