{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "memory-chips",
  "title": "Memory Chips",
  "description": "Everything an assistant remembers about someone, each one removable on its own.",
  "dependencies": [
    "lucide-react@^1.31.0"
  ],
  "registryDependencies": [
    "utils"
  ],
  "files": [
    {
      "path": "registry/default/memory-chips/memory-chips.tsx",
      "content": "\"use client\"\n\nimport * as React from \"react\"\nimport { X } from \"lucide-react\"\n\nimport { cn } from \"@/lib/utils\"\n\nexport type Memory = {\n  id: string\n  text: string\n  /** Where it came from, such as the conversation that produced it. */\n  source?: string\n}\n\nexport type MemoryChipsProps = Omit<\n  React.HTMLAttributes<HTMLDivElement>,\n  \"children\"\n> & {\n  memories: readonly Memory[]\n  onForget?: (id: string) => void\n  onForgetAll?: () => void\n  label?: string\n  emptyMessage?: string\n}\n\n/**\n * Everything an assistant has been told to remember about someone, each one\n * removable on its own.\n *\n * Memory that cannot be listed cannot be corrected, and memory that cannot be\n * removed one item at a time leaves forgetting all of it as the only way to\n * fix one wrong entry.\n */\nexport function MemoryChips({\n  memories,\n  onForget,\n  onForgetAll,\n  label = \"Remembered about you\",\n  emptyMessage = \"Nothing is being remembered about you.\",\n  className,\n  ...rootProps\n}: MemoryChipsProps) {\n  const [said, setSaid] = React.useState(\"\")\n\n  return (\n    <div\n      data-slot=\"memory-chips\"\n      className={cn(\n        \"border-border bg-background w-full rounded-xl border p-3\",\n        className\n      )}\n      {...rootProps}\n    >\n      <p className=\"text-muted-foreground mb-2 flex items-baseline gap-2 text-xs\">\n        <span className=\"font-medium\">{label}</span>\n        <span className=\"ms-auto tabular-nums\">{memories.length}</span>\n      </p>\n\n      {memories.length === 0 ? (\n        <p className=\"text-muted-foreground text-sm\">{emptyMessage}</p>\n      ) : (\n        <ul className=\"flex flex-wrap gap-2\">\n          {memories.map((memory) => (\n            <li key={memory.id}>\n              <span\n                data-slot=\"memory-chip\"\n                className=\"border-border bg-muted/40 text-foreground inline-flex max-w-full items-center gap-1 rounded-full border py-1 ps-3 pe-1 text-sm\"\n              >\n                <span className=\"min-w-0 truncate\">\n                  {memory.text}\n                  {memory.source ? (\n                    <span className=\"text-muted-foreground ms-1.5 text-xs\">\n                      {memory.source}\n                    </span>\n                  ) : null}\n                </span>\n\n                {onForget ? (\n                  <button\n                    type=\"button\"\n                    aria-label={`Forget: ${memory.text}`}\n                    onClick={() => {\n                      setSaid(`Forgotten: ${memory.text}`)\n                      onForget(memory.id)\n                    }}\n                    className=\"text-muted-foreground hover:bg-background hover:text-foreground focus-visible:ring-ring inline-flex size-7 shrink-0 items-center justify-center rounded-full transition-colors focus-visible:ring-2 focus-visible:outline-none motion-reduce:transition-none\"\n                  >\n                    <X aria-hidden=\"true\" size={13} />\n                  </button>\n                ) : null}\n              </span>\n            </li>\n          ))}\n        </ul>\n      )}\n\n      {onForgetAll && memories.length > 0 ? (\n        <button\n          type=\"button\"\n          onClick={() => {\n            setSaid(\"All memories forgotten.\")\n            onForgetAll()\n          }}\n          className=\"text-muted-foreground hover:text-foreground focus-visible:ring-ring mt-3 rounded-md text-xs underline underline-offset-4 transition-colors focus-visible:ring-2 focus-visible:outline-none motion-reduce:transition-none\"\n        >\n          Forget all {memories.length}\n        </button>\n      ) : null}\n\n      <span aria-live=\"polite\" className=\"sr-only\">\n        {said}\n      </span>\n    </div>\n  )\n}\n",
      "type": "registry:ui"
    }
  ],
  "categories": [
    "ai",
    "agent",
    "privacy",
    "settings",
    "chat"
  ],
  "type": "registry:ui"
}