History, search and cleanup
Stored history, what the transcript currently displays and the model's compacted context are separate. Choose navigation or filtering before deleting anything.
Search full history
- Open Search chat history in the conversation header, or use its configured shortcut (default Ctrl/Cmd+F).
- Select Entire session or Entire workspace and enter a search term.
- Enable Include tools and thinking if you need technical content as well as readable text.
- Select an excerpt. In Entire session, use Next results to continue through chronological pages.
Entire session matches a literal phrase case-insensitively across stored history. Entire workspace ranks the opened project's authorized directory tree and worktrees using up to six query terms, showing at most 40 best results in one list. Each conversation's best hit comes first, with titles and current worktree labels kept in rank order. Query terms are highlighted in excerpts and in the destination transcript after Open in session. Searchable content is readable text plus the optional tools and thinking content.
Conversation pages show This page: … results · … messages scanned as batches arrive. Workspace search shows Best results: … and compact notices for partial scans or excluded directories. When ranked search is unavailable in the runtime, use Entire session. Skipped messages are reported; run a fresh search to include new messages.
Project scans start with up to 16,384 newest stored messages per location. Search further back replaces the list with the next older window's best results. The note names the examined range, from the most recent messages to later message ordinals, newest first within each project location. Results are ranked only within that window. Changing query, scope or Include tools and thinking, closing search or leaving the session resets the window. New messages are included by starting a fresh search.
If a search window expires or its history changes, Start fresh search restarts from the newest messages with the same query and options.
Open results and use the timeline
- Choose a current-session search result to jump to its surrounding passage.
- Choose a result from another session to open a separate preview of that message; use Open in session to go to that conversation at the hit.
- In Message timeline, hover or focus a marker for an excerpt, then select it to navigate: its block moves to the top and the marker stays highlighted until you scroll, after which the highlight follows the block at the top of the conversation. Use the first/latest message arrows to return to the ends of stored history. They float over the conversation; with Put the first/latest message arrows under the timeline enabled in General, they sit instead in the corner under the timeline, to the right of Send message, with the arrow for the end you are at dimmed.
The timeline represents full session structure even when the transcript holds only a bounded passage. Jumps load the destination rather than fetching every intervening message. Other-session search previews do not load that session's entire transcript or select it; only Open in session switches conversations.
Tool markers follow Message content: a tool type hidden there has no marker (none with Nothing), except a tool waiting for a permission. A step that only ran tools shows just its tool markers, without an empty agent marker.
The timeline is hidden when the conversation is too narrow (below 420 CSS pixels); use search and transcript controls there. Its saved visibility preference is not erased by that responsive change.
Choose the right history operation
| Operation | Where | Scope and consequence |
|---|---|---|
| Display filtering | Message content, or Settings → Chat | Shared transcript display preferences; hides/collapses content without deleting it |
| Compaction | Palette Compact Session | Native summary/context compaction for the selected session, not technical-output deletion |
| One-response cleanup | Message More actions → Remove tools and reasoning from this response | Permanently removes eligible completed technical parts; preserves final text |
| Session technical cleanup | Palette Remove Session Tools and Reasoning | Plans across full stored session history, including pre-compaction messages; preserves final text and message/session metadata |
| Delete session | Session row Delete session, or selected-session delete | Recursively deletes the native conversation and its descendant subsessions/history after confirmation; no undo |
| Scrub Sessions | Command palette | Broader session deletion, not a display or context-size setting |
Message content applies across conversations. Choose a preset (Nothing, Minimal, Balanced or Everything) at its top or in Settings → Chat, then adjust individual rows; the Message content preset menu then shows Custom. Choosing another preset keeps those rows: choose Custom again to return to them. Hiding tools does not disable tools, change permissions or remove stored output. To keep rendering responsive, very large messages show Show … more at an omitted gap, and very long text or tool output stops at a … more characters hidden line with Show all, or Show … more when much remains, which may take several steps. Revealing either is display-only and does not recover deleted content. Drag across its eye or chevron buttons to set several rows at once: the first button you drag out of toggles, and every button you cross in the same column takes its new state. The conversation updates when you release the button.
In Tool groups, turn off the eye to show each call on its own, or use the chevron to open groups by default. Each tool type still has its own visibility setting. Everything opens groups by default; the other presets keep them collapsed.
Compact a session
- Select the intended conversation.
- Run Compact Session from the command palette.
- Wait for the native compaction result or inspect Compact failed before deciding whether to retry.
Compaction changes the context OpenCode uses to continue the session. It is not a promise to erase earlier stored messages: full-history search and technical cleanup can still reach pre-compaction content. Do not compact as a substitute for deleting sensitive stored history.
Remove tools and reasoning
- Choose the one-response action, or run Remove Session Tools and Reasoning for the selected session.
- Review the planned tool/reasoning counts and any skipped-content warning.
- Confirm Remove. For whole-session work, follow the progress above the transcript and use its cancellation control if needed.
Only eligible completed tools and reasoning are removed. Active/incomplete content is not pruned, nor is a message larger than 16 MB as OpenCode reads it (attached files included), which counts as skipped content; changed content is refused rather than silently expanding what you confirmed. Final text and message/session metadata remain, but removed technical output has no undo. Preserve anything you need before confirming.
Session cleanup is not atomic across the whole session. Successful earlier removals remain if a later message conflicts or fails. Cancellation stops future batches; it does not roll back an already dispatched batch, which may still commit.
Delete and scrub sessions
Deleting a parent session also deletes its descendant subsessions and their history. Inspect the conversation family before confirming. Mission specialist cleanup is different: it keeps sessions that have children.
- Prefer a specific row's Delete session when you know exactly which conversation should go.
- For broader maintenance, run Scrub Sessions and read the Deep Clean Sessions confirmation.
Both cleanup modes remove only verified empty, inactive sessions without children. Favorites and their ancestors are kept across folders.
If a conversation disappears during cleanup, look for its unsent text and attachments in the project’s new-conversation composer. Use Switch draft to open a saved draft without replacing the current one. This also works when you reopen the project.
Deletion removes conversations, not Git commits or a rollback of filesystem/external effects. If cleanup only partly succeeds, already deleted sessions stay deleted. Review the remaining list and errors before retrying. See Conversations for forks/undo and Projects for deleting temporary folders or worktrees.