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.
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=sessionto 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.
pi install git:github.com/vi2q/pi-clipboard-keeper| 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.
- Shared-store files are never deleted automatically;
/cbi cleanwipes them on demand, orrm -rf ~/.pi/agent/clipboard-storeresets everything. pruneremoves 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>.pngetc.) are stashed. Screenshots you saved elsewhere are already durable.