anthropics / anthropics/claude-code
[FEATURE] Let /clear reset context without wiping the terminal scrollback
- Dominant language
- Python
- Stars
- 145k
- Forks
- 23.1k
- PR merge metrics
- PR metrics pending
Description
### 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 `/clear` resets 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 `/clear` as 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 `/clear` exists 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 --resume` in 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
Contributor guide
No contributing guide indexed for this repository
Research direction
Start at the CLI's `/clear` command handling and trace how context reset is coupled to terminal clearing. Review the related behavior described in #93726 and #93441, then define whether a setting or separate command best fits. Done means context resets while prior output remains in scrollback, with a visible divider marking the new conversation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100