supermemory/packages/memory-graph
abhay-codes07 5bbcc07e93
fix(memory-graph): make popover quadrant fallback pick the side with most space
pickBestQuadrant flattened each side's available space to -1 when the
popover did not fully fit, then sorted those values for the fallback.
Once every side was -1 the sort was meaningless and the fallback always
returned right, even for a node hugging the right edge of the
container where the left side has ~45x more room. The clamped popover
then slides over the node it is annotating.

Keep the raw space measurements alongside the required size so the
preference pass still checks fit, while the fallback can genuinely
rank sides by available space. Also export the helper and cover the
preference order, the exact-fit boundary, and the fallback ranking
with unit tests.
2026-07-12 23:26:12 +05:30
..
scripts Rewrite @supermemory/memory-graph with perf optimizations + consolidate consumers (#809) 2026-03-28 19:06:27 -07:00
src fix(memory-graph): make popover quadrant fallback pick the side with most space 2026-07-12 23:26:12 +05:30
.gitignore package the graph (#563) 2025-11-19 18:57:56 +00:00
.npmignore package the graph (#563) 2025-11-19 18:57:56 +00:00
CHANGELOG.md MemoryGraph - revamped (#627) 2025-12-29 00:32:26 +05:30
package.json fix memory render (#1087) 2026-06-14 23:45:53 +05:30
README.md add docs for graph package (#603) 2025-12-04 18:56:40 +00:00
tsconfig.json Rewrite @supermemory/memory-graph with perf optimizations + consolidate consumers (#809) 2026-03-28 19:06:27 -07:00
vite.config.ts feat: make graph popover content scrollable and add View full button (#920) 2026-05-11 02:09:36 +00:00

@supermemory/memory-graph

Interactive graph visualization for documents and their memory connections.

npm version License: MIT

Installation

npm install @supermemory/memory-graph
# or
bun add @supermemory/memory-graph
# or
pnpm add @supermemory/memory-graph

Quick Start

import { MemoryGraph } from '@supermemory/memory-graph';
import type { DocumentWithMemories } from '@supermemory/memory-graph';

function App() {
  const [documents, setDocuments] = useState<DocumentWithMemories[]>([]);
  const [isLoading, setIsLoading] = useState(true);

  useEffect(() => {
    fetch('/api/graph')
      .then(res => res.json())
      .then(data => {
        setDocuments(data.documents);
        setIsLoading(false);
      });
  }, []);

  return (
    <div style={{ height: '100vh' }}>
      <MemoryGraph
        documents={documents}
        isLoading={isLoading}
        variant="console"
      />
    </div>
  );
}

Features

  • Interactive canvas visualization - Pan, zoom, and drag nodes using Canvas 2D rendering
  • Document and memory nodes - Documents as rectangles, memories as hexagons
  • Relationship visualization - Edges show document similarity and memory version chains
  • Space filtering - Filter by workspace or view all memories
  • Two variants - Full-featured console mode or embedded consumer mode
  • Pagination support - Load more documents on demand
  • TypeScript support - Full type definitions included

Essential Props

Prop Type Description
documents DocumentWithMemories[] Array of documents with their memory entries
isLoading boolean Show loading state
variant "console" | "consumer" Display mode (default: "console")
error Error | null Error to display
loadMoreDocuments () => Promise<void> Function to load more data
highlightDocumentIds string[] IDs of documents to highlight

Documentation

Full documentation available at docs.supermemory.ai:

Requirements

  • React 18+
  • Modern browser

License

MIT