fix: chatgpt memories import
- ChatGPT changed there DOM with new UI, this PR will fix the import to supermemory feature with chatgpt new UI
-
#597
👈 (View in Graphite)
-
main
How to use the Graphite Merge Queue
Add the label Main to this PR to add it to the merge queue.
You must have a Graphite account in order to use the merge queue. Sign up using this link.
An organization admin has enabled the Graphite Merge Queue in this repository.
Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.
This stack of pull requests is managed by Graphite. Learn more about stacking.
Deploying with
Cloudflare Workers
The latest updates on your project. Learn more about integrating Git with Workers.
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ❌ Deployment failed View logs |
supermemory-app | 3b75dadb | Dec 02 2025, 07:00 PM |
Pull Request Review: ChatGPT Memories Import Fix
Summary
This PR fixes the ChatGPT memories import functionality by simplifying the memory extraction logic and updating the CSS selector for the button placement. The changes reduce code complexity significantly (16 deletions, 5 additions).
✅ Positive Changes
-
Simplified Memory Extraction - The refactor from parsing individual table rows to using
textContentis more resilient to DOM structure changes - Reduced Code Complexity - Removed 20+ lines of brittle DOM traversal logic
- Version Bump - Appropriately updated extension version to 6.0.105
🐛 Potential Issues
1. Data Quality Degradation (High Priority)
The new approach captures ALL text content from the table, including:
- Column headers
- Row numbers
- Extra whitespace
- Potential UI elements within the table
Before: Structured extraction with indexed list format
ChatGPT Saved Memories:
1. [First memory]
2. [Second memory]
After: Raw text dump
Memories from ChatGPT:
[All table text content mixed together]
Impact: This could make the saved memories harder to parse, search, and use effectively in Supermemory's AI processing pipeline.
Recommendation: Consider using memoriesTable.innerText instead of textContent for better formatting, or add post-processing to clean up the extracted text.
2. Empty Content Check is Too Broad
if (!memoriesTable.textContent) {
DOMUtils.showToast("error")
return
}
This check will fail if textContent is any falsy value, but doesn't validate if there are actual memories. An empty table with just headers would pass this check.
Recommendation:
const content = memoriesTable.textContent?.trim()
if (!content || content.length < 10) { // Arbitrary min length
DOMUtils.showToast("error")
return
}
3. CSS Selector Brittleness
const deleteAllContainer = memoriesDialog.querySelector(
".flex.items-center.gap-0\\.5",
)
Concerns:
- This selector relies on ChatGPT's internal styling classes
- The escaped dot (
gap-0\\.5) suggests Tailwind CSS usage - If ChatGPT updates their UI/class names, this will break
Previous selector: .mt-5.flex.justify-end (also brittle but different breakage point)
Recommendation: Add fallback logic or use more semantic selectors if available (e.g., [data-testid] attributes).
4. Missing Error Context
When memory extraction fails, users just see a generic error toast. No information about what went wrong.
Recommendation: Add console logging:
if (!memoriesTable.textContent) {
console.error('ChatGPT memories table is empty or not found')
DOMUtils.showToast("error")
return
}
🔒 Security Considerations
Low Risk - No security concerns identified:
- No XSS vectors introduced
- No sensitive data exposure
- No authentication bypasses
- Content is properly passed through existing message handlers
⚡ Performance Considerations
Positive Impact:
- Removed expensive DOM traversal loop (
forEachon all table rows) - Single
.textContentproperty access is O(1) - Reduced memory allocation (no intermediate
memoriesarray)
🧪 Test Coverage
Missing Test Coverage:
- No tests verify the new extraction logic works correctly
- No tests for edge cases (empty table, table with only headers, malformed table)
- Selector changes aren't validated
Recommendation: Add integration tests for:
- Extracting memories from populated table
- Handling empty tables
- Verifying button placement after selector change
📝 Additional Suggestions
- Add a comment explaining the change:
// Using textContent to capture all table content. This is more resilient
// to ChatGPT's DOM structure changes than parsing individual cells.
const combinedContent = `Memories from ChatGPT:\n\n${memoriesTable.textContent}`
-
Consider adding telemetry: Track when memory extraction succeeds/fails to monitor the health of this integration.
-
Document the selector change: Add a comment explaining why
.flex.items-center.gap-0\\.5was chosen over the previous selector.
🎯 Verdict
Recommendation: Request Changes
While the simplification is architecturally sound, the data quality concerns need to be addressed before merging. The loss of structured formatting could negatively impact the user experience and downstream AI processing.
Suggested Action Items:
- Test the actual output format from
textContenton ChatGPT's live memories dialog - Add cleanup logic if the output includes unwanted headers/UI elements
- Improve the empty content validation
- Add console logging for debugging failed extractions
📊 Code Quality Score: 7/10
- ✅ Simplification and maintainability
- ✅ Performance improvement
- ⚠️ Data quality concerns
- ⚠️ Insufficient validation
- ⚠️ Missing test coverage
Review generated by Claude Code following repository conventions from CLAUDE.md
Merge activity
-
Dec 2, 6:58 PM UTC:
Dhravyaadded this pull request to the Graphite merge queue. - Dec 2, 7:00 PM UTC: Merged by the Graphite merge queue.