Skip to content

Export your Raycast AI chat sessions to structured JSON format.

License

Notifications You must be signed in to change notification settings

daveonkels/raycast-ai-exporter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Raycast AI Chat Exporter

Export your Raycast AI chat sessions to structured JSON format.

License: MIT

Raycast AI Chat window

Why This Exists

Raycast is a macOS productivity app with a powerful built-in AI chat feature. However, Raycast doesn't provide a native way to export your chat history.

This tool lets you rescue your AI conversations so you can:

  • Unify with ChatGPT and Claude exports in Central Chat for one searchable interface
  • Archive your chats for long-term storage
  • Search across your conversation history
  • Analyze your AI usage patterns

Installation

git clone https://github.com/daveonkels/raycast-ai-exporter
cd raycast-ai-exporter

Requirements

  • macOS
  • uv (Python package manager)
  • Raycast with AI Chat feature
  • Accessibility permissions for Terminal/your shell

Quick Start

# Extract 5 chats (quick test)
uv run --with pyobjc-framework-Cocoa --with pyobjc-framework-Quartz --with pyobjc-framework-ApplicationServices python3 raycast_export.py

# Extract all chats
uv run --with pyobjc-framework-Cocoa --with pyobjc-framework-Quartz --with pyobjc-framework-ApplicationServices python3 raycast_export.py --all

Usage

usage: raycast_export.py [-h] [--count COUNT] [--all] [--output OUTPUT] [--delay DELAY] [--debug]

Export Raycast AI Chat sessions

options:
  -h, --help            show this help message and exit
  --count, -n COUNT     Number of chats to extract (default: 5)
  --all                 Extract all chats
  --output, -o OUTPUT   Output file path (default: ~/Desktop/raycast_ai_chats.json)
  --delay, -d DELAY     Delay between chats in seconds (default: 1.0)
  --debug               Enable debug output (shows scroll progress and message counts)

Examples

# Export 20 chats
uv run --with pyobjc-framework-Cocoa --with pyobjc-framework-Quartz --with pyobjc-framework-ApplicationServices python3 raycast_export.py -n 20

# Export all chats with faster delay
uv run --with pyobjc-framework-Cocoa --with pyobjc-framework-Quartz --with pyobjc-framework-ApplicationServices python3 raycast_export.py --all -d 0.8

# Export to custom location
uv run --with pyobjc-framework-Cocoa --with pyobjc-framework-Quartz --with pyobjc-framework-ApplicationServices python3 raycast_export.py --all -o ~/Documents/my_chats.json

# Debug mode (shows scroll progress per chat)
uv run --with pyobjc-framework-Cocoa --with pyobjc-framework-Quartz --with pyobjc-framework-ApplicationServices python3 raycast_export.py -n 5 --debug

Before Running

  1. Open the Raycast AI Chat window - The script needs this window visible
  2. Grant accessibility permissions if prompted
  3. Don't use keyboard/mouse while the script runs - it automates UI selection

Output Format

The script exports to JSON with this structure:

{
  "exported_at": "2026-01-18T12:00:00.000000",
  "total_sessions": 100,
  "sessions": [
    {
      "index": 0,
      "title": "Chat Title",
      "date": "2026-01-18",
      "messages": [
        {"role": "user", "content": "Your message..."},
        {"role": "assistant", "content": "AI response..."}
      ]
    }
  ]
}

Date Field

The date field contains an approximate ISO date based on Raycast's sidebar grouping:

Sidebar Section Date Value
Pinned null
Today Current date
Yesterday -1 day
Last Week ~4 days ago
This Month ~14 days ago
Earlier/Older ~42 days ago

Note: Raycast only shows relative date sections, not exact timestamps.

How It Works

The script uses macOS Accessibility APIs to:

  1. Find the Raycast AI Chat window
  2. Read chat titles and date sections from the sidebar
  3. Select each chat using AppleScript row selection
  4. Scroll through the chat content to capture all messages (handles virtualized lists)
  5. Extract message content from both simple text areas and nested rich content structures
  6. Detect message roles by checking for AI command icons (distinguishes user vs assistant)

Troubleshooting

"AI Chat window not found"

Make sure the Raycast AI Chat window is open (not the main Raycast command bar).

Accessibility permission denied

Go to System Settings > Privacy & Security > Accessibility and add your terminal app.

Messages appear empty or wrong

Try increasing the delay with -d 1.5 to give more time for content to load.

Long chats missing messages

Use --debug to see scroll progress. Long chats are extracted by scrolling through the content area. If messages are missing, the scroll timing may need adjustment - try -d 1.5.

Script stops mid-way

The script may lose window focus. Keep the AI Chat window visible and don't interact with other apps.

Time Estimates

Chats Default (1s delay) Fast (0.8s delay)
50 ~1 min ~45 sec
200 ~3.5 min ~2.5 min
400 ~7 min ~5.5 min

Shell Alias (Optional)

Add to your .zshrc or .bashrc (adjust the path to where you cloned the repo):

alias raycast-export='uv run --with pyobjc-framework-Cocoa --with pyobjc-framework-Quartz --with pyobjc-framework-ApplicationServices python3 ~/Dev/raycast-ai-exporter/raycast_export.py'

Then use:

raycast-export --all
raycast-export -n 50

Consolidating Your AI Chat History

This exporter was built to feed into Central Chat, a local-first app that unifies AI conversations from multiple platforms into a single searchable interface. Your data never leaves your computer.

Central Chat supports imports from:

  • Raycast AI → Use this exporter (Raycast has no native export)
  • ChatGPT → Use OpenAI's built-in export
  • Claude → Use Anthropic's built-in export

Once you have exports from each platform, upload them to Central Chat for unified search across all your AI conversations.

ChatGPT (OpenAI)

  1. Sign in to ChatGPT
  2. Click your profile icon in the top right corner
  3. Click SettingsData Controls
  4. Under "Export Data", click Export
  5. Click Confirm export
  6. You'll receive an email with a download link (expires in 24 hours)

The export includes your conversations in JSON format plus account data. Note: Team/Enterprise workspace conversations and images are not included.

More info: OpenAI Help Center

Claude (Anthropic)

  1. Sign in to Claude
  2. Click your initials in the lower left corner
  3. Select Settings
  4. Navigate to the Privacy section
  5. Click Export data
  6. You'll receive a download link via email (expires in 24 hours)

The export includes your conversation data and account information. Available on Free, Pro, and Max tiers. Not available on iOS/Android apps—use the web app or Claude Desktop.

More info: Claude Support

About

Export your Raycast AI chat sessions to structured JSON format.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages