omp packages

pi-compaction-recovery0.1.0

Native-first overflow compaction recovery for Pi using transient payload reduction.

fcrescio Published 27 days ago MIT ~203 downloads/mo

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.

Did it work for you?

Result

One report per person. A new report replaces your old one.

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:

  1. call the native compactor normally;
  2. if it fails, reduce tool-result payloads in the in-memory preparation;
  3. if that still fails, also remove assistant reasoning blocks;
  4. 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_failed because 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