Introduction
Every time you use Copilot CLI, your session data is recorded on your local machine. This includes your prompts, Copilot's responses, the tools that were used, and details of files that were modified. By default, session data is also synced to your GitHub account. This lets you query all of your past sessions, including sessions from Copilot CLI, Copilot cloud agent, Copilot code review, VS Code, JetBrains, and the GitHub Copilot app.
This session data powers several features, available from Copilot CLI, VS Code, JetBrains, the GitHub Copilot app, and GitHub.com:
- Querying your session history: Ask natural language questions about your past work, and Copilot will search your session data for answers.
- Resuming sessions: Pick up where you left off in any previous session.
- The
/chronicleslash command: A set of purpose-built subcommands that generate standup reports, personalized tips, cost analysis, and suggestions for improving your custom instructions, all derived from your session history.
With user-scoped queries, you can only query your own sessions—no one else can access your session data.
This conceptual article explains how session data is stored and synced, and how you can use it to enhance your workflow. For a practical guide to resuming a session, asking Copilot about your CLI sessions, and using the /chronicle slash command, see Using GitHub Copilot CLI session data. For querying sessions from VS Code, see Managing agent sessions.
How session data is stored
Every Copilot CLI session is persisted as a set of files in the ~/.copilot/session-state/ directory on your machine. The data for each session contains a complete record of the session. These files allow you to resume an interactive CLI session.
In addition to the session files, Copilot CLI stores structured session data in a local SQLite database, referred to as the session store. This data is a subset of the full data stored in the session files. The session store is what powers the /chronicle slash command and it also allows Copilot to answer questions you ask about your past work.
Session syncing
By default, Copilot CLI syncs your session data to your GitHub account. This lets you query your past sessions from Copilot CLI, VS Code, JetBrains, the GitHub Copilot app, or GitHub.com, and includes sessions from Copilot cloud agent, Copilot code review, VS Code, and the GitHub Copilot app.
You can opt out of session syncing by setting "remoteExport": false in your CLI settings JSON. If you opt out, session data stays on your machine and you can only query it from Copilot CLI.
For Copilot Enterprise and Copilot Business users, an organization administrator must set the "Store local sessions in the Cloud" policy to at least "View from cloud." If the policy is disabled or unconfigured, sessions are stored locally only.
Privacy and data locality
Local session data is stored in ~/.copilot/session-state/ and is only accessible to your user account on that machine.
Synced session data is stored on GitHub and is tied to your personal account. It is accessible only to you by default. Organization and enterprise administrators control whether syncing is available through the "Store local sessions in the Cloud" policy, but enabling the policy does not give administrators access to your session data.
You can choose to share individual sessions, giving view-only access to others who have access to the repository. Shared sessions are not indexed for other users' session queries. For more information, see Managing agent sessions.
Copilot reads session data when you ask questions about past interactions or use the /chronicle slash command. Session data such as your previous prompts, context, and responses may be sent to the AI model, just as in any normal Copilot CLI interaction.
Managing your session data
You can manage your session data both locally and on GitHub.com.
- Local data: To remove data for a particular CLI session locally, delete the relevant session directory from
~/.copilot/session-state/. To clear all local session data, delete everything under~/.copilot/session-state/. After doing this you must manually reindex the session store. See Reindexing the session store later in this article. Deleting local files does not affect session data that has been synced to your account. You cannot delete synced data locally. - Synced data: You can delete or hide synced CLI sessions from GitHub.com. Hiding a session removes it from your session index so it no longer appears in query results. Deleting a session removes it from your session list on GitHub.com. Deletion applies to CLI, VS Code, and GitHub Copilot app sessions.
The /chronicle slash command
The /chronicle slash command provides purpose-built subcommands for generating insights from your session history, including standup reports, personalized tips, cost analysis, and suggestions for improving your custom instructions. For the full list of subcommands and usage examples, see Using GitHub Copilot CLI session data.
When to use session data
- At the start of your day: Run
/chronicle standup last 3 daysto generate a summary of recent work instead of reconstructing it manually. - Periodically, to level up: Run
/chronicle tipsevery week or two to discover features and workflow improvements you might be missing. - When Copilot keeps making the same mistake: Run
/chronicle improveto identify the pattern and generate custom instructions that make the agent more effective for your project. - To understand your token usage: Run
/chronicle cost tipsto see where tokens are going and get suggestions for reducing costs. - To search for a specific topic: Run
/chronicle search KEYWORDto find sessions containing a specific term or topic. Unlike free-form questions, this searches session content directly for keywords rather than interpreting your query semantically. - To recall past work: Ask a free-form question like "Have I worked on anything related to the payments API?" and Copilot will search your history.
- To continue previous work: Use
copilot --continueorcopilot --resumeto pick up where you left off.
Reindexing the session store
The session store is populated incrementally during a CLI session. Data for a session is written to disk in a session-specific subdirectory of ~/.copilot/session-state/. This also happens periodically during a session, and also when the session ends.
You can reindex the session store from the session files on disk. Reindexing also syncs your session data to your account.
Situations where you might need to reindex include:
- Indexing old sessions: If you have old session files on disk that were created before the session store existed, reindexing will populate the session store with data from those sessions.
- Session deletion: If you want to delete a session from your history you can delete the session directory and then reindex the session store.
- Migrating/recovering sessions: If you moved your session files to another machine, or restored them from a backup, without also moving/restoring the session store file (
~/.copilot/session-store.db), you can use the reindex command to recreate the session store. - File corruption: If the session store file (
~/.copilot/session-store.db) becomes corrupted, or is accidentally deleted, you can recover the session store from the session files. - Unexpected termination: If a session terminates unexpectedly (for example, due to a crash or power loss) before data held in memory has been flushed to the session store you may be able to populate the session store with the missing data if it was written to disk, in the session files, prior to the termination.
To reindex the session store, use the following slash command in an interactive CLI session:
/chronicle reindex
/chronicle reindex