Pi agent extension - prune old images from the context A developer released an extension for the Pi coding agent that prunes old images from the context to manage token usage. The extension, called image-context, allows users to configure per-model image limits and replaces pruned images with a placeholder. It is designed to work with Pi agent's message history and supports both new and legacy state formats. | import { readFileSync } from "node:fs"; | | import { homedir } from "node:os"; | | import { join } from "node:path"; | | import type { AgentMessage } from "@earendil-works/pi-agent-core"; | | import type { ExtensionAPI } from "@earendil-works/pi-coding-agent"; | | | | type JsonObject = Record