Tool memory
Tool renderer for memory saved, updated or forgotten, built on Tool call, with the exact text so people can see what the assistant now knows.
On this page
Saved, updated and forgotten, with the exact text and Undo.
Installation
Usage
import { ToolMemory, toolMemoryRenderers } from "@/components/ui/chatcn/tool-memory"
<ToolMemory
action="update"
state="output-available"
previous="Prefers jsdom for component tests."
memory="Prefers Vitest browser mode over jsdom."
onUndo={() => revert()}
/>
// Or route parts by tool name:
renderToolPart(part, { ...toolMemoryRenderers, ...toolBashRenderers })The renderer reads the action from the tool name (save_memory, update_memory, forget_memory) or from an action field for single-tool designs, and the text from memory, content or text.
Examples
States
Running, asking first, failed and inline.
Props
| Prop | Type | Notes |
|---|---|---|
action | "save" | "update" | "forget" | Picks the title |
memory | string | The saved, new or forgotten text |
previous | string | Struck through above an update |
onUndo, onManage | () => void | Shown once the call is done |
| Lifecycle | state, approval, errorText, onRetry and the rest of Tool call |
Accessibility
- Updates say Before and After to screen readers; the strike-through is not the only signal.
- Everything else follows Tool call: a real disclosure button and a polite status label.
Motion
- Same as Tool call: the status glyph crossfades and details open over 200 ms.