Memory Viewer
List what an agent remembers about a person and their work, and let them search, edit, pin, or forget it.
Overview
Memory Viewer shows what an agent has learned and keeps: facts about the person, their preferences, and the projects they work on. Each memory shows where it came from, when it was learned, when it was last used, and how sure the agent is. People can search, correct a memory, pin the ones that matter, and forget the rest.
It shows the memories you pass and calls back on every change. Storing them, and giving them to the agent, is your application's work.
Anatomy
- HeaderThe title, the count, search, and a filter for each group
- Selection barSelect all shown, the selected count, and Forget, when you handle forgetting
- GroupA label and the memories of one kind
- MemoryIts text, source, dates, confidence, and actions
- Undo barWhat was just forgotten, with Undo
Installing memory-viewer brings Button, Checkbox, Input, and Textarea along as registry dependencies.
Behavior
Groups
Memories are grouped by kind. The default groups are About you, Preferences, Facts, and Projects. Pass groups to rename or reorder them; memories of other kinds are listed after them. Pinned memories lead their group.
Search and filter
Search matches the memory and its source, and marks the match. The filter shows one group at a time, with a count for each. Both can be controlled with query and filter.
Editing
Edit turns the memory into a field. Enter or Save keeps the change, Shift+Enter adds a line, and Escape or Cancel leaves it as it was. Saving unchanged or empty text calls nothing.
Forgetting
Forget appears when you pass onForget, along with a checkbox on each memory for forgetting several at once. What happens next depends on onRestore:
- With
onRestore, forgetting happens at once and an Undo bar stays for eight seconds. Undo callsonRestorewith the forgotten memories. - Without it, Forget asks to confirm first, inline, because it cannot be taken back.
Dates and confidence
Learned dates are absolute and last-used dates are relative, measured from now or the reader's clock after the page loads. Confidence below lowConfidence (0.5 by default) is marked Unsure.
Accessibility
The viewer is a region named by its title, and each group is a list named by its label. Every action is named with its memory, such as "Forget: Works from Lisbon". The filter buttons report whether they are pressed. Focus returns to Edit after editing and moves to Undo after forgetting, and the Undo bar is announced.
Installation
Usage
import { MemoryViewer } from "@/components/ai/memory-viewer"
<MemoryViewer
memories={memories}
onEdit={(id, content) => memory.update(id, { content })}
onForget={(ids) => memory.forget(ids)}
onRestore={(items) => memory.restore(items)}
onPinnedChange={(id, pinned) => memory.update(id, { pinned })}
/>Examples
Confirm before forgetting
Without onRestore, forgetting asks first. One group is renamed for a team's shared memory, and an unsure memory is marked.
API reference
MemoryViewer
Accepts native section props beyond those listed.