supermemory icon indicating copy to clipboard operation
supermemory copied to clipboard

fix: chatgpt memories import

Open MaheshtheDev opened this issue 2 months ago • 3 comments

  • ChatGPT changed there DOM with new UI, this PR will fix the import to supermemory feature with chatgpt new UI

MaheshtheDev avatar Nov 26 '25 03:11 MaheshtheDev


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.

MaheshtheDev avatar Nov 26 '25 03:11 MaheshtheDev

Deploying with  Cloudflare Workers  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

  1. Simplified Memory Extraction - The refactor from parsing individual table rows to using textContent is more resilient to DOM structure changes
  2. Reduced Code Complexity - Removed 20+ lines of brittle DOM traversal logic
  3. 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 (forEach on all table rows)
  • Single .textContent property access is O(1)
  • Reduced memory allocation (no intermediate memories array)

🧪 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:

  1. Extracting memories from populated table
  2. Handling empty tables
  3. Verifying button placement after selector change

📝 Additional Suggestions

  1. 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}`
  1. Consider adding telemetry: Track when memory extraction succeeds/fails to monitor the health of this integration.

  2. Document the selector change: Add a comment explaining why .flex.items-center.gap-0\\.5 was 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:

  1. Test the actual output format from textContent on ChatGPT's live memories dialog
  2. Add cleanup logic if the output includes unwanted headers/UI elements
  3. Improve the empty content validation
  4. 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

claude[bot] avatar Nov 26 '25 03:11 claude[bot]

Merge activity

graphite-app[bot] avatar Dec 02 '25 18:12 graphite-app[bot]

SpongeBob SquarePants gif. SpongeBob smiles and gives two thumbs up, and then a dozen more hands giving thumbs up bud out from all sides of his body. Text, 'Many thumbs up.' (Added via Giphy)

graphite-app[bot] avatar Dec 02 '25 18:12 graphite-app[bot]