require 'sqlite3' db_path = File.expand_path('~/.config/Cursor/User/globalStorage/state.vscdb') # Adjust if needed table = 'cursorDiskKV' db = SQLite3::Database.new(db_path) columns = db.execute("PRAGMA table_info(#{table});").map { |col| col[1] } rows = db.execute("SELECT * FROM #{table};") File.open('cursor_chat_history.txt', 'w') do |file| file.puts columns.join("\t") rows.each { |row| file.puts row.join("\t") } end puts "Exported #{rows.size} rows from #{table} to cursor_chat_history.txt"