pi-compaction-recovery0.1.0
Native-first overflow compaction recovery for Pi using transient payload reduction.
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
pi-compaction-recovery
Native-first overflow compaction recovery for Pi.
When an overflow compaction fails because the summarizer reaches a generation or payload limit, this package retries Pi's native compaction with a transient reduction ladder:
- call the native compactor normally;
- if it fails, reduce tool-result payloads in the in-memory preparation;
- if that still fails, also remove assistant reasoning blocks;
- leave the persisted session history and user settings unchanged.
The extension only handles reason === "overflow". It is deliberately
opt-in, does not replace Pi's normal compaction behavior, and fails through to
Pi when the recovery attempts cannot succeed. It uses Pi's resolved provider
streaming API, verified against Pi 0.84.4.
Install
pi install npm:pi-compaction-recovery
Enable or inspect it with pi config. To load a checkout directly:
pi -e ./extensions/index.ts
Development
npm install
npm run check
npm run release:check
The reduction functions are exported and tested independently from Pi. They copy the compaction preparation rather than mutating the original object.
Scope and limitations
- This is a retry policy, not a guarantee that any summary can be recovered.
- It does not hook
session_compact_failedbecause that Pi event is observational; recovery must happen before Pi's compaction request. - It never rewrites JSONL entries, changes the configured context window, or silently installs dependencies.
- Pi extensions execute with the host process's permissions. Review the source before installing third-party packages.
License
MIT