Import xAI Grok conversation history into Open Brain as searchable thoughts.
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.
- Working Open Brain setup (guide)
- Grok data export — JSON file from X/Grok
- Node.js 18+ installed
- OpenRouter API key for embedding generation
GROK EXPORT IMPORT -- CREDENTIAL TRACKER
--------------------------------------
FROM YOUR OPEN BRAIN SETUP
Supabase URL: ____________
Service Role Key: ____________
FROM OPENROUTER
API Key: ____________
--------------------------------------
-
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
-
Copy this recipe folder and install dependencies:
cd grok-export-import npm install -
Create
.envwith 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
-
Preview what will be imported (dry run):
node import-grok.mjs /path/to/grok-export.json --dry-run
-
Run the import:
node import-grok.mjs /path/to/grok-export.json
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_thoughtsfinds relevant Grok conversations
Scale reference: Tested with 750+ Grok conversations imported successfully.
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.