Copy the last agent response as Markdown or Jira wiki markup, to the clipboard or a file. A TypeScript extension for zot, running on Node.js.
zot ext install https://github.com/unlight/zot-copyOr run ad-hoc:
zot --ext ./zot-copyThe repository ships the built dist/copy.js, so installing needs no build
step and no npm install.
Restart zot after installing or updating.
/copy # Markdown to the clipboard
/copy markdown # same as the default
/copy md # alias for markdown
/copy jira # Jira wiki markup to the clipboard
/copy j # alias for jira
/copy file [path] # Markdown to a file
/copy jira file [path] # Jira wiki markup to a file
The format argument is optional and case-insensitive; j is short for
jira. The default md assumes the agent already writes Markdown and copies
the text untouched. jira converts it through marked and marked-jira:
headings become h1., bold becomes *bold*, links become [text|url],
and fenced code becomes {code} blocks.
/copy file writes instead of touching the clipboard. Without a path it
creates <session alias>-dd-mmm-YYYY-HH-mm-ss.md in the session working
directory (.jira for Jira markup); relative paths resolve against that
directory.
- Runtime — zot executes the committed
dist/copy.js, an ESM bundle built by tsdown fromsrc/. Node.js 22.18+ runs it directly;markedandmarked-jiraare bundled into the artifact, so nonpm installhappens at install time.npm run typecheckchecks the types separately. - Event subscription — the extension subscribes to
assistant_messageandturn_end. A response is committed only when its turn ends withoutstop: "tool_use", so intermediate narration is never copied.turn_startresets only the current step, which keeps the previous answer available while a new turn is running; session boundaries clear the cache. - 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. - File write —
/copy file [path]writes the payload withwriteFileSyncinstead of calling the clipboard, so it works over SSH and headless hosts. - Encoding — frames are JSON lines in UTF-8 and clipboard payloads are handed over as UTF-8 regardless of the host locale.
- Format conversion —
/copy jirarenders the stored Markdown withmarkedandmarked-jira;/copyand/copy markdownpass the text through untouched. - 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.
- P1 Keep a short response history and support
/copy N. - P1 Add a panel picker for fenced code blocks, the full response and an "always copy full response" setting.
- P1 Add Windows (
clip.exe/PowerShell), Termux and WSL clipboard backends. - P2 Add OSC 52 and tmux fallbacks. OSC 52 from an extension needs a
/dev/ttywrite or a host API; this has to be verified first. - P2 Read long transcripts from the tail and cache the result instead of
scanning the whole session file on every
/copy. - P2 Add tests for platform-specific backends, the picker and transcript edge cases.
npm install
npm run lint
npm test
npm run format:checknpm test rebuilds dist/copy.js with tsdown and runs the wire tests against
that bundle. Commit the rebuilt bundle with any source change: zot never runs
npm install or a build step after cloning or pulling. The tests drive the
real subprocess over stdio and stub the clipboard tool, so no zot session and
no clipboard access are needed. npm run lint runs ESLint and tsc --noEmit.
- Node.js 22.18+
- zot 0.4.x
- A system clipboard tool:
pbcopy(macOS),wl-copy/xclip/xsel(Linux)
MIT, Copyright (c) 2026