Skip to content

[FEATURE] Undo message only - keep file changes (like Claude Code) #7963

Closed

Description

@SYRS-AI

Feature Request

Add an option to undo/remove AI messages from conversation history while preserving file changes.

Current Behavior

The /undo command reverts both:

  1. The conversation message
  2. 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

  1. 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.

  2. Context management: Long conversations eat up context window. Being able to remove old messages while keeping their file changes helps manage context efficiently.

  3. 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.

Environment

  • OS: Windows 11
  • OpenCode version: Latest

Related Issues

Activity

  1. github-actions commented on Jan 12, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    These issues discuss related functionality around managing conversation history and file changes. Feel free to ignore if your specific use case differs from these.

  2. IgorWarzocha commented on Jan 31, 2026

    @IgorWarzocha

    @SYRS-AI you're looking for

    },
      "snapshot": false
    }
    

    in your global opencode.json

  3. kanaka commented on Feb 19, 2026

    @kanaka

    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":
    Image

    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.

  4. github-actions commented on Apr 21, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

  5. phazei commented on Apr 27, 2026

    @phazei

    This is still an issue

  6. stcrd commented on Apr 28, 2026

    @stcrd

    would be a great feature, keep the changes, clean the chat, win-win

  7. franciscorubin commented on Aug 12, 2026

    @franciscorubin

    This is the most basic feature...

  8. qzhhhi commented on Aug 14, 2026

    @qzhhhi

    This is A FUCKING BASIC FEATUREEEE

  9. LuisBalsa commented on Sep 11, 2026

    @LuisBalsa

    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.

    Thanks for considering!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions