You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[FEATURE] Undo message only - keep file changes (like Claude Code) #7963
Add an option to undo/remove AI messages from conversation history while preserving file changes.
Current Behavior
The /undo command reverts both:
The conversation message
The file changes made by AI
There's no way to keep the file changes while cleaning up the conversation history.
Requested Behavior
Add a new command or option like:
/undo --keep-files or /undo -k
/forget (removes message only)
Or a separate UI button for "Remove message, keep changes"
Use Cases
Conversation cleanup: After AI makes correct changes through multiple back-and-forth messages, I want to clean up the messy conversation history while keeping the final working code.
Context management: Long conversations eat up context window. Being able to remove old messages while keeping their file changes helps manage context efficiently.
Iterative development: AI made changes across 5 messages. The code is good now, but I don't need all that conversation history cluttering my session.
Prior Art
Claude Code has this feature - you can undo messages while preserving file changes. It's extremely useful for keeping conversations clean without losing work.
These issues discuss related functionality around managing conversation history and file changes. Feel free to ignore if your specific use case differs from these.
I would like this functionality too. Sometimes I want to revert file changes but most of the time I want to only revert to a previous prompt (without reverting the files too). I use this all the time for managing the context window:
do a bunch of discovery, dump that into a concise learnings file, then revert to before the discovery and load the learnings file (which I don't want to disappear when I revert)
working on a problem which I realize is two problems have way through the session. Once the first problem is solved, revert some of the context that was only relevant to the first problem (and I don't want any more), and continue with the second issue (could fork, but I don't really care about the problem 1 session history so reverting makes more sense).
I can disable snapshots in opencode.json (which I do most of the time), but then if I do want to actually revert session and files, I don't have an option to do that (@IgorWarzocha)
For example, I would like to see another option in this dialog such as "Revert undo message but keep file changes":
Note, there is also a bug in that dialog in that if you have snapshots disabled, the current option is misleading because it will not in fact revert files changes too.
Reacted by Ivan Uhalin and Miguel de Benito Delgado
Hi! I'd like to +1 this feature request. Like many others here, I frequently need to revert conversation messages without losing the file changes made by the agent.
Use case: After the AI makes correct code changes through several back-and-forth messages, I want to clean up the conversation history to free context window, while keeping the working code intact. Currently, /undo reverts both messages and files, which forces me to either keep a cluttered conversation or lose my work.
What I've tried: PR #16447 implemented this with a mode parameter ("conversation" vs "conversation_and_code"), but it was closed by the bot after 60 days of inactivity. The feature and the approach looked solid.
Suggestion: Could this be reconsidered for a future release? Even a simple flag like /undo --keep-files would be a great start. This is a standard feature in Claude Code and significantly improves the development workflow.
Activity
github-actions commentedon Jan 12, 2026
This issue might be a duplicate of existing issues. Please check:
/undocommand only rolls back AI conversation message, not the associated file changes #5474:/undocommand only rolls back AI conversation message, not the associated file changes (opposite problem - wants file changes to also revert)redoableparameter to control permanent message deletion after revert #4681: Feature request to addredoableparameter to control permanent message deletion after revertThese issues discuss related functionality around managing conversation history and file changes. Feel free to ignore if your specific use case differs from these.
IgorWarzocha commentedon Jan 31, 2026
@SYRS-AI you're looking for
in your global opencode.json
kanaka commentedon Feb 19, 2026
I would like this functionality too. Sometimes I want to revert file changes but most of the time I want to only revert to a previous prompt (without reverting the files too). I use this all the time for managing the context window:
For example, I would like to see another option in this dialog such as "Revert undo message but keep file changes":

Note, there is also a bug in that dialog in that if you have snapshots disabled, the current option is misleading because it will not in fact revert files changes too.
github-actions commentedon Apr 21, 2026
To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.
phazei commentedon Apr 27, 2026
This is still an issue
stcrd commentedon Apr 28, 2026
would be a great feature, keep the changes, clean the chat, win-win
franciscorubin commentedon Aug 12, 2026
This is the most basic feature...
qzhhhi commentedon Aug 14, 2026
This is A FUCKING BASIC FEATUREEEE
LuisBalsa commentedon Sep 11, 2026
Hi! I'd like to +1 this feature request. Like many others here, I frequently need to revert conversation messages without losing the file changes made by the agent.
Use case: After the AI makes correct code changes through several back-and-forth messages, I want to clean up the conversation history to free context window, while keeping the working code intact. Currently,
/undoreverts both messages and files, which forces me to either keep a cluttered conversation or lose my work.What I've tried: PR #16447 implemented this with a
modeparameter ("conversation"vs"conversation_and_code"), but it was closed by the bot after 60 days of inactivity. The feature and the approach looked solid.Suggestion: Could this be reconsidered for a future release? Even a simple flag like
/undo --keep-fileswould be a great start. This is a standard feature in Claude Code and significantly improves the development workflow.Thanks for considering!