[FEATURE] Let /clear reset context without wiping the terminal scrollback
Problem
/clear does two separate things at once: it empties the model's context, and it wipes the terminal, so the previous conversation is no longer on screen or in scrollback.
The usual reason to clear is that the old context has stopped being useful and is costing tokens. But the moment right after a clear is exactly when I still need to read the previous conversation: the last answer, the command it suggested, the decision we just made. Today I have to choose between a fresh context and being able to see what we were just talking about.
Observed in the CLI (2.1.274, Linux, tmux 3.4): after /clear, scrolling back no longer shows the earlier conversation.
Proposed solution
Let context reset and screen wipe be separable. Either:
- a setting, e.g.
"clearScreenOnClear": false, under which/clearresets the context, prints a divider such as── context cleared ──, and leaves everything above it in scrollback; or - a separate built-in (e.g.
/reset) with that behaviour, leaving/clearas it is.
The divider keeps it obvious where the new conversation starts, which is the concern raised from the other direction in #93726.
Alternatives tried
- Start a new session in another pane or window. Works, but it is several steps every time, which is the friction
/clearexists to remove. /compact. Keeps a summary in context rather than an empty one, and has been reported to clear the screen too (#18204).- A custom command wrapping
/clear. Not possible: command bodies cannot dispatch built-ins (#85429, #91146; earlier #37307 was closed for inactivity). claude --resumein another pane, or reading the JSONL transcript. Read-only at best; typing in the resumed session brings the old context back.
Related
- #27242: no way to review earlier conversation after compaction or clear
- #93441: option to disable the terminal clear on session start
- #82658, #90089: automatic context clearing