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.
import { Command, UiSchema } from "@effect/ui"import { Html } from "@effect/ui/html"import { Effect, Schema } from "effect"import { Outcome } from "./ui/uicontext/components/domain/Outcome.ts"import { MemoryEntry, MemoryViewer } from "./ui/uicontext/components/kit/Memory.ts"const seed: ReadonlyArray<MemoryEntry> = [ { revision: "r1", id: "p1", text: "Book flights with an aisle seat, never a red-eye.", state: "proposed", author: "Learned from your trip to Lisbon", savedAt: "2026-11-30T18:20:00Z" }, { revision: "r1", id: "m1", text: "Grace's dentist is Dr. Osei at Harbour Dental, Tuesdays only.", state: "remembered", group: "People and places", source: { label: "Email from Harbour Dental" }, savedAt: "2026-11-12T09:02:00Z" }, { revision: "r1", id: "m2", text: "Mira is Grace's sister; her birthday is March 14.", state: "remembered", group: "People and places", source: { label: "Chat on Nov 3" }, savedAt: "2026-11-03T20:11:00Z" }, { revision: "r1", id: "m3", text: "Keep Friday afternoons free of meetings.", state: "remembered", group: "Calendar", source: { label: "Chat on Oct 28" }, savedAt: "2026-10-28T08:45:00Z" }, { revision: "r1", id: "m4", text: "Default meeting length is 25 minutes.", state: "remembered", group: "Calendar", savedAt: "2026-10-20T16:30:00Z" }, { revision: "r1", id: "m5", text: "Expense reports go to Ben Okafor in finance by the 3rd.", state: "remembered", group: "Work", source: { label: "Thread in #finance" }, savedAt: "2026-10-02T11:00:00Z" }, { revision: "r1", id: "m6", text: "Prefers summaries with the numbers first, as bullet points.", state: "remembered", group: "Work", savedAt: "2026-09-18T10:12:00Z" },]const Message = UiSchema.TaggedEnum({ Corrected: { entry: Schema.String, text: Schema.String, request: Schema.optional(Schema.String), baseRevision: Schema.optional(Schema.String) }, Forgot: { entry: Schema.String }, Approved: { entry: Schema.String }, Rejected: { entry: Schema.String }, Switched: { on: Schema.Boolean }, Reset: {}, PickedNotes: { files: Schema.Array(Schema.instanceOf(File)) }, Imported: { notes: Schema.Array(Schema.Struct({ file: Schema.String, text: Schema.String })) },})// Reads the picked files: each list item or line of text is one note.const ReadNotes = Command.make("ReadNotes", { args: { files: Schema.Array(Schema.instanceOf(File)) } }, ({ files }) => Effect.forEach(files, (file) => Effect.promise(() => file.text()).pipe( Effect.map((text) => text .split("\n") .map((line) => line.replace(/^\s*[-*]\s*/u, "").trim()) .filter((line) => line !== "" && !line.startsWith("#")) .map((line) => ({ file: file.name, text: line })), ), ), ).pipe(Effect.map((all) => Message.Imported({ notes: all.flat().slice(0, 50) }))),)export const AssistantMemory = Html.component({ name: "AssistantMemory", model: Schema.Struct({ entries: Schema.Array(MemoryEntry), on: Schema.Boolean, outcome: Schema.NullOr(Outcome), imported: Schema.Number }), message: Message,}).make({ init: () => ({ entries: seed, on: true, outcome: null, imported: 0 }), update: { // the app checks the revision the correction started from, so two edits can't overwrite each other Corrected: ($, { entry, text, request, baseRevision }) => { if (request === undefined) return $.model const current = $.model.entries.find((e) => e.id === entry) if (current === undefined || current.revision !== baseRevision) { return $.evolve({ outcome: { _tag: "Refused", request, reason: "This memory changed. Review the latest version." } }) } return $.evolve({ entries: (es) => es.map((e) => (e.id === entry ? { ...e, text, revision: request } : e)), outcome: { _tag: "Accepted", request }, }) }, Forgot: ($, { entry }) => $.evolve({ entries: (es) => es.filter((e) => e.id !== entry) }), Approved: ($, { entry }) => $.evolve({ entries: (es) => es.map((e) => (e.id === entry ? { ...e, state: "remembered" as const, group: "Travel" } : e)) }), Rejected: ($, { entry }) => $.evolve({ entries: (es) => es.filter((e) => e.id !== entry) }), Switched: ($, { on }) => $.evolve({ on }), Reset: ($) => $.evolve({ entries: [] }), PickedNotes: ($, { files }) => $.evolve({}).run(ReadNotes.make({ files })), Imported: ($, { notes }) => $.evolve({ imported: (n) => n + notes.length, entries: (es) => [ ...notes.map((note, i) => ({ revision: "r1", id: `import-${$.model.imported + i}`, text: note.text, state: "proposed" as const, author: `Imported from ${note.file}`, })), ...es, ], }), }, view: (h, model) => MemoryViewer(h, { props: { id: "grace", agentId: "memory-assistant", label: "What your assistant remembers", entries: model.entries, memory: { state: model.on ? "on" : "off", note: model.on ? "It uses these in every chat." : "Memory is off. Notes are kept but not used." }, can: ["correct", "forget", "approve", "reset", "import"], resetText: "Reset removes everything your assistant remembers about you.", outcome: model.outcome, empty: { title: "Nothing remembered yet", hint: "Tell your assistant something to remember, or import notes." }, timeZone: "Europe/London", }, onEmit: { RequestedCorrect: ({ entry, text, request, baseRevision }) => Message.Corrected({ entry, text, request, baseRevision }), RequestedForget: ({ entry }) => Message.Forgot({ entry }), RequestedApprove: ({ entry }) => Message.Approved({ entry }), RequestedReject: ({ entry }) => Message.Rejected({ entry }), RequestedMemory: ({ on }) => Message.Switched({ on }), RequestedReset: () => Message.Reset(), RequestedImport: ({ files }) => Message.PickedNotes({ files }), }, }),})Installation
pnpm dlx shadcn@latest add checkfu/uicontext/memoryUsage
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
import type { Html } from "@effect/ui/html"import * as stylex from "@stylexjs/stylex"import { MemoryViewer } from "./ui/uicontext/components/kit/Memory.ts"import { sx } from "./ui/uicontext/components/Sx.ts"import { space } from "./ui/uicontext/components/tokens.stylex.ts"const styles = stylex.create({ list: { display: "grid", gap: space.xxl, inlineSize: "100%" } })const noEvents = { RequestedCorrect: () => undefined, RequestedForget: () => undefined, RequestedApprove: () => undefined, RequestedReject: () => undefined, RequestedMemory: () => undefined, RequestedReset: () => undefined, RequestedImport: () => undefined,}export const MemoryStates = <M>(h: Html.H<M>) => h.div.attrs(sx(styles.list)).children( MemoryViewer(h, { key: "loading", props: { id: "loading", agentId: "memory-loading", label: "What the agent remembers", entries: [], status: "loading", can: [], timeZone: "UTC" }, onEmit: noEvents, }), MemoryViewer(h, { key: "empty", props: { id: "empty", agentId: "memory-empty", label: "What the agent remembers in #design", entries: [], memory: { state: "on" }, can: ["correct", "forget", "import"], empty: { title: "Nothing remembered yet", hint: "Ask it to remember something in a thread, or import notes." }, timeZone: "UTC", }, onEmit: noEvents, }), MemoryViewer(h, { key: "locked", props: { id: "locked", agentId: "memory-locked", label: "What the agent remembers in #legal", entries: [ { id: "l1", text: "Contracts over 100k need sign-off from two partners.", state: "remembered", readOnly: "Set by your admin", savedAt: "2026-09-01T09:00:00Z" }, ], memory: { state: "locked", note: "Your admin turned memory off for #legal." }, can: ["correct", "forget"], timeZone: "UTC", }, onEmit: noEvents, }), )API reference
Props
| Name | Type | Default | Description |
|---|---|---|---|
idrequired | string | — | Identifies the memory in the events it sends |
labelrequired | string | — | The list's heading: "What the agent remembers" |
entriesrequired | MemoryEntry[] | — | 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 |
notice | Notice | — | A banner: memory paused elsewhere, changes apply to another product too |
empty | { title, hint } | — | What shows when it remembers nothing |
canrequired | MemoryAction[] | — | What this person may do: correct, forget, approve, reset, and import notes from files |
resetText | string | — | What reset removes: "Everything the agent remembers about you, here and in the app." |
resetScope | MemoryResetScope | — | The final confirmation scope when the displayed entries do not describe the whole reset. |
outcome | Outcome | 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. |
timeZonerequired | string | — | The reader's time zone, for when each entry was learned |
locale | string | — | 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 |
refusal | string | null | — | Why the last request was refused, as a sentence |
agentId | string | — | The id agents see this memory by; memory:<id> when left out |
Events
| Event | Payload | Description |
|---|---|---|
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
| Action | Description |
|---|---|
ClickedCorrect | Start correcting an entry by id |
UpdatedDraft | Type the corrected text |
SubmittedCorrection | Save the correction |
ClickedForget | Ask to forget an entry by id (opens the confirmation) |
ConfirmedForgetasks first | Forget the entry being confirmed. Name it as your target. |
ClickedApprove | Approve an entry the agent proposed |
ClickedReject | Reject an entry the agent proposed |
ToggledMemory | Turn memory on or off |
ClickedReset | Ask to reset all memory (asks twice) |
ContinuedReset | Answer the first reset question |
ConfirmedResetasks first | Reset 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.