Skip to content

Allow /fork to open a new terminal and add copilot --fork #4578

Description

@rogerbarreto

Describe the feature or problem you'd like to solve

The interactive /fork [name] command creates a new independent session, but the current terminal moves into that fork. The original session remains available, but working with both sessions at the same time requires manually opening another terminal and locating the correct session.

There is also no process startup option for creating a fork from an existing session. Commands such as copilot --fork=<session-id> and copilot --branch=<session-id> are currently rejected as unknown options.

This makes /fork less flexible for users who keep several terminal windows or tabs open. It also prevents terminal-specific launch commands from creating and starting a fork directly.

Proposed solution

Support both of these entry points:

  1. Add copilot --fork=<session-id> [--name=<new-session-name>]. It should create a new fork of the supplied session, apply the optional name to the new fork, and start the fork in the process that invoked the command. The source session name should remain unchanged.
  2. Add an option such as /fork --new-terminal [name]. It should create the fork in a new terminal window or tab while the current terminal remains in the original session.

The command line option provides a portable building block even when automatic terminal launching is not available. Users can combine it with their preferred terminal application. For example, a Windows Terminal user could run:

wt new-tab copilot --fork=<session-id> --name=<new-session-name>

From Copilot CLI, the same command could be launched through the shell command prefix:

!wt new-tab copilot --fork=<session-id> --name=<new-session-name> --name=<new-session-name>

The convenience option on /fork could use supported terminal integration when available. If the CLI cannot identify or launch the current terminal application, it should return the new session ID and a ready-to-run copilot --resume=<new-session-id> command instead of silently switching behavior.

Example prompts or workflows

  1. Run /fork --new-terminal investigate-auth during a task. The fork opens separately, and the original session remains visible and interactive.
  2. Run wt new-tab copilot --fork=<session-id> --name=<new-session-name> to create a fork in a new Windows Terminal tab.
  3. Run copilot --fork=<session-id> --name=alternative-design from another shell to create, name, and enter a fork of a specific session.
  4. Use the shell command prefix inside Copilot CLI to invoke a terminal-specific launcher without abandoning the current session.

Additional context

This is a focused follow-up to #2058. That issue requested the core /fork command and mentioned a new terminal window or tab in its proposed solution. The core command now exists, but the terminal selection and process startup interfaces are still missing.

Related issue #1697 also describes working with forked sessions in separate terminals.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions