The agent finished the task and handed back three files. Now you need to move them into your editor. The ritual starts: drag the mouse across the block, the terminal redraws, the selection vanishes, and Ctrl+C ends up grabbing the spinner line along with the code. /copy exists to skip the ritual.
It has three behaviors almost nobody uses: a block picker, a key that writes straight to a file, and three clipboard paths it tries in order when the terminal sits inside SSH or tmux. Below are the command, the literal output and what to do when nothing pastes.
What does the /copy command do?
It copies the text of one agent reply to the clipboard and writes the same text to a temp file. When the reply contains a code block, it opens a picker before copying.
This is not screen capture. The command reads the message already stored in the session and writes the whole text, so indentation, tables and code fences arrive intact.
| What you want to copy | What to type |
|---|---|
| The latest agent reply | /copy |
| The reply before that | /copy 2 |
| One specific code block | /copy and pick it in the selector |
How do you copy the latest reply?
Type the command on its own and confirm. With no argument, the target is the most recent message the agent wrote.
/copy
The confirmation comes in two lines, with a count of what was copied and the file path:
Copied to clipboard (1428 characters, 37 lines)
Also written to /tmp/claude/response.md
Use the count as a quick check. If the line number is much smaller than what you see on screen, you copied a different reply or only a fragment.
How do you copy an earlier reply?
Pass the position counting backwards: 1 is the latest, 2 is the one before it.
/copy 2
Only agent messages that contain text are counted. Turns where the agent merely called a tool, and API error messages, are skipped. So /copy 3 is the third actual reply, not the third line of the log.
The ceiling is 20 replies back. Asking for more than exists shows the available count instead of copying the wrong thing:
Only 3 assistant messages available to copy
An argument that is not a positive integer falls back to the usage message:
Usage: /copy [N] where N is 1 (latest), 2, 3, … Got: abc
How do you copy only one code block?
Run /copy on a reply that has at least one fenced block. Instead of copying everything, it opens the Select content to copy: selector with one entry per block.
| Selector entry | What it copies |
|---|---|
Full response | The entire reply. The character and line count sits next to it. |
| First line of the block | That block only. The label is the first line cut at 60 characters, and the description carries the language and, when the block has more than one line, the line count. |
Always copy full response | The entire reply, and turns the selector off for next time. |
If the reply has no code block, the selector never appears: the command copies the whole reply. That is why /copy sometimes asks you to choose and sometimes does not.
What is the w key in the selector for?
To write the chosen entry to a file without touching the clipboard. For a block tagged py, the confirmation reads Written to /tmp/claude/copy.py.
| Key | Action | What appears |
|---|---|---|
enter | copies and writes the file | Copied to clipboard (...) |
w | writes the file only | Written to ... |
esc | cancels without copying | Copy cancelled |
It is the difference between "I want to paste this now" and "I want the file on disk". If you already had something important on the clipboard, w keeps it from being overwritten.
Where does the file that /copy writes live?
In the system temp directory, inside a folder named claude, which is an inherited name still in use. On Linux, /tmp/claude/. On macOS, inside $TMPDIR.
- Full reply:
response.md. - Code block:
copy.plus the language name written in the fence, cleaned to letters and digits. Apyfence givescopy.py; atypescriptfence givescopy.typescript. - Block with no language, or marked
plaintext:copy.txt.
The exact path is printed in the confirmation, so there is nothing to guess. Since it is a temp directory, the system may clean the file up after a while: move it into the project if the content matters.
/copy path. The temp file is written in both cases, including when the clipboard fails.Why does /copy paste nothing?
Because the clipboard is not part of the terminal protocol. The command does not write to the system clipboard by itself: it tries up to three paths, in order, and each one depends on your environment.
| Path | When it is used | What to expect |
|---|---|---|
Native utility: pbcopy on macOS, wl-copy, xclip or xsel on Linux | Local session, without SSH_CONNECTION | The most reliable path |
tmux buffer: tmux load-buffer -w -, or load-buffer - when the terminal is iTerm2 | Inside tmux | Pastes with the tmux prefix; reaching the system depends on set-clipboard |
| OSC 52, always emitted as the last attempt | Everything else, including SSH | The terminal must accept the sequence. It fails silently |
Two situations explain most "nothing pasted" reports:
- tmux without passthrough. Inside tmux, the OSC 52 sequence is wrapped in a DCS packet. tmux 3.3 or newer only forwards it with
allow-passthroughon, and the option ships off. Without it, tmux drops the packet without a word: no error on screen. - A terminal that ignores OSC 52. Some emulators receive the sequence and do nothing with it by default. iTerm2 is the best known case.
The tmux fix is one line in ~/.tmux.conf:
set -g allow-passthrough on
Reload it with tmux source-file ~/.tmux.conf and try again. On plain SSH, without tmux, the path is OSC 52 plus permission on the terminal at your end of the connection.
When pasting just will not happen, the shortest path is to stop depending on it. The file is already on disk:
cat /tmp/claude/response.md
Trap: the selector only lists top-level blocks. Extraction walks the reply at the top level, so a block nested inside a list, a quote or a numbered item may never become an option. If the right block is missing from the list, pick Full response and cut it in the editor.
How do you make /copy always copy the full reply?
Two ways, and both store the same global preference. In the selector, choose Always copy full response, and the confirmation ends with Preference saved. Use /config to change copyFullResponse. Or open /config and set copyFullResponse to true.
With the preference on, the selector stops appearing and /copy copies the whole reply straight away. To bring the selector back, set the same key to false.
Does mouse selection not solve the same problem?
Partly. In fullscreen mode, selecting with the mouse already copies on mouse-up, controlled by copyOnSelect, which is on by default. /copy covers what selection does badly: grabbing a whole block without aiming, reaching the previous reply, and working outside fullscreen.
| Method | Good for | Limit |
|---|---|---|
| Mouse selection | Any visible fragment, in fullscreen | Depends on aiming; screen redraws get in the way |
/copy | Latest reply, whole block, earlier reply | Agent message text only |
/export | The whole conversation in a file | It is the entire session, not the fragment |
Copying the result is the easy part. The expensive part is being able to ask for a third version of the same block without checking the meter before you hit Enter. With Verboo Code the terminal is the same, /copy is the same, and tokens do not count against your month: you paste, test and ask again.



