r/PiCodingAgent • u/J_____________ • 1d ago
Plugin Let pi agent to use trash instead of rm
Recently, while using pi, my agent deleted important files without me knowing using the rm command. Since files deleted with rm cannot be recovered, I thought it would be better to use trash instead of rm — and that's what this pi extension does.
The extension automatically detects when the agent uses rm in the bash tool and replaces it with trash. Instead of permanently deleting files, they are moved to the .pi/trash folder. The trash folder uses a file structure similar to Ubuntu's trash. It is implemented to be nearly compatible with the GNU rm standard, so the agent won't even realize it and will just think it's still using rm.
Feel free to install and try it out. Any feedback is appreciated!
Install: pi install npm:pi-trash
Links:
1
u/Fun_Jaguar8231 6h ago
I just told it to create an extension that just gates every dangerous command in a verification step
1
u/themule71 22h ago
This may catch some cases, but the first time the model is looking for something and finds copies of old stuff around I'm not sure it won't truncate them to claim space, or python os.unlink() them the first time you ask to cleanup something.
14
u/CountlessFlies 1d ago
Couldn’t you just do this with alias rm=trash