Siestai
Memory ArchitectureSchema

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.

ColumnTypeDescription
iduuidPrimary key (auto-generated)
agent_iduuidFK → agents.id (CASCADE delete)
contenttextThe memory content
embeddingvector(1536)text-embedding-3-small vector
memory_typevarchar(30)fact, preference, skill, insight
source_session_iduuidFK → arena_sessions.id (SET NULL)
importancereal0.0–1.0, default 0.5
statusvarchar(20)active, consolidated, completed
source_typevarchar(20)arena, agent_chat, team_chat
source_thread_idtextThread identifier for chat sources
created_attimestampCreation time
last_accessed_attimestampLast 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.

ColumnTypeDescription
iduuidPrimary key
team_iduuidFK → teams.id (CASCADE)
contenttextMemory content
embeddingvector(1536)Embedding vector
memory_typevarchar(30)decision, summary, context, knowledge
source_session_iduuidFK → arena_sessions.id
created_by_agent_iduuidFK → agents.id (which agent created it)
importancereal0.0–1.0
source_typevarchar(20)arena, agent_chat, team_chat
source_thread_idtextThread identifier
created_attimestampCreation time
last_accessed_attimestampLast access time

Indexes: team_id, source_type

Ad-hoc Memories

Memories from sessions without a team context — user-specific cross-session knowledge.

ColumnTypeDescription
iduuidPrimary key
user_idtextFK → user.id (CASCADE)
contenttextMemory content
embeddingvector(1536)Embedding vector
memory_typevarchar(30)Memory category
source_session_iduuidFK → arena_sessions.id
participant_agent_idsjsonbArray of agent UUIDs that participated
importancereal0.0–1.0
created_attimestampCreation time
last_accessed_attimestampLast access time

Indexes: user_id

Daily Memory Files

Time-scoped activity summaries that capture what happened each day. See pipeline/lifecycle for status transitions.

ColumnTypeDescription
iduuidPrimary key
scope_typevarchar(10)agent or team
scope_iduuidAgent or team ID
datedateThe calendar date
contenttextDaily summary content
embeddingvector(1536)Embedding vector
statusvarchar(10)active, warm, archived
created_attimestampCreation time
updated_attimestampLast 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.

ColumnTypeDescription
iduuidPrimary key
session_iduuidFK → arena_sessions.id (CASCADE)
decisionsjsonb{ text, confidence }[]
action_itemsjsonb{ owner, task, deadline? }[]
unresolvedjsonb{ topic, positions[] }[]
next_session_questionsjsonbstring[]
created_attimestampCreation 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.

On this page