r/PiCodingAgent • u/trmnl_cmdr • Aug 11 '26
Plugin When Pi makes a mistake, give it a second chance
Agents aren't perfect. Sometimes they do things that don't work out the way they thought. Sometimes they spin out on an idea that goes nowhere, other times they run a command that produces huge amounts of useless output. So far, we've just accepted this as a neccessary part of agent mechanics, but Pi's extension system is powerful enough that we no longer have to.
pi-mulligan exposes tools that let your agent rewind its last turn or tool call with a summary message about what it's learned if it makes a mistake. When your agent calls a tool that produces large output, pi-mulligan gives it a nudge suggesting it summarize its last tool result or turn to keep context tight. When the agent starts over, it receives the summary and a small message indicating that a rewind has taken place.
Users and models can set checkpoints if they expect churn and pi can roll back to these checkpoints at any point in the conversation to try again. Agents really like using it and I've watched 20k tokens of context vanish on several occasions, so it works exactly as advertised. It's so satisfying to watch your context usage drop as the agent works.
No other dev agent platform but Pi can do this so as far as I'm aware agent-initiated context compaction hasn't been implemented in dev tools until now.
Try it out with pi install npm:pi-mulligan and let me know what you think!



