Skip to content

Improve memory graph#973

Open
Dhravya wants to merge 8 commits into
mainfrom
codex/memory-graph-playground-clusters
Open

Improve memory graph#973
Dhravya wants to merge 8 commits into
mainfrom
codex/memory-graph-playground-clusters

Conversation

@Dhravya
Copy link
Copy Markdown
Member

@Dhravya Dhravya commented May 19, 2026

Summary

  • add a container tag selector to the memory graph playground, including a proxy for /v3/container-tags/list
  • improve dense graph readability with stable append placement, wider memory clustering, dynamic zoom bounds, and relation-edge level-of-detail
  • add cluster-colored nodes, clearer update-chain markers, stronger focused update edges, and an expanded legend explaining colors/edge semantics
  • make the playground converter match current API response shapes (memoryEntries, type, relation fields)

Verification

  • bun --filter @supermemory/memory-graph test
  • bun run build in packages/memory-graph
  • bun run build in apps/memory-graph-playground
  • git diff --cached --check

@claude
Copy link
Copy Markdown

claude Bot commented May 19, 2026

Claude finished @ishaanxgupta's task in 1m 58s —— View job


Reviewing PR and Screenshots

  • Examine the screenshots showing the graph in full view
  • Review the outstanding issues raised by @vorflux
  • Check if the issues have been addressed in recent commits
  • Provide summary and recommendations

Analysis

The screenshots show the memory graph rendered with a spiral/starburst layout at full zoom-out view. The visualization displays thousands of nodes with:

  • Cluster coloring (teal/cyan dominant with blue accents)
  • Legend panel showing statistics and color meanings
  • The spiral pattern that emerges from the golden-angle placement algorithm

Review Status

I verified the code against @vorflux's feedback from the earlier review:

Issue Status
nodeCache.current mutation in useMemo Fixed — The hook now builds a new nextCache Map inside useMemo and only assigns it to nodeCache.current via useEffect (lines 623-625). This follows React's side-effect-free contract.
isAppendCandidateOpen O(n) performance Fixed — Spatial hashing implemented via buildAppendSpatialGrid() and getAppendSpatialCell(). Now checks only 9 neighboring grid cells instead of all nodes.
Duplicate hashString function Fixed — Extracted to packages/memory-graph/src/utils/hash.ts and imported in both renderer.ts and use-graph-data.ts.
Aggressive version inference Fixed — Version assignment is now per-entry: const version = Number.isFinite(m.version) && m.version > lastVersion ? m.version : lastVersion + 1. Invalid entries fall back individually without discarding the entire chain.

Tests

All 172 tests pass in the memory-graph package.

Summary

All issues from the previous review have been addressed. The code follows correct React patterns, has good performance characteristics with spatial hashing, and handles edge cases gracefully. The PR looks ready to merge.

@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented May 19, 2026

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 859298d May 30 2026, 11:55 AM

Copy link
Copy Markdown

@claude claude Bot left a comment

Choose a reason for hiding this comment

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

Overview: This PR improves memory graph readability with container tag filtering, cluster-colored nodes, dynamic zoom bounds, and level-of-detail edge rendering for dense graphs.

Issues found: None — this looks good to ship.

The code is well-structured with solid test coverage. Key observations:

  • Container tags proxy (/api/container-tags/route.ts): Clean API proxy pattern appropriate for a playground app. Error handling is thorough.

  • Simulation changes (simulation.ts): The new stop() method and dynamic getDocMemoryDistance() based on memory count are correctly implemented. The append-only pagination logic in memory-graph.tsx properly preserves existing node positions.

  • Cluster assignments (use-graph-data.ts): The BFS-based clustering algorithm correctly merges cross-document relation clusters and assigns consistent colors via deterministic hashing.

  • Level-of-detail rendering (renderer.ts): Smart edge sampling at low zoom levels using getRelationEdgeStride() and shouldDrawRelationEdge(). Structural "derives" edges are always drawn, while relation edges are deterministically sampled to reduce visual noise.

  • Version chain inference (version-chain.ts): Good fix for backends that repeat v1 across update chains — the code now infers display versions from chain order when needed.

  • Dynamic zoom bounds (viewport.ts): setMinZoomForNodes() properly allows zooming out further for large graphs while clamping to reasonable limits.

Score: 10/10

@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented May 19, 2026

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 859298d Commit Preview URL

Branch Preview URL
May 30 2026, 11:56 AM

Copy link
Copy Markdown
Contributor

@vorflux vorflux Bot left a comment

Choose a reason for hiding this comment

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

Reviewed the full diff. A few real bugs and a design concern below.

Comment thread packages/memory-graph/src/hooks/use-graph-data.ts Outdated
Comment thread packages/memory-graph/src/hooks/use-graph-data.ts
Comment thread packages/memory-graph/src/canvas/renderer.ts Outdated
Comment thread packages/memory-graph/src/canvas/version-chain.ts Outdated
@Dhravya Dhravya changed the title Improve memory graph playground readability Improve memory graph May 19, 2026
@ishaanxgupta
Copy link
Copy Markdown
Contributor

ishaanxgupta commented May 29, 2026

the graph looks like this in full view:
image
image

…ayground-clusters

# Conflicts:
#	packages/memory-graph/src/components/legend.tsx
#	packages/memory-graph/src/components/memory-graph.tsx
@ishaanxgupta
Copy link
Copy Markdown
Contributor

Added low-zoom rendering optimization:

  • samples dense document-memory edges
  • fades/simplifies low-zoom edges
  • draws huge memory sets as batched colored points instead of expensive detailed nodes

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