Adding Metadata
Metadata allows you to attach arbitrary key-value pairs to memories for organization and filtering.
metadata.ts
await client.memories.create({
content: 'User completed onboarding',
spaceId: spaceId,
metadata: {
category: 'milestone',
importance: 'high',
step: 5,
timestamp: new Date().toISOString()
}
});Supported Types
Metadata values can be:
- Strings - Text values for categories, labels, etc.
- Numbers - Numeric values for counts, scores, etc.
- Booleans - True/false flags
- Objects - Nested structures stored as JSON
Filtering by Metadata
Query memories by tags and content type:
filtering.ts
const result = await client.memories.list({
q: 'user activity',
spaceId: spaceId,
type: 'text',
tags: 'milestone,important',
created_after: '2026-01-01T00:00:00Z',
created_before: '2026-12-31T23:59:59Z'
});