Agent Memory
What an agent has remembered and where each piece came from. Distinct from retrieval: these are injected into every future run whether relevant or not, which is why a person has to be able to inspect and delete them.
src/components/ui/agent-memory.tsxAbout
From the component's own source, where it was written.
What an agent has remembered, and where each piece came from.
Distinct from RetrievalResults, which shows what one query pulled back. This is the durable store — the things that will be injected into *every* future run whether they are relevant or not, which is why it needs to be inspectable and editable by a person.
**Provenance is mandatory in the type, not optional.** A memory with no source cannot be audited, and an agent that has silently learned something wrong is exactly the case this screen exists for. source is required.
Pinned entries sort first and are exempt from eviction — they are the ones a person asserted, as opposed to the ones the agent inferred.
Install
npx astralyx-ui add agent-memory
Usage
import { AgentMemory } from '@/components/ui/agent-memory'
<AgentMemory entries={entries} onPin={pin} onForget={forget} />Composer
Change the props and the source below follows.
Ada prefers British spelling and metric units in all generated copy.
user:ada · stated12 Augweight 0.90preferencepinnedThe staging database is reset every Sunday at 03:00 UTC — data written before then is gone.
run:8841 · inferred28 Augweight 0.60factRefunds above £200 always need a human. The agent proposed one at £340 and was blocked.
run:9102 · correction3 Sepweight 0.95correctionThe team calls the billing service “ledger”, not “payments”.
thread:eng-41271 Sepweight 0.40fact
No props to configure.
<AgentMemory entries={entries} onPin={pin} onForget={forget} />Examples
Inspecting and editing memory
<AgentMemory entries={entries} onPin={pin} onForget={forget} />API
Generated from the source, so it cannot fall behind the code. One table per exported component, then hooks, functions and types.
AgentMemory
Extends Omit<ComponentProps<'div'>, 'onSelect'>.
| Prop | Type | Default | Description |
|---|---|---|---|
| entries | MemoryEntry[] | required | { id, content, source, at?, importance?, pinned?, kind? }. |
| onPin | (id: string, pinned: boolean) => void | — | — |
| onForget | (id: string) => void | — | Deleting a memory is a normal operation, not an admin one. |
| searchable | boolean | true | — |
| searchPlaceholder | string | 'Search memory…' | — |
| searchLabel | string | 'Search memory' | — |
| pinLabel | string | 'Pin' | — |
| unpinLabel | string | 'Unpin' | — |
| forgetLabel | string | 'Forget' | — |
| emptyLabel | string | 'Nothing remembered yet' | — |
| emptyHint | string | 'Memories appear here as the agent learns them.' | — |
| sourceLabel | (source: string) => ReactNode | (source) => source | — |
Types
MemoryEntry
What an agent has remembered, and where each piece came from.
| Field | Type | Description |
|---|---|---|
| id | string | — |
| content | ReactNode | — |
| source | string | Required in the type, not optional. A memory with no provenance cannot be audited, and an agent that has silently learned something wrong is exactly what this screen exists for. |
| at? | string | Already formatted — this component does not own your locale. |
| importance? | number | 0–1. How strongly it is weighted at retrieval time. |
| pinned? | boolean | Sorts first and is exempt from eviction — the things a person asserted, as opposed to what the agent inferred. |
| kind? | string | Free-form grouping — 'preference', 'fact', 'correction'. |