Skip to content

Latest commit

 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pi-clipboard-keeper

Keeps pasted clipboard images referenceable across pi sessions.

When you paste an image into pi (Ctrl+V), pi writes it to a temp file like /var/folders/.../pi-clipboard-<uuid>.png and inserts that path into your prompt. The path is only text — the model reads the file when it needs the image. macOS clears /var/folders within days, so an older session that mentions a pasted image usually points at a file that no longer exists, and UUID paths are impractical to re-type anyway.

How it works

On submit, the extension scans your prompt for pi-clipboard-* paths, copies each image into ~/.pi/agent/clipboard-store/ under a content hash, and rewrites the path in the outgoing text. The session therefore records a durable path from the start, and 50 turns later or after pi --resume, the image is still there.

Details worth knowing:

  • Content-hashed storage: pasting the same screenshot three times stores one file.
  • The rewrite happens before the prompt reaches the model, so nothing extra to remember and nothing to run manually.
  • Metadata (origin path, store path, size, time) is written to a custom session entry, so the list survives restarts and branch switches.
  • Storage is shared across sessions by default. Set PI_CLIPBOARD_KEEP=session to store under the session id and delete the files when that session shuts down.
  • The build-in /model-style commands are untouched; this extension only adds /cbi.

Install

pi install git:github.com/vi2q/pi-clipboard-keeper

/cbi

Command Action
/cbi List images stored in this session (newest first); pick one to insert its path into the editor
/cbi prune Drop list entries whose stored file is missing
/cbi clean Delete everything in the store after a confirmation

/ moves, Enter inserts the path, Esc closes. Inserted paths are stable store paths, so you can reference the same image again in any later prompt.

Limits

  • Shared-store files are never deleted automatically; /cbi clean wipes them on demand, or rm -rf ~/.pi/agent/clipboard-store resets everything.
  • prune removes dead references from the list but leaves files alone, since another session may share the same content.
  • Only paths pi itself produces (pi-clipboard-<uuid>.png etc.) are stashed. Screenshots you saved elsewhere are already durable.

License

MIT

About

Keeps pasted clipboard images referenceable across pi sessions

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages