r/PiCodingAgent • u/Full_Promotion4522 • Aug 30 '26
Plugin Alzheimer is all you need - Forgetting to optimize context
I built a context-management extension for coding agents that forgets on purpose instead of hoarding everything.
What it does:
- Compresses giant bash output into short digests (exit code, key facts, truncation info) instead of dumping raw output into context
- Strips the skill catalog from the system prompt when it's not needed that turn
- Drops file contents from context once they're no longer needed — but only when it's actually safe to (tracks whether the model still needs them)
Results: ~19% reduction in effective input tokens on the clean path, with zero drop in output quality — same correct answers, just less noise sitting in context.
Install:
pi install npm:pi-context-window-manager
Repo: https://github.com/Its-Atharva-Gupta/pi-context-window-manager
Would love feedback/suggestions — especially if you've hit edge cases with context pruning breaking agent behavior, or ideas for what else is safe to forget.
0
Upvotes
15
u/LordMoridin84 Aug 30 '26
Won't constantly changing the system prompt and history break the cache?
2
u/Zestyclose_Potato794 Aug 30 '26
What about preserve thinking = false ?
8
u/IceManMinus0ne Aug 30 '26
This would break caching so hard.
2
u/Subject-Mobile-6250 Aug 30 '26
To be honest, I have been commenting a bit too much about the common ignorance of prompt prefix caching, this needs to be normalized
1
u/kantorcodes1 Aug 30 '26
you’re rewriting Pi’s bash output after the command finishes, which makes HOL Guard relevant in a weird way. i work on Guard, an open-source local check before agent actions run. want to try both?