Skip to main content

Metadata

Attach custom metadata to memories for filtering, categorization, and enrichment.

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()
  }
});

Using Tags

For simple categorization, use the tags array:

tags.ts
// Create memory with tags
await client.memories.create({
  content: 'User prefers dark mode',
  tags: ['preferences', 'ui', 'settings']
});

// Filter by tags
const result = await client.memories.list({
  q: 'user settings',
  tags: 'preferences,settings'  // Comma-separated
});

Tags are indexed for fast filtering and support comma-separated values in queries.

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'
});