Where chat history are stored? Hoe to get all chat history?
1 Like
Hi @sarkar
Maybe this helps:
3 Likes
Thanks itās worked for me
I was glad to help. ![]()
you rule
another work aroundā¦
COPY and PASTE this instruction message and give to your Cursor agent to help you recover lost chat history:
"Please help me recover lost chat history from Cursorās workspace storage. This is a two-step process:
- First, create a Python script called
export_chats.pythat can search through SQLite databases in the workspace storage directory (on Mac:~/Library/Application Support/Cursor/User/workspaceStorage, each containing astate.vscdbfile). The script should search through chat data for specific time periods and keywords related to the lost content. - Then, create a Node.js script called
clean_history.jsthat processes the exported chat history. This script should: -
- Filter conversations based on project-specific keywords
- Clean up markdown formatting
- Remove irrelevant content
- Output cleaned history files for each team Weāll need to make multiple search passes with
export_chats.py, refining the parameters each time to filter out noise and focus on relevant conversations. Once we have the raw chat data, weāll useclean_history.jsto organize and clean it. When we find matching content, help me reconstruct the code and implementation details from the chat fragments. Please guide me through this process step by step, starting with creating both scripts and then helping me search effectively by suggesting relevant search terms and filtering strategies based on what Iām trying to recover. Remember that chat history might contain code snippets, implementation discussions, and debugging sessions that can help piece together the lost work." - Cursor will find and translate
Hope this helps
A comprehensive toolkit for recovering lost chat history from Cursorās workspace storage
I wrote a short script (using cursor
) to find the cursor workspace for a specific search term:
find_cursor_workspace() {
local search_term=$1
local base_dir="$HOME/Library/Application Support/Cursor/User/workspaceStorage"
if [[ -z "$search_term" ]]; then
echo "Usage: find_cursor_workspace <search_term>"
return 1
fi
# 1. Find all state.vscdb files
find "$base_dir" -name "state.vscdb" -type f | while read -r db_path; do
# 2. Query the SQLite DB for the search term in the 'value' column
# We use 'grep' on the output of the SQL query to check for the term
local match=$(sqlite3 "$db_path" "SELECT value FROM ItemTable" 2>/dev/null | grep -i "$search_term")
if [[ -n "$match" ]]; then
local workspace_dir=$(dirname "$db_path")
local workspace_json="$workspace_dir/workspace.json"
if [[ -f "$workspace_json" ]]; then
# 3. Extract the workspace name/path
local ws_path=$(jq -r '.workspace // .folder' "$workspace_json")
echo "-----------------------------------"
echo "Match Found in: $(basename "$workspace_dir")"
echo "Workspace: $ws_path"
fi
fi
done
}
hope this helps.