Data Model
Database schema and field definitions
The engine uses PostgreSQL (via Prisma) to store memory metadata and Qdrant for vector embeddings. The primary data entity is Memory.
Schema (Memory)
| Field | Type | Description |
|---|---|---|
id | Int | Unique primary key (autoincrement). |
userId | Int | ID of the user who owns the memory. |
agentId | String? | Optional ID of the agent that created the memory. |
runId | String? | Optional ID for grouping memories by execution run. |
role | String? | Role of the message creator (e.g., "user", "assistant"). |
source | String | Source of the memory (e.g., "chat", "codebase", "manual"). |
sourceId | String | External ID references the source (e.g., message ID). |
timestamp | DateTime | Logical timestamp of the memory. |
content | Stored in Qdrant | The actual text content is primarily managed via embeddings/payloads, though raw text can be retrieved. |
contentUrl | String | URL or path to the original content. |
title | String | Title or brief description. |
origin | String | Origin system or component. |
tags | String[] | Array of tags for categorization. |
category | String[] | Array of categories. |
attribute | Json | Flexible JSON field for extra metadata (e.g., key/value pairs). |
summary | String | Short summary of the memory. |
type | String | Type of memory (e.g., "text", "procedural"). |
importance | Float | Importance score (0-1). |
confidence | Float | Confidence score (0-1). |
embeddingRef | Int | Reference ID potentially linking to vector store status. |
contentHash | String | Unique hash of the content for deduplication. |
createdAt | DateTime | Creation timestamp. |
updatedAt | DateTime | Last update timestamp. |
Indices
To ensure performance, the following indices are maintained:
[contentHash]- For fast deduplication checks.[userId, contentHash]- For user-scoped deduplication.[userId, agentId, runId]- For fast retrieval of execution history.