Settings & Usage
Memory Panel
What the agent remembers about the user and project — search, scopes, inline edit and forget.
3 variantsMIT
Preview
Installation
Copies the component into components/ui and installs its dependencies and theme tokens.
pnpm dlx shadcn@latest add https://uilab.tmih06.com/r/memory-panel.jsonUsage
Pass your own data and wire the callbacks to your agent runtime.
import { MemoryPanel } from "@/components/ui/memory-panel";
export function AgentMemory({ memories }: { memories: Memory[] }) {
return (
<MemoryPanel
data={memories}
onEdit={(memory, text) => api.memories.update(memory.id, { text })}
// Called after the undo window closes, so a quick Undo never hits the server.
onForget={(memory) => api.memories.delete(memory.id)}
/>
);
}
// Pass null while the memories request is in flight; keep stale data and set
// loading when refetching.
export function AgentMemoryState({ query }: { query: MemoriesQuery }) {
return (
<MemoryPanel
data={query.data ?? null}
loading={query.isRefetching}
skeleton={{ count: 4 }}
/>
);
}Props
| Prop | Type | Default | Description |
|---|---|---|---|
| data* | Memory[] | null | — | Memories in display order. Set isNew on ones added this session. Pass null while they load. |
| loading | boolean | false | Force the layout-preserving skeleton while refetching, even when stale data is available. |
| skeleton | { count?: number } | — | Shape hints for the loading state; count is the number of memory row placeholders. |
| onEdit | (memory, text: string) => void | — | Called when an inline edit is saved with Enter. Esc cancels. |
| onForget | (memory) => void | — | Called once the undo window closes. The row hides immediately and shows an Undo pill. |
| onUndo | (memory) => void | — | Called when the user restores a memory within the undo window. |
| undoMs | number | 5000 | How long the Undo pill stays before the Forget is committed. |
| variant | "panel" | "compact" | "panel" | A panel with search and scope filters, or a dense list without them. |
| title | string | "Memory" | Heading and accessible name of the panel. |
| labels | Partial<MemoryPanelLabels> | — | Your own UI strings (loading, scopes, search, empty states, screen-reader text), for translating. Right-to-left works under `dir="rtl"`. |
| className | string | — | Extra classes for the root element. |
type Memory = {
id: string;
text: string;
scope: "user" | "project" | "session";
source?: string; // e.g. "from chat · 2d ago"
pinned?: boolean;
isNew?: boolean; // shows a "New" pill
};