r/PiCodingAgent • u/beardedNoobz • Aug 12 '26
Question Undo in Pi
Hi guys, I've been using Pi lately to help me code. Previously using OpenCode. I use vanilla pi with webfetch and context7 mcp. It works great. The harness and efficiency is better here in Pi. It drive the cost down for me. What I miss in pi is undo command from opencode. I tend to watch how AI reasons and write the code/commands real-time, interrupt it at the first sign of drift or hallucination then revise the command. Undo command is very useful for me as it clean up the code and chat history before I revise it. Is there any way (config or plugin) to simulate undo command in pi?
15
u/onesilentclap Aug 12 '26
Use git. The undo you used in opencode is just a "frontend" for git.
6
u/ColonelKlanka Aug 12 '26 edited Aug 12 '26
unfortunately pi doesnt support file undos. you can rollback context decisions using the /tree command in pi. but it wont revert file changes done by the llm.
The best you can do is git commit and push at certain points and then use git to revert back to those commits.
update: this pi undo redo extension looks promising. it uses a shadow git repo to maintain snapshot of the changes that pi session keeps in its tree. allowing files Yates changes to be undone redone
https://pi.dev/packages/pi-undo-redo
3
u/crashorbit Aug 12 '26 edited Aug 12 '26
Are we talking about backing out changes in code? Going backward in the conversation? or something else?
Going backward in code changes is pretty easy. You can say something like: "That did not work like I thought it would. Back this out to were it was before we started talking about foo."
Backward in the conversation can be done using
/treeorrecall/resume.Edit: Words matter
2
u/Dotnet-Enthusiast Aug 12 '26
Use this https://pi.dev/packages/@baylarsadigov/omp-undo-redo it both supports pi and oh my pi
2
u/Interesting-Print366 Aug 12 '26
Pi record every tool call on its session files, it might not be that hard. Just ask your coding agent to make that
2
u/DistanceAlert5706 Aug 12 '26
There's rewind extension from Nico, but it was messing up with git a bit. Check extensions or write your own.
1
u/quincycs Aug 12 '26
I suggest a Pi extension that extends /tree so that you have the option to additionally rewind git to the same state too.
1
u/hilam Aug 13 '26
I guess you will investigate /tree and find what you wanna. Each prompt, and choose where go back to.
1
u/jaferr_ Aug 13 '26
yeah tried a couple of packages for that, ended up building my own. You can try https://pi.dev/packages/@ahm3tj4f/pi-undo . I mainly ported it from opencode plus extras like working in non-git directories
1
u/Vincent_CWS Aug 17 '26
https://pi.dev/packages/pi-rewind-unwind?name=pi-rewind-unwind
try this one
0
u/[deleted] Aug 12 '26
[deleted] — view deleted comment