Your clipboard history, from Terminal

You copied a link, an error, or a screenshot an hour ago, and now your coding agent needs it. Instead of digging it up and pasting it in, tell the agent to find it.

How it works: On Hand 1.3.0 and later include the onhand command. It searches the history On Hand keeps on your Mac, prints a clip’s text (including the text in screenshots), copies clips back, and pauses capture. Claude Code, Codex, or any script can run it.

Try it

onhand search invoice
onhand get 3f2a91c0
onhand copy 3f2a91c0
onhand pin 3f2a91c0 --board Snippets

That finds clips mentioning “invoice,” prints the full text of one, copies it back, and pins it to a board. IDs come from onhand search, and any unique start of one works, like a short Git hash. Add --json to search, get, boards, or status for output a script can parse.

Every command

CommandWhat it does
onhand search [words]Newest clips containing all the words, one line each. Leave out the words for recent clips.
onhand get IDA clip’s full text. For an image, the text On Hand found in it; add --image out.png to save the image.
onhand copy IDPut a clip back on the clipboard.
onhand pin ID --board NAMEPin a clip so it never expires, optionally to a board. unpin undoes it.
onhand boardsYour boards and how many clips each holds.
onhand delete IDDelete a clip from history.
onhand forget-lastClear the clipboard and delete what On Hand saved from it.
onhand pause / resumeStop saving copies, then start again.
onhand statusWhether On Hand is saving copies, and how many clips it holds.

search takes --kind text|link|image, --pinned, --sent (messages you sent, when Sent messages is on), --board NAME, and --limit N (10 by default, at most 50). Run onhand help for the full list.

Tell your agent about it

Add this line to your CLAUDE.md, AGENTS.md, or your agent’s instructions, so it reaches for your clipboard history when you mention something you copied:

On Hand keeps my clipboard history. When I mention something I copied earlier, find it with `onhand search <words>` and read it with `onhand get <id>`. Ask before deleting anything.

Then ask things like:

Install the command

If you installed On Hand with Homebrew, onhand is already on your PATH:

brew install --cask coreyhaines31/tap/onhand

If you downloaded the app instead, link the command once. It asks for your Mac password:

sudo mkdir -p /usr/local/bin
sudo ln -sf "/Applications/On Hand.app/Contents/MacOS/onhand" /usr/local/bin/onhand

New to On Hand? Start with the installation guide.

What your agent can see

Read the privacy policy for details.

Questions

Does On Hand have to be running?

No. The command reads and changes the same history file the app uses, so it works either way, and a running app shows the changes right away. On Hand has to be running to save new copies.

Which agents does it work with?

Any agent that can run Terminal commands, including Claude Code, Codex, Cursor, and Gemini CLI. There’s nothing to set up beyond the line in your instructions file.

Can I use it in my own scripts?

Yes. Use --json for structured output. Errors go to stderr, and the command exits with 1 when something fails and 2 for a typo in the command. The source is on GitHub.