r/PiCodingAgent • u/porkyminch • Sep 17 '26
Resource al-jaffee - simple cache-preserving fold-in compaction for pi agents
I've been working on a longer-term project and I have a lot of little side tangents and investigations as I work that I don't want the full context to get polluted by. I wrote a little pi plugin that lets agents create markers, then work on a task with their full context. When they're done, they can fold-in their full context to a summary, compacting the work in place.
It's less manual than forking the session and a little less to keep track of than subagents. I thought it was worth sharing. MIT license, 1k lines of code. Cost was maybe a dime worth of GLM 5.3 Flash.


View all comments
3
u/sergeant113 Sep 17 '26
Could share more about the UX? Does it replace pi native compaction, and so i can just install and forget?
And how about agent experience? Can the agent independently trigger compaction? Does the agent know it has access to these folds? How does it discover the folds and read it? Are the folds transferable between sessions - can subagent when given a forked context read the folds as well?