Memory manager
ProWhat agents remember about this account, one line each, with who taught it and when. Things an agent inferred are marked as inferred, so a person can confirm or delete them; things a person said are theirs. Add a memory in plain words. Memory agents take from past chats can't be listed, so with history it says so plainly, and an empty list never reads as "nothing remembered". With mode it says when memory is paused or off.
Preview
Install
First time? Get started sets up the registry and theme. Or with shadcn directly: npx shadcn@latest add @candor/memory-manager
Brings in: agent-avatar, button, know, locale, relative-time, terms, utils · npm: lucide-react@^1.67.0
Usage
"use client"
import * as React from "react"
import type { Memory } from "@/lib/know"
import { MemoryManager } from "@/components/memory-manager"
const ago = (h: number) => new Date(Date.now() - h * 3_600_000).toISOString()
const initial: Memory[] = [
{ id: "m1", text: "Staging is reset from a Production snapshot every Monday at 06:00.", from: { person: "Dana" }, createdAt: ago(24 * 6), scope: "environment", environmentId: "staging" },
{ id: "m2", text: "Priya approves anything touching data regions or routing.", from: { person: "Maya" }, createdAt: ago(24 * 20), scope: "account" },
{ id: "m3", text: "The team prefers enums to free-text columns for anything reported on.", from: { agent: { id: "a-arch", name: "Architect agent", role: "architect" } }, createdAt: ago(48), scope: "account" },
]
export default function Example() {
const [memories, setMemories] = React.useState(initial)
return (
<MemoryManager
className="max-w-xl"
memories={memories}
history={{ chats: 14 }}
onAdd={(text) => setMemories((l) => [{ id: `m${Date.now()}`, text, from: { person: "You" }, createdAt: new Date().toISOString(), scope: "account" }, ...l])}
onDelete={(id) => setMemories((l) => l.filter((m) => m.id !== id))}
onConfirm={(id) => setMemories((l) => l.map((m) => (m.id === id ? { ...m, from: { person: "You" } } : m)))}
/>
)
}<MemoryManager>
| Prop | Type | Default | Description |
|---|---|---|---|
| memoriesrequired | Memory[] | — | What's remembered, with who taught it (a person or an agent) and when. |
| onAdd | ((text: string) => void) | undefined | — | Shows a box to add a memory; called with its text. |
| onDelete | ((id: string) => void) | undefined | — | Shows Delete on each memory; called with its id. |
| onConfirm | ((id: string) => void) | undefined | — | Turn an inferred memory into one the viewer stands behind. |
| history | { chats?: number | undefined } | undefined | — | Agents also learn from past chats, which can't be listed: says so, with how many chats if known. |
| mode | MemoryModeValue | undefined | — | Whether memory is on, paused or off (see MemoryMode). Paused and off are said above the list. |
| className | string | undefined | — | Extra classes for the outer element. |
Strings
The fixed words, in English by default. Change any of them under memoryManager in <LocaleProvider strings={{ … }}>; the table is exported as memoryManagerStrings.
| Key | English |
|---|---|
| label | Memory |
| heading | What agents remember |
| summary | {total} · {inferred} inferred |
| placeholder | e.g. Staging is refreshed every Monday morning |
| newMemory | New memory |
| add | Add |
| empty | Nothing remembered yet. |
| emptyWithHistory | No saved memories. |
| history | Agents also learn from past chats. That isn’t kept as a list, so it can’t be shown or forgotten one by one here. |
| historyCount | { one: "Agents also learn from {count} past chat. That isn’t kept as a list, so it can’t be shown or forgotten one by one here.", other: "Agents also learn from {count} past chats. That isn’t kept as a list, so it can’t be shown or forgotten one by one here.", } |
| paused | Memory is paused. These are kept as they are; agents don’t use them until it’s back on. |
| off | Memory is off. Agents don’t use these. |
| inferredBy | Inferred by {name} |
| from | From {name} |
| environmentOnly | this {environment} only |
| confirm | Confirm |
| forgetThis | Forget this |
| forget | Forget |