Memory Types
Database tables, fields, relationships, and indexes for the Siestai memory system
The memory system uses five PostgreSQL tables with pgvector extensions for semantic search. All tables are defined in packages/db/src/schema/memories.ts.
Agent Memories
Individual agent knowledge — facts, preferences, skills, and insights learned from conversations.
| Column | Type | Description |
|---|---|---|
id | uuid | Primary key (auto-generated) |
agent_id | uuid | FK → agents.id (CASCADE delete) |
content | text | The memory content |
embedding | vector(1536) | text-embedding-3-small vector |
memory_type | varchar(30) | fact, preference, skill, insight |
source_session_id | uuid | FK → arena_sessions.id (SET NULL) |
importance | real | 0.0–1.0, default 0.5 |
status | varchar(20) | active, consolidated, completed |
source_type | varchar(20) | arena, agent_chat, team_chat |
source_thread_id | text | Thread identifier for chat sources |
created_at | timestamp | Creation time |
last_accessed_at | timestamp | Last retrieval time (for recency scoring) |
Indexes: agent_id, (agent_id, status), source_type
Team Memories
Shared knowledge across a team — decisions, summaries, context, and domain knowledge.
| Column | Type | Description |
|---|---|---|
id | uuid | Primary key |
team_id | uuid | FK → teams.id (CASCADE) |
content | text | Memory content |
embedding | vector(1536) | Embedding vector |
memory_type | varchar(30) | decision, summary, context, knowledge |
source_session_id | uuid | FK → arena_sessions.id |
created_by_agent_id | uuid | FK → agents.id (which agent created it) |
importance | real | 0.0–1.0 |
source_type | varchar(20) | arena, agent_chat, team_chat |
source_thread_id | text | Thread identifier |
created_at | timestamp | Creation time |
last_accessed_at | timestamp | Last access time |
Indexes: team_id, source_type
Ad-hoc Memories
Memories from sessions without a team context — user-specific cross-session knowledge.
| Column | Type | Description |
|---|---|---|
id | uuid | Primary key |
user_id | text | FK → user.id (CASCADE) |
content | text | Memory content |
embedding | vector(1536) | Embedding vector |
memory_type | varchar(30) | Memory category |
source_session_id | uuid | FK → arena_sessions.id |
participant_agent_ids | jsonb | Array of agent UUIDs that participated |
importance | real | 0.0–1.0 |
created_at | timestamp | Creation time |
last_accessed_at | timestamp | Last access time |
Indexes: user_id
Daily Memory Files
Time-scoped activity summaries that capture what happened each day. See pipeline/lifecycle for status transitions.
| Column | Type | Description |
|---|---|---|
id | uuid | Primary key |
scope_type | varchar(10) | agent or team |
scope_id | uuid | Agent or team ID |
date | date | The calendar date |
content | text | Daily summary content |
embedding | vector(1536) | Embedding vector |
status | varchar(10) | active, warm, archived |
created_at | timestamp | Creation time |
updated_at | timestamp | Last update time |
Unique constraint: (scope_type, scope_id, date) — one file per scope per day
Indexes: (scope_type, scope_id)
Arena Session Briefs
Structured summaries of arena (voice) sessions — decisions, action items, and unresolved topics.
| Column | Type | Description |
|---|---|---|
id | uuid | Primary key |
session_id | uuid | FK → arena_sessions.id (CASCADE) |
decisions | jsonb | { text, confidence }[] |
action_items | jsonb | { owner, task, deadline? }[] |
unresolved | jsonb | { topic, positions[] }[] |
next_session_questions | jsonb | string[] |
created_at | timestamp | Creation time |
Unique constraint: session_id — one brief per session
Vector Type
All embedding columns use a custom pgvector type defined as vector(1536), compatible with OpenAI's text-embedding-3-small model. The type handles serialization between JavaScript number[] arrays and PostgreSQL vector strings.
Related Pages
- pipeline/lifecycle — How memory status changes over time
- pipeline/scoring — How embeddings are used in search
- operations/surfaces — Where memories originate from