Working with an AI coding assistant often involves more than one development session. You might start a task on your office computer, leave it running while you attend a meeting, and want to check its progress from your phone. Later, you may want to continue the same task from another computer without explaining the requirements again.
This workflow becomes difficult when an AI coding session depends entirely on the machine where it started. Closing the terminal, shutting down the laptop, or switching devices can interrupt the work or make it difficult to recover the original context.
GitHub Copilot provides session management and remote access capabilities that help address this problem. Developers can resume previous sessions, monitor active work, and, when supported and enabled, control a running Copilot CLI session from another device.
The important distinction is that saving a session, synchronizing its history, keeping the machine awake, and remotely controlling an active session are different capabilities.
In this article, we will explore how GitHub Copilot manages agent sessions, how to keep a CLI session running, and how to continue development work across devices without losing valuable context.
Understanding GitHub Copilot Agent Sessions
A Copilot session represents an interaction between the developer and the AI agent. It contains more than just the messages exchanged during a conversation.
Depending on the client and execution environment, a session can include:
- Prompts and follow-up instructions the developer provides.
- Responses and explanations generated by Copilot.
- Files accessed and changes made during the task.
- Commands executed and tool activity.
- Session-specific settings and working context.
- Information about the repository and development task.
For example, imagine asking Copilot to refactor an authentication service in an ASP.NET Core application.
During the session, Copilot might inspect the project structure, review existing authentication middleware, update several classes, and run unit tests. You may then ask it to correct a failing test or follow an existing repository convention.
If the session is saved and can be resumed, you can continue the conversation without reconstructing all those instructions manually.
However, session history and the actual working files are not always stored in the same place. This distinction becomes especially important when moving between devices.
Understanding Local and Cloud Sessions
GitHub Copilot supports different session execution environments. Understanding them helps you choose the right approach for work that needs to continue across devices.
Local sessions
A local session runs on your development machine.
For example, when you start Copilot CLI in a terminal, it works with the files and tools available on that machine. It can inspect your local repository, execute commands, and make changes within its permitted environment.
Copilot CLI saves session data locally and, by default, synchronizes session data with your GitHub account.
You can resume a previous session, but this does not automatically transfer your complete local development environment to another computer.
The original machine may still contain uncommitted changes, local dependencies, environment variables, or other resources needed to continue the task.
Cloud sessions
Cloud sessions run in an isolated environment hosted by GitHub.
The session's conversation and working environment are hosted remotely, allowing you to access the same work through supported Copilot clients.
For example, you can start a task from the GitHub Copilot app, monitor it from GitHub Mobile, and later continue from GitHub.com or Copilot CLI.
This is particularly useful when you want an agent to continue working after closing your laptop.
Session comparison
| Capability | Local Session | Cloud Session |
|---|
| Execution environment | Your development machine | GitHub-hosted environment |
| Local files | Uses your local workspace | Uses its cloud workspace |
| Session history | Saved locally and synced by default | Stored with the cloud session |
| Cross-device history access | Available when synchronized | Available through supported clients |
| Remote steering | Requires remote control to be enabled | Supported through cloud session clients |
| Depends on your laptop staying available | Generally yes for active local work | No |
The right choice depends on whether the task requires your local development environment or can run independently in a cloud sandbox.
Resuming Previous Copilot CLI Sessions
One of the simplest ways to continue development work is to resume an existing Copilot CLI session.
Copilot CLI provides commands for continuing the most recent session or selecting a previous one.
To continue your most recent session, run:
copilot --continue
This opens the most recent session and restores its conversation history.
If you want to select a particular session, use:
copilot --resume
Copilot displays a session picker containing available sessions.
You can also resume a session directly when you know its ID:
copilot --resume SESSION-ID
To find the current session ID from an interactive session, use:
/session
This is useful when you work on multiple tasks in parallel.
For example, you might have one session updating API authentication, another improving database performance, and a third writing unit tests. Instead of mixing these tasks into one conversation, you can maintain separate sessions and return to each one when required.
You can also rename a session to make it easier to identify:
/rename Improve API authentication
Clear session names are especially helpful when a project contains several ongoing development activities.
Keeping a Copilot CLI Session Active
A local Copilot CLI session can be interrupted if the operating system puts the machine to sleep.
This becomes a problem when Copilot is executing a long-running task, such as refactoring a large project, running tests, or analyzing multiple files.
Copilot CLI provides the /keep-alive command to control the machine's sleep behavior while a session is active.
To prevent the machine from sleeping while the session is active, run:
/keep-alive on
To restore the normal sleep behavior:
/keep-alive off
You can also use the busy option:
/keep-alive busy
This prevents the machine from sleeping while Copilot is actively working. It does not allow the machine to sleep while Copilot is waiting for your response to a request for input.
You can specify a duration instead of keeping the machine awake indefinitely:
/keep-alive 30m
Other supported duration formats include:
/keep-alive 8h
/keep-alive 1d
To check the current setting, run:
/keep-alive
This command is useful for long-running local tasks, but it does not turn a local session into a cloud session. The machine must still be running, and the Copilot CLI process must remain available.
For tasks that need to continue independently of your computer, a cloud session is a better choice.
Controlling a Running Copilot CLI Session Remotely
Keeping a session alive is only part of the problem. Developers also need a way to monitor its progress and respond when Copilot asks a question.
GitHub Copilot CLI supports remote control for eligible sessions.
Remote control allows you to access a running local CLI session through GitHub.com or GitHub Mobile. You can inspect its output, respond to permission requests, and provide additional instructions without sitting in front of the original machine.
Remote control is different from session synchronization.
Session synchronization makes previous session information available through your GitHub account. It does not automatically make an active local session controllable from another device.
To enable remote control, open an interactive Copilot CLI session and run:
/remote-control
When remote control is enabled, the CLI provides a link that you can open in a browser.
You must sign in using the same GitHub account that started the session.
You can also locate the session from GitHub.com by opening the Copilot area and checking your recent agent sessions.
From there, you can inspect the session and interact with it remotely, subject to the supported permissions and account policies.
Remote control is disabled by default. Organizations can also apply policies that restrict remote control for sessions running on managed devices.
Accessing Sessions From GitHub Mobile
GitHub Mobile provides another way to interact with Copilot sessions when you are away from your development machine.
After enabling remote control for an eligible CLI session, you can open GitHub Mobile and navigate to Copilot.
Your recent agent sessions are available in the Agent sessions area.
You can use the mobile interface to:
- Check the progress of a running task.
- Review the agent's responses and activity.
- Respond to requests for permission.
- Provide follow-up instructions.
- Continue the same session without starting a new conversation.
Consider a developer who starts a large refactoring task before leaving the office.
Copilot begins inspecting the repository and updating several files. While travelling, the developer opens GitHub Mobile and checks the session. The agent asks whether it should update an existing interface or introduce a new abstraction.
The developer can respond from the phone instead of waiting until returning to the office.
The original local machine still needs to remain available for a locally running session. Remote control does not move the execution environment to the phone.
Moving the Same Cloud Session Between Devices
Cloud sessions provide a more direct way to continue development across different devices.
Because the session runs in GitHub-hosted infrastructure, it is not tied to the computer or client where it was originally started.
Consider this workflow:
- Start a Copilot cloud session from the GitHub Copilot app.
- Ask Copilot to implement a new feature in a repository.
- Close your laptop while the agent continues working in the cloud.
- Open GitHub Mobile and inspect the session.
- Provide additional instructions if the implementation needs changes.
- Open GitHub.com later to review the updated files.
- Resume the same cloud session through Copilot CLI if you want to continue working from the terminal.
The conversation and cloud workspace remain associated with the same session.
This avoids repeatedly transferring project files or reconstructing the original instructions.
It is important to understand that this capability applies to cloud sessions. A synchronized local session may be visible on another device, but that does not mean its original machine and working directory have moved with it.
Delegating Long-Running Tasks to Copilot Cloud Agent
Another useful approach is to delegate a task from Copilot CLI to the cloud agent.
This allows you to hand off work that does not require continuous interaction from your local terminal.
Inside Copilot CLI, you can use the /delegate command.
You can also prefix a prompt with & to delegate the task.
For example:
/delegate Implement unit tests for the authentication service and identify missing edge cases.
The task is handed off to Copilot cloud agent, which works independently of the local CLI session.
Cloud sessions appear in the Sessions tab and can be resumed or monitored through supported clients.
This is useful when you want to continue another development task locally while Copilot works on a separate assignment.
For example, you could delegate test generation to the cloud agent while continuing to review API changes in your local development environment.
Before delegating, provide clear instructions about the expected outcome, project conventions, and testing requirements. Also review the resulting changes before merging them into the main branch.
Managing Session History and Privacy
Session synchronization makes previous development work easier to access, but it also introduces important considerations around data storage and privacy.
Copilot CLI stores session information locally and synchronizes session data with your GitHub account by default.
You can review session synchronization settings in the Copilot CLI configuration.
For example, the following setting disables remote session export:
{
"remoteExport": false
}
When remote export is disabled, session data is not synchronized to your GitHub account for the associated features.
This can affect the ability to access and query session history across clients.
Organizations may also control whether local sessions can be stored in the cloud through enterprise policies.
Remember that synchronizing a session does not automatically make it public. Local sessions are private by default. Sharing controls determine whether repository collaborators can view a shared local session.
Before sharing a session, review its prompts, responses, and file changes. Development conversations may contain internal implementation details, code snippets, or other information that should not be shared unnecessarily.
Common Problems and Troubleshooting
Even with session synchronization and remote access, developers may encounter problems when continuing previous work.
Previous session is not available
If a session does not appear in the session picker, check whether it was saved and whether session synchronization is enabled.
For local sessions, confirm that you are using the same GitHub account and that your organization permits cloud session storage.
You can also try resuming the session directly by its ID:
copilot --resume SESSION-ID
Session history is visible but cannot be controlled
This usually happens because session synchronization and remote control are different capabilities.
A synchronized session can be available for viewing without supporting live interaction.
For remote control, enable the feature for the running CLI session and verify that your account and organization policies permit it.
Local session stops when the machine sleeps
Use the keep-alive command:
/keep-alive on
Alternatively, use a duration such as 8h if you only need to prevent sleep for a limited period.
If the task must continue even when the computer is shut down, use a cloud session instead.
Copilot cannot continue the original task correctly
Restoring a conversation does not guarantee that every external dependency is still available.
The original task may depend on uncommitted changes, environment variables, local databases, installed tools, or files that are not part of the synchronized session history.
Before moving a development task to another machine, commit or otherwise preserve important changes and document any local dependencies.
For cloud sessions, verify that the required tools and repository access are available in the cloud environment.
Best Practices for Managing Copilot Sessions
Session management becomes more valuable when developers use Copilot for multiple tasks throughout the day.
A few practical practices can make these workflows more reliable.
First, keep sessions focused on individual development tasks. A separate session for authentication, database changes, and test improvements makes it easier to resume work without confusing unrelated requirements.
Second, give sessions meaningful names. A name such as Improve API authentication is more useful than a generic session title.
Third, choose the execution environment based on the task. Use local sessions when Copilot needs your local tools or development services. Use cloud sessions when work needs to continue independently of your computer.
Fourth, do not treat session history as a replacement for version control. Commit important changes, preserve uncommitted work, and review modifications before merging.
Finally, review organization policies and session-sharing settings before enabling remote access. Keep credentials and sensitive development information out of prompts and session content whenever possible.
Summary
GitHub Copilot provides several capabilities for keeping development work connected across sessions and devices. Developers can resume previous CLI conversations, synchronize session history, prevent their computers from sleeping during active tasks, and remotely control eligible running sessions.
Cloud sessions provide an additional level of flexibility because the execution environment is hosted by GitHub rather than tied to a particular development machine. This makes it possible to start work on one device, monitor it from another, and continue from a supported Copilot client.
The key is to understand the difference between session history, execution environments, and remote control. Choosing the appropriate approach helps developers avoid interrupted workflows, preserve useful context, and manage long-running AI coding tasks more effectively.
Join the conversation! Your thoughts help the community grow.