TUI: pasting "f" or "q" in backtrack browse forked or closed instead of typing
it, because a single-character paste reached the browse key table. Pasted
input now closes browse and types into the composer.
CLI: a bracketed paste in browse was swallowed (browse stayed open and the text
vanished). It now closes browse and goes to the normal paste handler.
Review finding (P2, cli_backtrack primed_chord): primed_chord included
lone_esc, which requires an empty key queue, so a recognised primed chord
stopped matching when another key was already buffered: Esc + Left + Enter
in one read did nothing, Esc + Enter + X gave "\nX".
The empty-queue condition now gates only lone-Esc eagerness. The primed
chord needs the prime plus an idle, empty composer; the key it replays is
fed at the front of the queue, so the keys behind it run after, in order.
Review finding "Enter on an image prompt prefills the model-side expansion": the stored row holds
the vision description and cache path the model got, and both surfaces put that in the composer.
split_image_notes (agent/image_routing.py, mirrored in ui-tui lib/imageNotes.ts) removes the
leading vision notes and trailing [Image attached at: ...] hints. The TUI attaches each named
image again as a composer image; the CLI prefills the typed text only (an armed CLI edit sends
text, as before).
Review M1. The terminal parser holds a lone Esc for the escape timeout,
so a browse key typed sooner after the second Esc arrived as Alt+←
(word jump) or Alt+Enter (newline) and cancelled the prime. While primed
on an idle, empty composer, ('escape', key) for every browse key now
opens browse and then applies the key. Unprimed or with a draft, Alt
keys are unchanged.
Tests drive the real prompt_toolkit parser and key processor through a
pipe input (also replaces the browse test that called the close helper
directly instead of pressing Esc/q).
Live: with a non-eager lone-Esc binding the second Esc waited out prompt_toolkit's
escape timeout and then matched Esc Esc only on the next press. The lone Esc is
now eager on an idle, empty composer with no further key already queued; an
Alt-sequence arrives in one terminal read, so Esc+Enter / Esc+V still match as
a pair (verified live: Esc+Enter inserts a newline on an empty and a non-empty
composer). With a draft it stays non-eager, so Esc Esc still discards it.
Esc on an idle, empty composer now PRIMES and shows `esc again to edit previous
message` (no time window; any other key cancels the prime and acts normally).
Esc again opens BROWSE: a transcript pager panel (prompt_toolkit can't scroll
the terminal's scrollback) with every `› prompt` / `• reply`, wrapped by terminal
cells and sized to the screen, the latest prompt selected in reverse video.
←/h →/l pick an older/newer prompt (clamped, scrolled into view), ↑↓/jk scroll a
row, PgUp/PgDn a page, Enter puts the prompt back in the composer (nothing is cut
until the edit is sent, unchanged), f forks, Esc/q/Ctrl+C close, any other key
closes browse and then types normally. /rewind opens browse directly.
The lone-Esc binding is not eager, so Esc+Enter / Esc+V / Esc Esc still match
first; it is off in vi insert mode and while any prompt owns the composer. Esc Esc
with a draft still discards it (main behaviour). The old list picker rendering and
its preview_label / more_lines keys are gone; prime_hint / no_previous are added
to every locale. Behaviour lives in cli_backtrack.py + cli_backtrack_browse.py;
cli_tui_mixin.py is untouched.
Classic CLI gains a Codex-style backtrack picker. Esc Esc on an idle, empty composer with no
overlay (or /rewind) lists earlier prompts newest first with a preview and turn number.
- Enter: prefill the prompt for editing. Nothing is cut until the edit is submitted; the
submission rides to the process loop as a BacktrackResend, which re-validates the picked
turn (same session, same text) and then runs the same durable rewind /undo uses. Esc Esc,
Ctrl+C, an empty submit, or submitting a slash/! command cancels and cuts nothing.
- f: fork. Runs the existing /branch path, then rewinds only the CHILD to just before the
picked prompt and prefills it; the parent's rows stay active.
- /rewind N and /rewind fork N do the same without the picker.
Esc Esc with a draft still discards it; mid-turn Esc Esc is unchanged.
undo_last's rewind body moves into CLISessionMixin._rewind_to_user_ordinal (shared by /undo
and the picker; same compaction-carrier handling, agent patching and memory rewound hook).
The picker lives in a new hermes_cli/cli_backtrack.py mixin; cli_tui_mixin.py is untouched.
CommandDef rewind is cli_only (desktop: terminal); desktop registry and parity table regenerated.