You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[FEATURE]: TUI - Search for and find string in session buffer #4714
feat: Copy Mode for OpenCode #2755: Copy Mode for OpenCode - Requests vim/tmux-like copy mode with text selection and navigation, which would support finding and selecting specific text in the buffer
Feel free to ignore if your specific use case for searching agent output differs from these session/copy mode features.
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.
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:
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?
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...
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
Reacted by Johann Pardanaud and SOFe (Jonathan Chan Kwan Yin)
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
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
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.
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.
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.
Reacted by Radosław Gawryś, cwegener and Michail Theofilatos
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.
@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?
@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.
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
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 =))
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?
/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
Activity
github-actions commentedon Nov 24, 2025
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.
rekram1-node commentedon Nov 24, 2025
good idea
cwegener commentedon Nov 24, 2025
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.
ariane-emory commentedon Nov 26, 2025
Upvoting, I'd love to see this feature too.
OpeOginni commentedon Nov 29, 2025
Have a PR for something like this, any feedback?
further-reduced.mov
rekram1-node commentedon Nov 29, 2025
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
xidiot commentedon Jan 19, 2026
This is something I'm looking since day 1.
unphased commentedon Jan 19, 2026
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:
nesk commentedon Jan 20, 2026
This would definitely be useful, I sometimes have to search for a specific a message in the session.
DebelToni commentedon Jan 30, 2026
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?
unphased commentedon Jan 31, 2026
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...
DebelToni commentedon Jan 31, 2026
You are completely right! Thanks. Until something is merged I use /export without saving and then find what I need in Neovim
nesk commentedon Jan 31, 2026
Well, I'm embarrassed I've never thought about this workaround before. Thank you.
unphased commentedon Feb 1, 2026
Thank you, knowing about
/exporthelps me too.19 remaining items
phanen commentedon Aug 12, 2026
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.
vic-stan commentedon Aug 12, 2026
ooh, kinda similar to
avante?sim590 commentedon Aug 22, 2026
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
/searchA few details:
vic-stan commentedon Aug 24, 2026
yeysyes, it's very interestingg!! pls mr. maintainer merge
dmmop commentedon Aug 26, 2026
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:
xterm-ghostty, truecolor)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.
feat(tui): add find-in-session search
cep207 commentedon Oct 1, 2026
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.
levontumanyan commentedon Oct 6, 2026
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?
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.
sim590 commentedon Oct 6, 2026
@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-searchbranch here. Or are you disregarding this approach already based on the demo above? Did you take a look before posting your message?levontumanyan commentedon Oct 7, 2026
@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-searchbranch 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.
arefdsg commentedon Oct 22, 2026
you should reply yourself instead of having the AI write the replies for you
viktorashi commentedon Oct 22, 2026
honestly be nice to them, they have to maintain 2 versions of opencode in parallel now =))
moritzWa commentedon Oct 22, 2026
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//searchopens 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?
vshulcz commentedon Oct 25, 2026
/exportand 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, anddeja search --harness opencode "15.09.2026"lists the matching sessions with the lines and the session id: https://github.com/vshulcz/deja-vu