Skip to content

Feature: rewind/edit-and-resubmit (like Claude Code's double-Esc) #21910

@SaguaroDev

Description

@SaguaroDev

Summary

Add a first-class "rewind" affordance to jump back to a prior user message in the current session and re-prompt from there, discarding everything after. Equivalent to Claude Code's double-Esc behavior.

Motivation

When a turn goes off the rails (bad tool call cascade, misunderstood intent, polluted context), the user's options today are:

  • /new — nukes the whole session, loses durable context
  • /branch — forks into a new session (good for exploration, not for "undo")
  • Manually tell the agent "ignore that, instead..." — context is still polluted, model has already committed to a direction, wastes tokens

There's no clean "back up two turns and try again" primitive. This is the single biggest UX gap relative to Claude Code for users coming from that tool.

Proposed UX

  • /rewind (and a keybind, e.g. double-Esc in CLI / TUI) opens a picker showing the last N user messages
  • User selects a target message; transcript is truncated to just before that message; cursor lands in the input prompt pre-filled with the selected message text (editable)
  • Submitting replays from that point — all messages, tool calls, and assistant turns after the rewind point are dropped from the active context
  • Rewind point is a soft delete in the SQLite session store (recoverable / inspectable), not a hard truncate, so session_search and audit can still see what was rewound

Scope

Related

/branch is a sibling primitive (fork into new session) but doesn't solve the in-place undo case.

Acceptance

  • /rewind command + double-Esc keybind in CLI and TUI
  • Truncated transcript no longer shown to the model on the next turn
  • Rewound rows preserved in SessionDB (inactive flag), not deleted
  • Memory providers notified on rewind
  • Tests covering: rewind to first user message, rewind mid-session, rewind then continue normally, rewind across tool-call boundaries

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Low — cosmetic, nice to havecomp/cliCLI entry point, hermes_cli/, setup wizardcomp/tuiTerminal UI (ui-tui/ + tui_gateway/)type/featureNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions