claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

Feature Request: Add /copy command to copy messages to clipboard

Open NightMachinery opened this issue 4 months ago • 8 comments

Feature Request: /copy [N=1] slash command

Summary

Add a /copy slash command that copies the last N Claude Code messages as Markdown to the OS clipboard.

Proposed Usage

/copy        # Copies the last message (Claude's response)
/copy 3      # Copies the last 3 messages (alternating user/Claude)
/copy 5      # Copies the last 5 messages

Expected Behavior

  • Default N=1 (copies just Claude's last response)
  • Messages should be copied as properly formatted Markdown
  • Should include both user messages and Claude responses when N > 1
  • Should integrate with OS clipboard (works with Cmd+V/Ctrl+V)
  • Should preserve code blocks, formatting, and structure

Use Cases

  • Quickly share Claude's responses in documentation
  • Copy code snippets and explanations for use elsewhere
  • Archive conversation snippets for later reference
  • Share troubleshooting responses with team members

Implementation Notes

  • Should work across platforms (macOS, Linux, Windows)
  • Consider using a clipboard library like pyperclip or similar
  • Messages should maintain original formatting and structure
  • Could potentially support additional formats (plain text, HTML) as options

This would significantly improve the workflow when working with Claude Code responses that need to be shared or documented elsewhere.

NightMachinery avatar Aug 10 '25 21:08 NightMachinery

Found 1 possible duplicate issue:

  1. https://github.com/anthropics/claude-code/issues/859

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

github-actions[bot] avatar Aug 10 '25 21:08 github-actions[bot]

need this

EmmettHan avatar Aug 15 '25 03:08 EmmettHan

Need this too, would be nice if it was native but found this https://github.com/Twizzes/copy-claude-response

gabrielbryk avatar Aug 21 '25 21:08 gabrielbryk

need this

ekil1100 avatar Oct 14 '25 08:10 ekil1100

Please add this because a lot of times I want to copy the claude message to a colleague on slack.

weltonrodrigo avatar Oct 20 '25 12:10 weltonrodrigo

This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.

github-actions[bot] avatar Dec 08 '25 10:12 github-actions[bot]

This would be extremely helpful!

shirgoldbird avatar Dec 08 '25 18:12 shirgoldbird

Fwiw a hack I use: if the message has some uniquely identifiable piece, you can grep for that in ~/.claude. Here's a one-liner to copy the markdown to clipboard:

rg -FIN 'some unique substring from the message' ~/.claude | jq -r '.message.content[].text' | pbcopy

pokey avatar Dec 11 '25 13:12 pokey