Licence
MIT
Version
0.1.3
Deps
0
Size
8 kB
Vulns
0
Weekly
15
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, and avoids the dumb zone.
By default, pi auto-compacts when:
contextTokens > model.contextWindow - reserveTokens
This 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 toggle
The 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:
/reload
Notes
- 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.