# Decay Recency-weighted structured compaction for Pi. Load `extensions/decay/index.ts` through Pi's package discovery. Set the optional compaction model in Pi settings: ```json { "decay": { "model": "provider/classifier-model", "summarizerModel": "provider/summarizer-model" } } ``` Omit `model` or set it to `null` to use the current session model. Omit `summarizerModel` or set it to `null` to reuse the classifier model. Failed Decay runs delegate to Pi's default compactor and append a bounded `decay-diagnostic` custom entry containing the stage, model, sanitized reason, and timestamp. The custom entry is persisted in session JSONL but excluded from model context. Repeated compactions provide the classifier a bounded prior-atom identity catalog so paraphrased facts can reuse exact recurrence keys without counting catalog entries as new occurrences. Interactive progress uses a passive, borderless five-row widget above Pi's editor, preserving native steering submission and Escape cancellation during compaction. The aligned `CTX`, `FACTS`, and `NEW` maps use compact human-readable counts and reversed semantic colors so overlaid labels remain legible across themes. Classifier records replace muted pending cells with durable and context regions as they arrive. After reconciliation, selected canonical facts turn to the accent color before streamed summary cells grow at the start of `NEW`. `CTX` and `NEW` share a token scale, so the retained suffix keeps the same approximate width and follows the growing summary in the resulting context. `keepRecentTokens` is Pi's configured target, not an exact count or minimum guarantee. Pi chooses whole-entry boundaries, which can retain more or fewer tokens than the target. Decay preserves `firstKeptEntryId` unchanged and does not send the retained suffix to its classifier. The displayed retained count and `estimatedKeptTokens` details field use Pi's message-token estimator over the actual retained suffix, including older summaries when present. `~` marks estimates; unavailable boundaries display `?`, never the configured target as a measured count. The [original Decay plan](../../docs/super/plans/2026-08-22-decay-compaction.md) contains earlier visual artifacts. The current widget uses five contiguous lines at every terminal height; aligned evidence-driven maps replace that plan's eight-line design.