Repository navigation
Description
Feature Request: Fork Existing Agent Sessions
Summary
Add the ability to fork (branch) an existing agent session — creating a new parallel session that inherits the full conversation context up to the fork point, then diverges independently. Think "right-click → Fork" on any active or completed agent session.
Motivation
Orca already excels at parallel agent orchestration via git worktrees, but currently there's no way to branch an existing conversation context. Common scenarios where this is needed:
- Exploring alternatives — An agent is halfway through implementing auth with JWT; you want to fork and try OAuth2 without losing the JWT progress
- Splitting a complex task — An agent has built up rich context about a codebase; you want to fork that context into multiple specialized subtasks
- Recovering from dead ends — An agent went down a wrong path; fork from an earlier point rather than starting fresh
- Review + iterate — Fork a completed session to ask follow-up questions or request changes without polluting the original
Proposed Implementation
Since Orca is agent-agnostic and wraps CLI agents via PTY, forking could work at multiple levels:
Level 1: Orca-native context fork (indirect)
- Serialize the terminal scrollback/conversation history of the source session
- Create a new worktree (or reuse current)
- Launch a new agent session, injecting the serialized context as initial prompt/context file
- This works with ANY agent CLI — it's passing context through Orca's orchestration layer
Level 2: Agent-native fork passthrough
- For agents that support forking natively, Orca could invoke the agent's fork mechanism directly
- Map Orca's fork action → agent-specific fork command
Level 3: Full fork (folder-mode projects / no git)
- For workspaces or directories without a git repo, forking creates a copy-on-write directory clone (
cp --reflinkon APFS/btrfs, full copy fallback) - Respect
.orcaignoreor.gitignorepatterns to skipnode_modules, build artifacts, etc. - Register the copied directory as a new folder-mode project linked to the parent
orca fork rmremoves the copy and deregisters the project
orca fork CLI Command
orca fork [--message <uuid>] [--terminal <handle>] [--name <label>] [--activate] [--no-copy-files]
orca fork list [--worktree <selector>] [--json]
orca fork show <fork-id>
orca fork diff <fork-id-a> <fork-id-b>
orca fork rm <fork-id>
Flags:
--message <uuid>— Fork agent session at this specific message/checkpoint (truncates after this point). Without this, forks from current end of session.--terminal <handle>— Which agent terminal's session to fork. Defaults to active terminal.--name <label>— Label for the fork. Used as branch name suffix (git) or directory suffix (folder-mode).--activate— Switch the UI to the forked worktree/project immediately.--no-copy-files— Fork only the agent session, not the workspace files. Useful for retrying a prompt without duplicating the directory.
Examples:
# Fork from current state
orca fork --name "try-redis-approach"
# Fork from a specific message in the agent conversation
orca fork --message msg_a1b2c3d4 --name "before-refactor"
# List forks of current worktree
orca fork listUX Mockup
Sidebar:
├── 🟢 auth-feature (main session)
│ ├── 🟡 auth-feature/fork-1 (trying OAuth2)
│ └── ⚪ auth-feature/fork-2 (trying Passport.js)
├── 🟢 api-refactor
Right-click context menu on any session → "Fork from here" → pick a message/checkpoint as the fork point.
Non-Git Workspace Support
For projects without a .git directory, forking still works:
$ pwd
/home/user/scratch/prototype
$ orca fork --name "approach-b"
Forked: approach-b
Session: forked at current state
Path: /home/user/scratch/prototype-approach-b
Copy: reflink (instant)
The directory is cloned (CoW where supported), registered as a linked project, and appears in the sidebar with fork lineage.
Relationship to Existing Features
- Worktrees handle file isolation; this handles context/conversation isolation
- Discussion Multi-agent orchestration: coordinator pattern for Claude/Codex/OpenCode #681 (multi-agent orchestration) is complementary — forking provides the "spawn from existing context" primitive that orchestration needs
- [Feature]: have a queue up mode so the messages are not default to interrupt at the next tool call. #1881 (queue mode) — forking is the parallel counterpart to queuing sequential tasks
- Session persistence (feat: persist agent session metadata on sleep for one-click resume on wake #1796) — fork requires session state to be serializable, which aligns with persistence goals
Benefits
- Zero-cost exploration of alternative approaches
- Preserves valuable built-up context instead of starting fresh
- Enables tree-of-thought workflows at the agent level
- Works with Orca's agent-agnostic philosophy (Level 1 works with any CLI agent)
- Works on any workspace — git repos and plain directories alike
- Natural extension of the worktree mental model (worktrees fork files; this forks conversations)
Activity
AmethystLiang commentedon May 18, 2026
sounds useful.
@brennanb2025 can look into this
mmarabel commentedon May 30, 2026
+1 on this, I've tested a few other apps like Conductor which has something similar and it's very useful.
It also allows you to copy a summary of the context to pass into another chat:
Here's how the forking looks:
AmethystLiang commentedon May 30, 2026
@slashdevcorpse @gatsby74 adding it now :-D
AmethystLiang commentedon May 31, 2026
Added forking to a new worktree in #3976.
will revisit the rest of the proposal here later (maybe there is nothing outstanding)
nwparker commentedon Aug 23, 2026
Closing because agent-session forking shipped in PR #3976.
Disagree? Please respond! I will re-visit this ticket in 5 days. If you respond, I will re-open it 🙏.