Skip to content

Database Schema Reference

Auto-Generated

This file is auto-generated by scripts/generate-db-docs.mjs. Do not edit manually. Run npm run docs:generate-db to regenerate.

SQLite database using Drizzle ORM over better-sqlite3. Schema source: packages/server/src/db/schema.ts

SQLite Pragmas

PragmaValuePurpose
journal_modeWALConcurrent reads during writes
foreign_keysONEnforce referential integrity
synchronousNORMAL~10x write speedup vs FULL
busy_timeout50005s wait on write lock contention
cache_size-6400064MB page cache

Table of Contents


Conversations & Messages

conversations

Primary key: id

ColumnTypeNullableDefaultNotes
idTEXTNOT NULLPK
agent_idTEXTNOT NULL
task_idTEXTnullable

Indexes:

  • idx_conversations_agent on agentId

messages

Primary key: id (auto-increment)

ColumnTypeNullableDefaultNotes
idINTEGERNOT NULLPK, auto-increment
conversation_idTEXTNOT NULLFK → conversations.id
senderTEXTNOT NULL
contentTEXTNOT NULL
from_roleTEXTnullable

Indexes:

  • idx_messages_conversation on conversationId

Configuration

roles

Primary key: id

ColumnTypeNullableDefaultNotes
idTEXTNOT NULLPK
nameTEXTNOT NULL
descriptionTEXTnullable
system_promptTEXTnullable
colorTEXTnullable#888
iconTEXTnullable🤖
built_inINTEGERnullable0

settings

Primary key: key

ColumnTypeNullableDefaultNotes
keyTEXTNOT NULLPK

Coordination

file_locks

Primary key: file_path

ColumnTypeNullableDefaultNotes
file_pathTEXTNOT NULLPK
agent_idTEXTNOT NULL
agent_roleTEXTNOT NULL
reasonTEXTnullable
acquired_atTEXTnullableUTC now
expires_atTEXTNOT NULL

Indexes:

  • idx_file_locks_agent on agentId
  • idx_file_locks_project on projectId

activity_log

Primary key: id (auto-increment)

ColumnTypeNullableDefaultNotes
idINTEGERNOT NULLPK, auto-increment
agent_idTEXTNOT NULL
agent_roleTEXTNOT NULL
action_typeTEXTNOT NULL
summaryTEXTNOT NULL
detailsTEXTnullable{}
timestampTEXTnullableUTC now

Indexes:

  • idx_activity_agent on agentId
  • idx_activity_type on actionType
  • idx_activity_project on projectId

decisions

Primary key: id

ColumnTypeNullableDefaultNotes
idTEXTNOT NULLPK
agent_idTEXTNOT NULL
agent_roleTEXTNOT NULL
lead_idTEXTnullable
project_idTEXTnullable
titleTEXTNOT NULL
rationaleTEXTnullable
needs_confirmationINTEGERnullable0
statusTEXTnullablerecorded
auto_approvedINTEGERnullable0
confirmed_atTEXTnullable

Indexes:

  • idx_decisions_status on status
  • idx_decisions_needs_confirmation on needsConfirmation
  • idx_decisions_lead_id on leadId
  • idx_decisions_project_id on projectId

Chat Groups

chat_groups

Primary key: (name, leadId) composite

ColumnTypeNullableDefaultNotes
nameTEXTNOT NULL
lead_idTEXTNOT NULL
project_idTEXTnullable
rolesTEXTnullable
archivedINTEGERnullable0

chat_group_members

Primary key: (groupName, leadId, agentId) composite

ColumnTypeNullableDefaultNotes
group_nameTEXTNOT NULL
lead_idTEXTNOT NULL
agent_idTEXTNOT NULL

chat_group_messages

Primary key: id

ColumnTypeNullableDefaultNotes
idTEXTNOT NULLPK
group_nameTEXTNOT NULL
lead_idTEXTNOT NULL
from_agent_idTEXTNOT NULL
from_roleTEXTNOT NULL
contentTEXTNOT NULL
reactionsTEXTnullable{}

Indexes:

  • idx_group_messages_group on groupName, leadId

Planning & Execution

dag_tasks

Primary key: (id, leadId) composite

ColumnTypeNullableDefaultNotes
idTEXTNOT NULL
lead_idTEXTNOT NULL
project_idTEXTnullable
team_idTEXTNOT NULLdefault
roleTEXTNOT NULL
titleTEXTnullable
descriptionTEXTNOT NULL
filesTEXTnullable[]
depends_onTEXTnullable[]
dag_statusTEXTnullablepending
priorityINTEGERnullable0
modelTEXTnullable
assigned_agent_idTEXTnullable
failure_reasonTEXTnullable
created_atTEXTnullableUTC now
started_atTEXTnullable
completed_atTEXTnullable
archived_atTEXTnullable

Indexes:

  • idx_dag_tasks_lead on leadId
  • idx_dag_tasks_status on dagStatus
  • idx_dag_tasks_project on projectId
  • idx_dag_tasks_team on teamId
  • idx_dag_tasks_id_team on id, teamId

agent_memory

Primary key: id (auto-increment)

ColumnTypeNullableDefaultNotes
idINTEGERNOT NULLPK, auto-increment
lead_idTEXTNOT NULL
agent_idTEXTNOT NULL
keyTEXTNOT NULL
valueTEXTNOT NULL

Indexes:

  • idx_agent_memory_lead on leadId
  • idx_agent_memory_agent on agentId
  • idx_agent_memory_unique (unique) on leadId, agentId, key

agent_plans

Primary key: agent_id

ColumnTypeNullableDefaultNotes
agent_idTEXTNOT NULLPK
lead_idTEXTnullable
plan_jsonTEXTNOT NULL[]

Projects

projects

Primary key: id

ColumnTypeNullableDefaultNotes
idTEXTNOT NULLPK
nameTEXTNOT NULL
descriptionTEXTnullable
cwdTEXTnullable
created_atTEXTnullableUTC now

Indexes:

  • idx_projects_status on status

project_sessions

Primary key: id (auto-increment)

ColumnTypeNullableDefaultNotes
idINTEGERNOT NULLPK, auto-increment
project_idTEXTNOT NULLFK → projects.id
taskTEXTnullable
started_atTEXTnullableUTC now

Indexes:

  • idx_project_sessions_project on projectId
  • idx_project_sessions_lead on leadId

Agent Registry & Tracking

agent_roster

Primary key: agent_id

ColumnTypeNullableDefaultNotes
agent_idTEXTNOT NULLPK
roleTEXTNOT NULL
modelTEXTNOT NULL
session_idTEXTnullable
project_idTEXTnullable
providerTEXTnullable
team_idTEXTNOT NULLdefault
created_atTEXTNOT NULLUTC now
updated_atTEXTNOT NULLUTC now
last_task_summaryTEXTnullable

Indexes:

  • idx_agent_roster_status on status
  • idx_agent_roster_project on projectId
  • idx_agent_roster_project_team on projectId, teamId
  • idx_agent_roster_team on teamId
  • idx_agent_roster_session on sessionId

active_delegations

Primary key: delegation_id

ColumnTypeNullableDefaultNotes
delegation_idTEXTNOT NULLPK
agent_idTEXTNOT NULLFK → agentRoster.agentId
taskTEXTNOT NULL
contextTEXTnullable
dag_task_idTEXTnullable
team_idTEXTNOT NULLdefault
created_atTEXTNOT NULLUTC now
completed_atTEXTnullable

Indexes:

  • idx_ad_agent on agentId, status
  • idx_ad_status on status
  • idx_ad_dag_task on dagTaskId
  • idx_ad_team on teamId

agent_file_history

Primary key: (agentId, leadId, filePath) composite

ColumnTypeNullableDefaultNotes
agent_idTEXTNOT NULL
agent_roleTEXTNOT NULL
lead_idTEXTNOT NULL
file_pathTEXTNOT NULL
first_touched_atTEXTnullableUTC now
last_touched_atTEXTnullableUTC now

Indexes:

  • idx_file_history_file on filePath, leadId
  • idx_file_history_agent on agentId, leadId

Knowledge & Memory

collective_memory

Primary key: id (auto-increment)

ColumnTypeNullableDefaultNotes
idINTEGERNOT NULLPK, auto-increment
keyTEXTNOT NULL
valueTEXTNOT NULL
project_idTEXTnullable
created_atTEXTnullableUTC now
last_used_atTEXTnullableUTC now

Indexes:

  • idx_collective_memory_category on category
  • idx_collective_memory_key on key
  • idx_collective_memory_project on projectId
  • idx_collective_memory_cat_key (unique) on category, key, projectId

knowledge

Primary key: id (auto-increment)

ColumnTypeNullableDefaultNotes
idINTEGERNOT NULLPK, auto-increment
project_idTEXTNOT NULL
keyTEXTNOT NULL
contentTEXTNOT NULL
created_atTEXTNOT NULLUTC now

Indexes:

  • idx_knowledge_project_cat_key (unique) on projectId, category, key
  • idx_knowledge_project_category on projectId, category

Observability

task_cost_records

Primary key: (agentId, dagTaskId, leadId) composite

ColumnTypeNullableDefaultNotes
agent_idTEXTNOT NULL
dag_task_idTEXTNOT NULL
lead_idTEXTNOT NULL
project_idTEXTnullable
input_tokensINTEGERnullable0
output_tokensINTEGERnullable0
cache_read_tokensINTEGERnullable0
cache_write_tokensINTEGERnullable0
cost_usdREALnullable0
created_atTEXTnullableUTC now

Indexes:

  • idx_task_cost_agent on agentId
  • idx_task_cost_task on dagTaskId, leadId
  • idx_task_cost_project on projectId

session_retros

Primary key: id (auto-increment)

ColumnTypeNullableDefaultNotes
idINTEGERNOT NULLPK, auto-increment
lead_idTEXTNOT NULL

Indexes:

  • idx_session_retros_lead on leadId

Infrastructure

timers

Primary key: id

ColumnTypeNullableDefaultNotes
idTEXTNOT NULLPK
agent_idTEXTNOT NULL
agent_roleTEXTNOT NULL
lead_idTEXTnullable
labelTEXTNOT NULL
messageTEXTNOT NULL
delay_secondsINTEGERNOT NULL
fire_atTEXTNOT NULL
created_atTEXTnullableUTC now

Indexes:

  • idx_timers_agent on agentId
  • idx_timers_status on status

message_queue

Primary key: id (auto-increment)

ColumnTypeNullableDefaultNotes
idINTEGERNOT NULLPK, auto-increment
target_agent_idTEXTNOT NULL
source_agent_idTEXTnullable
attemptsINTEGERNOT NULL0
created_atTEXTnullableUTC now
delivered_atTEXTnullable

Indexes:

  • idx_mq_target_status on targetAgentId, status
  • idx_mq_project on projectId

24 tables. Generated from packages/server/src/db/schema.ts.

Documentation generated by AI

Documentation generated by AI