pi-pact
Improves Pi compaction by only compacting older history while keeping recent turns intact.
Package details
Install pi-pact from npm and Pi will load the resources declared by the package manifest.
$ pi install npm:pi-pact- Package
pi-pact- Version
0.2.0- Published
- Jun 21, 2026
- Downloads
- not available
- Author
- tripplyons
- License
- MIT
- Types
- extension
- Size
- 22.1 KB
- Dependencies
- 0 dependencies · 1 peer
Pi manifest JSON
{
"extensions": [
"./extensions/pact.ts"
]
}Security note
Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.
README
pi-pact
Pact improves Pi by retaining recent messages when compacting.
Install
Install from npm:
pi install npm:pi-pact
Run temporarily without installing:
pi -e npm:pi-pact
Configuration
Pact reads configuration in this order, with later values overriding earlier ones:
- Built-in defaults
- Global config:
~/.pi/agent/pact.json - Trusted project config:
.pi/pact.json - Environment variables
- Session-local setting commands such as
/pact:onand/pact:fraction
Example pact.json:
{
"enabled": true,
"fraction": 0.8,
"threshold": "160000",
"debug": false,
"debugFile": null
}
Settings:
enabled— enable automatic Pact compaction, defaulttruefraction— fraction of tool results to compact, default0.8threshold— token count or percentage like60%, default160000debug— enable context order notifications, defaultfalsedebugFile— append debug records to the given JSONL file, defaultnull
Environment variable overrides:
PACT_ENABLED=1|0|true|falsePACT_FRACTION=0.8PACT_THRESHOLD=160000orPACT_THRESHOLD=60%PACT_DEBUG=1|0|true|falsePACT_DEBUG_FILE=/tmp/pact.jsonl
Slash commands:
/pact manually trigger compaction
/pact:on enable automatic Pact compaction
/pact:off disable automatic Pact compaction
/pact:toggle toggle automatic Pact compaction
/pact:status show current Pact settings
/pact:stats show Pact compaction stats
/pact:debug [on|off] toggle or set context-order debug notifications
/pact:verify verify compaction summary ordering
/pact:fraction N set the fraction of tool results to compact
/pact:threshold N set the token count or percent threshold
Development
npm test
npm run check
npm pack --dry-run