Memory

What the assistant remembers: a settings page to search, edit and delete memories, the note that appears in a chat when one is saved, and a profile of what it knows grouped by topic.

Loading preview…

Install

  1. 1

    Run this command in your Tailwind CSS project. It adds components/ai/memory-manage.tsx and installs its dependencies.

    $ npx shadcn@latest add https://gradientdeck.com/ai-components/r/memory-manage.json

Usage & API

Example

memory-manage.tsx
import { MemoryManager } from "@/components/ai/memory-manage"

<MemoryManager
  memories={[]}
  enabled={true}
  onEnabledChange={() => {}}
  onEdit={() => {}}
  onDelete={() => {}}
  onRestore={() => {}}
/>

Props MemoryManager

PropType & descriptionRequired
memoriesMemory[]Required
limitnumberOptional
enabledbooleanRequired
onEnabledChange(on: boolean) => voidRequired
onEdit(id: string, text: string) => voidRequired
onDelete(ids: string[]) => voidRequired
onRestore(removed: RemovedMemory[]) => voidCalled from the undo toast with the memories and the positions they were removed from.Required

Dependencies

  • React
  • Tailwind CSS
  • motion
  • lucide-react
Implementation notes

Manage is headed Memory, with the line that details are picked up from chats and carried into new ones. The switch row is first. Search memories and a Select button share the next row. While selecting, that row becomes a checkbox, a selected count, Delete and Cancel. The list is labelled Saved memories. An empty store says they show up as you chat. Each row shows the text and, under it, the saved time and the source chat title. Search highlights matches in both. The footer meter is labelled Memory used. The undo toast sits over the bottom of the section, with Undo and a dismiss control. Editing uses a textarea labelled Edit memory. A blank edit is ignored. The text is only committed when it changed.

Choosing a layout

Use manage on the memory settings page, where a person should correct a sentence, delete one, or turn memory off without losing the list. Use the chat notes in the thread, directly under or above the reply they belong to. Memories used belongs above the answer that drew on them, because the person can open it and see which lines were used and which chat each came from. Memory updated belongs under the answer that wrote something new, with Undo and Save again, so a wrong save can be taken back before they ever open settings. Both notes have a Manage memories button that should route to the manage page.

Use profile when the right view is topical rather than a flat log. Work, food, travel and preferences are just the topics you pass, each with an icon. It fits a page titled as what the assistant knows, where the action is remove one fact or forget a topic, not edit the wording. Do not use these as the tool allow-list or the MCP server list. A memory here is a sentence about the person or the project. It is not a permission, and none of the three variants call a model or write storage except through the callbacks.

Does turning the switch off delete the saved list?

No. The description under Reference saved memories says turning it off does not delete anything. The list stays, faded, and a note says it is not used in replies and nothing new gets saved. Deleting is a separate action, one row at a time or through Select, and it can be undone from the toast.

Where should the used-memory note sit relative to the reply?

Memories used is the note for context the reply drew on, so it belongs above that reply. Memory updated is the note that something was written, so it belongs under the reply, where Undo can take the save back. Neither one edits the list. Manage memories is the way out to the settings page.