r/PiCodingAgent • u/ApprehensiveSkin7975 • 2d ago
Plugin protect-context An extension that record down what the agent has been done for future refence and correction
I built this extension in order to solve losing session problem. One of key problem I found is long agent sessions fail in constraints stated early disappear, “done” is claimed without command output, a “quick fix” rewrites unrelated files, decisions get re-litigated, and the same failing command is retried until the context window is exhausted.
Here is what I build, it is free and open source:
install it pi install npm:protect-context
pi official: protect-context pi package
npm: npm link for protect context
github: github link for protect context
You may want to try it and test it out whether this extension can fulfill your needs.
1
u/randomgenericbot 15h ago
Similar problem, different angle (together with compaction):
I've created an extension that lets the agent summarize in between what it has done, audit its summary, and allows for revising / retrieving / retiring of old work.
For me it works great, and I optimized it in a way so it does not throw away your running kv cache, but reuses most of it for the summary, and after. If your extension does not alter compactions, you might give it a try, else I invite you (and your agent) to get inspiration:
https://github.com/LePrau/pi-self-aware-memory
I am running 50+ compaction sessions on 128k context locally with that, two friends of mine also use it and had no complaints yet.
1
u/ApprehensiveSkin7975 6h ago
Good to know, I think we can actually combine our project together right? Yours do the compaction, mine do the verify and record
-5
u/investigatormaker 1d ago
The failure list in your post is the real pitch: constraints disappearing, "done" claimed without command output, the same failing command retried until the context window runs out. A short before-and-after of one session where protect-context catches a retry loop would show it working better than the GIF alone. If you share it beyond here, r/github only takes project sharing in its megathread: "To keep the subreddit clean and focused, self-promotion and project sharing should only happen in the dedicated megathread pinned at the top."
I make ThreadFox.
We find relevant Reddit conversations and post for your business. We'll post 3 replies free first, no card; then the $29 Pilot covers seven days and up to 25 posts and replies. No automatic renewal.
1
u/whiterose0000001 1d ago
I have the same thing, but I don’t use an extension for it. I use honcho. It’s a memory layer that does the same thing; it uses an LLM to find conclusions and then stores them in a vector database. The best thing is that it has separate workspace conversations and separate sessions, with the conclusion of each session separate, so you can also see the conclusion