Calling /clear drops entries from navigating history with the up arrow
What happened?
When you type /clear it resets the chat history which is useful when trying to save chat tokens. However it breaks flows where users want to type clear and then repeat a prompt they just typed. For example, I often do this when trying to repeat the previous prompt to run and fix tests with a clean context window. Chats from before the current conversation are still shown just not chats from the latest conversation.
What did you expect to happen?
Expect the only effect of clear to be to clear the conversation history not break the history of chats accessible with the up arrow.
Client information
$ gemini /about
# paste output here
Login information
No response
Anything else we need to know?
No response
A simple solution would be to manage the history using a flag, which would ensure that the input history remains accessible after clearing the chat. However, considering future scalability and separation of concerns, we could also explore managing input history independently from the main chat history.
Which approach do you think would be more suitable for the project? Or do you have any other recommended solutions?
I think managing input history separately might be the simplest. the two do not need to be the same. and the input history is small enough that storing it separately would not use significant memory.
@jacob314 Thank you for your response and suggestion. I will proceed with addressing the issue based on that approach.
/clear is nuking two different things: the model context (good) and your local input history (bad when you want ↑ to repeat the last prompt). They should be separated.
Proposed behavior (short):
/clear: drop conversation context only; keep input history so ↑ still shows your previous prompt. /clear --all (optional): wipe both context and input history for privacy. Keep input history in a tiny separate ring buffer (e.g. 50–100 entries); negligible memory. Don’t store the /clear command itself as a history entry (or filter commands starting with /). Acceptance:
After /clear, pressing ↑ returns the last real prompt. After /clear --all, ↑ returns nothing. No noticeable performance or memory change. Happy to open a PR with that split if approved. Let me know.
In my case /clear doesnt clear the up arrow history.
Is this has since been changed?
It doesn't clear old history but it clears recently added history from your conversation which is really annoying if you cleared to reset the context and wanted to repeat a command you just entered.