Feature Request: Quick-history editing via arrow-key navigation (switch chat history)
What would you like to be added?
Please add an in-place history editing mode in Gemini CLI so I can:
- Press ↑/↓ to scroll through previous messages and see a live preview.
- Hit Enter on a selected message to rewind the session to that point and open the message for editing.
No more manual /chat save before every prompt—just intuitive arrow-key navigation and instant message rewrite.
Why is this needed?
- Natural CLI UX: Arrow keys are the de facto navigation method in terminals.
- On-the-fly fixes: If a single reply is off, I can jump back and tweak it without reloading the entire thread, and avoid forgetting to run
/chat savebeforehand—which otherwise would force restarting the conversation from scratch. - Streamlined workflow: Keeps the conversation flow smooth—no extra commands or context juggling.
Thanks for considering!
Additional context
Related discussion: https://github.com/google-gemini/gemini-cli/discussions/1538
Yeah, I want this by default.
The UX around this is quite bad.
Atlassian's RovoDev CLI does it better. They save all threads in history so if for any reason, it errors out, you can go back to an old thread & "Continue".. please try that CLI & encorporate its best parts in this.
I love the UX of Gemini but this is one of the most missing features that is instant value.
Also would be nice to remove messages from the end of the chat history. Like "/chat pop" or similar.
So just to perhaps put a user flow to this
-
User starts a conversation 1.1 User prompt 1: 'Write a python function that adds two numbers'. 1.2 User prompt 2: 'Now make it substract'
-
Model gets confused and gives generic answer that doesn't help (as a hypothetical)
-
User presses up arrow key once
-
Input box populates with last prompt ('Now make it substract')
This is current gemini-cli behaviour at the moment of step 4.
- User presses 'enter' after the up arrow key (or some other key combination/command - someone suggested '/chat pop'.
- The chat history should rewind based upon how many up arrow keys and the prompt that appears in the input box - in this example the gemini response that was generic is removed.
- After the rewind - The cursor is active in the input box with prompt 2
- User edits the incorrect prompt to 'Now make it subtract'
- User presses enter to submit the correct prompt
- Conversation continues correctly as gemini provides the right response.
Happy to work on this if my understanding is correct and there's alignment on UX.
Thanks for volunteering! The up arrow is already an established pattern. I use up arrow to intentionally execute something from history. I would be surprised if it changed to do something else like rewind.
"/chat pop" expresses my intent more directly to modify the context. It would be natural to extend it for more sophisticated history editing like "/chat drop 3" (sure this will mess with context caching, but I want the context control since this is what I can do in AI studio and many other interfaces).
Also needs clarification: I'm assuming /chat pop would leave my files as is, since it's referring to "chat" specifically. If there is a feature to also undo the changes, it should be a separate command like /undo or something.
I think we can keep it simple. In Claude Code and Codex, we only need to press Esc twice to enter this browsing history mode. This interaction is very simple and fast, and I think we can adopt this good design.
Thanks for your thoughts.
Agreed something like a double esc works, but this key binding already removes text for this in gemini-cli, I don't think enter is the correct keyboard either too confusing (I merely put it in there to aid discussion towards a spec). Something like '/reverse' works, open to suggestions, Adding in things like drop 3 etc... feels a little overcomplicated when you have a UI to do this type of work but i understand the appeal.
in Claude code, i see there's the ability to change code and change conversation or both, I think for now as an MVP conversation would be the first step imo, but would love ideas from those internally.
Still a little fuzzy on what the user should see when in reverse mode (step 6 in my list), should the user see the prompts which doesn't provide context or a summary of the model's output together (are these outputs even stored?) with the prompt so that you understand at which checkpoint to select back to ? If that is the case, I would suggest adding the last few prompt/output states and allow user to use arrows to navigate up or down.
Agreed something like a double esc works, but this key binding already removes text for this in gemini-cli
Same for claude code. Double-Escape with filled text input clears the text input, with empty text input it summons the "Rewind" selector to step back in the conversation (This also rolls back file changes made by the agent in Claude Code!)
Extremely silly that a dozen companies make their own similar agent CLI each with unique downsides.
I personally would vote for aligning with Claude Code, especially as many users will be inevitably switching over from Claude Code now Google is leading the race, makes sense to make it easy for them to transition. Also, just to emphasise, the current UX having to make a checkpoint with /chat save [x_name] is so backward. Imagine the command line crashes and you've lost your entire chat !
I belive gemini --resume without any additional arguments launches gemini and restores the last chat. I have used it yesterday because I lost my chat because of WebStorm. This --resume argument is not documented anywhere or I was unable to find info about it.
Edit: I have checked it more thoroughly: Read my observations here: https://github.com/google-gemini/gemini-cli/discussions/1538#discussioncomment-15045530