Skip to main content

Schema Overview

PostgreSQL schema reference for the Crawbl orchestrator. All tables live in the orchestrator schema, set via search_path on the database connection.

Entity Hierarchy

users
+-- user_preferences (1:1, CASCADE delete)
+-- user_push_tokens (1:1, CASCADE delete)
+-- usage_quotas (1:N, CASCADE delete)
+-- workspaces (1:N, CASCADE delete)
+-- agents (1:N, CASCADE delete)
| +-- agent_settings (1:1, CASCADE delete)
| +-- agent_prompts (1:N, CASCADE delete)
| +-- agent_usage_counters (1:1, CASCADE delete)
+-- conversations (1:N, CASCADE delete)
| +-- messages (1:N, CASCADE delete)
| +-- agent_history (1:N, CASCADE delete)
+-- agent_delegations (1:N)
+-- agent_messages (1:N)
+-- artifacts (1:N)
| +-- artifact_versions (1:N)
| +-- artifact_reviews (1:N)
+-- workflow_definitions (1:N)
+-- workflow_executions (1:N)
+-- workflow_step_executions (1:N)

usage_counters (per user per month)
usage_plans (reference table)
model_pricing (reference table)
tools (global catalog)
models (global catalog)
tool_categories (global catalog)
integration_categories (global catalog)
integration_providers (global catalog)
integration_connections (per user)
mcp_audit_logs (append-only audit)

Memory Palace (per workspace):
memory_drawers -> memory_entities -> memory_triples
memory_identities

Tables

TableParentDeleteDescription
Core
users--Soft deleteUser accounts
user_preferencesusersCASCADETheme, language, currency
user_push_tokensusersCASCADEFCM push token
workspacesusersCASCADEIsolated work environments
Agents
agentsworkspacesCASCADEAI agents within a workspace
agent_settingsagentsCASCADEModel, response length config
agent_promptsagentsCASCADESystem prompt templates
agent_historyagentsCASCADEConversation history summaries
Chat
conversationsworkspacesCASCADEChat threads (swarm or agent)
messagesconversationsCASCADEIndividual messages
Multi-Agent
agent_delegationsworkspacesCASCADEAgent-to-agent task handoffs
agent_messagesworkspacesCASCADEInter-agent message log
Artifacts & Workflows
artifactsworkspacesCASCADEVersioned documents/plans/code
artifact_versionsartifactsCASCADEVersion history
artifact_reviewsartifactsCASCADEReview comments
workflow_definitionsworkspacesCASCADEMulti-step workflow templates
workflow_executionsworkflow_definitionsCASCADERunning/completed executions
workflow_step_executionsworkflow_executionsCASCADEPer-step execution state
Integrations
integration_connectionsusersCASCADEOAuth connections per user
Catalogs
tools----Global tool definitions
models----Available LLM models
tool_categories----Tool category groupings
integration_categories----Integration category groupings
integration_providers----OAuth provider configs
Usage & Billing
model_pricing----Per-token costs (append-only)
usage_plans----Plan definitions (free, pro)
usage_quotasusersCASCADEPer-user plan assignment
usage_countersusersCASCADEMonthly running totals
agent_usage_countersagentsCASCADELifetime agent totals
Audit
mcp_audit_logs----MCP tool call audit trail
Memory Palace
memory_drawersworkspacesCASCADETopic-based memory containers
memory_entitiesmemory_drawersCASCADENamed entities (people, places)
memory_triplesmemory_entitiesCASCADESubject-predicate-object facts
memory_identitiesworkspacesCASCADEUser identity recognition
Triggers
agent_triggersagentsCASCADEEvent-driven agent triggers
agent_trigger_executionsagent_triggersCASCADETrigger execution log
memory_triggers--CASCADEMemory-based triggers

Conventions

ConventionDetail
Primary keysUUIDs generated in Go, not database-generated
TimestampsAll tables have created_at and updated_at (TIMESTAMPTZ)
Soft deletesdeleted_at column (only users currently)
Foreign keysON DELETE CASCADE by default
Agent referencesON DELETE SET NULL (conversations and messages keep the row when an agent is removed)
Schemaorchestrator, set via search_path on the connection

ClickHouse Tables

Analytics data is stored in a separate ClickHouse database. See the ClickHouse reference for details.

TableEngineTTLDescription
llm_usageMergeTree13 monthsRaw per-LLM-call events
llm_usage_dailySummingMergeTree25 monthsAuto-aggregated daily rollups