# ctxprune

Shrinks tool results before the model reads them, without dropping content: runs of identical lines are counted, JSON record lists with nested values.

- Type: Plugin
- Version: 0.4.1
- Updated: 22 Nov 2026
- Publisher: riceharvest
- Category: Tools

[Contact us](https://www.ulpi.io/en/support#contact)

## What it does

Shrinks tool results before the model reads them, without dropping content: runs of identical lines are counted, JSON record lists with nested values (typical MCP results) become rows on hosted models, read_file/terminal JSON wrappers are unescaped, and every structural rule is kept only if it decodes back to the exact original. patch/edit/memory/todo results are never touched.

On claude-opus-\* models, an llm_request middleware turns a tool result that repeats an earlier one in the same request into a reference to it. Fails open: on any error or past a 2 s budget Ulpi gets the original output.

Disclosure — stdlib Python only; no network calls, no shell commands, no child processes, no credentials, no telemetry; rewrites tool results before the model sees them and, on claude-opus-\* models, edits repeated tool results in outgoing requests into references; writes a small state store (first-render pins so already-sent results keep their bytes and the prompt cache stays valid, plus a registry of its own outputs) under \~/.cache/ctxprune or $CTXPRUNE_STATE in a 0700 directory shared by all Ulpi profiles, and reads only that store and its optional \~/.config/ctxprune/settings.json; CTXPRUNE_OFF=1 disables it.

## Review notes

What an owner reads and accepts before the install is approved.

- Ulpi has not reviewed this version: it is listed in the public plugin catalog, and the install still fetches it at its pinned commit, checks its shape and scans it before you approve

## More in Tools

- [Cua Spaces](https://www.ulpi.io/en/marketplace/plugins/cua-spaces): Cua's own plugin: runs Ulpi's terminal, file and code tools inside a Cua Space, an isolated Linux, macOS or Windows machine you can watch live, as a terminal backend.
- [Culprit](https://www.ulpi.io/en/marketplace/plugins/culprit): git bisect for your agent.
- [CUPS Print Tools](https://www.ulpi.io/en/marketplace/plugins/cups-print-tools): Printer-agnostic Linux CUPS printing for Ulpi: queue status, files, wrapped text, and styled one-page letters.

[All listings →](https://www.ulpi.io/en/marketplace) · [Publisher's guide →](https://www.ulpi.io/en/docs) · [Report a problem →](https://www.ulpi.io/en/security#report)
