Skip to content

Latest commit

 

History

History
 
 

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

README.md

Grok Export Import

Import xAI Grok conversation history into Open Brain as searchable thoughts.

What It Does

Parses xAI Grok conversation exports (JSON format with MongoDB-style dates) and imports each conversation as a thought with embeddings. Handles nested conversation/response structures and MongoDB date objects.

Prerequisites

  • Working Open Brain setup (guide)
  • Grok data export — JSON file from X/Grok
  • Node.js 18+ installed
  • OpenRouter API key for embedding generation

Credential Tracker

GROK EXPORT IMPORT -- CREDENTIAL TRACKER
--------------------------------------

FROM YOUR OPEN BRAIN SETUP
  Supabase URL:          ____________
  Service Role Key:      ____________

FROM OPENROUTER
  API Key:               ____________

--------------------------------------

Steps

  1. Export your Grok data:

    • Request your data export from X (formerly Twitter)
    • The Grok conversations are included in the data archive
    • Find the Grok JSON file in the export
  2. Copy this recipe folder and install dependencies:

    cd grok-export-import
    npm install
  3. Create .env with your credentials (see .env.example):

    SUPABASE_URL=https://your-project.supabase.co
    SUPABASE_SERVICE_ROLE_KEY=your-service-role-key
    OPENROUTER_API_KEY=sk-or-v1-your-key
  4. Preview what will be imported (dry run):

    node import-grok.mjs /path/to/grok-export.json --dry-run
  5. Run the import:

    node import-grok.mjs /path/to/grok-export.json

Expected Outcome

After running the import:

  • Each Grok conversation becomes a thought with source_type: grok_import
  • MongoDB-style dates ($date.$numberLong) are properly parsed to ISO timestamps
  • Running search_thoughts finds relevant Grok conversations

Scale reference: Tested with 750+ Grok conversations imported successfully.

Troubleshooting

Issue: Date parsing errors Grok uses MongoDB's {$date: {$numberLong: "..."}} format. The script handles this automatically. If you see wrong dates, check that the JSON file hasn't been modified.

Issue: "conversations" field not found The script looks for parsed.conversations first, then treats the root as an array. Different Grok export versions may structure the data differently.