Memory

What an agent remembers, to review and edit.

What your assistant remembers

It uses these in every chat.

To review (1)

  • Book flights with an aisle seat, never a red-eye.

    Learned from your trip to Lisbon · Mon, Nov 30, 6:20 PM

People and places

  • Grace's dentist is Dr. Osei at Harbour Dental, Tuesdays only.

    Email from Harbour Dental · Thu, Nov 12, 9:02 AM

  • Mira is Grace's sister; her birthday is March 14.

    Chat on Nov 3 · Tue, Nov 3, 8:11 PM

Calendar

  • Keep Friday afternoons free of meetings.

    Chat on Oct 28 · Wed, Oct 28, 8:45 AM

  • Default meeting length is 25 minutes.

    Tue, Oct 20, 5:30 PM

Work

  • Expense reports go to Ben Okafor in finance by the 3rd.

    Thread in #finance · Fri, Oct 2, 12:00 PM

  • Prefers summaries with the numbers first, as bullet points.

    Fri, Sep 18, 11:12 AM

Reset removes everything your assistant remembers about you.

Installation

pnpm dlx shadcn@latest add checkfu/uicontext/memory

Usage

import { type MemoryEntry, MemoryViewer } from "./ui/uicontext/components/kit/Memory.ts"
const Message = UiSchema.TaggedEnum({	CorrectedMemory: { entry: Schema.String, text: Schema.String },	ForgotMemory: { entry: Schema.String },	ImportedMemory: { files: Schema.Array(Schema.instanceOf(File)) },})// your app stores the entries; the viewer asks for each changeexport const Remembered = (h: Html.H<typeof Message.Type>, entries: ReadonlyArray<MemoryEntry>) =>	MemoryViewer(h, {		props: { id: "grace", label: "What your assistant remembers", entries, can: ["correct", "forget", "import"], timeZone: "Europe/London" },		onEmit: {			RequestedCorrect: ({ entry, text }) => Message.CorrectedMemory({ entry, text }),			RequestedForget: ({ entry }) => Message.ForgotMemory({ entry }),			RequestedImport: ({ files }) => Message.ImportedMemory({ files }),			RequestedApprove: () => undefined,			RequestedReject: () => undefined,			RequestedMemory: () => undefined,			RequestedReset: () => undefined,		},	})

Examples

Loading, empty and locked

A placeholder while it loads, an empty state that says what to do, and a switch an admin has locked, with the reason.

What the agent remembers

What the agent remembers in #design

Nothing remembered yet

Ask it to remember something in a thread, or import notes.

What the agent remembers in #legal

Your admin turned memory off for #legal.

  • Contracts over 100k need sign-off from two partners.

    Tue, Sep 1, 9:00 AM

    Set by your admin

API reference

Props

MemoryViewer props
NameTypeDefaultDescription
idrequiredstring—Identifies the memory in the events it sends
labelrequiredstring—The list's heading: "What the agent remembers"
entriesrequiredMemoryEntry[]—What the agent remembers, each with where it came from and when
status"loading" | "ready""ready""loading" shows a placeholder; "ready" by default
memory{ state, label, note }—The memory switch: on, off (entries kept), or locked by an admin with the reason
noticeNotice—A banner: memory paused elsewhere, changes apply to another product too
empty{ title, hint }—What shows when it remembers nothing
canrequiredMemoryAction[]—What this person may do: correct, forget, approve, reset, and import notes from files
resetTextstring—What reset removes: "Everything the agent remembers about you, here and in the app."
resetScopeMemoryResetScope—The final confirmation scope when the displayed entries do not describe the whole reset.
outcomeOutcome | null—Pass null to opt in before editing, then answer each RequestedCorrect using its request: Accepted closes the editor, Refused keeps the draft and shows the reason.
timeZonerequiredstring—The reader's time zone, for when each entry was learned
localestring—Formats times shown; the reader's own when left out
pending{ action, entry } | null—The request in flight, such as forgetting an entry: its buttons show busy
refusalstring | null—Why the last request was refused, as a sentence
agentIdstring—The id agents see this memory by; memory:<id> when left out

Events

MemoryViewer events
EventPayloadDescription
RequestedCorrect{ id: string; entry: string; text: string; request?: string; baseRevision?: string }The person corrected an entry's text
RequestedForget{ id: string; entry: string }The person confirmed forgetting an entry
RequestedApprove{ id: string; entry: string }The person kept an entry the agent proposed
RequestedReject{ id: string; entry: string }The person turned down an entry the agent proposed
RequestedMemory{ id: string; on: boolean }The person switched memory on or off
RequestedReset{ id: string }The person confirmed, twice, forgetting everything
RequestedImport{ id: string; files: instanceOf[] }The person picked files of notes to import (Markdown, text or JSON); the app reads and adds them

Agent actions

What agents can do with MemoryViewer
ActionDescription
ClickedCorrectStart correcting an entry by id
UpdatedDraftType the corrected text
SubmittedCorrectionSave the correction
ClickedForgetAsk to forget an entry by id (opens the confirmation)
ConfirmedForgetasks firstForget the entry being confirmed. Name it as your target.
ClickedApproveApprove an entry the agent proposed
ClickedRejectReject an entry the agent proposed
ToggledMemoryTurn memory on or off
ClickedResetAsk to reset all memory (asks twice)
ContinuedResetAnswer the first reset question
ConfirmedResetasks firstReset all memory. It can't be undone. Name the memory as your target.

Accessibility

  • Each entry's buttons name the entry they act on: approve, reject, correct or forget.
  • Using memory is a switch, and a refusal or error is announced. Cancelling a correction returns focus to the heading.
  • Forgetting asks first, and resetting asks twice. Agents must name the entry or memory they remove.

Source