Skip to content

Feature: live reply preview, scrollable approval diffs, a context meter, and /history in the CLI - #101

Merged
DevMando merged 3 commits into
mainfrom
feature/cli-live-ui
Sep 25, 2026
Merged

DevMando merged 3 commits into
mainfrom
feature/cli-live-ui

Conversation

@DevMando

Copy link
Copy Markdown
Owner

Summary

Four additions to the CLI that make long replies, long diffs and long sessions easier to follow:

  1. Live reply preview: while a reply streams, its latest lines show dimmed above the spinner.
  2. Scrollable diffs in approvals: a long diff shows in a scrollable window above the approve/deny menu instead of pushing the menu off screen.
  3. Context meter: a bar above the prompt shows how full the model's context window is.
  4. /history: browse this session's conversation, filtered as you type.

What changed

  • Live reply preview: the last five lines of the streaming reply appear dimmed above the spinner and update at most once per spinner frame. They disappear with the spinner, and the finished reply still prints as formatted markdown. Lines are fitted to the terminal width so a wrapped line can't throw off the redraw.
  • Scrollable diffs: a change over 30 lines that needs a decision now leaves a one-line summary in scrollback. The diff itself appears in a fixed-height window above the menu, scrolled with PgUp/PgDn/Home/End, while ↑/↓ and Enter still choose. Short diffs and auto-approved changes print as before.
  • Context meter: shows the last request's size against the model's context window, e.g. Context ████████░░░░ 17k / 32k (54%). It turns yellow at 60% and red at 85%, with the empty part drawn in grey so the bar's length is easy to read. Cloud models manage their window server-side, so they show the token count only.
  • /history: opens the session's messages in a scrollable window with a search box. Tab moves between the search box and the list; Esc, or Enter on an empty search, closes it.

Why this was done

  • A long reply used to look like a frozen "Thinking…" until it finished.
  • A long diff could push the approval menu hundreds of lines down, so reviewing a large change meant scrolling back and forth.
  • On small local models, the context window fills quickly and the model then starts losing the earlier conversation. The meter shows when to run /compact before that happens.
  • There was no way to look back through a long session without scrolling the terminal.

How it was tested

  • New unit tests for the preview layout (wrapping, wide characters, control characters) and the context meter math (levels, clamping, cloud models). The full harness test suite passes on .NET 8 and .NET 10.
  • Checked in the CLI: the context meter renders and updates after each reply.
  • Not yet exercised by hand: PgUp/PgDn in a long diff approval, and Tab/Esc in /history. These depend on how RazorConsole reports those keys, so they're worth a quick manual check.

Notes

  • The meter and /history only render while the CLI is idle, and the diff window only while an approval menu is up. RazorConsole redraws its area in place, so it can't share the screen with output printed while a request runs. The live preview uses the spinner's existing redraw technique for the same reason.
  • MandoCode Desktop reads the CLI's slash-command list for its autocomplete, so /history will show there once Desktop picks up this engine version. Desktop has no handler for it and reports it as unknown; Desktop's transcript already has Ctrl+F search.
  • Changelog: entries added under [Unreleased] → Added.

DevMando and others added 3 commits September 24, 2026 15:28
… and /history

Live preview: while a reply streams, the spinner shows its last five
lines above the spinner line, redrawn at most once per spinner frame and
cleared with the spinner. The finished reply still prints as rendered
markdown. ReplyPreview wraps by terminal cells so no row can wrap on its
own and throw off the cursor-up redraws.

Scrollable diffs: a diff longer than 30 lines that needs a decision no
longer prints above the approval menu. Scrollback gets a one-line summary
and the diff shows in a fixed-height ScrollPreview above the menu, scrolled
with PgUp/PgDn/Home/End while the menu keeps focus for the arrow keys.
Short diffs and auto-approved ones print as before.

Context meter: a line above the prompt shows how full the context window
is, from the last request's prompt tokens. Local models get a bar against
the configured context length; cloud models, whose window is managed
server-side, show the token count.

/history: browse this session's conversation in a scrollable window,
filtered as you type, with Tab between the search box and the list.

The meter and /history render only while the app is idle, and the
approval preview only while a menu is up: RazorConsole redraws its region
in place, so it can't share the screen with output printed mid-request.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The whole bar was one Markup in the level color, so on bright or glowing
themes the shaded empty cells read as nearly full. The used part keeps
the level color and the unused part is grey, in a gapless FlexBox row so
the two halves stay joined.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant