avtc-pi-prune-images1.0.0
Payload-level rolling image eviction for pi: sends only the N most recent images per LLM call so providers with per-prompt image caps (e.g. GLM's 2) never reject the request. Session history stays intact.
Untested on omp
This is a pi package. No one has reported whether it works on omp yet. If you try it, add your result below.
Reports 0
No reports yet.
Readme
avtc-pi-prune-images
Payload-level rolling image eviction for pi.
Providers may cap images per prompt (for example vLLM's --limit-mm-per-prompt '{"audio": 0, "image": 8, "video": 0}').
pi keeps every image in session history — pasted images and images returned by read — and re-sends the full history on every LLM call, so one image over the cap bricks the session with 400: At most X image(s) may be provided in one prompt.
This extension listens to the context event (fires before each LLM call) and replaces every image part older than the N most recent with a text placeholder.
Only the outgoing payload is pruned: the session file keeps every image for /tree, /export, and compaction.
Settings
~/.pi/agent/settings.json (project .pi/settings.json overrides):
{
"avtc-pi-prune-images": {
"keep-last-images": 8
}
}
keep-last-images: non-negative integer, ornullfor unlimited. Defaultnull— the extension is inert until you opt into eviction.0strips all images from the payload (payload-only equivalent of pi'simages.blockImages).
Invalid values warn once and leave messages unmodified.
Notes
- The setting is re-read before every LLM call, so edits apply live.
/treeto a point before an image-heavyreadremains the surgical fix when you want the images gone from history entirely.