NEW Workflows: agents follow the steps, you sign off. Read more →
Ulpi

ctxprune

PLUGIN

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

by riceharvest · v0.4.1

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

All listings →