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
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:
vim (both normal buffers and vim's terminal buffer)
tmux
Also, ghostty community has had some interesting conversations about their design of the scrollback search feature: ghostty-org/ghostty#189
Reacted by Tom, Arsham Shirvani, Shmuel Hizmi, Niels Mentink, Sashank Gunda, Steven Lu, Johann Pardanaud, Anatoli Tsinovoy, nenahp, Justas Raudonius and 59 more
Reacted by xpufx, OPProductivity, Ioan-Victor Stan, Melker Ulander, cateyes99, cep207 and Levon Tumanyan
Reacted by Ioan-Victor Stan, Melker Ulander, Theodor Nikulin, Levon Tumanyan and Fabien Battello
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)
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
Thanks for the request, @cwegener! You're asking for a find-in-session search in the TUI: look up a string anywhere in the current session's transcript (agent output and your messages) and jump between matches, much like / in vim or tmux copy mode.
The v2 TUI doesn't have this yet. Maintainers will consider it. Related work and issues:
For now, the workaround mentioned above still works: run /export and search the exported transcript in your editor.
This can't be built as a TUI plugin yet. A plugin can read the session's messages, but it has no way to scroll the session view to a match or highlight it.
A short map of where this stands, since the open question now is "native, or plugin API first?" (@moritzWa's comment).
Tried so far:#4898 (Ctrl+F, whole-message matches), #34297 (dialog), #36526 (inline Ctrl+R), #53589 (v1, got an LGTM, closed with the v1 branch), and @sim590's feat/session-search branch. They differ in UI (dialog, inline bar, Ctrl+R) but agree on the core: type, see matches, jump next and previous. So the UX is mostly settled. What's blocking is where the code lives.
The gap is two small things, not search itself.@simonklee said plugins are the preferred route but can't jump to a result, and the bot reply above confirms it: a plugin can read messages but can't scroll the session view or mark text. So the smallest unblock might be two plugin primitives:
scrollTo(messageID, partID, line?): bring a part into view.
highlight(ranges) / clearHighlights(): decorate rendered text without changing it.
Search then ships as a built-in plugin (the #53589 port fits almost as is), and the same two calls cover other asks in this thread for free: jump to an earlier prompt (@Mehdi-afs's /prompts idea), jump to the last error, bookmarks.
Scope for v1, answering @levontumanyan's questions with what the existing attempts already do:
Search user and assistant text. Leave tool and bash output out for now; it's noisy and often collapsed.
Loaded messages only, but say so: "3 matches in loaded messages" rather than a silent miss on older history.
/search plus one keybind, Enter / Shift+Enter for next and previous, Esc returns to where you were.
If a maintainer can pick "two primitives first" or "native first", I think the port is ready to go either way.
#53589 implemented this for V1 and was closed only because V1 is frozen. I'd like to port it to V2. Before I start: is the in-place-highlight approach from that PR still the design you'd take, or should the V2 version look different?
Keybinding (asked twice in this thread, still unanswered):super+f is deliverable on v2 today, and it's the key people reach for first. OpenTUI negotiates the kitty keyboard protocol and its parser exposes super/hyper; cli.json already accepts super+… (input.select.all defaults to super+a). The blocker is the terminal, not the TUI — Ghostty 1.4.0 binds super+f=start_search by default, so it needs keybind = super+f=unbind (nothing lost; terminal find can't see an alt-screen app). iTerm2/Terminal.app would need a key remap to send the sequence.
So: super+f on macOS, ctrl+f elsewhere, scoped to the session view so the prompt keeps ctrl+f = move-right, with /search and @moritzWa's <leader>f as the config-free path. Not ctrl+shift+f: Windows Terminal and the common Linux terminals reserve it for their own find, so it never reaches the app.
Answering @cwegener's open question (can the minimal TUI load a historical session into the primary screen): it already does. opencode mini --session <id> replays that session into normal scrollback — checked on v2.3.0 against an old session — so terminal find works on past sessions today, no /export needed. Caveat: mini.replay_limit defaults to 200 messages.
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.23 remaining items
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-vuopencodejr commentedon Oct 29, 2026
Thanks for the request, @cwegener! You're asking for a find-in-session search in the TUI: look up a string anywhere in the current session's transcript (agent output and your messages) and jump between matches, much like
/in vim or tmux copy mode.The v2 TUI doesn't have this yet. Maintainers will consider it. Related work and issues:
For now, the workaround mentioned above still works: run
/exportand search the exported transcript in your editor.This can't be built as a TUI plugin yet. A plugin can read the session's messages, but it has no way to scroll the session view to a match or highlight it.
balabommablock-cpu commentedon Oct 31, 2026
A short map of where this stands, since the open question now is "native, or plugin API first?" (@moritzWa's comment).
Tried so far: #4898 (Ctrl+F, whole-message matches), #34297 (dialog), #36526 (inline Ctrl+R), #53589 (v1, got an LGTM, closed with the v1 branch), and @sim590's
feat/session-searchbranch. They differ in UI (dialog, inline bar, Ctrl+R) but agree on the core: type, see matches, jump next and previous. So the UX is mostly settled. What's blocking is where the code lives.The gap is two small things, not search itself. @simonklee said plugins are the preferred route but can't jump to a result, and the bot reply above confirms it: a plugin can read messages but can't scroll the session view or mark text. So the smallest unblock might be two plugin primitives:
scrollTo(messageID, partID, line?): bring a part into view.highlight(ranges)/clearHighlights(): decorate rendered text without changing it.Search then ships as a built-in plugin (the #53589 port fits almost as is), and the same two calls cover other asks in this thread for free: jump to an earlier prompt (@Mehdi-afs's
/promptsidea), jump to the last error, bookmarks.Scope for v1, answering @levontumanyan's questions with what the existing attempts already do:
/searchplus one keybind, Enter / Shift+Enter for next and previous, Esc returns to where you were.If a maintainer can pick "two primitives first" or "native first", I think the port is ready to go either way.
delaysystem commentedon Nov 10, 2026
#53589 implemented this for V1 and was closed only because V1 is frozen. I'd like to port it to V2. Before I start: is the in-place-highlight approach from that PR still the design you'd take, or should the V2 version look different?
mindxploit commentedon Nov 13, 2026
Two things not covered above.
Keybinding (asked twice in this thread, still unanswered):
super+fis deliverable on v2 today, and it's the key people reach for first. OpenTUI negotiates the kitty keyboard protocol and its parser exposessuper/hyper;cli.jsonalready acceptssuper+…(input.select.alldefaults tosuper+a). The blocker is the terminal, not the TUI — Ghostty 1.4.0 bindssuper+f=start_searchby default, so it needskeybind = super+f=unbind(nothing lost; terminal find can't see an alt-screen app). iTerm2/Terminal.app would need a key remap to send the sequence.So:
super+fon macOS,ctrl+felsewhere, scoped to the session view so the prompt keepsctrl+f= move-right, with/searchand @moritzWa's<leader>fas the config-free path. Notctrl+shift+f: Windows Terminal and the common Linux terminals reserve it for their own find, so it never reaches the app.Answering @cwegener's open question (can the minimal TUI load a historical session into the primary screen): it already does.
opencode mini --session <id>replays that session into normal scrollback — checked on v2.3.0 against an old session — so terminal find works on past sessions today, no/exportneeded. Caveat:mini.replay_limitdefaults to 200 messages.Env: v2.3.0, macOS 24.6.0 arm64, Ghostty 1.4.0.