Problem
In the Claude Code CLI (TUI mode), older messages in a conversation become invisible and cannot be scrolled back to, even before context compression kicks in. The terminal's own scrollback buffer (e.g., Ghostty scrollback-limit = 100000) has no effect because Claude Code uses the alternate screen buffer, which bypasses terminal scrollback entirely.
This means critical information is lost from view during a session:
- Tool call results (file contents, command output, search results)
- Code diffs and changes made earlier in the conversation
- Architectural decisions and reasoning from earlier messages
- Error messages and debugging context
There is no user-configurable setting (settings.json, environment variable, or CLI flag) to control how many messages are rendered in the TUI.
Proposed Solution
- Virtual scrolling in TUI - Render only visible messages in the viewport, but allow scrolling back through the full conversation history (similar to how terminal multiplexers handle scrollback)
- Configurable render limit - At minimum, expose a setting (e.g.,
maxRenderedMessages or tui.scrollbackLines) so users can control how much history is kept renderable
- Lazy rendering on scroll - Load and render older messages on demand when the user scrolls up, rather than discarding them
Environment
- Claude Code v2.1.51
- Terminal: Ghostty (also reproducible in iTerm2, Terminal.app)
- OS: macOS
Related
Problem
In the Claude Code CLI (TUI mode), older messages in a conversation become invisible and cannot be scrolled back to, even before context compression kicks in. The terminal's own scrollback buffer (e.g., Ghostty
scrollback-limit = 100000) has no effect because Claude Code uses the alternate screen buffer, which bypasses terminal scrollback entirely.This means critical information is lost from view during a session:
There is no user-configurable setting (
settings.json, environment variable, or CLI flag) to control how many messages are rendered in the TUI.Proposed Solution
maxRenderedMessagesortui.scrollbackLines) so users can control how much history is kept renderableEnvironment
Related