@diegopetrucci/pi-context-cap
v0.1.0
Published
A pi extension that caps effective model context windows at 200k tokens for earlier auto-compaction.
Maintainers
Readme
context-cap
A pi extension that treats large-context models as having an effective 200k-token context window, so pi's built-in auto-compaction starts earlier.
By default, pi auto-compacts when:
contextTokens > model.contextWindow - reserveTokensThis extension changes the active model's in-memory contextWindow to:
min(originalContextWindow, 200000)With pi's default reserveTokens of 16,384, models larger than 200k will proactively compact around 183,616 tokens.
Commands
/context-cap status
/context-cap off
/context-cap on
/context-cap toggleThe extension starts enabled by default. Disabling is temporary for the current extension runtime/session; after /reload, /new, /resume, or /fork, the extension starts enabled again.
Install
Standalone npm package
pi install npm:@diegopetrucci/pi-context-capCollection package
pi install npm:@diegopetrucci/pi-extensionsGitHub package
pi install git:github.com/diegopetrucci/pi-extensionsThen reload pi:
/reloadNotes
- This extension mutates pi's in-memory model metadata only. It does not edit
models.json. - The cap affects pi logic that reads
model.contextWindow, including auto-compaction thresholding and UI context-window display. - Because pi also uses
model.contextWindowfor some overflow detection, a request that succeeds above 200k tokens on a larger model may be treated as overflow and retried after compaction. Use/context-cap offif you need the full model window temporarily.
