Skip to content

interactive history search #2622

Closed
Closed

Description

@mkusaka

What feature would you like to see?

I would like to request an interactive history search feature for the Codex CLI, similar to the Ctrl+R functionality in bash/zsh shells. This would allow users to quickly search and reuse previous prompts.

Feature Description

Implement an interactive reverse search through prompt history:

  • Trigger: Press Ctrl+R to enter history search mode
  • Search: Type to search through previous prompts (fuzzy matching)
  • Navigate: Use Ctrl+R repeatedly to cycle through matches, Ctrl+S for forward search
  • Select: Press Enter to use the selected prompt, Escape to cancel
  • Edit: Arrow keys to exit search mode and edit the selected prompt before submitting

User Experience

  1. Entering search mode:

    > [Ctrl+R pressed]
    (reverse-i-search)`': _
    
  2. Searching:

    (reverse-i-search)`refactor': refactor this function to use async/await
    
  3. Multiple matches: Press Ctrl+R again to cycle through older matches

Implementation Details

  • Store prompt history persistently (local file or database)
  • Implement fuzzy/substring matching algorithm
  • Display match with highlighting of matched substring
  • Support for:
    • Case-insensitive search
    • Multi-word search terms
    • Configurable history size limit
    • Optional: frecency-based sorting (frequency + recency)

Are you interested in implementing this feature?

No, but I'm happy to test and provide feedback.

Additional information

No response

Activity

  1. added
    TUIIssues related to the terminal user interface: text input, menus and dialogs, and terminal display
    on Oct 28, 2025
  2. PanJason commented on Mar 31, 2026

    @PanJason

    Hi I have implemented here #16249. Feel free to use it. I will keep rebasing until codex allows a pr over it

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

    TUIIssues related to the terminal user interface: text input, menus and dialogs, and terminal displayenhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions