feat(sdk-playground): reflect SDK-owned memory block in debug view - #1533
Conversation
|
Claude finished @Dhravya's task in 1m 31s —— View job Review Complete
Overview: Updates the SDK playground debug view to show the actual deduplicated memory block that the SDK middleware sends. Issues found: None — this looks good to ship. Re: Cursor Bugbot's "double dedupe" concern: This was a valid observation on an earlier commit, but has been fixed. The current code correctly fetches raw profile data and deduplicates once with the correct Score: 10/10 |
There was a problem hiding this comment.
Overview: Adds a memory deduplication helper and updates the SDK playground debug view to show the actual deduplicated memory block that the SDK middleware sends.
Issues found: None — this looks good to ship.
The implementation is clean:
dedupeProfileForModecorrectly implements static → dynamic → search priority deduplication with case-insensitive normalization- The
chatReadylogic properly allows chat when either user-entered keys OR server env keys are present - The debug view now accurately reflects what the SDK middleware actually injects
Score: 10/10
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit ed15364. Configure here.
| dynamic: profileRaw?.dynamic ?? [], | ||
| searchResults: normalizeSearchResults(profileResponse.searchResults), | ||
| }, | ||
| ) |
There was a problem hiding this comment.
Wrong-mode double dedupe
Medium Severity
fetchContainerContext always runs dedupeProfileForMode with "full" or "profile" based only on whether a query string is present, then buildMiddlewareMemoryDebug dedupes again with the real memoryMode. For "query" mode that first pass treats overlapping search hits as profile duplicates and drops them, so the debug preview no longer matches what the SDK middleware injects.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit ed15364. Configure here.
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
supermemory-mcp | 4ad5f0b | Sep 01 2026, 06:21 AM |
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
supermemory-app | 4ad5f0b | Commit Preview URL Branch Preview URL |
Sep 01 2026, 06:23 AM |
42f308b to
8de27af
Compare
ed15364 to
5243a43
Compare
There was a problem hiding this comment.
Overview: Adds a dedupeProfileForMode helper to the SDK playground and updates the debug view to show the actual deduplicated memory block the SDK middleware sends.
Issues found: None — this looks good to ship.
Re: Cursor Bugbot's "double dedupe" concern: This is a false positive. The two call sites are in separate code paths:
fetchContainerContextis used by the/api/contextendpoint for UI displaybuildMiddlewareMemoryDebugcallsfetchProfileContextdirectly (line 236-241), notfetchContainerContext, so it gets fresh raw data and dedupes once with the correctmemoryMode
The implementation is correct:
dedupeProfileForModecorrectly implements static → dynamic → search priority deduplicationnormalizeFactKeyproperly normalizes text by stripping date/recent prefixes and normalizing whitespace- Mode handling is accurate: "query" keeps only search results, "profile" clears search results, "full" keeps all
Score: 10/10
a46eba5 to
5d1f557
Compare
Merge activity
|
cb557f4 to
7c2adf1
Compare
5d1f557 to
1aad7f1
Compare
There was a problem hiding this comment.
Overview: Updates the SDK playground debug view to show the actual deduplicated memory block that the SDK middleware sends, with both TypeScript and Python implementations now using proper deduplication logic.
Issues found: None — this looks good to ship.
Re: Cursor Bugbot's "double dedupe" concern: This was a valid observation on commit ed15364, but it has been fixed in subsequent commits (d14db89, 1aad7f1). The current code no longer calls dedupeProfileForMode in fetchContainerContext. The flow is now correct:
fetchProfileContextreturns raw profile data (no deduplication)buildMiddlewareMemoryDebugcallsreconstructSdkMemoryBlockwhich performs deduplication once with the correctmemoryMode
The implementation is clean:
reconstructSdkMemoryBlockcorrectly handles bothai-sdkandopenaiflavors with appropriate template differencesdeduplicateMemoriesForModeproperly handles"query"mode by not deduplicating search results against the profile (since the profile isn't injected in that mode)- Python
reconstruct_python_sdk_memory_blockmirrors the TypeScript logic correctly
Score: 10/10
7c2adf1 to
5df25cc
Compare
…1533) ## Stack Context Part 3 (top) of a 3-PR stack moving memory deduplication into the SDKs. See `sdk-dedup/tools-ts` for full context. ## What? Update the SDK playground so its debug view reflects the SDK-owned memory block. - Displays the current deduplicated `<supermemory>` replacement block produced by the SDK middleware, instead of the old browser-side "seen facts" delta. - Adds a `memory-dedupe` helper and ignores local `*.tsbuildinfo`. ## Why? The previous debug cards were misleading — they showed an incremental browser-filtered delta while the middleware actually re-injected the full profile. Now the visualization matches what the SDK really sends. 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Low Risk** > Playground-only visualization and chat gating changes; no production SDK or API behavior. > > **Overview** > The playground **debug trace** now shows the **deduplicated memory block** the SDK middleware would inject (static → dynamic → search, mode-aware), instead of a misleading browser-side “new facts” delta. A new **`memory-dedupe`** helper mirrors `@supermemory/tools` middleware behavior and is applied when fetching container context and building middleware memory debug entries; the context preview card is relabeled to reflect that each turn **replaces** the prior `<supermemory>` block. > > **Chat UX:** messaging is enabled when API keys are configured on the **server** (`hasSupermemoryKey` / `hasOpenAiKey` from `/api/chat`), not only when keys are typed in the panel. The message input stays editable while waiting for text; Send still requires non-empty input. > > Also ignores `*.tsbuildinfo` in `.gitignore`. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit ed15364. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY -->
1aad7f1 to
a25aa3e
Compare
…1533) ## Stack Context Part 3 (top) of a 3-PR stack moving memory deduplication into the SDKs. See `sdk-dedup/tools-ts` for full context. ## What? Update the SDK playground so its debug view reflects the SDK-owned memory block. - Displays the current deduplicated `<supermemory>` replacement block produced by the SDK middleware, instead of the old browser-side "seen facts" delta. - Adds a `memory-dedupe` helper and ignores local `*.tsbuildinfo`. ## Why? The previous debug cards were misleading — they showed an incremental browser-filtered delta while the middleware actually re-injected the full profile. Now the visualization matches what the SDK really sends. 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Low Risk** > Playground-only visualization and chat gating changes; no production SDK or API behavior. > > **Overview** > The playground **debug trace** now shows the **deduplicated memory block** the SDK middleware would inject (static → dynamic → search, mode-aware), instead of a misleading browser-side “new facts” delta. A new **`memory-dedupe`** helper mirrors `@supermemory/tools` middleware behavior and is applied when fetching container context and building middleware memory debug entries; the context preview card is relabeled to reflect that each turn **replaces** the prior `<supermemory>` block. > > **Chat UX:** messaging is enabled when API keys are configured on the **server** (`hasSupermemoryKey` / `hasOpenAiKey` from `/api/chat`), not only when keys are typed in the panel. The message input stays editable while waiting for text; Send still requires non-empty input. > > Also ignores `*.tsbuildinfo` in `.gitignore`. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit ed15364. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY -->
5df25cc to
03773c4
Compare
a25aa3e to
4ad5f0b
Compare
The base branch was changed.



Stack Context
Part 3 (top) of a 3-PR stack moving memory deduplication into the SDKs. See
sdk-dedup/tools-tsfor full context.What?
Update the SDK playground so its debug view reflects the SDK-owned memory block.
<supermemory>replacement block produced by the SDK middleware, instead of the old browser-side "seen facts" delta.memory-dedupehelper and ignores local*.tsbuildinfo.Why?
The previous debug cards were misleading — they showed an incremental browser-filtered delta while the middleware actually re-injected the full profile. Now the visualization matches what the SDK really sends.
🤖 Generated with Claude Code
Note
Low Risk
Playground-only visualization and chat gating changes; no production SDK or API behavior.
Overview
The playground debug trace now shows the deduplicated memory block the SDK middleware would inject (static → dynamic → search, mode-aware), instead of a misleading browser-side “new facts” delta. A new
memory-dedupehelper mirrors@supermemory/toolsmiddleware behavior and is applied when fetching container context and building middleware memory debug entries; the context preview card is relabeled to reflect that each turn replaces the prior<supermemory>block.Chat UX: messaging is enabled when API keys are configured on the server (
hasSupermemoryKey/hasOpenAiKeyfrom/api/chat), not only when keys are typed in the panel. The message input stays editable while waiting for text; Send still requires non-empty input.Also ignores
*.tsbuildinfoin.gitignore.Reviewed by Cursor Bugbot for commit ed15364. Bugbot is set up for automated code reviews on this repo. Configure here.