Skip to content
SettingsTool memoryMenu

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.

Saved, updated and forgotten, with the exact text and Undo.

Installation

$ pnpm dlx shadcn@latest add https://chatcn.dev/r/tool-memory.json

Usage

tsx
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

PropTypeNotes
action"save" | "update" | "forget"Picks the title
memorystringThe saved, new or forgotten text
previousstringStruck through above an update
onUndo, onManage() => voidShown once the call is done
Lifecyclestate, 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.