feat: add /branch command to create new session with compacted context #7824
+281
−13
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Been using OpenCode since early days and finally pulled off some improvements, at least for my workflow. Hope you like it and support it.
Fixes #7826
Summary
Add
/branchcommand that creates a new session with compacted context from the current conversation.Problem
When working on larger tasks, you often want to explore different ideas or directions without losing the context of what you've already discussed. Currently you'd have to start fresh and re-explain everything.
Solution
/branchcreates a new session with a summary of the conversation. You can branch off to try different approaches while preserving the shared context of what was discussed.Usage
/branchin the promptctrl+p) → "Branch session"POST /session/:sessionID/branchImplementation
BranchParttype triggers compaction with source session messagesChanges
core: AddedSession.branch(),BranchParttype, branch handling in prompt looptui: Wired up/branchcommand and command palette actiondocs: Added documentation for/branch