How to export the chat history of GitHub Copilot Chat? #57190
Replies: 13 comments 32 replies
-
|
Agree this would be helpful feature. There come a time when you want to come back to earlier Copilot chat entries. A way to save select output would be value add. |
Beta Was this translation helpful? Give feedback.
-
|
You can export a Copilot Chat session in Visual Studio Code to a JSON file via If you would like to read your chat session outside of VSC i made a python script that formats the .json file and puts a more readable version in a .txt file. |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
For me, exporting and then importing the immediate result ends in It would seem to be quite important in the long term for a more automated method of keeping keep chat history with the resulting code, in the shorter term a way of being more comfortable that your chats aren't liable to be lost due to some action/inaction |
Beta Was this translation helpful? Give feedback.
-
|
To export your chats to JSON or Markdown, see my comment here: microsoft/vscode-copilot-release#417 (comment):
|
Beta Was this translation helpful? Give feedback.
-
|
Right click --> Copy All |
Beta Was this translation helpful? Give feedback.
-
|
Each workspace has its own chat history collection. You can extract the chats for one workspace using a script like below in the workspace dir with the This will create a group of files in the dir that is similar to the json you would get if you ran #!/bin/bash
#extract the history to json
sqlite3 ./state.vscdb "SELECT value FROM ItemTable WHERE key = 'interactive.sessions';" > interactive.sessions.json
# Read the JSON file and split each object into a separate file
jq -c '.[]' interactive.sessions.json | while read -r element; do
# Extract the customTitle and sanitize it for use as a filename
customTitle=$(echo $element | jq -r '.customTitle' | tr -cd '[:alnum:][:space:]._-' | tr ' ' '_')
# Ensure the filename is not empty
if [ -z "$customTitle" ]; then
customTitle="untitled"
fi
# Write the element to a file named after the sanitized customTitle
echo "$element" | jq '.' > "${customTitle}.json"
done
I found the workspaces in The person that found this also mentioned a
|
Beta Was this translation helpful? Give feedback.
-
|
Visual Studio 2022 saves the GitHub Copilot chat history to log files in the user's AppData\Local\Temp directory. They are named with a timestamp + "VSGitHubCopilot.chat.log" and may be in a subdirectory of Temp. What's great about this is it gives you not only the question and answer history, but shows you detail of what Copilot was analyzing to prepare the answer it gave you, and also reveals the initial prompt it is using to be your AI Assistant. FYI in my logs it shows the prompt as this:
|
Beta Was this translation helpful? Give feedback.
-
|
Chat histories are stored at |
Beta Was this translation helpful? Give feedback.
-
|
For Windows: Each folder contains chat history for a specific workspace, identified by unique workspace IDs. |
Beta Was this translation helpful? Give feedback.
-
|
Try this, https://marketplace.visualstudio.com/items?itemName=fengzehan.vscode-copilot-exporter. :) |
Beta Was this translation helpful? Give feedback.
-
|
Try this https://marketplace.visualstudio.com/items?itemName=imperium-dev.copilot-chat-to-markdown |
Beta Was this translation helpful? Give feedback.
-
Export Copilot Chat to Styled HTML (Quick Guide)
<style>
* { font-family: vazirmatn, vazir; direction:rtl; }
blockquote { background: #0084ff; color: #ffffff; padding: 10px 14px; margin: 8px 0 8px auto; border-radius: 14px; max-width: 75%; line-height: 1.5; word-wrap: break-word; }
blockquote p { border: none !important; font-style: normal !important; }ont-style: normal !important; }
</style>✅ Open the HTML file in your browser and enjoy it! |
Beta Was this translation helpful? Give feedback.



Uh oh!
There was an error while loading. Please reload this page.
-
Select Topic Area
Question
Body
Currently, I am using Copilot Chat to assist in the development of a repository's code. While I can easily synchronize the code to other computers, I cannot do the same for the chat history of Copilot Chat. This inconvenience me when developing on other computers. I hope that in the future, there will be an added feature to export and import chat history.
Beta Was this translation helpful? Give feedback.
All reactions