Manage agent sessions in VS Code
AI agents: See llms.txt for documentation discovery and navigation. Documentation articles are also available as Markdown by appending .md to the article URL. Join VS Code at Microsoft Ignite or catch the sessions online. A year of VS Code, wrapped. Explore the highlights. Manage agent sessions in VS Code View as Markdown Ask in VS Code Ask in VS Code Insiders Use the sessions list to return to an agent task, monitor ongoing work, and put completed work away.
This article shows how to manage sessions in the Chat view and the Agents window . A session groups the workspace, code changes, and conversations for a task. Each conversation has its own history and context. If you're starting your first task, follow the agents quickstart . Find and resume a session Open an existing session to continue its conversation rather than start the task again. For an unsent New Session request in the Agents window, resume a saved draft instead.
Open the sessions list in the interface you use: Interface Location and scope Chat view The list is at the top of the view and shows sessions for the current workspace, grouped by time. With no workspace open, it shows sessions across workspaces. Agents window The list is in the left sidebar and shows sessions across workspaces. Sessions are grouped by workspace by default. Select the session to open its conversation.
If your session is completed, it may not appear in the active sessions list. Change the list filter from active sessions to Archived (Chat view) or Done (Agents window). Review the previous messages and changes before sending a follow-up. For an archived session, restore it first . If the list isn't visible in the Chat view, right-click in an empty chat and select Show Sessions . For display options, see sessions list layout .
Find a missing session Check these items before creating a replacement session: Workspace and host : Open the original workspace or connect to the host where the session runs. The Agents window lets you browse across workspaces. State filters : Include Archived or Done sessions, not only active sessions. Other applications : Check the External filter and discovery limits . Supported interface : Local harness sessions The Local harness is deprecated and will be removed in February 2027.
Move your workflows to the Copilot harness before then. Learn more about Local harness deprecation . and sessions from the OpenAI Codex extension are editor-only. Check which sessions support both interfaces . To find earlier work by topic, file, or pull request instead of browsing the list, query session history . Synced history doesn't by itself provide access to a running agent. Continue between the Chat view and Agents window Supported Copilot and Claude sessions are available in both interfaces.
Codex requires the experimental Agent Host integration . Switching interfaces doesn't change the session's harness, workspace, or worktree. For a supported Copilot session with a project: From the Agents window : Select Open in Editor in the title bar. The editor opens the project with the session available in the Chat view. From the Chat view : Select Open in Agents Window from the view's ... menu. From an SSH, WSL, or tunnel editor window, opening the Agents window selects the same remote and folder.
For remote Dev Containers, it selects the source folder on that remote. Supported tunnel connections can also reopen the same session in either window. For SSH, WSL, and Dev Containers, switching windows currently opens the folder without continuing the session. To change the harness instead, see Continue with a different harness . Note Claude and Codex harnesses are disabled when Copilot enterprise-managed settings apply , unless your administrator explicitly permits them.
Existing sessions aren't deleted. Contact the IT team that deployed the settings to discuss access. View sessions from other applications You can open supported local sessions from Copilot CLI, the GitHub Copilot app, Claude Code, and Codex in either interface. Open the sessions list filter and select External to choose which discovered sessions appear: Filter Sessions shown None No external sessions. Recent Up to two most recently updated external sessions from the last seven days.
At startup, sessions older than the second-most-recently updated local session are hidden. Last 24 Hours Sessions updated within the last 24 hours. Last 7 Days (default) Sessions updated within the last seven days. Last 30 Days Sessions updated within the last 30 days. The filter applies to both interfaces and is also configurable with chat.agentSessions.showExternal Open in VS Code Open in VS Code Insiders (Experimental).
Discovery has separate limits: Copilot only considers supported local sessions updated within the last seven days, even if you select Last 30 Days . When you open an external session in the Agents window, a one-time banner identifies its origin and lets you choose which external sessions to show. If that choice hides the open session, you're asked to confirm it. After you send a message from VS Code, the session is no longer external and the External filter no longer controls its visibility.
For an external Codex session, only one application can write to the chat at a time. If This chat is open in another app appears, fully quit the other application and select Retry . The transcript, draft, and attachments remain available while sending, queueing, and resending are blocked. Retry doesn't send the draft. Send it yourself after the banner disappears. Use Copilot CLI from the terminal If the session's context menu includes Resume in Terminal , select it to continue in GitHub Copilot CLI.
Not every harness or session type provides this action. Otherwise, continue in a supported VS Code interface. To begin a separate terminal conversation, start a new CLI session . Starting a new CLI session doesn't resume an existing conversation. Continue a CLI session in VS Code (Experimental) Move an existing GitHub Copilot CLI conversation from a terminal outside VS Code into the Chat view to continue beside your code without starting over.
This workflow requires Copilot CLI 1.0.107 or later and Copilot harness access in VS Code. In your Copilot CLI session, run /settings experimental on to turn on experimental CLI features. Run /code , or /code-insiders for VS Code Insiders. The CLI exits, and VS Code opens the session in the Chat view of the window for the session's folder, starting the application if needed. The session keeps its conversation history, model, reasoning effort, mode, and permissions, except for permissions that apply only to the CLI process.
Note CLI-process-only permissions, such as --allow-tool options or approvals granted for the CLI session, don't carry over. The CLI lists these permissions before handing off. If another CLI process still has the session open, VS Code asks before opening it. Exit that process first to avoid both applications writing to the same session. To return to the CLI, run the copilot --resume command that the CLI displays when it hands off.
Continue on another device or in the cloud Where the session runs How to continue A remote host Use GitHub environments GitHub environments is in preview and might change before it becomes generally available. or SSH or dev tunnels , then open the existing session. The host must remain running and reachable. A managed cloud environment Cloud sessions is experimental and might change or be removed. Reconnect to the existing cloud session .
Execution stays in the managed environment. To move from local work to cloud execution, start a separate cloud session . For a hands-on walkthrough, start a task in a cloud session and continue it from a regular terminal with Copilot CLI Cloud sessions is experimental and might change or be removed. . Start a new or related conversation Choose a conversation based on whether you need the discussion so far: Your goal Action Continue the same task
The rest of this page is on the live site.