Skip to content

review suggestions option for inferred memories#1138

Open
sohamd22 wants to merge 2 commits into
mainfrom
06-19-review_suggestions_option_for_inferred_memories
Open

review suggestions option for inferred memories#1138
sohamd22 wants to merge 2 commits into
mainfrom
06-19-review_suggestions_option_for_inferred_memories

Conversation

@sohamd22

@sohamd22 sohamd22 commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

TL;DR

Adds a swipeable "Review suggestions" card to the dashboard that lets users approve or decline inferred memories surfaced by Nova.

What changed?

  • Added a ReviewMemoriesCard component that appears in the "Suggested for you" section of the dashboard (both desktop and mobile layouts). The card is hidden when there are no pending inferred memories, so it never renders empty chrome. While the modal is open, the displayed count is frozen so the trigger button doesn't tick down or disappear mid-session. Switching spaces closes the modal automatically.
  • Added a ReviewMemoriesModal component that presents inferred memories as a swipeable card deck. Users can approve (swipe right / ✓), decline (swipe left / ✗), or skip each memory. The modal includes:
    • Drag-to-swipe with a full-card color wash (green for keep, red for decline) and verdict pills that intensify as the swipe threshold approaches
    • Keyboard support: to approve, to decline, or Space to skip, and Cmd/Ctrl+Z to undo
    • An undo button that steps back one card and reverts the server-side decision, using refs to avoid stale-state bugs during rapid interactions
    • A progress dot indicator showing position in the queue alongside a numeric counter
    • A "All caught up" completion state summarising how many memories were kept
    • Reduced-motion support via useReducedMotion
    • The card queue is snapshotted when the modal opens so cache updates from review mutations don't reshuffle the stack mid-session
  • Added a useInferredMemories hook to fetch the pending review queue for a given container tag, and a useReviewInferredMemory mutation hook that calls the review endpoint. On success it removes the reviewed entry from the cached queue directly; on undo it invalidates the query to refetch the restored memory from the server.
  • Registered two new API schema entries: GET /container-tags/:containerTag/inferred to fetch the pending queue and POST /container-tags/:containerTag/inferred/:memoryId/review to submit an approve, decline, or undo action.

How to test?

  1. Ensure there are inferred memories pending review for a container tag.
  2. Open the dashboard — a "Review suggestions" card should appear in the "Suggested for you" section showing the count of pending memories.
  3. Click the card to open the modal and swipe or use the buttons/keyboard to approve, decline, or skip memories.
  4. Verify that approved and declined memories are removed from the queue after each decision and that the completion state appears once all cards are reviewed.
  5. Use the undo button or Cmd/Ctrl+Z to step back through decisions and confirm the server-side state is reverted correctly.
  6. Confirm the card does not render when there are zero pending inferred memories.
  7. Switch spaces while the modal is open and confirm it closes without carrying state into the new space.

Why make this change?

Nova infers memories on behalf of users but may not always be fully confident in them. This feature gives users a lightweight, low-friction way to review and curate those suggestions directly from the dashboard, improving the quality and trustworthiness of their memory store.

Copy link
Copy Markdown
Contributor Author

How to use the Graphite Merge Queue

Add the label Main to this PR to add it to the merge queue.

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@sohamd22 sohamd22 marked this pull request as ready for review June 19, 2026 10:36
@graphite-app graphite-app Bot requested a review from Dhravya June 19, 2026 10:36
@claude

claude Bot commented Jun 19, 2026

Copy link
Copy Markdown

Claude finished @sohamd22's task in 40s —— View job


Review Complete

  • Fetch PR diff and existing review comments
  • Review new changes since last commit
  • Update review status

Overview: Second commit adds an undo feature (Ctrl/Cmd+Z) to step back through reviewed cards and revert server-side decisions.

New changes look good: The undo implementation correctly uses refs (indexRef, historyRef) to avoid stale closure issues during rapid swipes/undos, and the mutation properly invalidates the query on undo to refetch the restored memory.

Outstanding issue: The velocity bug from my previous inline comment is still present at lines 368-371. The swipe detection can trigger the wrong action if the user drags one direction but flicks the opposite way. The fix is straightforward:

- if (offset.x > SWIPE_OFFSET || velocity.x > SWIPE_VELOCITY)
+ if ((offset.x > SWIPE_OFFSET) || (offset.x > 0 && velocity.x > SWIPE_VELOCITY))
    onDecide("approve")
- else if (offset.x < -SWIPE_OFFSET || velocity.x < -SWIPE_VELOCITY)
+ else if ((offset.x < -SWIPE_OFFSET) || (offset.x < 0 && velocity.x < -SWIPE_VELOCITY))
    onDecide("decline")

Score: 9/10 — Ship once the velocity check is fixed.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jun 19, 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 fcd1e6c Jun 20 2026, 11:42 AM

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jun 19, 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 fcd1e6c Commit Preview URL Jun 20 2026, 11:43 AM

@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 swipeable card UI for reviewing Nova's inferred memories from the dashboard.

Issues found:

  • Swipe velocity detection can trigger the wrong decision when the user drags one direction but flicks the opposite way (see inline comment with fix)

Everything else looks solid — the snapshot-on-open pattern for the card queue is well thought out, keyboard support is clean, and the mutation/cache update logic handles the optimistic removal correctly.

Score: 9/10

Comment on lines +320 to +323
if (offset.x > SWIPE_OFFSET || velocity.x > SWIPE_VELOCITY)
onDecide("approve")
else if (offset.x < -SWIPE_OFFSET || velocity.x < -SWIPE_VELOCITY)
onDecide("decline")

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Bug: Velocity check can trigger wrong decision

The velocity conditions don't verify that the drag direction matches. If a user drags left but releases with a rightward flick (or vice versa), the velocity check can override the visual intent:

  • User drags left (offset.x = -50) but flicks right (velocity.x = +700)
  • First condition: offset.x > 120 is false, but velocity.x > 600 is true
  • Result: approve is triggered despite the card being in the decline zone

This would feel broken to users since the card's visual feedback (red wash, "Decline" pill) wouldn't match the action taken.

Suggested change
if (offset.x > SWIPE_OFFSET || velocity.x > SWIPE_VELOCITY)
onDecide("approve")
else if (offset.x < -SWIPE_OFFSET || velocity.x < -SWIPE_VELOCITY)
onDecide("decline")
if ((offset.x > SWIPE_OFFSET) || (offset.x > 0 && velocity.x > SWIPE_VELOCITY))
onDecide("approve")
else if ((offset.x < -SWIPE_OFFSET) || (offset.x < 0 && velocity.x < -SWIPE_VELOCITY))
onDecide("decline")

This ensures a fast flick only counts if the drag is already moving in that direction.

@sohamd22 sohamd22 force-pushed the 06-19-review_suggestions_option_for_inferred_memories branch from 9aa147b to fcd1e6c Compare June 20, 2026 11:41
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.

1 participant