r/PiCodingAgent • • 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.

https://github.com/gopherbone/al-jaffee

16 Upvotes

22 comments sorted by

View all comments

Show parent comment

1

u/porkyminch Sep 17 '26

There's an existing rollback feature in pi for that, this is just a slightly more ergonomic way for agents to use that feature. It's basically a nice little way for you to get back ~30-40% of your context window after doing tasks where the results are more important than the methodology.

1

u/n4te Sep 17 '26

What rollback feature? Do you mean /tree and pick a previous turn? That's not the same as replacing everything between 2 turns with a summary.

1

u/porkyminch Sep 17 '26

If you double tap escape it brings up a tree, you can pick out a previous message and roll back to it with a summary. 

1

u/n4te Sep 17 '26

Aye, same as /tree. I use that a lot, but I never bothered with the summary. Now I get what the summary is for, cool thanks!

With that and your extension my productivity should go up, cheers!

1

u/madcapnmckay Sep 18 '26

I assume that then is a cache bust? Same for the fold itself?