omp packages

@adeildo/pi-compact7.2.0

Keeps a long pi session's context small: hides old tool output, keeping each call so the agent can run it again, and writes pi's compaction summary on a small model.

GitHub Actions Published 4 days ago MIT ~1.8K downloads/mo

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.

Did it work for you?

Result

One report per person. A new report replaces your old one.

Reports 0

No reports yet.

Readme

@adeildo/pi-compact

npm pi SDK

In a long session, every request sends the whole context again, and most of it is old tool output that the agent no longer needs. This package hides that old output and keeps what matters: your words, the agent's words and the decisions. On a week of real sessions, it cut the cost by about a third.

pi install npm:@adeildo/pi-compact

What it does

When a run ends with more than 150k tokens of context, each tool output older than the last 10 turns becomes one line that names its call:

Output hidden to save context, about 4.2k tokens. It came from: read src/view.ts. Run it again if you need it.
  • Your messages, the agent's words, errors and the last 10 turns stay whole.
  • When pi compacts anyway, a small model writes the summary, with your last words on top unchanged.

Each prune leaves a line in the chat with what it saved, and Ctrl+O lists the calls it hid.

After a tool call, the prune's line: 181 old tool outputs hidden, 705k to 250k tokens, and below it what the next request pays to rewrite the cache and in how many requests that pays back. Then pi's cache miss notice for that rewrite.
A prune's line, and the one cache rewrite it costs on the next request.

Commands and settings

/prune hides old output when the run ends, whatever the size of the context.

These are on the Compact tab of Alt+S, and stored under compact in ~/.pi/agent/extensions/pi-harness/settings.json.

Setting Default What it does
Hide old tool output on Turns the prune on
On Anthropic's side off On Anthropic models, Anthropic clears old output instead of the prune, and the agent keeps its thinking
Above 150000 How many tokens of context a run must end with to prune
Write it on the side model on Pi's summary is written on the model below, with your last words on top. When off, pi uses the session's model
Model auto The model that writes the summary. auto picks the cheapest one of the session's provider

The tab also shows what this session's prunes freed, and how many hidden outputs the agent had to run again. A high share means the prune hides output that the agent still needs.

How it works explains when a prune runs, why it works this way, Anthropic's own clearing, and how it was measured.

adeildo.dev
pi-harness is made by adeildo.dev