Skip to content

[Feature]: Prompt navigation - jump to previous/next user prompt #345

Description

@thatdudealso

Feature Description

Read-only prompt navigation for long interactive sessions: jump to previous/next user prompts and (follow-up) pick a prompt from a list. This does not resend, rewind, fork, edit-and-resubmit, or otherwise mutate session state. Composer Up/Down history-recall stays unchanged. Cross-session jumping and scrollbar tick-marks are out of scope (marks would need an OpenTUI primitive that does not exist yet).

Problem

In a long TUI session the only way back to a prompt you wrote is manual scrolling and eyeballing user turns among assistant output, tool traces, and subagent noise. That gets expensive once the transcript is long.

Proposed behavior

  1. Keyboard jump (PR 1)

    • Prev / next user prompt relative to the current scroll position (not always the newest).
    • Target prompt lands at/near the top of the viewport so its assistant reply stays visible below.
    • Brief highlight/flash on the jump target.
    • Hard stop at first/last prompt (no wrap), unless maintainers prefer wrap.
  2. Picker (PR 2, after PR 1)

    • List every user prompt as a one-line truncated preview + timestamp.
    • Arrow keys + mouse click; selecting scrolls to that prompt.
    • Candidate openers: dedicated shortcut and/or /prompts (slash menu already hosts /schedule, /verify, etc.).

Data model

Derive an ordered index from existing session/transcript state (role === "user"). Derived, not duplicated - no second source of truth. Each entry: message id, grapheme-safe ~60-char preview (newlines collapsed), scroll anchor.

Implementation sketch (aligned with current tree)

  • Chat scroll lives in src/ui/app.tsx (scrollRef / ScrollBoxRenderable, sticky bottom).
  • Transcript persistence already distinguishes user messages in src/storage/transcript.ts.
  • Picker UI can follow existing modal list patterns (schedule-modal.tsx, mcp-modal.tsx, agents-modal.tsx).
  • Unit-test pure helpers with Vitest (bun test); keep the first PR keyboard-only and small.

Default keybinding candidates (open to bikeshed)

  • Prev / next: ctrl+shift+[ / ctrl+shift+]
  • Picker (PR 2): ctrl+shift+p and/or /prompts

I will verify these do not collide with current handleKey / textarea bindings before locking them in.

Out of scope (explicit)

  • Resend / rewind / fork / edit-and-resubmit
  • Cross-session jump
  • Scrollbar track marks
  • Changing composer history-recall
  • Unrelated repo hygiene (known AGENTS.md ESLint / dev-mode type-import issues)

Prior art

Searched open and closed issues/PRs for prompt navigation, jump-to-prompt, scrollback, and related keyboard/scroll wording. No existing request for this feature; unrelated "prompt" hits only (e.g. prompt-cache metrics, sandbox trust prompt, headless --prompt).

Offer

I am happy to implement this in two small PRs:

  1. Keyboard-only jump + unit tests + flash
  2. Picker dialog built on (1)

Happy to adjust defaults (bindings, wrap vs stop, picker trigger, highlight style) to maintainer preference before or during review.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions