Skip to content

feat(sdk-playground): reflect SDK-owned memory block in debug view - #1533

Merged
graphite-app[bot] merged 1 commit into
mainfrom
sdk-dedup/playground
Sep 1, 2026
Merged

feat(sdk-playground): reflect SDK-owned memory block in debug view#1533
graphite-app[bot] merged 1 commit into
mainfrom
sdk-dedup/playground

Conversation

@Dhravya

@Dhravya Dhravya commented Aug 18, 2026

Copy link
Copy Markdown
Member

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


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.

Reviewed by Cursor Bugbot for commit ed15364. Bugbot is set up for automated code reviews on this repo. Configure here.

@claude

claude Bot commented Aug 18, 2026

Copy link
Copy Markdown

Claude finished @Dhravya's task in 1m 31s —— View job


Review Complete

  • Fetch PR diff and understand changes
  • Review changed files for bugs and security issues
  • Check existing review comments to avoid duplicates
  • Submit review

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 memoryMode in reconstructSdkMemoryBlock.

Score: 10/10

Dhravya commented Aug 18, 2026

Copy link
Copy Markdown
Member Author

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

  • dedupeProfileForMode correctly implements static → dynamic → search priority deduplication with case-insensitive normalization
  • The chatReady logic 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

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ 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),
},
)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit ed15364. Configure here.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Aug 18, 2026

Copy link
Copy Markdown

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 successful!
View logs
supermemory-mcp 4ad5f0b Sep 01 2026, 06:21 AM

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Aug 18, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

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

@ved015
ved015 force-pushed the sdk-dedup/playground branch from ed15364 to 5243a43 Compare August 24, 2026 16:21

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

  • fetchContainerContext is used by the /api/context endpoint for UI display
  • buildMiddlewareMemoryDebug calls fetchProfileContext directly (line 236-241), not fetchContainerContext, so it gets fresh raw data and dedupes once with the correct memoryMode

The implementation is correct:

  • dedupeProfileForMode correctly implements static → dynamic → search priority deduplication
  • normalizeFactKey properly 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

@ved015
ved015 force-pushed the sdk-dedup/playground branch 2 times, most recently from a46eba5 to 5d1f557 Compare August 24, 2026 18:09
ved015
ved015 previously approved these changes Aug 24, 2026
@graphite-app

graphite-app Bot commented Sep 1, 2026

Copy link
Copy Markdown

Merge activity

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

  • fetchProfileContext returns raw profile data (no deduplication)
  • buildMiddlewareMemoryDebug calls reconstructSdkMemoryBlock which performs deduplication once with the correct memoryMode

The implementation is clean:

  • reconstructSdkMemoryBlock correctly handles both ai-sdk and openai flavors with appropriate template differences
  • deduplicateMemoriesForMode properly 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_block mirrors the TypeScript logic correctly

Score: 10/10

graphite-app Bot pushed a commit that referenced this pull request Sep 1, 2026
…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 -->
@graphite-app
graphite-app Bot force-pushed the sdk-dedup/playground branch from 1aad7f1 to a25aa3e Compare September 1, 2026 06:04
…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 -->
@graphite-app
graphite-app Bot force-pushed the sdk-dedup/playground branch from a25aa3e to 4ad5f0b Compare September 1, 2026 06:14
@graphite-app
graphite-app Bot changed the base branch from sdk-dedup/python to main September 1, 2026 06:22
@graphite-app
graphite-app Bot dismissed ved015’s stale review September 1, 2026 06:22

The base branch was changed.

@graphite-app
graphite-app Bot merged commit 4ad5f0b into main Sep 1, 2026
6 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants