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
Normally forking happens on a specific message within a session. Is your intent that it would automatically fork on the last/most-recent message in the session (i.e, using this on a session with one message in it would be equivalent to starting a new session)?
@moonray Well, alright... I do not use Claude Code, so I'm just trying to understand this from the documentation that you linked:
The --fork-session switch essentially just duplicates the session in question and then loads that duplicate?
Should we retain OpenCode's current behaviour of re-titling forked sessions to something like Some session (fork #1), even though we aren't truly 'forking' the session per se (but rather are simply duplicating it)? I would assume that that would be desirable, but I could be mistaken.
This switch must be used in conjunction with --continue or --session, opencode --fork-session would be non-sensical?
If I am understanding your intent correctly, I could take a stab at this and see what I can cook up.
That is correct. It's still a fork, if you continue in both sessions, though. :)
The current opencode titling makes the most sense
Correct. You cannot fork without a session id, or you're simply creating a new session. --continue is simply shorthand for providing the last used session id. So it must be used in conjunction with either --continue or --session [session id]
@moonray Alrighty then... I rolled the dice a few times, had a few different models try their out their own takes on this feature, then tossed them into the arena to let yet another set of models review these and assess the best amongst them. I've now submitted a PR for the take that was deemed the best of the bunch, which can be found here: #11340.
Fingers crossed that the maintainers will like it!
Activity
github-actions commentedon Jan 29, 2026
This issue might be a duplicate of existing issues. Please check:
Feel free to ignore if this request is specifically about a direct CLI flag approach (--fork-session) rather than ACP or /branch command.
ariane-emory commentedon Jan 30, 2026
Normally forking happens on a specific message within a session. Is your intent that it would automatically fork on the last/most-recent message in the session (i.e, using this on a session with one message in it would be equivalent to starting a new session)?
moonray commentedon Jan 30, 2026
For CLI based forking, Claude Code's session behavior seems optimal to me, not forking before the last message.
https://code.claude.com/docs/en/how-claude-code-works#resume-or-fork-sessions
ariane-emory commentedon Jan 30, 2026
@moonray Well, alright... I do not use Claude Code, so I'm just trying to understand this from the documentation that you linked:
--fork-sessionswitch essentially just duplicates the session in question and then loads that duplicate?Some session (fork #1), even though we aren't truly 'forking' the session per se (but rather are simply duplicating it)? I would assume that that would be desirable, but I could be mistaken.--continueor--session,opencode --fork-sessionwould be non-sensical?If I am understanding your intent correctly, I could take a stab at this and see what I can cook up.
moonray commentedon Jan 30, 2026
--continueis simply shorthand for providing the last used session id. So it must be used in conjunction with either--continueor--session [session id]feat(cli): add --fork-session flag for session forking
add --fork flag to duplicate sessions before continuing
ariane-emory commentedon Jan 30, 2026
@moonray Alrighty then... I rolled the dice a few times, had a few different models try their out their own takes on this feature, then tossed them into the arena to let yet another set of models review these and assess the best amongst them. I've now submitted a PR for the take that was deemed the best of the bunch, which can be found here: #11340.
Fingers crossed that the maintainers will like it!
71 remaining items
feat(tui): add Claude Code-style --fork flag to duplicate sessions be…
feat(tui): add Claude Code-style --fork flag to duplicate sessions be…
feat(tui): add Claude Code-style --fork flag to duplicate sessions be…
feat(tui): add Claude Code-style --fork flag to duplicate sessions be…
feat(tui): add Claude Code-style --fork flag to duplicate sessions be…
feat(tui): add Claude Code-style --fork flag to duplicate sessions be…