Back to Supermemory

@supermemory/memory-graph

packages/memory-graph/README.md

latest3.1 KB
Original Source

@supermemory/memory-graph

Interactive graph visualization for documents and their memory connections.

Installation

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

Quick Start

tsx
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

PropTypeDescription
documentsDocumentWithMemories[]Array of documents with their memory entries
isLoadingbooleanShow loading state
variant"console" | "consumer"Display mode (default: "console")
errorError | nullError to display
loadMoreDocuments() => Promise<void>Function to load more data
highlightDocumentIdsstring[]IDs of documents to highlight

Documentation

Full documentation available at docs.supermemory.ai:

Requirements

  • React 18+
  • Modern browser

License

MIT