Fixing Claude Code's Broken Copy-Paste

Copying in Claude Code is broken. The clipboard picks up box-drawing characters, leading margins, trailing spaces, and hard line breaks from terminal wrapping.


Copy this from Claude Code:


  │ A pen-sized fishing rod that extends to a full meter, aluminum alloy,
  │ with a reel included. Under a dollar to source. $21 profit per sale.

Paste it and you get:


A pen-sized fishing rod that extends to a full meter, aluminum alloy,

with a reel included. Under a dollar to source. $21 profit per sale.

So I built claude-copy. Same copy now gives you:


A pen-sized fishing rod that extends to a full meter, aluminum alloy, with a reel included. Under a dollar to source. $21 profit per sale.

It’s a Hammerspoon script for macOS that intercepts Cmd+C in terminal apps, detects Claude TUI artifacts in the clipboard, and cleans them before you paste.


Detection is confidence-based. It scores margin coverage, pipe characters, and wrapped-line shape to decide how aggressively to clean. Low-confidence text is left untouched.


git clone https://github.com/andersmyrmel/claude-copy.git
cd claude-copy
./install.sh

macOS only. Works with Ghostty, iTerm2, Terminal.app, and most other terminal emulators.


GitHub · MIT licensed