Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
d1d936e
bugfix: after memory is moved, when doc is dragged the moved memory s…
vrupak Dec 20, 2025
b7a2009
added a changelog.md doc
vrupak Dec 20, 2025
db0f741
updated rendering to hybrid: continuous when simulation active, chang…
vrupak Dec 21, 2025
e111672
performance fix: limited doc similarity check to 50 docs for now, mem…
vrupak Dec 21, 2025
db7fa87
updated changelog to include minor performance fix.
vrupak Dec 21, 2025
3823b3c
optimized doc similarity calculation by using k-NN algo (each doc com…
vrupak Dec 21, 2025
404c382
fix: made changes in the wrong directory, reverted and updated in the…
vrupak Dec 21, 2025
7967f50
updated color scheme for better visual clarity
vrupak Dec 21, 2025
c07cdf5
refactor: replaced concentric ring layout with physics driven approach.
vrupak Dec 21, 2025
2f60729
updated changelog.md to include recent changes
vrupak Dec 21, 2025
278dda3
updated memory-graph legend colors
vrupak Dec 21, 2025
ef59792
updated the hexagon icons in legend to be uniform along with their bo…
vrupak Dec 21, 2025
72df14c
added doc type icon to graph nodes for supported file formats. also u…
vrupak Dec 22, 2025
ad51532
added popover cards for doc and memory to open next to the selected n…
vrupak Dec 22, 2025
696f5bb
updated changelog and refactored popover logic to eliminate unnecessa…
vrupak Dec 22, 2025
ac8fad9
added dimming to bg when popover is open.
vrupak Dec 22, 2025
acc9181
made dimming animation to last 1.5seconds. also updated popover posit…
vrupak Dec 22, 2025
97599c4
added slideshow mode to automatically cycle through nodes with smooth…
vrupak Dec 22, 2025
b645d18
added logic to clear old timeout before creating new one (prevents ac…
vrupak Dec 22, 2025
ccef366
slideshow now stops when user clicks outside the popover
vrupak Dec 22, 2025
b86785d
bugfix: physics persisted sometimes after slideshow ends. now explici…
vrupak Dec 23, 2025
263d6e5
updated changelog.md to be more concise
vrupak Dec 23, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,6 @@ yarn-error.log*
# Misc
.DS_Store
*.pem

.claude
.venv
__pycache__
74 changes: 68 additions & 6 deletions apps/memory-graph-playground/src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ export default function Home() {
// State for controlled space selection
const [selectedSpace, setSelectedSpace] = useState<string>("all")

// State for slideshow
const [isSlideshowActive, setIsSlideshowActive] = useState(false)
const [currentSlideshowNode, setCurrentSlideshowNode] = useState<string | null>(null)

const PAGE_SIZE = 500

const fetchDocuments = useCallback(
Expand Down Expand Up @@ -109,6 +113,23 @@ export default function Home() {
setSelectedSpace("all")
}

// Toggle slideshow
const handleToggleSlideshow = () => {
setIsSlideshowActive((prev) => !prev)
}

// Handle slideshow node change
const handleSlideshowNodeChange = useCallback((nodeId: string | null) => {
// Track which node is being shown in slideshow
setCurrentSlideshowNode(nodeId)
console.log("Slideshow showing node:", nodeId)
}, [])

// Handle slideshow stop (when user clicks outside)
const handleSlideshowStop = useCallback(() => {
setIsSlideshowActive(false)
}, [])

return (
<div className="flex flex-col h-screen bg-zinc-950">
{/* Header */}
Expand Down Expand Up @@ -158,12 +179,49 @@ export default function Home() {
</span>
</div>
</div>
<button
onClick={handleReset}
className="rounded-lg border border-zinc-700 px-3 py-1 text-xs font-medium text-zinc-300 transition-colors hover:bg-zinc-800"
>
Reset Filters
</button>
<div className="flex items-center gap-3">
<button
onClick={handleToggleSlideshow}
className={`rounded-lg px-3 py-1.5 text-xs font-medium transition-colors flex items-center gap-1.5 ${
isSlideshowActive
? "bg-blue-600 text-white hover:bg-blue-700"
: "border border-zinc-700 text-zinc-300 hover:bg-zinc-800"
}`}
>
{isSlideshowActive ? (
<>
<svg
width="12"
height="12"
viewBox="0 0 24 24"
fill="currentColor"
>
<rect x="6" y="6" width="12" height="12" />
</svg>
Slideshow
</>
) : (
<>
<svg
width="12"
height="12"
viewBox="0 0 24 24"
fill="currentColor"
>
<path d="M8 5v14l11-7z" />
</svg>
Slideshow
</>
)}
</button>
<div className="h-6 w-px bg-zinc-700" />
<button
onClick={handleReset}
className="rounded-lg border border-zinc-700 px-3 py-1.5 text-xs font-medium text-zinc-300 transition-colors hover:bg-zinc-800"
>
Reset Filters
</button>
</div>
</div>
</div>
)}
Expand Down Expand Up @@ -225,6 +283,10 @@ export default function Home() {
// Controlled space selection
selectedSpace={selectedSpace}
onSpaceChange={handleSpaceChange}
// Slideshow control
isSlideshowActive={isSlideshowActive}
onSlideshowNodeChange={handleSlideshowNodeChange}
onSlideshowStop={handleSlideshowStop}
>
<div className="flex h-full items-center justify-center">
<p className="text-zinc-400">
Expand Down
772 changes: 143 additions & 629 deletions bun.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"@scalar/hono-api-reference": "^0.9.11",
"@vanilla-extract/recipes": "^0.5.7",
"ai": "^5.0.59",
"alchemy": "^0.55.2",
"alchemy": "^0.81.4",
"atmn": "^0.0.16",
"better-auth": "^1.3.3",
"boxen": "^8.0.1",
Expand Down Expand Up @@ -61,7 +61,7 @@
"drizzle-kit": "^0.31.4",
"turbo": "^2.5.4",
"typescript": "5.8.3",
"wrangler": "4.22.0"
"wrangler": "^4.42.2"
},
"workerd": {
"import": "./esm/index.mjs",
Expand Down
83 changes: 83 additions & 0 deletions packages/memory-graph/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# Memory Graph Changelog

## Development Setup

To test changes, run these commands in separate terminals:

**Terminal 1** - Build memory-graph in watch mode:
```bash
cd packages/memory-graph && bun run dev
```

**Terminal 2** - Run the playground:
```bash
cd apps/memory-graph-playground && bun run dev
```

Then open http://localhost:3000 in your browser.

---

### Features

#### Slideshow Mode
Auto-cycling through nodes with smooth animations and physics simulation
- Random node selection every 3.5s (avoids consecutive duplicates)
- Smooth pan-to-node animation with automatic popover
- Brief physics pulse (1s) on each selection
- Background dimming animation
- Single-click to stop

#### Node Popover with Background Dimming
Floating popover with smart positioning and focus dimming effect
- Smooth 1.5s cubic ease-out dimming animation
- Non-selected nodes: 20% opacity, unconnected edges: 10% opacity
- Smart edge detection with 20px gap from node
- Auto-flips to avoid viewport edges
- Close via backdrop click, X button, or Escape key
- Shows: title, summary, type, memory count, URL, date, ID

#### Document Type Icons
Canvas-rendered icons centered on document cards
- Supported: TXT, PDF, MD, DOC/DOCX, RTF, CSV, JSON
- Scales with card size (40% of height)
- Only renders when zoomed in

#### Physics-Driven Layout
Simplified initial positioning, letting physics create natural layouts
- Simple grid with random offsets (no concentric rings)
- 50 quick pre-ticks + smooth animation
- Eliminates teleportation on node interaction
- Faster, non-blocking initial render

#### Updated Color Scheme
Refined palette for better contrast and readability

### Bug Fixes

#### Edge Viewport Culling
Fixed edges disappearing during zoom/pan
- Now checks both X and Y axis bounds
- Only culls when BOTH endpoints off-screen in same direction
- 100px margin on all sides

#### Memory Nodes Follow Parents
Memory nodes now move with parent documents when dragged
- Store relative offset instead of absolute position
- Automatically repositions based on parent location

### Performance

#### k-NN Similarity Algorithm
Reduced from O(n²) to O(n·k)
- 3x faster: ~50ms → ~17ms for 100 docs
- 4,950 → 1,500 comparisons for 100 docs
- Separated into own memo (doesn't recalculate on UI interactions)

#### Memory Leak Fix
NodeCache now cleans up deleted nodes properly

#### Race Condition Fix
Atomic node/edge updates eliminate NaN positions

---
2 changes: 2 additions & 0 deletions packages/memory-graph/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,11 @@
"@emotion/is-prop-valid": "^1.4.0",
"@radix-ui/react-collapsible": "^1.1.12",
"@radix-ui/react-slot": "^1.2.4",
"@supermemory/memory-graph": "^0.1.7",
"@vanilla-extract/css": "^1.17.4",
"@vanilla-extract/recipes": "^0.5.7",
"@vanilla-extract/sprinkles": "^1.6.5",
"d3-force": "^3.0.0",
"lucide-react": "^0.552.0",
"motion": "^12.23.24"
},
Expand Down
Loading