@deathbeam/pi-context
Minimal extension for context-window token economy: RTK command rewriting, stale tool-result pruning, and a compaction model override.
Package details
Install @deathbeam/pi-context from npm and Pi will load the resources declared by the package manifest.
$ pi install npm:@deathbeam/pi-context- Package
@deathbeam/pi-context- Version
0.0.9- Published
- Nov 20, 2026
- Downloads
- 1,767/mo · 331/wk
- Author
- deathbeam
- License
- MIT
- Types
- extension
- Size
- 19.7 KB
- Dependencies
- 0 dependencies · 1 peer
Pi manifest JSON
{
"extensions": [
"./index.ts"
]
}Security note
Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.
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. Project settings override global ones.
Development
From the repo root:
npm install
npm test -- packages/pi-context
pi install ./packages/pi-context