Copy the last agent response to the system clipboard.
zot ext install https://github.com/unlight/zot-copy-lastOr run ad-hoc:
zot --ext ./zot-copy-lastRestart zot after installing or updating.
Type:
/copy
Copies the most recent agent response from the current session to the system clipboard and posts a confirmation note back into the chat.
- Event subscription — the extension subscribes to
assistant_messageand keeps the last non-empty text.turn_startandsession_endclear the cache, so/copynever returns a preamble left over from an earlier step. - Clipboard write — on
/copythe stored text is written through the platform clipboard tool:pbcopyon macOS,wl-copy/xclip/xselon Linux. Candidates are tried in order; a broken tool does not stop the fallback chain. - Encoding — frames are read and written as UTF-8 regardless of the host locale, and clipboard payloads are handed over as UTF-8 too.
- Transcript fallback — a session loaded with
/sessionsreplays no events, so when the cache is empty/copyreads the last assistant message from<state dir>/sessions/<hash of cwd>/*.jsonlinstead of failing.
- A
/btwside dialog emitsassistant_messageattributed to the active session (host behaviour), so its reply can replace the text/copyreads. - Only the Linux and macOS clipboard tools are supported.
- The transcript fallback depends on zot's state layout (no host API exposes
the session file), so a future change there degrades
/copyback to "nothing to copy" rather than to a wrong answer.
The extension is a single executable Python script — no build step.
chmod +x copy.py
python3 -m unittest test_copy -vThe tests drive the real subprocess over stdio and stub the clipboard tool, so no zot session and no clipboard access are needed.
zot-copy-last/
├── extension.json # manifest
├── copy.py # source code
└── test_copy.py # wire-level tests
- Python 3.7+
- zot 0.4.x
- A system clipboard tool:
pbcopy(macOS),wl-copy/xclip/xsel(Linux)
MIT, Copyright (c) 2026