chatgpt2memmachine utility is a Python-based migration tool that transforms exported chat histories into episodic or semantic memories within your MemMachine organization.
Before starting, ensure you have your
orgId and projectId available from your MemMachine dashboard.Quick Start
Prepare your Data
Export your chat history from OpenAI (Settings > Data Controls > Export Data) or locate your Locomo history JSON file.
Install Dependencies
Clone the tool from the official repository and install required Python packages.
Configuration
The migration script supports several arguments to fine-tune how data is ingested.Core Arguments
| Parameter | Type | Description |
|---|---|---|
-i, --input | FILE | Required. Input chat history file. |
-s, --source | string | Source format: openai (default) or locomo. |
--org-id | ID | Organization ID in MemMachine. |
--project-id | ID | Project ID in MemMachine. |
--memory-types | string | episodic (default), semantic, or comma-separated values. |
Filtering & Logic
| Parameter | Description |
|---|---|
--since | Only process messages after this time (Unix, ISO, or YYYY-MM-DD). |
-l, --limit | Max messages to process per conversation (0 = no limit). |
--index | Process only the conversation at specific index N (1-based). |
--chat-title | [OpenAI only] Process only chats matching this title (case-insensitive). |
--user-only | Only add user messages to MemMachine (Enabled by default). |
--dry-run | Preview migration without adding memories. |
Advanced Operations
Resuming Failed Jobs
If a migration is interrupted, use therun-id generated in the output/ directory to retry or resume.
Performance Tuning
For large datasets, use parallel processing to speed up the ingestion:Output & Logs
Each migration run generates a uniquerun_id and stores data in the following directories:
extracted/: Contains extracted conversations saved for caching.output/success_{run_id}.txt: List of successfully migrated message IDs.output/errors_{run_id}.txt: List of failed messages with error details.output/migration_stats_{run_id}.json: Summary of counts and duration.
Verifying Your Migration
Once the script completes, you can verify that your memories were correctly ingested by checking the following:Check the Output Files
The script generates a
migration_stats_{run_id}.json file in the output/ directory. Open it to confirm:total_messages_processedmatches your expectations.success_countrepresents the majority of your data.
Spot-Check the API
You can query your MemMachine instance directly to see if the new memories appear in your project.

