@deathbeam/pi-context0.0.10
Minimal extension for context-window token economy: RTK command rewriting, stale tool-result pruning, and a compaction model override.
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
@deathbeam/pi-context
Keep the context small: rewrite bash commands through RTK when rtk is in PATH, prune tool results that a later call made stale, and compact with a cheaper model.
Use the /gain command to see the tokens saved.
Installation
# Choose one:
pi install npm:@deathbeam/pi-context # this package
pi install git:github.com/deathbeam/pi-packages # all my packages
Configuration
Optional context settings live in ~/.pi/agent/settings.json or .pi/settings.json:
{
"context": {
"compaction": "anthropic/claude-haiku-4-5:low"
}
}
compactionis aprovider/model-idstring with an optional:<thinking>suffix, used as the compaction model.
Environment
PI_CACHE_RETENTION picks the prompt-cache tier that gates pruning. Set it to long for models with an extended cache lifetime; anything else, including unset, uses the short tier.
PI_CACHE_RETENTION=long pi
Development
From the repo root:
npm install
npm test -- packages/pi-context
pi install ./packages/pi-context