Skip to content

Context Memory

A long conversation folds into a few memory notes, and the next run recalls the right one. A 4:3 card for bento grids, a wide scene for heroes, and a quiet mode for dashboards.

On this page
Used for
  • Bento card about agent memory
  • Dashboard card next to a memory list
  • Long chats that need a summary story
  • Hero scene for context and recall

Examples

Mode
Recalled note

Installation

npx knowns-ui@latest add context-memory
For Claude Code, Cursor or Codex: installs it and wires the props to your own data.

Props

notes
{ id, text, tag? }[]
Default3 billing and style notes
What the long conversation is compacted into. Three or four read best; the fifth is not drawn.
thread
{ from: 'user' | 'agent', text }[]
Default6 short lines
The conversation that fills first. Up to six lines are drawn; the narrow card shows four.
messageCount
number
Default214
The size of the long run, shown as the counter.
recall
string
Defaultthe second note
The id of the note the next run pulls in. It lights up, a line is drawn from it, and it is echoed as 'Recalled'. Notes wrap, they are never cut.
prompt / answer
string
Defaulta refund request and its reply
The next run's first message, and the reply that uses the recalled note.
mode
'loop' | 'once'
Default'loop'
Loop repeats the story. Once stops on the recalled frame.
quiet
boolean
Defaultfalse
A compact single card for a dashboard: the memory notes and one recall line, opacity only. No thread, no new run.
paused
boolean
Defaultfalse
Holds the scene. It also stops offscreen and in hidden tabs.
className
string
On the root, a size container. Under 560px it is a 4:3 card (the next run takes the thread's place, the memory sits below); from 560px the three parts sit side by side. `quiet` ignores this.

What it handles

  1. 01Plays one story in four beats: a long chat fills, its lines fly into a few memory notes as the counter ticks down, a new run opens, and a line is drawn from the note it needs.
  2. 02Takes your own `notes` (id, text, optional tag), a `thread` of up to six lines and a `messageCount`, and recalls the note named by `recall`, by default the second. Notes wrap onto two lines, they are never cut.
  3. 03Writes the next run from `prompt` and `answer`, and echoes the recalled note as a 'Recalled' line so it is clear where the answer came from.
  4. 04Loops with `mode` set to loop, or plays once and holds the recalled frame with `once`, which suits a dashboard that should not keep moving.
  5. 05Changes shape with its container: under 560px it is a 4:3 card where the next run takes the thread's place; from 560px the thread, the memory and the next run sit side by side.
  6. 06Turns into one compact card with `quiet`: the memory notes and a single recall line, opacity only, for a dashboard. Text is fixed at 11 to 12.5px, so it stays readable at 320px.

States

First render
The conversation is full and the memory slots are empty
none
Compact
Each line travels into its note slot, 40ms apart, and the counter ticks down; the notes land as the lines arrive
none, a half-second flight
Recall
The next run opens, the chosen note lights, a line is drawn from it to the Recalled line, then the answer appears
180ms, ease out
Loop end
The recalled frame dissolves straight back to the first one, never through an empty scene (loop only)
180ms, ease out
Offscreen, hidden tab or paused
The story holds where it is
none
Reduced motion and the server render
The finished frame shows: notes kept, one recalled, the answer written
0ms

Works with

When to use

When to use

  • A feature or bento card about memory: a long chat shrinks to a few notes and the next run starts with the right one.
  • A quiet dashboard card next to an agent's memory list, in `quiet` mode: just the notes and one recall line, playing once.

When not to use

Using with AI

Use Copy page for AI above to give your assistant this page, Copy prompt under the install command to have it installed and wired to your data, or connect the Knowns UI MCP server and just ask:

  • Add the Knowns UI Context Memory to my app and wire it to my own data.
  • I need a feature or bento card about memory: a long chat shrinks to a few notes and the next run starts with the right one. Set that up with the Knowns UI Context Memory.
  • Which Context Memory props do I need for a minimal setup? Show me a short example.

With the server connected, your assistant calls get_component({ name: "context-memory" }) and search_docs({ query: "context memory" }).

Need help?

Stuck on Context Memory, or found something off? We read every message.