@grammeaway/pi-clip

Clipboard snippet picker extension for the Pi agentic harness — /clip copies recent code blocks to the system clipboard, raw

Packages

Package details

extension

Install @grammeaway/pi-clip from npm and Pi will load the resources declared by the package manifest.

$ pi install npm:@grammeaway/pi-clip
Package
@grammeaway/pi-clip
Version
1.0.0
Published
Jun 30, 2026
Downloads
58/mo · 23/wk
Author
grammeaway
License
MIT
Types
extension
Size
8.2 KB
Dependencies
0 dependencies · 1 peer
Pi manifest JSON
{
  "extensions": [
    "./index.ts"
  ]
}

Security note

Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.

README

pi-clip

Disclaimer: Extension written fully by Pi itself.

A clipboard snippet picker for the pi coding agent.

Selecting text in the TUI copies the rendered output — soft-wrap line breaks, indentation, highlight artifacts — so it pastes dirty. pi-clip pulls snippets straight from the conversation instead, so they paste clean.

Every assistant message is scanned for fenced ```code blocks``` and each one is pushed onto an in-memory ring buffer (newest first). /clip opens a picker of those snippets; Enter copies the chosen one to the system clipboard, raw.

No agent instruction needed — the agent already fences commands and SQL, so the buffer fills itself just by working.

Install

pi install npm:@grammeaway/pi-clip

To try it without permanently installing:

pi -e npm:@grammeaway/pi-clip

Usage

Run /clip, arrow to the snippet you want, press Enter. A notification confirms which tool copied it and how many characters.

Notes

  • Platform-agnostic clipboard. Tries wl-copy (Wayland), pbcopy (macOS), xclip / xsel (X11), then clip.exe (Windows/WSL) — the first one that runs and succeeds wins. A missing or wrong-context tool falls through to the next. Requires at least one of them on PATH; if none exist, /clip reports it instead of failing silently.
  • Ring buffer holds the 30 most recent blocks. Re-seeing an identical snippet floats it back to the top rather than duplicating it.
  • In-memory — the buffer resets when the session restarts.
  • The buffer is captured per code block, so multi-block messages give you each block as a separate, individually-pickable entry.