copilot-cli icon indicating copy to clipboard operation
copilot-cli copied to clipboard

Start a new session in programmatic mode

Open gridsandspaces opened this issue 2 months ago • 0 comments

Describe the feature or problem you'd like to solve

Add a command for starting a new session --start-session and return the ID

Proposed solution

When using the CLI we currently have the ability to --resume {id} or --continue, but there is no programmatic way to start a new session or easily capture the most recent session ID.

When using the CLI in an application it would be very convenient to start a new session, capture the ID and then use --resume {id} on all subsequent prompts.

Pseudo Code:

let session_id = copilot --start-session
copilot -p "review the README.md contents and make them sound more professional" --resume {session_id}
copilot -p "review the README.md contents and make them sound more professional" --continue

In its current form, users must look at the .copilot/logs or .copilot/session-state to locate a session GUID and apply it.

Example prompts or workflows

No response

Additional context

No response

gridsandspaces avatar Oct 31 '25 16:10 gridsandspaces