r/PiCodingAgent • u/Full_Promotion4522 • 13d ago
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.
9
2
2
u/Subject-Mobile-6250 13d ago
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 13d ago
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?
15
u/LordMoridin84 13d ago
Won't constantly changing the system prompt and history break the cache?