Skip to content

[FEATURE]: TUI - Search for and find string in session buffer #4714

Open

Description

@cwegener

Feature hasn't been suggested before.

  • I have verified this feature I'm about to request hasn't been suggested before.

Describe the enhancement you want to request

Similar to how 'find' works in a text editor, I sometimes need to find a certain string in the agent's output.

This does not seem possible in the TUI at the moment.

Some possible inspirations to look at for designing such a feature:

  1. vim (both normal buffers and vim's terminal buffer)
  2. tmux

Also, ghostty community has had some interesting conversations about their design of the scrollback search feature: ghostty-org/ghostty#189

Activity

  1. added
    discussionUsed for feature requests, proposals, ideas, etc. Open discussion
    on Nov 24, 2025
  2. github-actions commented on Nov 24, 2025

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    Feel free to ignore if your specific use case for searching agent output differs from these session/copy mode features.

  3. rekram1-node commented on Nov 24, 2025

    @rekram1-node
    Contributor

    good idea

  4. cwegener commented on Nov 24, 2025

    @cwegener
    Author

    good idea

    I only just noticed it today for the first time that this is a functionality that would be useful. (And I've been using opencode for 2 months now)

    The way I realized that I needed to find strings in the session's output buffer was because I was running opencode on a codebase that I am not extremely familiar with. And I was running the 'Plan' agent quite a lot to produce a lot of summaries to specific questions that I had about the code base (mostly architecture).

    And when I went back to the historical session in the TUI on the next day, I wanted to check if some of the session output had already mentioned one particular method inside one of the codebase's modules I wanted to know more about.

    My idea being, that if my previous session's context was already mentioning the name of the particular method I was after, I might just continue that same session and get a really good output in response. And otherwise I might start a new session ...

    But I'm sure there are additional use cases for such find/search inside session buffer functionality.

  5. ariane-emory commented on Nov 26, 2025

    @ariane-emory
    Contributor

    Upvoting, I'd love to see this feature too.

  6. OpeOginni commented on Nov 29, 2025

    @OpeOginni
    Contributor

    Have a PR for something like this, any feedback?

    further-reduced.mov
  7. rekram1-node commented on Nov 29, 2025

    @rekram1-node
    Contributor

    this is cool, Im not 100% sure if we wanna put it in the prompt box but this is very nice ill have david (our designer) take a look

  8. xidiot commented on Jan 19, 2026

    @xidiot

    This is something I'm looking since day 1.

  9. unphased commented on Jan 19, 2026

    @unphased

    I'm building a high scalability terminal recorder that will let me travel through time to solve this issue in general for terminals, but... it's not close to ready yet and it's also not quite the right hammer for this nail.

    I must say it's rather appalling that this feature does not exist yet. I've been extremely impressed with opencode so far though. For example the syntax colorization of code diffs is chef's kiss:

    Image
  10. nesk commented on Jan 20, 2026

    @nesk

    This would definitely be useful, I sometimes have to search for a specific a message in the session.

  11. DebelToni commented on Jan 30, 2026

    @DebelToni

    Get this merged to main ASAP. Any implementation is fine. BTW why does the TTI use the single windowed mode instead of continuing terminal flow so we can use tmux to find and to stuff?

  12. unphased commented on Jan 31, 2026

    @unphased

    Because if you look at an implementation of a console that uses the scrollback, like codex, it's insanely easy to corrupt and garble the output and scrollback just by resizing your terminal. This way is better but IMO it should not have even shipped without a search feature...

  13. DebelToni commented on Jan 31, 2026

    @DebelToni

    Because if you look at an implementation of a console that uses the scrollback, like codex, it's insanely easy to corrupt and garble the output and scrollback just by resizing your terminal. This way is better but IMO it should not have even shipped without a search feature...

    You are completely right! Thanks. Until something is merged I use /export without saving and then find what I need in Neovim

  14. nesk commented on Jan 31, 2026

    @nesk

    Until something is merged I use /export without saving and then find what I need in Neovim

    Well, I'm embarrassed I've never thought about this workaround before. Thank you.

  15. unphased commented on Feb 1, 2026

    @unphased

    Thank you, knowing about /export helps me too.

  16. 19 remaining items

  17. phanen commented on Aug 12, 2026

    @phanen

    for nvim user, https://github.com/sudo-tee/opencode.nvim/ allow to interact with chat in a normal buffer.

    openncode's API is comprehensive. I think building another third-party TUI with native terminal scrollback shouldn't be difficult.

  18. vic-stan commented on Aug 12, 2026

    @vic-stan

    for nvim user, https://github.com/sudo-tee/opencode.nvim/ allow to interact with chat in a normal buffer.

    openncode's API is comprehensive. I think building another third-party TUI with native terminal scrollback shouldn't be difficult.

    ooh, kinda similar to avante ?

  19. sim590 commented on Aug 22, 2026

    @sim590

    I did implement this feature myself. I did a couple months ago and I was waiting for some other PRs of mine to get merged, but... Nothing got merged, so I decided to forget about contributing. I'm not going to push a branch and create a PR before I get the confirmation that this implementation is interesting in anyway.

    Here is the demo:

    recording.mp4
    • keymaps
      • to trigger: ctrl-x /
      • next/previous: Enter / Shift+Enter
    • command: /search

    A few details:

    • it searches in user text and responses from the LLM;
    • handles searching in tables by converting tables to bare markdown while in search mode and resets the view afterwards
    • keeps the view on the appropriate height of the conversation scoller after pressing ESC
  20. vic-stan commented on Aug 24, 2026

    @vic-stan

    I did implement this feature myself. I did a couple months ago and I was waiting for some other PRs of mine to get merged, but... Nothing got merged, so I decided to forget about contributing. I'm not going to push a branch and create a PR before I get the confirmation that this implementation is interesting in anyway.

    Here is the demo:

    recording.mp4

    • keymaps

      • to trigger: ctrl-x /
      • next/previous: Enter / Shift+Enter
    • command: /search

    A few details:

    • it searches in user text and responses from the LLM;
    • handles searching in tables by converting tables to bare markdown while in search mode and resets the view afterwards
    • keeps the view on the appropriate height of the conversation scoller after pressing ESC

    yeysyes, it's very interestingg!! pls mr. maintainer merge

  21. dmmop commented on Aug 26, 2026

    @dmmop

    Requesting this feature for opencode v2 as well — this issue was opened during v1, but the v2 TUI still has no way to search text within an open session (no Ctrl+F, /search, or remappable keybind), so finding anything in long sessions means scrolling manually or leaving the TUI via /export.

    Environment where I hit this on v2:

    • opencode version: opencode2 v0.0.0-beta-18155 (beta channel)
    • OS: Linux x64
    • Terminal: Ghostty (xterm-ghostty, truecolor)
    • Shell: zsh

    Note for maintainers: there are three prior implementation attempts that were closed without merging and might be useful as reference — #4898 (Ctrl+F, message-block granularity), #34297 (dialog-based), #36526 (inline incremental Ctrl+R with occurrence-level matching). Happy to test any of these approaches on v2.

  22. self-assigned this
    on Sep 17, 2026
  23. cep207 commented on Oct 1, 2026

    @cep207

    Same need here — in OpenCode Desktop.

    Use case: I keep daily status reports inside a single session. When I need to
    find the report for a specific date (e.g. "15.09.2026") weeks later, the only
    way today is to scroll back through thousands of lines — practically impossible.

    A Ctrl+F-style search in the session buffer (jump to match, next/prev,
    highlight) would fully cover it. Note this applies to the Desktop app too,
    not only the TUI — there is currently no way to search conversation history
    inside an open session there.

  24. levontumanyan commented on Oct 6, 2026

    @levontumanyan

    I'm interested in contributing in-session search for the OpenCode TUI. Before I start coding, could a core-team maintainer review the proposed behavior and advise on the design?

    My main requirement is that search covers the whole current session, not only the visible terminal viewport or currently rendered rows. I propose an incremental search with a match count, next/previous navigation, highlighted matches, and a jump that scrolls the TUI to each match, including matches outside the current viewport.

    Could you advise on a few scope questions?

    • Should search cover user and assistant text only, or tool output too? Should collapsed tool output be searchable?
    • Should it cover the complete session history, including older messages not currently loaded into the view?
    • Is there a preferred keybinding or interaction pattern for the TUI?
    • Is there an existing design direction or prior implementation you would like a contribution to follow?

    I saw the earlier attempt in #4898 and the discussion here about jumping to a result. I would make reliable navigation to the matched text part of the design, rather than only counting matches in rendered output. If this scope looks right, I can work up a focused implementation and tests.

  25. sim590 commented on Oct 6, 2026

    @sim590

    @levontumanyan: note that my implementation showed in a demo above already does what you are asking for (covering the whole session, the output of the LLM and user messages).

    Maintainers are obviously not considering this a priority, hence their silence.

    Since you seem to be interested in making efforts to make this work (even though maintainers give next to no sign of approval), you should have a look at my implementation on feat/session-search branch here. Or are you disregarding this approach already based on the demo above? Did you take a look before posting your message?

  26. levontumanyan commented on Oct 7, 2026

    @levontumanyan

    @sim590 I simply hadn't noticed your implementation when I posted earlier. That was my oversight; I wasn't disregarding your work. Please don't assume I had seen it and dismissed it.

    I've now reviewed the feat/session-search branch and agree it's a useful starting point. My earlier questions were about getting design feedback before contributing, not asking you to prove the feature is worthwhile. Searching the currently loaded session is fine for my immediate need; I understand the history limit can be addressed separately.

    Thanks for pointing me to the branch. I appreciate the implementation and the demo.

  27. arefdsg commented on Oct 22, 2026

    @arefdsg

    61. @sim590 I simply hadn't noticed your implementation when I posted earlier. That was my oversight; I wasn't disregarding your work. Please don't assume I had seen it and dismissed it.
    I've now reviewed the feat/session-search branch and agree it's a useful starting point. My earlier questions were about getting design feedback before contributing, not asking you to prove the feature is worthwhile. Searching the currently loaded session is fine for my immediate need; I understand the history limit can be addressed separately.
    Thanks for pointing me to the branch. I appreciate the implementation and the demo.

    you should reply yourself instead of having the AI write the replies for you

  28. viktorashi commented on Oct 22, 2026

    @viktorashi

    31. > 61. @sim590 I simply hadn't noticed your implementation when I posted earlier. That was my oversight; I wasn't disregarding your work. Please don't assume I had seen it and dismissed it.
    > I've now reviewed the feat/session-search branch and agree it's a useful starting point. My earlier questions were about getting design feedback before contributing, not asking you to prove the feature is worthwhile. Searching the currently loaded session is fine for my immediate need; I understand the history limit can be addressed separately.
    > Thanks for pointing me to the branch. I appreciate the implementation and the demo.

     you should reply yourself instead of having the AI write the replies for you
    

    honestly be nice to them, they have to maintain 2 versions of opencode in parallel now =))

  29. moritzWa commented on Oct 22, 2026

    @moritzWa

    Porting this to v2, as asked on the closed v1 PR (#53589, which got an LGTM review before the v1 branch closed). It already runs on v2 in my fork. Demo: https://raw.githubusercontent.com/moritzWa/opencode/pr-assets/search-demo.gif

    What it does: <leader>f / /search opens a bar; matches are highlighted in place in user messages and assistant markdown (tables included), enter/↓ and ↑ scroll to the exact line, Esc clears. Smart case, plain text. Tool and bash output are not searched, and only loaded messages are reachable.

    Design question before I open a v2 PR: this needs to scroll the transcript to a match and decorate rendered text in place, which a TUI plugin can't do today. Would you take it as a native TUI feature, or would you rather have a plugin API for scroll-to-row and text highlights first?

  30. vshulcz commented on Oct 25, 2026

    @vshulcz

    /export and a grep still works today, and the text of every session is already in ~/.local/share/opencode/opencode.db, so it can be searched from outside the TUI. i built a small cli that indexes it, and deja search --harness opencode "15.09.2026" lists the matching sessions with the lines and the session id: https://github.com/vshulcz/deja-vu

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

Metadata

Metadata

Assignees

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