pi-pact
v0.2.1
Published
Improves Pi compaction by only compacting older history while keeping recent turns intact.
Maintainers
Readme
pi-pact
Pact improves Pi by retaining recent messages when compacting.
Install
Install from npm:
pi install npm:pi-pactRun temporarily without installing:
pi -e npm:pi-pactConfiguration
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": "80%",
"threshold": "60%",
"debug": false,
"debugFile": null
}Settings:
enabled— enable automatic Pact compaction, defaulttruefraction— fraction or percentage of eligible tool results to remove from live context by summarizing, default80%threshold— token count or percentage like60%, default60%debug— enable context order notifications, defaultfalsedebugFile— append debug records to the given JSONL file, defaultnull
Environment variable overrides:
PACT_ENABLED=1|0|true|falsePACT_FRACTION=80%orPACT_FRACTION=0.8PACT_THRESHOLD=60%orPACT_THRESHOLD=160000PACT_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 eligible tool results to remove from live context
/pact:threshold N set the token count or percent thresholdDevelopment
npm test
npm run check
npm pack --dry-run