Files
lobehub__lobehub/docs/development/database-schema.dbml
Arvin Xu 2a3f0bcff6 🗃️ chore(database): record where a distilled standard came from, and what it rests on (#19627)
* 🗃️ chore(database): record where a distilled standard came from, and what it rests on

Four columns for turning a reviewer's rejections into delivery standards. Nothing
reads them yet; the capture pipeline and the backtest are stacked on top.

**`expertise_hits.source_check_result_id`** — the reverse lookup "which rejections
taught this lesson". A hit could only reach an acceptance through `evidence_id`,
and 260 of this owner's 876 rejections circled no evidence at all, so that path
loses a third of the provenance. `on delete set null`: the link is provenance, not
ownership, so deleting an acceptance must not delete the rule it taught — pinned
by a test that deletes the check result and asserts the hit survives.

**`expertise_lessons.reason_kind`** — whether the standard rests on a mechanism or
on the owner's taste. Both are legitimate; only one can be enforced automatically,
because a taste standard has no test a delivery could be measured against. This
has to be a column rather than a note in the lesson body: the compile step reads
it to refuse compiling taste into a criterion that blocks work on its own, and the
body's wording follows the reviewer's own language, so matching on a phrase would
silently miss for anyone not writing in Chinese.

**`expertise_lessons.reason_source`** — whether the reviewer gave the reason or the
distillation supplied it. An inferred reason is worth keeping, but it must never
carry the weight of something the reviewer actually said.

Both are decided when a lesson is born. A later rejection that supplies a real
mechanism should arguably upgrade a `taste` lesson; the upgrade rule is not worked
out, so that does not happen yet.

**`expertise_lessons.backtest`** — how a standard scored against the reviewer's own
past decisions before anything compiles it. The metric is precision on the units it
fired on, deliberately not recall: every standard covers a narrow slice, so recall
is near zero for all of them and separates nothing, while firing on approved
deliveries is the failure that makes someone switch the feature off. Read against
the base rate, not 1.0 — 876 of 1,956 judged units are rejections, so random firing
already scores ~0.45. jsonb because the metric set is still moving.

**`EXPERTISE_SUBJECT_TYPES` gains `standalone`** so a practice run can mirror the
subject of the acceptance it came from (36 of 193 carry no in-product subject).
`text({ enum })` emits no constraint, so it costs no migration.

No indexes: the read paths are lesson → hits (already indexed) and the lesson row
itself, and `expertise_hits` is the one table here with real scale risk.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* 📝 docs(database): write the expertise schema comments in English

Comment-only change; the schema itself is untouched (verified by comparing the
comment-stripped AST before and after).

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* 🗃️ chore(database): keep which delivery each generalized boundary rests on

A consolidation pass rewrites a standard from several rejections and may write
exemptions into its `limits`. The only thing that makes such an exemption
legitimate is a delivery the reviewer accepted while the standard's subject was
plainly in view — and the rewrite text cannot carry that: the model cites
deliveries by per-request labels ("S2") that mean nothing once the request is
gone. Without a stored link, "why is this allowed" has no answer a week later.

`expertise_lesson_revisions.evidence` (jsonb, nullable) records the rejected
deliveries the pass read, the accepted ones it was offered, and for each
boundary the accepted check result ids it was read from. null on a person's
rewrite, whose authority is `feedback`. jsonb rather than a link table: a pass
reads a handful of deliveries and is audited one revision at a time; the ids are
provenance, so a deleted check simply stops resolving.

Folded into the branch's unshipped 0165 migration by regenerating it, per the
migration guide, so the PR still carries a single migration.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-09-18 02:02:45 +08:00

4533 lines
145 KiB
Plaintext

table acceptance_comments {
id text [pk, not null]
acceptance_id uuid [not null]
author_user_id text
author_agent_id text
workspace_id text
parent_comment_id text
kind text [not null, default: 'comment']
anchor_type text [not null, default: 'acceptance']
context_run_id uuid
check_item_id text
evidence_id uuid
anchor_rect jsonb
content text [not null]
editor_data jsonb
attachments jsonb
client_id text [not null]
resolved_at "timestamp with time zone"
resolved_by_user_id text
deleted_at "timestamp with time zone"
created_at "timestamp with time zone" [not null, default: `now()`]
updated_at "timestamp with time zone" [not null, default: `now()`]
indexes {
(acceptance_id, author_user_id, client_id) [name: 'acceptance_comments_acceptance_id_author_user_id_client_id_unique', unique]
(acceptance_id, created_at, id) [name: 'acceptance_comments_acceptance_id_created_at_id_idx']
parent_comment_id [name: 'acceptance_comments_parent_comment_id_idx']
evidence_id [name: 'acceptance_comments_evidence_id_idx']
author_user_id [name: 'acceptance_comments_author_user_id_idx']
author_agent_id [name: 'acceptance_comments_author_agent_id_idx']
workspace_id [name: 'acceptance_comments_workspace_id_idx']
}
}
table acceptance_flow_edges {
id uuid [pk, not null, default: `gen_random_uuid()`]
flow_id uuid [not null]
source_node_id uuid [not null]
target_node_id uuid [not null]
trigger text [not null]
condition text
required boolean [not null, default: true]
indexes {
(flow_id, source_node_id) [name: 'acceptance_flow_edges_source_idx']
(flow_id, target_node_id) [name: 'acceptance_flow_edges_target_idx']
}
}
table acceptance_flow_nodes {
id uuid [pk, not null, default: `gen_random_uuid()`]
flow_id uuid [not null]
criterion_id uuid
sub_flow_id uuid
is_entry boolean [not null, default: false]
overrides jsonb
indexes {
sub_flow_id [name: 'acceptance_flow_nodes_sub_flow_idx']
(flow_id, id) [name: 'acceptance_flow_nodes_flow_id_unique', unique]
flow_id [name: 'acceptance_flow_nodes_entry_unique', unique]
criterion_id [name: 'acceptance_flow_nodes_criterion_idx']
}
}
table acceptance_flows {
id uuid [pk, not null, default: `gen_random_uuid()`]
acceptance_id uuid [not null]
title text [not null]
accessed_at "timestamp with time zone" [not null, default: `now()`]
created_at "timestamp with time zone" [not null, default: `now()`]
updated_at "timestamp with time zone" [not null, default: `now()`]
indexes {
acceptance_id [name: 'acceptance_flows_acceptance_idx']
}
}
table agents {
id text [pk, not null]
slug varchar(100)
title varchar(255)
name varchar(255)
description varchar(1000)
tags jsonb [default: `[]`]
editor_data jsonb
avatar text
background_color text
market_identifier text
metadata jsonb
profile jsonb
society_id text
plugins jsonb
client_id text
user_id text [not null]
workspace_id text
agency_config jsonb
chat_config jsonb
few_shots jsonb
model text
params jsonb [default: `{}`]
provider text
system_role text
tts jsonb
virtual boolean [default: false]
pinned boolean
opening_message text
opening_questions text[] [default: `[]`]
session_group_id text
visibility text [not null, default: 'public']
deleted_at "timestamp with time zone"
is_deleted boolean
accessed_at "timestamp with time zone" [not null, default: `now()`]
created_at "timestamp with time zone" [not null, default: `now()`]
updated_at "timestamp with time zone" [not null, default: `now()`]
indexes {
(client_id, user_id) [name: 'client_id_user_id_unique', unique]
(slug, user_id) [name: 'agents_slug_user_id_unique', unique]
created_at [name: 'agents_created_at_idx']
user_id [name: 'agents_user_id_idx']
title [name: 'agents_title_idx']
description [name: 'agents_description_idx']
session_group_id [name: 'agents_session_group_id_idx']
workspace_id [name: 'agents_workspace_id_idx']
(workspace_id, visibility, user_id) [name: 'agents_workspace_visibility_idx']
(workspace_id, slug) [name: 'agents_slug_workspace_id_unique', unique]
}
}
table agents_files {
file_id text [not null]
agent_id text [not null]
enabled boolean [default: true]
user_id text [not null]
workspace_id text
accessed_at "timestamp with time zone" [not null, default: `now()`]
created_at "timestamp with time zone" [not null, default: `now()`]
updated_at "timestamp with time zone" [not null, default: `now()`]
indexes {
(file_id, agent_id, user_id) [pk]
agent_id [name: 'agents_files_agent_id_idx']
file_id [name: 'agents_files_file_id_idx']
user_id [name: 'agents_files_user_id_idx']
workspace_id [name: 'agents_files_workspace_id_idx']
}
}
table agents_knowledge_bases {
agent_id text [not null]
knowledge_base_id text [not null]
user_id text [not null]
workspace_id text
enabled boolean [default: true]
accessed_at "timestamp with time zone" [not null, default: `now()`]
created_at "timestamp with time zone" [not null, default: `now()`]
updated_at "timestamp with time zone" [not null, default: `now()`]
indexes {
(agent_id, knowledge_base_id) [pk]
agent_id [name: 'agents_knowledge_bases_agent_id_idx']
knowledge_base_id [name: 'agents_knowledge_bases_knowledge_base_id_idx']
user_id [name: 'agents_knowledge_bases_user_id_idx']
workspace_id [name: 'agents_knowledge_bases_workspace_id_idx']
}
}
table agent_bot_providers {
id uuid [pk, not null, default: `gen_random_uuid()`]
agent_id text [not null]
user_id text [not null]
workspace_id text
platform varchar(50) [not null]
application_id varchar(255) [not null]
credentials text
settings jsonb [default: `{}`]
enabled boolean [not null, default: true]
accessed_at "timestamp with time zone" [not null, default: `now()`]
created_at "timestamp with time zone" [not null, default: `now()`]
updated_at "timestamp with time zone" [not null, default: `now()`]
indexes {
(platform, application_id) [name: 'agent_bot_providers_platform_app_id_unique', unique]
platform [name: 'agent_bot_providers_platform_idx']
agent_id [name: 'agent_bot_providers_agent_id_idx']
user_id [name: 'agent_bot_providers_user_id_idx']
workspace_id [name: 'agent_bot_providers_workspace_id_idx']
}
}
table agent_cron_jobs {
id text [pk, not null]
agent_id text [not null]
group_id text
user_id text [not null]
workspace_id text
name text
description text
enabled boolean [default: true]
cron_pattern text [not null]
timezone text [default: 'UTC']
content text [not null]
edit_data jsonb
max_executions integer
remaining_executions integer
execution_conditions jsonb
last_executed_at timestamp
total_executions integer [default: 0]
deleted_at "timestamp with time zone"
is_deleted boolean
accessed_at "timestamp with time zone" [not null, default: `now()`]
created_at "timestamp with time zone" [not null, default: `now()`]
updated_at "timestamp with time zone" [not null, default: `now()`]
indexes {
agent_id [name: 'agent_cron_jobs_agent_id_idx']
group_id [name: 'agent_cron_jobs_group_id_idx']
user_id [name: 'agent_cron_jobs_user_id_idx']
workspace_id [name: 'agent_cron_jobs_workspace_id_idx']
enabled [name: 'agent_cron_jobs_enabled_idx']
remaining_executions [name: 'agent_cron_jobs_remaining_executions_idx']
last_executed_at [name: 'agent_cron_jobs_last_executed_at_idx']
}
}
table agent_documents {
id uuid [pk, not null, default: `gen_random_uuid()`]
user_id text [not null]
workspace_id text
agent_id text [not null]
document_id varchar(255) [not null]
template_id varchar(100)
access_self integer [not null, default: 31]
access_shared integer [not null, default: 0]
access_public integer [not null, default: 0]
policy_load varchar(30) [not null, default: 'always']
policy jsonb
policy_load_position varchar(50) [not null, default: 'before-first-user']
policy_load_format varchar(20) [not null, default: 'raw']
policy_load_rule varchar(50) [not null, default: 'always']
deleted_at "timestamp with time zone"
deleted_by_user_id text
deleted_by_agent_id text
delete_reason text
created_at "timestamp with time zone" [not null, default: `now()`]
updated_at "timestamp with time zone" [not null, default: `now()`]
indexes {
workspace_id [name: 'agent_documents_workspace_id_idx']
user_id [name: 'agent_documents_user_id_idx']
agent_id [name: 'agent_documents_agent_id_idx']
access_self [name: 'agent_documents_access_self_idx']
access_shared [name: 'agent_documents_access_shared_idx']
access_public [name: 'agent_documents_access_public_idx']
policy_load [name: 'agent_documents_policy_load_idx']
template_id [name: 'agent_documents_template_id_idx']
policy_load_position [name: 'agent_documents_policy_load_position_idx']
policy_load_format [name: 'agent_documents_policy_load_format_idx']
policy_load_rule [name: 'agent_documents_policy_load_rule_idx']
(agent_id, policy_load_position) [name: 'agent_documents_agent_load_position_idx']
deleted_at [name: 'agent_documents_deleted_at_idx']
(agent_id, deleted_at, policy_load) [name: 'agent_documents_agent_autoload_deleted_idx']
document_id [name: 'agent_documents_document_id_idx']
(agent_id, document_id, user_id) [name: 'agent_documents_agent_document_user_unique', unique]
}
}
table agent_eval_benchmarks {
id text [pk, not null]
identifier text [not null]
name text [not null]
description text
rubrics jsonb [not null]
reference_url text
metadata jsonb
user_id text
workspace_id text
is_system boolean [not null, default: true]
accessed_at "timestamp with time zone" [not null, default: `now()`]
created_at "timestamp with time zone" [not null, default: `now()`]
updated_at "timestamp with time zone" [not null, default: `now()`]
indexes {
(identifier, user_id) [name: 'agent_eval_benchmarks_identifier_user_id_unique', unique]
is_system [name: 'agent_eval_benchmarks_is_system_idx']
user_id [name: 'agent_eval_benchmarks_user_id_idx']
workspace_id [name: 'agent_eval_benchmarks_workspace_id_idx']
(workspace_id, identifier) [name: 'agent_eval_benchmarks_identifier_workspace_id_unique', unique]
}
}
table agent_eval_datasets {
id text [pk, not null]
benchmark_id text
source_experiment_id text
identifier text [not null]
user_id text
workspace_id text
name text [not null]
description text
eval_mode text
eval_config jsonb
metadata jsonb
accessed_at "timestamp with time zone" [not null, default: `now()`]
created_at "timestamp with time zone" [not null, default: `now()`]
updated_at "timestamp with time zone" [not null, default: `now()`]
indexes {
(identifier, user_id) [name: 'agent_eval_datasets_identifier_user_id_unique', unique]
benchmark_id [name: 'agent_eval_datasets_benchmark_id_idx']
source_experiment_id [name: 'agent_eval_datasets_source_experiment_id_idx']
user_id [name: 'agent_eval_datasets_user_id_idx']
workspace_id [name: 'agent_eval_datasets_workspace_id_idx']
(workspace_id, identifier) [name: 'agent_eval_datasets_identifier_workspace_id_unique', unique]
}
}
table agent_eval_experiment_benchmarks {
experiment_id text [not null]
benchmark_id text [not null]
user_id text [not null]
workspace_id text
created_at "timestamp with time zone" [not null, default: `now()`]
indexes {
(experiment_id, benchmark_id) [pk]
benchmark_id [name: 'agent_eval_experiment_benchmarks_benchmark_id_idx']
user_id [name: 'agent_eval_experiment_benchmarks_user_id_idx']
workspace_id [name: 'agent_eval_experiment_benchmarks_workspace_id_idx']
}
}
table agent_eval_experiments {
id text [pk, not null]
user_id text [not null]
workspace_id text
name text [not null]
description text
metadata jsonb
accessed_at "timestamp with time zone" [not null, default: `now()`]
created_at "timestamp with time zone" [not null, default: `now()`]
updated_at "timestamp with time zone" [not null, default: `now()`]
indexes {
user_id [name: 'agent_eval_experiments_user_id_idx']
workspace_id [name: 'agent_eval_experiments_workspace_id_idx']
}
}
table agent_eval_run_topics {
user_id text [not null]
workspace_id text
run_id text [not null]
topic_id text [not null]
test_case_id text [not null]
status text
score real
passed boolean
eval_result jsonb
created_at "timestamp with time zone" [not null, default: `now()`]
indexes {
(run_id, topic_id) [pk]
user_id [name: 'agent_eval_run_topics_user_id_idx']
run_id [name: 'agent_eval_run_topics_run_id_idx']
test_case_id [name: 'agent_eval_run_topics_test_case_id_idx']
workspace_id [name: 'agent_eval_run_topics_workspace_id_idx']
}
}
table agent_eval_runs {
id text [pk, not null]
dataset_id text [not null]
experiment_id text
parent_run_id text
target_agent_id text
user_id text [not null]
workspace_id text
name text
status text [not null, default: 'idle']
config jsonb
metrics jsonb
started_at "timestamp with time zone"
accessed_at "timestamp with time zone" [not null, default: `now()`]
created_at "timestamp with time zone" [not null, default: `now()`]
updated_at "timestamp with time zone" [not null, default: `now()`]
indexes {
dataset_id [name: 'agent_eval_runs_dataset_id_idx']
experiment_id [name: 'agent_eval_runs_experiment_id_idx']
parent_run_id [name: 'agent_eval_runs_parent_run_id_idx']
user_id [name: 'agent_eval_runs_user_id_idx']
status [name: 'agent_eval_runs_status_idx']
target_agent_id [name: 'agent_eval_runs_target_agent_id_idx']
workspace_id [name: 'agent_eval_runs_workspace_id_idx']
}
}
table agent_eval_test_cases {
id text [pk, not null]
user_id text [not null]
workspace_id text
dataset_id text [not null]
content jsonb [not null]
eval_mode text
eval_config jsonb
metadata jsonb
sort_order integer
accessed_at "timestamp with time zone" [not null, default: `now()`]
created_at "timestamp with time zone" [not null, default: `now()`]
updated_at "timestamp with time zone" [not null, default: `now()`]
indexes {
user_id [name: 'agent_eval_test_cases_user_id_idx']
dataset_id [name: 'agent_eval_test_cases_dataset_id_idx']
sort_order [name: 'agent_eval_test_cases_sort_order_idx']
workspace_id [name: 'agent_eval_test_cases_workspace_id_idx']
}
}
table agent_history_job_agents {
id uuid [pk, not null, default: `gen_random_uuid()`]
job_id text [not null]
agent_id text [not null]
indexes {
(job_id, agent_id) [name: 'agent_history_job_agents_job_id_agent_id_unique', unique]
agent_id [name: 'agent_history_job_agents_agent_id_idx']
}
}
table agent_history_job_groups {
id uuid [pk, not null, default: `gen_random_uuid()`]
job_id text [not null]
group_id text [not null]
indexes {
(job_id, group_id) [name: 'agent_history_job_groups_job_id_group_id_unique', unique]
group_id [name: 'agent_history_job_groups_group_id_idx']
}
}
table agent_history_job_topics {
id uuid [pk, not null, default: `gen_random_uuid()`]
job_id text [not null]
topic_id text [not null]
priority boolean [not null, default: false]
activity_at "timestamp with time zone" [not null]
payload jsonb
indexes {
(job_id, topic_id) [name: 'agent_history_job_topics_job_id_topic_id_unique', unique]
topic_id [name: 'agent_history_job_topics_topic_id_idx']
(job_id, priority, activity_at) [name: 'agent_history_job_topics_pick_idx']
}
}
table agent_history_jobs {
id text [pk, not null]
status text [not null, default: 'pending']
type text [not null, default: 'transfer']
payload jsonb
agent_ids jsonb [not null]
session_ids jsonb [not null]
group_ids jsonb [not null, default: `[]`]
source_user_id text [not null]
source_workspace_id text
target_user_id text [not null]
target_workspace_id text
total_topics integer [not null]
completed_topics integer [not null, default: 0]
completed_at "timestamp with time zone"
accessed_at "timestamp with time zone" [not null, default: `now()`]
created_at "timestamp with time zone" [not null, default: `now()`]
updated_at "timestamp with time zone" [not null, default: `now()`]
indexes {
status [name: 'agent_history_jobs_status_idx']
source_user_id [name: 'agent_history_jobs_source_user_id_idx']
target_user_id [name: 'agent_history_jobs_target_user_id_idx']
source_workspace_id [name: 'agent_history_jobs_source_workspace_id_idx']
target_workspace_id [name: 'agent_history_jobs_target_workspace_id_idx']
}
}
table agent_intervention_resolutions {
id uuid [pk, not null, default: `gen_random_uuid()`]
resolution_request_id uuid [not null]
operation_id text [not null]
batch_id text [not null]
source text [not null]
user_id text [not null]
workspace_id text
actor_id text [not null]
scope text [not null]
selected_intervention_ids jsonb [not null]
expected_versions jsonb [not null]
expected_request_revision_hashes jsonb [not null]
expected_item_count integer [not null]
action jsonb [not null]
custom_execution_input_hash varchar(64)
custom_execution_state text
custom_execution_attempt integer
custom_execution_lease_token uuid
custom_execution_lease_expires_at "timestamp with time zone"
custom_execution_result jsonb
remember_tool_key text
remember_effect_status text
original_arguments text
edited_arguments text
original_request_revision_hash text
edited_request_revision_hash text
argument_effect_status text
status text [not null, default: 'resolving']
resolving_at "timestamp with time zone" [not null, default: `now()`]
published_at "timestamp with time zone"
continuation_started_at "timestamp with time zone"
producer_ack_at "timestamp with time zone"
terminal_at "timestamp with time zone"
rolled_back_at "timestamp with time zone"
version integer [not null, default: 1]
created_at "timestamp with time zone" [not null, default: `now()`]
updated_at "timestamp with time zone" [not null, default: `now()`]
indexes {
resolution_request_id [name: 'agent_intervention_resolutions_request_unique', unique]
(user_id, workspace_id, batch_id) [name: 'agent_intervention_resolutions_owner_batch_idx']
(status, created_at) [name: 'agent_intervention_resolutions_status_created_idx']
}
}
table agent_interventions {
id uuid [pk, not null, default: `gen_random_uuid()`]
operation_id text [not null]
tool_call_id text [not null]
tool_message_id text
user_id text [not null]
workspace_id text
source text [not null]
provider text
interaction_kind text [not null]
surface text [not null]
system_action_eligibility text [not null]
approval_mode text
batch_id text [not null]
activity_key text [not null]
step_index integer [not null]
item_index integer [not null]
item_count integer [not null]
sealed boolean [not null, default: false]
canonical_tool_key text
request_revision_hash text [not null]
allowed_actions jsonb [not null]
risk jsonb
review_token_hash text [not null]
review_context jsonb [not null]
sanitized_request jsonb [not null]
deadline "timestamp with time zone" [not null]
status text [not null, default: 'pending']
resolution_id uuid
resolving_at "timestamp with time zone"
published_at "timestamp with time zone"
resolved_at "timestamp with time zone"
producer_ack_at "timestamp with time zone"
version integer [not null, default: 1]
created_at "timestamp with time zone" [not null, default: `now()`]
updated_at "timestamp with time zone" [not null, default: `now()`]
indexes {
(operation_id, tool_call_id) [name: 'agent_interventions_operation_tool_call_unique', unique]
review_token_hash [name: 'agent_interventions_review_token_hash_unique', unique]
(operation_id, batch_id, item_index) [name: 'agent_interventions_operation_batch_item_unique', unique]
(user_id, activity_key, item_index) [name: 'agent_interventions_owner_activity_item_unique', unique]
(user_id, workspace_id, status, deadline) [name: 'agent_interventions_owner_status_deadline_idx']
(user_id, workspace_id, batch_id, item_index) [name: 'agent_interventions_owner_batch_idx']
(user_id, activity_key) [name: 'agent_interventions_activity_key_idx']
(status, deadline) [name: 'agent_interventions_status_deadline_idx']
}
}
table agent_label_assignments {
id uuid [pk, not null, default: `gen_random_uuid()`]
label_id uuid [not null]
agent_id text [not null]
user_id text [not null]
workspace_id text
accessed_at "timestamp with time zone" [not null, default: `now()`]
created_at "timestamp with time zone" [not null, default: `now()`]
updated_at "timestamp with time zone" [not null, default: `now()`]
indexes {
(label_id, agent_id) [name: 'agent_label_assignments_label_id_agent_id_unique', unique]
agent_id [name: 'agent_label_assignments_agent_id_idx']
workspace_id [name: 'agent_label_assignments_workspace_id_idx']
}
}
table agent_labels {
id uuid [pk, not null, default: `gen_random_uuid()`]
name text [not null]
description text
color text
archived boolean [not null, default: false]
user_id text [not null]
workspace_id text
accessed_at "timestamp with time zone" [not null, default: `now()`]
created_at "timestamp with time zone" [not null, default: `now()`]
updated_at "timestamp with time zone" [not null, default: `now()`]
indexes {
user_id [name: 'agent_labels_user_id_idx']
workspace_id [name: 'agent_labels_workspace_id_idx']
(user_id, name) [name: 'agent_labels_user_id_name_unique', unique]
(workspace_id, name) [name: 'agent_labels_workspace_id_name_unique', unique]
}
}
table agent_operations {
id text [pk, not null]
user_id text [not null]
workspace_id text
agent_id text
topic_id text
thread_id text
task_id text
chat_group_id text
parent_operation_id text
status text [not null]
completion_reason text
verify_status text
verify_plan jsonb
verify_plan_confirmed_at "timestamp with time zone"
started_at "timestamp with time zone"
completed_at "timestamp with time zone"
step_count integer
max_steps integer
force_finish boolean
interruption jsonb
error jsonb
total_cost "numeric(20, 6)"
currency text [not null, default: 'USD']
total_input_tokens integer
total_output_tokens integer
total_tokens integer
llm_calls integer
tool_calls integer
human_interventions integer
processing_time_ms integer
human_waiting_time_ms integer
cost jsonb
usage jsonb
cost_limit jsonb
model text
provider text
model_runtime_config jsonb
trigger text
app_context jsonb
trace_s3_key text
metadata jsonb [default: `{}`]
accessed_at "timestamp with time zone" [not null, default: `now()`]
created_at "timestamp with time zone" [not null, default: `now()`]
updated_at "timestamp with time zone" [not null, default: `now()`]
indexes {
user_id [name: 'agent_operations_user_id_idx']
workspace_id [name: 'agent_operations_workspace_id_idx']
agent_id [name: 'agent_operations_agent_id_idx']
topic_id [name: 'agent_operations_topic_id_idx']
thread_id [name: 'agent_operations_thread_id_idx']
task_id [name: 'agent_operations_task_id_idx']
chat_group_id [name: 'agent_operations_chat_group_id_idx']
parent_operation_id [name: 'agent_operations_parent_operation_id_idx']
status [name: 'agent_operations_status_idx']
(user_id, created_at) [name: 'agent_operations_user_id_created_at_idx']
metadata [name: 'agent_operations_metadata_idx']
}
}
table agent_account_bindings {
id uuid [pk, not null, default: `gen_random_uuid()`]
agent_id text [not null]
account_id uuid [not null]
user_id text [not null]
workspace_id text
role text [not null, default: 'pool']
priority integer [not null, default: 0]
weight integer [not null, default: 1]
enabled boolean [not null, default: true]
accessed_at "timestamp with time zone" [not null, default: `now()`]
created_at "timestamp with time zone" [not null, default: `now()`]
updated_at "timestamp with time zone" [not null, default: `now()`]
indexes {
(agent_id, account_id) [name: 'agent_account_bindings_agent_account_unique', unique]
agent_id [name: 'agent_account_bindings_agent_pinned_unique', unique]
agent_id [name: 'agent_account_bindings_agent_id_idx']
account_id [name: 'agent_account_bindings_account_id_idx']
user_id [name: 'agent_account_bindings_user_id_idx']
workspace_id [name: 'agent_account_bindings_workspace_id_idx']
}
}
table agent_provider_accounts {
id uuid [pk, not null, default: `gen_random_uuid()`]
user_id text [not null]
workspace_id text
provider text [not null]
external_account_id text
email text
display_name text
organization_id text
plan_tier text
rate_limit_tier text
label varchar(255)
credential_mode text [not null, default: 'referenced']
credentials text
credential_ref jsonb
token_expires_at "timestamp with time zone"
status text [not null, default: 'active']
enabled boolean [not null, default: true]
last_validated_at "timestamp with time zone"
metadata jsonb
accessed_at "timestamp with time zone" [not null, default: `now()`]
created_at "timestamp with time zone" [not null, default: `now()`]
updated_at "timestamp with time zone" [not null, default: `now()`]
indexes {
user_id [name: 'agent_provider_accounts_user_id_idx']
workspace_id [name: 'agent_provider_accounts_workspace_id_idx']
token_expires_at [name: 'agent_provider_accounts_token_expires_at_idx']
(user_id, provider, external_account_id) [name: 'agent_provider_accounts_identity_unique', unique]
(provider, external_account_id, workspace_id) [name: 'agent_provider_accounts_identity_workspace_unique', unique]
}
}
table agent_quota_calibrations {
id uuid [pk, not null, default: `gen_random_uuid()`]
account_id uuid [not null]
user_id text [not null]
workspace_id text
limit_type text [not null]
scope_key text [not null, default: '']
capacity_usd "numeric(20, 6)" [not null]
capacity_tokens_equivalent bigint
model_mix jsonb
sample_count integer [not null]
confidence "numeric(20, 6)"
method text
window_seconds integer
calibrated_at "timestamp with time zone" [not null, default: `now()`]
metadata jsonb
created_at "timestamp with time zone" [not null, default: `now()`]
indexes {
(account_id, limit_type, scope_key, calibrated_at) [name: 'agent_quota_calibrations_account_type_scope_idx']
workspace_id [name: 'agent_quota_calibrations_workspace_id_idx']
}
}
table agent_quota_snapshots {
id uuid [pk, not null, default: `gen_random_uuid()`]
account_id uuid [not null]
user_id text [not null]
workspace_id text
device_id uuid
limit_type text [not null]
scope_key text [not null, default: '']
resets_at "timestamp with time zone"
utilization integer [not null]
severity text
is_active boolean
captured_at "timestamp with time zone" [not null, default: `now()`]
raw jsonb
created_at "timestamp with time zone" [not null, default: `now()`]
indexes {
(account_id, limit_type, scope_key, captured_at) [name: 'agent_quota_snapshots_account_type_scope_idx']
(account_id, captured_at) [name: 'agent_quota_snapshots_account_captured_idx']
resets_at [name: 'agent_quota_snapshots_resets_at_idx']
workspace_id [name: 'agent_quota_snapshots_workspace_id_idx']
}
}
table agent_quota_usage_ledger {
id uuid [pk, not null, default: `gen_random_uuid()`]
account_id uuid
user_id text [not null]
workspace_id text
provider text [not null]
model text
occurred_at "timestamp with time zone" [not null]
input_tokens integer
output_tokens integer
cache_read_tokens integer
cache_write_tokens integer
reasoning_tokens integer
cost_usd "numeric(20, 6)"
cost_source text
message_id text
operation_id text
topic_id text
agent_id text
external_event_id text
metadata jsonb
created_at "timestamp with time zone" [not null, default: `now()`]
indexes {
(account_id, occurred_at) [name: 'agent_quota_usage_ledger_account_occurred_idx']
(account_id, model, occurred_at) [name: 'agent_quota_usage_ledger_account_model_occurred_idx']
message_id [name: 'agent_quota_usage_ledger_message_id_idx']
operation_id [name: 'agent_quota_usage_ledger_operation_id_idx']
workspace_id [name: 'agent_quota_usage_ledger_workspace_id_idx']
external_event_id [name: 'agent_quota_usage_ledger_external_event_unique', unique]
}
}
table agent_quota_windows {
id uuid [pk, not null, default: `gen_random_uuid()`]
account_id uuid [not null]
user_id text [not null]
workspace_id text
limit_type text [not null]
scope_key text [not null, default: '']
resets_at "timestamp with time zone" [not null]
window_start_at "timestamp with time zone" [not null]
window_seconds integer [not null]
peak_utilization integer [not null, default: 0]
last_utilization integer
rate_limited_at "timestamp with time zone"
observed_cost_usd "numeric(20, 6)"
observed_tokens bigint
estimated_capacity_usd "numeric(20, 6)"
contaminated boolean [not null, default: false]
first_seen_at "timestamp with time zone"
last_seen_at "timestamp with time zone"
accessed_at "timestamp with time zone" [not null, default: `now()`]
created_at "timestamp with time zone" [not null, default: `now()`]
updated_at "timestamp with time zone" [not null, default: `now()`]
indexes {
(account_id, limit_type, scope_key, resets_at) [name: 'agent_quota_windows_natural_key_unique', unique]
(account_id, resets_at) [name: 'agent_quota_windows_account_resets_idx']
user_id [name: 'agent_quota_windows_user_id_idx']
workspace_id [name: 'agent_quota_windows_workspace_id_idx']
}
}
table agent_shares {
id uuid [pk, not null, default: `gen_random_uuid()`]
agent_id text [not null]
visibility text [not null, default: 'private']
share_config jsonb
user_view_count integer [not null, default: 0]
accessed_at "timestamp with time zone" [not null, default: `now()`]
created_at "timestamp with time zone" [not null, default: `now()`]
updated_at "timestamp with time zone" [not null, default: `now()`]
indexes {
agent_id [name: 'agent_shares_agent_id_unique', unique]
visibility [name: 'agent_shares_visibility_idx']
}
}
table agent_skills {
id text [pk, not null]
name text [not null]
description text [not null]
identifier text [not null]
source text [not null]
manifest jsonb [not null, default: `{}`]
content text
editor_data jsonb
resources jsonb [default: `{}`]
zip_file_hash varchar(64)
user_id text [not null]
workspace_id text
deleted_at "timestamp with time zone"
is_deleted boolean
accessed_at "timestamp with time zone" [not null, default: `now()`]
created_at "timestamp with time zone" [not null, default: `now()`]
updated_at "timestamp with time zone" [not null, default: `now()`]
indexes {
(user_id, name) [name: 'agent_skills_user_name_idx', unique]
identifier [name: 'agent_skills_identifier_idx']
user_id [name: 'agent_skills_user_id_idx']
source [name: 'agent_skills_source_idx']
zip_file_hash [name: 'agent_skills_zip_hash_idx']
workspace_id [name: 'agent_skills_workspace_id_idx']
(workspace_id, name) [name: 'agent_skills_name_workspace_id_unique', unique]
}
}
table ai_models {
id varchar(150) [not null]
"_id" uuid [pk, not null, default: `gen_random_uuid()`]
display_name varchar(200)
description text
organization varchar(100)
enabled boolean
provider_id varchar(64) [not null]
type varchar(20) [not null, default: 'chat']
sort integer
user_id text [not null]
pricing jsonb
parameters jsonb [default: `{}`]
config jsonb
abilities jsonb [default: `{}`]
context_window_tokens integer
source varchar(20)
released_at varchar(10)
settings jsonb [default: `{}`]
workspace_id text
accessed_at "timestamp with time zone" [not null, default: `now()`]
created_at "timestamp with time zone" [not null, default: `now()`]
updated_at "timestamp with time zone" [not null, default: `now()`]
indexes {
(id, provider_id, user_id) [name: 'ai_models_id_provider_id_user_id_unique', unique]
(id, provider_id, user_id, workspace_id) [name: 'ai_models_id_provider_id_user_id_workspace_id_unique', unique]
user_id [name: 'ai_models_user_id_idx']
workspace_id [name: 'ai_models_workspace_id_idx']
}
}
table ai_providers {
id varchar(64) [not null]
name text
"_id" uuid [pk, not null, default: `gen_random_uuid()`]
user_id text [not null]
sort integer
enabled boolean
fetch_on_client boolean
check_model text
logo text
description text
key_vaults text
source varchar(20)
settings jsonb
config jsonb
workspace_id text
accessed_at "timestamp with time zone" [not null, default: `now()`]
created_at "timestamp with time zone" [not null, default: `now()`]
updated_at "timestamp with time zone" [not null, default: `now()`]
indexes {
(id, user_id) [name: 'ai_providers_id_user_id_unique', unique]
(id, user_id, workspace_id) [name: 'ai_providers_id_user_id_workspace_id_unique', unique]
user_id [name: 'ai_providers_user_id_idx']
workspace_id [name: 'ai_providers_workspace_id_idx']
}
}
table api_keys {
id text [pk, not null]
name varchar(256) [not null]
key varchar(256) [not null, unique]
key_hash varchar(128) [unique]
enabled boolean [default: true]
scopes jsonb
expires_at "timestamp with time zone"
last_used_at "timestamp with time zone"
user_id text [not null]
workspace_id text
accessed_at "timestamp with time zone" [not null, default: `now()`]
created_at "timestamp with time zone" [not null, default: `now()`]
updated_at "timestamp with time zone" [not null, default: `now()`]
indexes {
user_id [name: 'api_keys_user_id_idx']
workspace_id [name: 'api_keys_workspace_id_idx']
}
}
table async_tasks {
id uuid [pk, not null, default: `gen_random_uuid()`]
type text
status text
error jsonb
inference_id text
user_id text [not null]
workspace_id text
duration integer
parent_id uuid
metadata jsonb [not null, default: '{}']
accessed_at "timestamp with time zone" [not null, default: `now()`]
created_at "timestamp with time zone" [not null, default: `now()`]
updated_at "timestamp with time zone" [not null, default: `now()`]
indexes {
user_id [name: 'async_tasks_user_id_idx']
parent_id [name: 'async_tasks_parent_id_idx']
(type, status) [name: 'async_tasks_type_status_idx']
inference_id [name: 'async_tasks_inference_id_idx']
metadata [name: 'async_tasks_metadata_idx']
workspace_id [name: 'async_tasks_workspace_id_idx']
}
}
table accounts {
access_token text
access_token_expires_at timestamp
account_id text [not null]
created_at timestamp [not null, default: `now()`]
id text [pk, not null]
id_token text
password text
provider_id text [not null]
refresh_token text
refresh_token_expires_at timestamp
scope text
updated_at timestamp [not null]
user_id text [not null]
indexes {
user_id [name: 'account_userId_idx']
}
}
table passkey {
aaguid text
backedUp boolean
counter integer
createdAt timestamp [default: `now()`]
credentialID text [not null]
deviceType text
id text [pk, not null]
name text
publicKey text [not null]
transports text
userId text [not null]
indexes {
credentialID [name: 'passkey_credential_id_unique', unique]
userId [name: 'passkey_user_id_idx']
}
}
table auth_sessions {
created_at timestamp [not null, default: `now()`]
expires_at timestamp [not null]
id text [pk, not null]
impersonated_by text
ip_address text
token text [not null, unique]
updated_at timestamp [not null]
user_agent text
user_id text [not null]
indexes {
user_id [name: 'auth_session_userId_idx']
}
}
table two_factor {
backup_codes text [not null]
id text [pk, not null]
secret text [not null]
user_id text [not null]
indexes {
secret [name: 'two_factor_secret_idx']
user_id [name: 'two_factor_user_id_idx']
}
}
table verifications {
created_at timestamp [not null, default: `now()`]
expires_at timestamp [not null]
id text [pk, not null]
identifier text [not null]
updated_at timestamp [not null, default: `now()`]
value text [not null]
indexes {
identifier [name: 'verification_identifier_idx']
}
}
table chat_groups {
id text [pk, not null]
title text
description text
avatar text
background_color text
market_identifier text
content text
editor_data jsonb
config jsonb
client_id text
user_id text [not null]
workspace_id text
group_id text
pinned boolean [default: false]
visibility text [not null, default: 'public']
deleted_at "timestamp with time zone"
is_deleted boolean
accessed_at "timestamp with time zone" [not null, default: `now()`]
created_at "timestamp with time zone" [not null, default: `now()`]
updated_at "timestamp with time zone" [not null, default: `now()`]
indexes {
(client_id, user_id) [name: 'chat_groups_client_id_user_id_unique', unique]
user_id [name: 'chat_groups_user_id_idx']
group_id [name: 'chat_groups_group_id_idx']
workspace_id [name: 'chat_groups_workspace_id_idx']
(workspace_id, visibility, user_id) [name: 'chat_groups_workspace_visibility_idx']
}
}
table chat_groups_agents {
chat_group_id text [not null]
agent_id text [not null]
user_id text [not null]
workspace_id text
enabled boolean [default: true]
order integer [default: 0]
role text [default: 'participant']
accessed_at "timestamp with time zone" [not null, default: `now()`]
created_at "timestamp with time zone" [not null, default: `now()`]
updated_at "timestamp with time zone" [not null, default: `now()`]
indexes {
(chat_group_id, agent_id) [pk]
user_id [name: 'chat_groups_agents_user_id_idx']
workspace_id [name: 'chat_groups_agents_workspace_id_idx']
}
}
table user_connector_tools {
id uuid [pk, not null, default: `gen_random_uuid()`]
user_connector_id uuid [not null]
user_id text [not null]
workspace_id text
tool_name varchar(255) [not null]
display_name varchar(255)
description text
input_schema jsonb
output_schema jsonb
crud_type text [not null]
render_config jsonb
permission text [not null]
is_work_artifact boolean [not null, default: false]
work_artifact_config jsonb
limit_config jsonb
metadata jsonb
accessed_at "timestamp with time zone" [not null, default: `now()`]
created_at "timestamp with time zone" [not null, default: `now()`]
updated_at "timestamp with time zone" [not null, default: `now()`]
indexes {
(user_connector_id, tool_name) [name: 'user_connector_tools_connector_tool_unique', unique]
user_id [name: 'user_connector_tools_user_id_idx']
user_connector_id [name: 'user_connector_tools_connector_id_idx']
workspace_id [name: 'user_connector_tools_workspace_id_idx']
}
}
table user_connectors {
id uuid [pk, not null, default: `gen_random_uuid()`]
user_id text [not null]
workspace_id text
agent_id text
identifier varchar(255) [not null]
name varchar(255) [not null]
source_type text [not null]
mcp_server_url text
mcp_connection_type text
mcp_stdio_config jsonb
status text [not null]
is_enabled boolean [not null, default: true]
oidc_config jsonb
credentials text
token_expires_at "timestamp with time zone"
metadata jsonb
accessed_at "timestamp with time zone" [not null, default: `now()`]
created_at "timestamp with time zone" [not null, default: `now()`]
updated_at "timestamp with time zone" [not null, default: `now()`]
indexes {
(user_id, identifier) [name: 'user_connectors_personal_identifier_idx']
(user_id, workspace_id, identifier) [name: 'user_connectors_workspace_identifier_idx']
(agent_id, identifier) [name: 'user_connectors_agent_identifier_idx']
user_id [name: 'user_connectors_user_id_idx']
token_expires_at [name: 'user_connectors_token_expires_at_idx']
workspace_id [name: 'user_connectors_workspace_id_idx']
agent_id [name: 'user_connectors_agent_id_idx']
}
}
table user_installed_plugins {
user_id text [not null]
workspace_id text
identifier text [not null]
type text [not null]
manifest jsonb
settings jsonb
custom_params jsonb
source varchar(255)
accessed_at "timestamp with time zone" [not null, default: `now()`]
created_at "timestamp with time zone" [not null, default: `now()`]
updated_at "timestamp with time zone" [not null, default: `now()`]
indexes {
(user_id, identifier) [pk]
workspace_id [name: 'user_installed_plugins_workspace_id_idx']
}
}
table devices {
id uuid [pk, not null, default: `gen_random_uuid()`]
user_id text [not null]
workspace_id text
visibility text [not null, default: 'private']
shared_from_device_id varchar(64)
device_id varchar(64) [not null]
identity_source varchar(20) [not null]
hostname text
platform varchar(20)
friendly_name text
default_cwd text
recent_cwds text[] [not null, default: `[]`]
working_dirs jsonb [default: `[]`]
first_seen_at "timestamp with time zone" [not null, default: `now()`]
last_seen_at "timestamp with time zone" [not null, default: `now()`]
accessed_at "timestamp with time zone" [not null, default: `now()`]
created_at "timestamp with time zone" [not null, default: `now()`]
updated_at "timestamp with time zone" [not null, default: `now()`]
indexes {
(user_id, device_id) [name: 'devices_user_id_device_id_unique', unique]
(workspace_id, device_id) [name: 'devices_workspace_id_device_id_unique', unique]
user_id [name: 'devices_user_id_idx']
workspace_id [name: 'devices_workspace_id_idx']
(workspace_id, visibility, user_id) [name: 'devices_workspace_visibility_idx']
}
}
table document_comment_mentions {
id uuid [pk, not null, default: `gen_random_uuid()`]
comment_id uuid [not null]
mentioned_user_id text [not null]
workspace_id text [not null]
created_at "timestamp with time zone" [not null, default: `now()`]
indexes {
(comment_id, mentioned_user_id) [name: 'document_comment_mentions_comment_id_mentioned_user_id_unique', unique]
(mentioned_user_id, created_at) [name: 'document_comment_mentions_mentioned_user_id_created_at_idx']
workspace_id [name: 'document_comment_mentions_workspace_id_idx']
}
}
table document_comments {
id uuid [pk, not null, default: `gen_random_uuid()`]
document_id text [not null]
parent_comment_id uuid
reply_to_comment_id uuid
author_user_id text
workspace_id text [not null]
content text [not null]
editor_data jsonb
selection_anchor jsonb
client_id text [not null]
deleted_at "timestamp with time zone"
created_at "timestamp with time zone" [not null, default: `now()`]
updated_at "timestamp with time zone" [not null, default: `now()`]
indexes {
(document_id, author_user_id, client_id) [name: 'document_comments_document_id_author_user_id_client_id_unique', unique]
(parent_comment_id, created_at, id) [name: 'document_comments_parent_comment_id_created_at_id_idx']
reply_to_comment_id [name: 'document_comments_reply_to_comment_id_idx']
(document_id, created_at, id) [name: 'document_comments_document_id_created_at_id_idx']
author_user_id [name: 'document_comments_author_user_id_idx']
workspace_id [name: 'document_comments_workspace_id_idx']
}
}
table document_histories {
id varchar(255) [pk, not null]
document_id varchar(255) [not null]
user_id text [not null]
workspace_id text
editor_data jsonb [not null]
save_source text [not null]
saved_at "timestamp with time zone" [not null]
indexes {
document_id [name: 'document_histories_document_id_idx']
user_id [name: 'document_histories_user_id_idx']
workspace_id [name: 'document_histories_workspace_id_idx']
saved_at [name: 'document_histories_saved_at_idx']
}
}
table document_likes {
id uuid [pk, not null, default: `gen_random_uuid()`]
document_id text [not null]
user_id text [not null]
workspace_id text [not null]
created_at "timestamp with time zone" [not null, default: `now()`]
indexes {
(document_id, user_id) [name: 'document_likes_document_id_user_id_unique', unique]
(document_id, created_at) [name: 'document_likes_document_id_created_at_idx']
user_id [name: 'document_likes_user_id_idx']
workspace_id [name: 'document_likes_workspace_id_idx']
}
}
table document_shares {
id uuid [pk, not null, default: `gen_random_uuid()`]
document_id varchar(255) [not null]
user_id text [not null]
workspace_id text
visibility text [not null, default: 'private']
permission text [not null, default: 'read']
page_view_count integer [not null, default: 0]
accessed_at "timestamp with time zone" [not null, default: `now()`]
created_at "timestamp with time zone" [not null, default: `now()`]
updated_at "timestamp with time zone" [not null, default: `now()`]
indexes {
document_id [name: 'document_shares_document_id_unique', unique]
user_id [name: 'document_shares_user_id_idx']
workspace_id [name: 'document_shares_workspace_id_idx']
}
}
table environments {
id uuid [pk, not null, default: `gen_random_uuid()`]
user_id text [not null]
workspace_id text
name varchar(255) [not null]
description text
enabled boolean [not null, default: true]
configuration jsonb [not null]
accessed_at "timestamp with time zone" [not null, default: `now()`]
created_at "timestamp with time zone" [not null, default: `now()`]
updated_at "timestamp with time zone" [not null, default: `now()`]
indexes {
user_id [name: 'environments_user_id_idx']
workspace_id [name: 'environments_workspace_id_idx']
}
}
table environment_instances {
id uuid [pk, not null, default: `gen_random_uuid()`]
environment_id uuid [not null]
name varchar(255) [not null]
kind text [not null]
device_id uuid
provider text
provider_scope text
provider_resource_id text
working_directory text [not null]
configuration_snapshot jsonb [not null]
configuration jsonb
enabled boolean [not null, default: true]
status text [not null, default: 'pending']
accessed_at "timestamp with time zone" [not null, default: `now()`]
created_at "timestamp with time zone" [not null, default: `now()`]
updated_at "timestamp with time zone" [not null, default: `now()`]
indexes {
(environment_id, id) [name: 'environment_instances_environment_id_id_unique', unique]
(device_id, working_directory) [name: 'environment_instances_device_path_unique', unique]
(kind, provider, provider_scope, provider_resource_id, working_directory) [name: 'environment_instances_provider_path_unique', unique]
environment_id [name: 'environment_instances_environment_id_idx']
}
}
table expertise_bindings {
id uuid [pk, not null, default: `gen_random_uuid()`]
domain_id varchar(255) [not null]
agent_id text
project_id text
bound_workspace_id text
bound_user_id text
contribution_mode text [not null, default: 'derive']
added_by_user_id text
workspace_id text
enabled boolean [not null, default: true]
sort_order integer [not null, default: 0]
accessed_at "timestamp with time zone" [not null, default: `now()`]
created_at "timestamp with time zone" [not null, default: `now()`]
updated_at "timestamp with time zone" [not null, default: `now()`]
indexes {
(agent_id, domain_id) [name: 'expertise_bindings_agent_domain_unique', unique]
(project_id, domain_id) [name: 'expertise_bindings_project_domain_unique', unique]
(bound_workspace_id, domain_id) [name: 'expertise_bindings_workspace_domain_unique', unique]
(bound_user_id, domain_id) [name: 'expertise_bindings_user_domain_unique', unique]
domain_id [name: 'expertise_bindings_domain_idx']
workspace_id [name: 'expertise_bindings_workspace_id_idx']
}
}
table expertise_domain_snapshots {
id uuid [pk, not null, default: `gen_random_uuid()`]
domain_id varchar(255) [not null]
run_id uuid
run_index integer [not null]
learned_total integer [not null]
retired_total integer [not null, default: 0]
active_count integer [not null]
compiled_count integer [not null, default: 0]
layer_counts jsonb [not null, default: `{}`]
p_inf numeric
tau numeric
maturity numeric
fit_sample_size integer
fit_r2 numeric
fit_confidence text
fit_computed_at "timestamp with time zone"
tau_pinned boolean [not null, default: false]
observed_span numeric
plateau_kind text
layer_coverage numeric
canon_coverage numeric
active_rate numeric
captured_at "timestamp with time zone" [not null, default: `now()`]
indexes {
(domain_id, run_index) [name: 'expertise_domain_snapshots_domain_run_index_unique', unique]
(domain_id, captured_at) [name: 'expertise_domain_snapshots_domain_captured_idx']
domain_id [name: 'expertise_domain_snapshots_pending_fit_idx']
}
}
table expertise_domains {
id varchar(255) [pk, not null]
slug varchar(255) [not null]
title text [not null]
description text
user_id text [not null]
workspace_id text
visibility text [not null, default: 'private']
source text [not null, default: 'user']
parent_domain_id varchar(255)
domain_filter text [not null]
out_of_scope text
layers jsonb [not null, default: `[]`]
layer_source text [not null, default: 'invented']
canon_entries jsonb [not null, default: `[]`]
canon_document_id varchar(255)
flow jsonb [not null, default: `[]`]
evidence_spec jsonb [not null, default: `[]`]
lesson_base_document_id varchar(255)
anchor_candidates jsonb
anchor_chosen_at "timestamp with time zone"
anchor_chosen_by_user_id text
seed_state text [not null, default: 'seeding']
seed_run_id uuid
accessed_at "timestamp with time zone" [not null, default: `now()`]
created_at "timestamp with time zone" [not null, default: `now()`]
updated_at "timestamp with time zone" [not null, default: `now()`]
indexes {
(slug, user_id) [name: 'expertise_domains_slug_user_unique', unique]
(workspace_id, slug) [name: 'expertise_domains_slug_workspace_unique', unique]
user_id [name: 'expertise_domains_user_id_idx']
(workspace_id, visibility) [name: 'expertise_domains_workspace_visibility_idx']
parent_domain_id [name: 'expertise_domains_parent_idx']
}
}
table expertise_hits {
id uuid [pk, not null, default: `gen_random_uuid()`]
run_id uuid [not null]
lesson_id uuid [not null]
domain_id varchar(255) [not null]
outcome text [not null]
where text
note text
example text
severity text
evidence_id uuid
operation_id text
source_check_result_id uuid
user_decision text
user_decision_at "timestamp with time zone"
created_at "timestamp with time zone" [not null, default: `now()`]
indexes {
(lesson_id, created_at) [name: 'expertise_hits_lesson_created_idx']
run_id [name: 'expertise_hits_run_idx']
(domain_id, outcome) [name: 'expertise_hits_domain_outcome_idx']
operation_id [name: 'expertise_hits_operation_idx']
}
}
table expertise_insights {
id uuid [pk, not null, default: `gen_random_uuid()`]
domain_id varchar(255)
user_id text
workspace_id text
kind varchar(255) [not null]
headline text [not null]
body text [not null]
action_label text
action_target jsonb
evidence jsonb [not null, default: `[]`]
confidence real
status text [not null, default: 'active']
dismiss_reason text
stale_after_run_index integer
generated_by_operation_id text
created_at "timestamp with time zone" [not null, default: `now()`]
updated_at "timestamp with time zone" [not null, default: `now()`]
indexes {
(domain_id, status) [name: 'expertise_insights_domain_status_idx']
(user_id, status) [name: 'expertise_insights_user_status_idx']
workspace_id [name: 'expertise_insights_workspace_idx']
}
}
table expertise_lesson_revisions {
id uuid [pk, not null, default: `gen_random_uuid()`]
lesson_id uuid [not null]
revision integer [not null]
sections jsonb [not null]
feedback text
changed_by text [not null]
kind text [not null, default: 'user-feedback']
prev_title text
evidence jsonb
changed_by_user_id text
source_run_id uuid
operation_id text
created_at "timestamp with time zone" [not null, default: `now()`]
indexes {
(lesson_id, revision) [name: 'expertise_lesson_revisions_lesson_revision_unique', unique]
lesson_id [name: 'expertise_lesson_revisions_lesson_idx']
}
}
table expertise_lessons {
id uuid [pk, not null, default: `gen_random_uuid()`]
domain_id varchar(255) [not null]
created_by_user_id text
code varchar(20) [not null]
polarity text [not null]
title text [not null]
sections jsonb [not null]
layer varchar(255)
tags text[]
reason_kind text
reason_source text
canon_anchor text
origin_run_id uuid
origin_hit_id uuid
status text [not null, default: 'active']
rejected_reason text
salvaged_from_id uuid
retired_at "timestamp with time zone"
compilability text [not null, default: 'compilable']
backtest jsonb
compiled_criterion_id uuid
hit_count integer [not null, default: 0]
hit_run_count integer [not null, default: 0]
false_positive_count integer [not null, default: 0]
last_hit_at "timestamp with time zone"
last_hit_run_id uuid
generalized_from_ids jsonb
specificity text
example_count integer [not null, default: 0]
current_revision integer [not null, default: 1]
accessed_at "timestamp with time zone" [not null, default: `now()`]
created_at "timestamp with time zone" [not null, default: `now()`]
updated_at "timestamp with time zone" [not null, default: `now()`]
indexes {
(domain_id, code) [name: 'expertise_lessons_domain_code_unique', unique]
(id, domain_id) [name: 'expertise_lessons_id_domain_unique', unique]
(domain_id, status, hit_count) [name: 'expertise_lessons_domain_status_hits_idx']
(domain_id, layer) [name: 'expertise_lessons_domain_layer_idx']
compiled_criterion_id [name: 'expertise_lessons_compiled_criterion_idx']
}
}
table expertise_runs {
id uuid [pk, not null, default: `gen_random_uuid()`]
domain_id varchar(255) [not null]
run_index integer [not null]
is_seed_run boolean [not null, default: false]
actor_type text [not null]
actor_id text [not null]
subject_type text [not null]
subject_id text [not null]
window_start "timestamp with time zone"
window_end "timestamp with time zone"
reflection_key varchar(255)
had_human_in_loop boolean [not null, default: false]
user_id text
workspace_id text
instance_count integer [not null, default: 0]
refine_count integer [not null, default: 0]
new_count integer [not null, default: 0]
started_at "timestamp with time zone" [not null, default: `now()`]
completed_at "timestamp with time zone"
accessed_at "timestamp with time zone" [not null, default: `now()`]
created_at "timestamp with time zone" [not null, default: `now()`]
updated_at "timestamp with time zone" [not null, default: `now()`]
indexes {
(domain_id, run_index) [name: 'expertise_runs_domain_run_index_unique', unique]
(id, domain_id) [name: 'expertise_runs_id_domain_unique', unique]
(domain_id, reflection_key) [name: 'expertise_runs_domain_reflection_key_unique', unique]
(domain_id, started_at) [name: 'expertise_runs_domain_started_idx']
(actor_type, actor_id) [name: 'expertise_runs_actor_idx']
(subject_type, subject_id) [name: 'expertise_runs_subject_idx']
}
}
table documents {
id varchar(255) [pk, not null]
title text
description text
content text
file_type varchar(255) [not null]
filename text
total_char_count integer [not null]
total_line_count integer [not null]
metadata jsonb
pages jsonb
source_type text [not null]
source text [not null]
file_id text
knowledge_base_id text
parent_id varchar(255)
user_id text [not null]
client_id text
editor_data jsonb
slug varchar(255)
workspace_id text
visibility text [not null, default: 'public']
deleted_at "timestamp with time zone"
is_deleted boolean
accessed_at "timestamp with time zone" [not null, default: `now()`]
created_at "timestamp with time zone" [not null, default: `now()`]
updated_at "timestamp with time zone" [not null, default: `now()`]
indexes {
source [name: 'documents_source_idx']
file_type [name: 'documents_file_type_idx']
source_type [name: 'documents_source_type_idx']
user_id [name: 'documents_user_id_idx']
file_id [name: 'documents_file_id_idx']
parent_id [name: 'documents_parent_id_idx']
knowledge_base_id [name: 'documents_knowledge_base_id_idx']
(client_id, user_id) [name: 'documents_client_id_user_id_unique', unique]
(slug, user_id) [name: 'documents_slug_user_id_unique', unique]
workspace_id [name: 'documents_workspace_id_idx']
(workspace_id, visibility, user_id) [name: 'documents_workspace_visibility_idx']
(workspace_id, slug) [name: 'documents_slug_workspace_id_unique', unique]
}
}
table file_uploads {
id uuid [pk, not null, default: `gen_random_uuid()`]
user_id text [not null]
workspace_id text
pathname text [not null]
size integer [not null]
status text [not null, default: 'active']
multipart_upload_id text
multipart_part_size integer
completed_at "timestamp with time zone"
file_id text
expires_at "timestamp with time zone" [not null]
created_at "timestamp with time zone" [not null, default: `now()`]
updated_at "timestamp with time zone" [not null, default: `now()`]
indexes {
(user_id, workspace_id, status) [name: 'file_uploads_user_scope_status_idx']
(workspace_id, status) [name: 'file_uploads_workspace_status_idx']
(status, expires_at) [name: 'file_uploads_status_expires_at_idx']
(status, updated_at, id) [name: 'file_uploads_status_updated_at_id_idx']
pathname [name: 'file_uploads_live_pathname_unique', unique]
}
}
table files {
id text [pk, not null]
user_id text [not null]
file_type varchar(255) [not null]
file_hash varchar(64)
name text [not null]
size integer [not null]
url text [not null]
source text
parent_id varchar(255)
client_id text
metadata jsonb
chunk_task_id uuid
embedding_task_id uuid
workspace_id text
visibility text [not null, default: 'public']
deleted_at "timestamp with time zone"
is_deleted boolean
accessed_at "timestamp with time zone" [not null, default: `now()`]
created_at "timestamp with time zone" [not null, default: `now()`]
updated_at "timestamp with time zone" [not null, default: `now()`]
indexes {
file_hash [name: 'file_hash_idx']
user_id [name: 'files_user_id_idx']
parent_id [name: 'files_parent_id_idx']
chunk_task_id [name: 'files_chunk_task_id_idx']
embedding_task_id [name: 'files_embedding_task_id_idx']
(client_id, user_id) [name: 'files_client_id_user_id_unique', unique]
workspace_id [name: 'files_workspace_id_idx']
(workspace_id, visibility, user_id) [name: 'files_workspace_visibility_idx']
}
}
table global_files {
hash_id varchar(64) [pk, not null]
file_type varchar(255) [not null]
size integer [not null]
url text [not null]
metadata jsonb
creator text [not null]
created_at "timestamp with time zone" [not null, default: `now()`]
accessed_at "timestamp with time zone" [not null, default: `now()`]
indexes {
creator [name: 'global_files_creator_idx']
}
}
table knowledge_base_files {
knowledge_base_id text [not null]
file_id text [not null]
user_id text [not null]
workspace_id text
created_at "timestamp with time zone" [not null, default: `now()`]
indexes {
(knowledge_base_id, file_id) [pk]
knowledge_base_id [name: 'knowledge_base_files_kb_id_idx']
user_id [name: 'knowledge_base_files_user_id_idx']
file_id [name: 'knowledge_base_files_file_id_idx']
workspace_id [name: 'knowledge_base_files_workspace_id_idx']
}
}
table knowledge_bases {
id text [pk, not null]
name text [not null]
description text
avatar text
type text
user_id text [not null]
client_id text
is_public boolean [default: false]
settings jsonb
workspace_id text
visibility text [not null, default: 'public']
deleted_at "timestamp with time zone"
is_deleted boolean
accessed_at "timestamp with time zone" [not null, default: `now()`]
created_at "timestamp with time zone" [not null, default: `now()`]
updated_at "timestamp with time zone" [not null, default: `now()`]
indexes {
(client_id, user_id) [name: 'knowledge_bases_client_id_user_id_unique', unique]
user_id [name: 'knowledge_bases_user_id_idx']
workspace_id [name: 'knowledge_bases_workspace_id_idx']
(workspace_id, visibility, user_id) [name: 'knowledge_bases_workspace_visibility_idx']
}
}
table fts_search_sync_capture_version {
id text [pk, not null]
version integer [not null]
}
table fts_search_sync_outbox {
attempts integer [not null, default: 0]
available_at "timestamp with time zone" [not null, default: `now()`]
created_at "timestamp with time zone" [not null, default: `now()`]
dead_at "timestamp with time zone"
document_id text [not null]
entity text [not null]
id uuid [pk, not null, default: `gen_random_uuid()`]
last_error text
locked_until "timestamp with time zone"
priority smallint [not null, default: 10]
revision bigint [not null, default: `nextval('fts_search_sync_revision_seq')`]
updated_at "timestamp with time zone" [not null, default: `now()`]
indexes {
(entity, document_id) [name: 'fts_search_sync_outbox_entity_document_id_unique', unique]
(priority, available_at, revision) [name: 'fts_search_sync_outbox_claim_idx']
dead_at [name: 'fts_search_sync_outbox_dead_idx']
locked_until [name: 'fts_search_sync_outbox_lease_idx']
}
}
table generation_batches {
id text [pk, not null]
user_id text [not null]
workspace_id text
generation_topic_id text [not null]
provider text [not null]
model text [not null]
prompt text [not null]
width integer
height integer
ratio varchar(64)
config jsonb
deleted_at "timestamp with time zone"
is_deleted boolean
accessed_at "timestamp with time zone" [not null, default: `now()`]
created_at "timestamp with time zone" [not null, default: `now()`]
updated_at "timestamp with time zone" [not null, default: `now()`]
indexes {
user_id [name: 'generation_batches_user_id_idx']
generation_topic_id [name: 'generation_batches_topic_id_idx']
workspace_id [name: 'generation_batches_workspace_id_idx']
}
}
table generation_topics {
id text [pk, not null]
user_id text [not null]
workspace_id text
title text
cover_url text
type varchar(32) [not null, default: 'image']
visibility text [not null, default: 'public']
deleted_at "timestamp with time zone"
is_deleted boolean
accessed_at "timestamp with time zone" [not null, default: `now()`]
created_at "timestamp with time zone" [not null, default: `now()`]
updated_at "timestamp with time zone" [not null, default: `now()`]
indexes {
user_id [name: 'generation_topics_user_id_idx']
workspace_id [name: 'generation_topics_workspace_id_idx']
(workspace_id, visibility, user_id) [name: 'generation_topics_workspace_visibility_idx']
}
}
table generations {
id text [pk, not null]
user_id text [not null]
workspace_id text
generation_batch_id varchar(64) [not null]
async_task_id uuid
file_id text
seed integer
asset jsonb
deleted_at "timestamp with time zone"
is_deleted boolean
accessed_at "timestamp with time zone" [not null, default: `now()`]
created_at "timestamp with time zone" [not null, default: `now()`]
updated_at "timestamp with time zone" [not null, default: `now()`]
indexes {
user_id [name: 'generations_user_id_idx']
generation_batch_id [name: 'generations_batch_id_idx']
file_id [name: 'generations_file_id_idx']
workspace_id [name: 'generations_workspace_id_idx']
}
}
table goals {
id text [pk, not null]
user_id text [not null]
workspace_id text
agent_id text
project_id text
title text [not null]
requirement text
config jsonb
max_rounds integer
max_total_cost "numeric(20, 6)"
status text [not null, default: 'planning']
subject_type text
subject_id text
started_at "timestamp with time zone"
completed_at "timestamp with time zone"
deleted_at "timestamp with time zone"
is_deleted boolean
created_at "timestamp with time zone" [not null, default: `now()`]
updated_at "timestamp with time zone" [not null, default: `now()`]
indexes {
user_id [name: 'goals_user_id_idx']
workspace_id [name: 'goals_workspace_id_idx']
agent_id [name: 'goals_agent_id_idx']
project_id [name: 'goals_project_id_idx']
status [name: 'goals_status_idx']
(subject_type, subject_id) [name: 'goals_subject_idx']
}
}
table goal_edges {
id uuid [pk, not null, default: `gen_random_uuid()`]
goal_id text [not null]
source_node_id uuid [not null]
target_node_id uuid [not null]
kind text [not null]
created_at "timestamp with time zone" [not null, default: `now()`]
indexes {
(source_node_id, target_node_id, kind) [name: 'goal_edges_source_target_kind_unique', unique]
goal_id [name: 'goal_edges_goal_id_idx']
target_node_id [name: 'goal_edges_target_node_id_idx']
}
}
table goal_events {
id uuid [pk, not null, default: `gen_random_uuid()`]
goal_id text [not null]
event_type text [not null]
entity_type text [not null]
entity_id text [not null]
actor_type text [not null]
actor_id text
task_id text
operation_id text
reason text
created_at "timestamp with time zone" [not null, default: `now()`]
indexes {
(goal_id, created_at) [name: 'goal_events_goal_id_created_at_idx']
(entity_type, entity_id) [name: 'goal_events_entity_idx']
task_id [name: 'goal_events_task_id_idx']
operation_id [name: 'goal_events_operation_id_idx']
}
}
table goal_node_decisions {
id uuid [pk, not null, default: `gen_random_uuid()`]
node_id uuid [not null]
authority text [not null]
status text [not null, default: 'pending']
question text [not null]
options jsonb
recommended_option_id text
requested_user_id text
requested_project_role text
resolved_option_id text
resolution text
resolved_by_user_id text
resolved_by_agent_id text
resolved_at "timestamp with time zone"
canceled_at "timestamp with time zone"
accessed_at "timestamp with time zone" [not null, default: `now()`]
created_at "timestamp with time zone" [not null, default: `now()`]
updated_at "timestamp with time zone" [not null, default: `now()`]
indexes {
node_id [name: 'goal_node_decisions_node_id_unique', unique]
status [name: 'goal_node_decisions_status_idx']
(requested_user_id, status) [name: 'goal_node_decisions_requested_user_id_status_idx']
}
}
table goal_node_work_versions {
id uuid [pk, not null, default: `gen_random_uuid()`]
node_id uuid [not null]
work_version_id uuid [not null]
relation text [not null]
created_at "timestamp with time zone" [not null, default: `now()`]
indexes {
(node_id, work_version_id, relation) [name: 'goal_node_work_versions_node_version_relation_unique', unique]
work_version_id [name: 'goal_node_work_versions_work_version_id_idx']
}
}
table goal_nodes {
id uuid [pk, not null, default: `gen_random_uuid()`]
goal_id text [not null]
kind text [not null]
status text [not null, default: 'proposed']
title text [not null]
description text
task_id text
priority integer [not null, default: 0]
confidence "numeric(4, 3)"
created_by_user_id text
created_by_agent_id text
resolved_at "timestamp with time zone"
accessed_at "timestamp with time zone" [not null, default: `now()`]
created_at "timestamp with time zone" [not null, default: `now()`]
updated_at "timestamp with time zone" [not null, default: `now()`]
indexes {
(goal_id, status) [name: 'goal_nodes_goal_id_status_idx']
(goal_id, kind) [name: 'goal_nodes_goal_id_kind_idx']
(goal_id, id) [name: 'goal_nodes_goal_id_id_unique', unique]
task_id [name: 'goal_nodes_task_id_unique', unique]
}
}
table goal_traces {
goal_id text [pk, not null]
trace_s3_key text
started_at "timestamp with time zone"
completed_at "timestamp with time zone"
final_status text
advances_total integer
ticks_total integer
advances_by_trigger jsonb
advances_by_outcome jsonb
ticks_by_branch jsonb
total_cost "numeric(20, 6)"
work_operations integer
nodes_total integer
work_resolved integer
work_retired integer
findings_total integer
gates_opened integer
gates_resolved integer
human_waiting_ms integer
created_at "timestamp with time zone" [not null, default: `now()`]
updated_at "timestamp with time zone" [not null, default: `now()`]
indexes {
started_at [name: 'goal_traces_started_at_idx']
final_status [name: 'goal_traces_final_status_idx']
}
}
table llm_generation_tracing {
id uuid [pk, not null, default: `gen_random_uuid()`]
scenario text [not null]
prompt_version text [not null]
prompt_hash text [not null]
schema_name text
user_id text [not null]
agent_id text
topic_id text
workspace_id text
trigger text
parent_tracing_id uuid
provider text
model text
success boolean [not null]
error_code text
error_detail text
validation_failed boolean [not null, default: false]
input_hash text
input_hint text
latency_ms integer
input_tokens integer
output_tokens integer
cost_usd "numeric(12, 8)"
storage_key text
feedback_signal text
feedback_score "numeric(3, 2)"
feedback_source text
feedback_data jsonb
feedback_updated_at "timestamp with time zone"
trace_id text
span_id text
metadata jsonb [default: `{}`]
created_at "timestamp with time zone" [not null, default: `now()`]
indexes {
scenario [name: 'llm_generation_tracing_scenario_idx']
prompt_version [name: 'llm_generation_tracing_prompt_version_idx']
user_id [name: 'llm_generation_tracing_user_id_idx']
agent_id [name: 'llm_generation_tracing_agent_id_idx']
topic_id [name: 'llm_generation_tracing_topic_id_idx']
workspace_id [name: 'llm_generation_tracing_workspace_id_idx']
provider [name: 'llm_generation_tracing_provider_idx']
model [name: 'llm_generation_tracing_model_idx']
success [name: 'llm_generation_tracing_success_idx']
error_code [name: 'llm_generation_tracing_error_code_idx']
validation_failed [name: 'llm_generation_tracing_validation_failed_idx']
feedback_signal [name: 'llm_generation_tracing_feedback_signal_idx']
created_at [name: 'llm_generation_tracing_created_at_idx']
}
}
table message_chunks {
message_id text
chunk_id uuid
user_id text [not null]
workspace_id text
indexes {
(chunk_id, message_id) [pk]
user_id [name: 'message_chunks_user_id_idx']
message_id [name: 'message_chunks_message_id_idx']
workspace_id [name: 'message_chunks_workspace_id_idx']
}
}
table message_groups {
id varchar(255) [pk, not null]
topic_id text
user_id text [not null]
workspace_id text
parent_group_id varchar(255)
parent_message_id text
title varchar(255)
description text
type text
content text
editor_data jsonb
metadata jsonb
client_id varchar(255)
accessed_at "timestamp with time zone" [not null, default: `now()`]
created_at "timestamp with time zone" [not null, default: `now()`]
updated_at "timestamp with time zone" [not null, default: `now()`]
indexes {
(client_id, user_id) [name: 'message_groups_client_id_user_id_unique', unique]
user_id [name: 'message_groups_user_id_idx']
topic_id [name: 'message_groups_topic_id_idx']
type [name: 'message_groups_type_idx']
parent_group_id [name: 'message_groups_parent_group_id_idx']
parent_message_id [name: 'message_groups_parent_message_id_idx']
workspace_id [name: 'message_groups_workspace_id_idx']
}
}
table message_plugins {
id text [pk, not null]
tool_call_id text
type text [default: 'default']
intervention jsonb
api_name text
arguments text
identifier text
state jsonb
error jsonb
client_id text
user_id text [not null]
workspace_id text
indexes {
(client_id, user_id) [name: 'message_plugins_client_id_user_id_unique', unique]
user_id [name: 'message_plugins_user_id_idx']
tool_call_id [name: 'message_plugins_tool_call_id_idx']
workspace_id [name: 'message_plugins_workspace_id_idx']
}
}
table message_queries {
id uuid [pk, not null, default: `gen_random_uuid()`]
message_id text [not null]
rewrite_query text
user_query text
client_id text
user_id text [not null]
workspace_id text
embeddings_id uuid
indexes {
(client_id, user_id) [name: 'message_queries_client_id_user_id_unique', unique]
user_id [name: 'message_queries_user_id_idx']
message_id [name: 'message_queries_message_id_idx']
embeddings_id [name: 'message_queries_embeddings_id_idx']
workspace_id [name: 'message_queries_workspace_id_idx']
}
}
table message_query_chunks {
id text
query_id uuid
chunk_id uuid
similarity "numeric(6, 5)"
user_id text [not null]
workspace_id text
indexes {
(chunk_id, id, query_id) [pk]
user_id [name: 'message_query_chunks_user_id_idx']
id [name: 'message_query_chunks_message_id_idx']
query_id [name: 'message_query_chunks_query_id_idx']
workspace_id [name: 'message_query_chunks_workspace_id_idx']
}
}
table message_tts {
id text [pk, not null]
content_md5 text
file_id text
voice text
client_id text
user_id text [not null]
workspace_id text
indexes {
(client_id, user_id) [name: 'message_tts_client_id_user_id_unique', unique]
user_id [name: 'message_tts_user_id_idx']
workspace_id [name: 'message_tts_workspace_id_idx']
}
}
table message_translates {
id text [pk, not null]
content text
from text
to text
client_id text
user_id text [not null]
workspace_id text
indexes {
(client_id, user_id) [name: 'message_translates_client_id_user_id_unique', unique]
user_id [name: 'message_translates_user_id_idx']
workspace_id [name: 'message_translates_workspace_id_idx']
}
}
table messages {
id text [pk, not null]
role varchar(255) [not null]
content text
editor_data jsonb
summary text
reasoning jsonb
search jsonb
metadata jsonb
usage jsonb
model text
provider text
favorite boolean [default: false]
error jsonb
tools jsonb
trace_id text
observation_id text
client_id text
user_id text [not null]
session_id text
topic_id text
thread_id text
parent_id text
quota_id text
agent_id text
group_id text
target_id text
message_group_id varchar(255)
workspace_id text
deleted_at "timestamp with time zone"
is_deleted boolean
accessed_at "timestamp with time zone" [not null, default: `now()`]
created_at "timestamp with time zone" [not null, default: `now()`]
updated_at "timestamp with time zone" [not null, default: `now()`]
indexes {
created_at [name: 'messages_created_at_idx']
(client_id, user_id) [name: 'message_client_id_user_unique', unique]
topic_id [name: 'messages_topic_id_idx']
(topic_id, updated_at) [name: 'messages_topic_id_updated_at_idx']
parent_id [name: 'messages_parent_id_idx']
quota_id [name: 'messages_quota_id_idx']
user_id [name: 'messages_user_id_idx']
session_id [name: 'messages_session_id_idx']
thread_id [name: 'messages_thread_id_idx']
agent_id [name: 'messages_agent_id_idx']
group_id [name: 'messages_group_id_idx']
message_group_id [name: 'messages_message_group_id_idx']
() [name: 'messages_usage_cost_idx']
() [name: 'messages_usage_total_tokens_idx']
workspace_id [name: 'messages_workspace_id_idx']
}
}
table messages_files {
file_id text [not null]
message_id text [not null]
user_id text [not null]
workspace_id text
indexes {
(file_id, message_id) [pk]
user_id [name: 'messages_files_user_id_idx']
message_id [name: 'messages_files_message_id_idx']
workspace_id [name: 'messages_files_workspace_id_idx']
}
}
table messenger_account_links {
id uuid [pk, not null, default: `gen_random_uuid()`]
user_id text [not null]
workspace_id text
platform varchar(50) [not null]
tenant_id varchar(255) [not null, default: '']
platform_user_id varchar(255) [not null]
platform_username text
application_id varchar(255)
credentials text
active_agent_id text
accessed_at "timestamp with time zone" [not null, default: `now()`]
created_at "timestamp with time zone" [not null, default: `now()`]
updated_at "timestamp with time zone" [not null, default: `now()`]
indexes {
(platform, tenant_id, platform_user_id) [name: 'messenger_account_links_platform_tenant_user_unique', unique]
(user_id, platform, tenant_id) [name: 'messenger_account_links_user_platform_tenant_unique', unique]
(platform, tenant_id, application_id) [name: 'messenger_account_links_platform_tenant_application_unique', unique]
active_agent_id [name: 'messenger_account_links_active_agent_idx']
workspace_id [name: 'messenger_account_links_workspace_id_idx']
}
}
table messenger_installations {
id uuid [pk, not null, default: `gen_random_uuid()`]
platform varchar(50) [not null]
tenant_id varchar(255) [not null]
application_id varchar(255) [not null]
account_id varchar(255)
credentials text [not null]
metadata jsonb [not null, default: `{}`]
token_expires_at "timestamp with time zone"
installed_by_user_id text
installed_by_platform_user_id varchar(255)
revoked_at "timestamp with time zone"
accessed_at "timestamp with time zone" [not null, default: `now()`]
created_at "timestamp with time zone" [not null, default: `now()`]
updated_at "timestamp with time zone" [not null, default: `now()`]
indexes {
(platform, application_id, tenant_id) [name: 'messenger_installations_platform_app_tenant_unique', unique]
(platform, tenant_id) [name: 'messenger_installations_platform_tenant_idx']
token_expires_at [name: 'messenger_installations_token_expires_at_idx']
}
}
table metric_points {
id uuid [pk, not null, default: `gen_random_uuid()`]
metric_id text [not null]
user_id text [not null]
workspace_id text
value "numeric(20, 6)" [not null]
observed_at "timestamp with time zone" [not null]
actor_type text [not null]
actor_id text
operation_id text
source_type text [not null]
metadata jsonb
created_at "timestamp with time zone" [not null, default: `now()`]
indexes {
(metric_id, observed_at) [name: 'metric_points_series_time_idx']
user_id [name: 'metric_points_user_id_idx']
workspace_id [name: 'metric_points_workspace_id_idx']
}
}
table metrics {
id text [pk, not null]
user_id text [not null]
workspace_id text
subject_type text [not null]
subject_id text [not null]
key text [not null]
title text
kind text [not null, default: 'gauge']
unit text
config jsonb
metadata jsonb
deleted_at "timestamp with time zone"
is_deleted boolean
created_at "timestamp with time zone" [not null, default: `now()`]
updated_at "timestamp with time zone" [not null, default: `now()`]
indexes {
(subject_type, subject_id, key) [name: 'metrics_subject_key_unique', unique]
user_id [name: 'metrics_user_id_idx']
workspace_id [name: 'metrics_workspace_id_idx']
}
}
table nextauth_accounts {
access_token text
expires_at integer
id_token text
provider text [not null]
providerAccountId text [not null]
refresh_token text
scope text
session_state text
token_type text
type text [not null]
user_id text [not null]
indexes {
(provider, providerAccountId) [pk]
user_id [name: 'nextauth_accounts_user_id_idx']
}
}
table nextauth_authenticators {
counter integer [not null]
credentialBackedUp boolean [not null]
credentialDeviceType text [not null]
credentialID text [not null, unique]
credentialPublicKey text [not null]
providerAccountId text [not null]
transports text
user_id text [not null]
indexes {
(user_id, credentialID) [pk]
}
}
table nextauth_sessions {
expires timestamp [not null]
sessionToken text [pk, not null]
user_id text [not null]
indexes {
user_id [name: 'nextauth_sessions_user_id_idx']
}
}
table nextauth_verificationtokens {
expires timestamp [not null]
identifier text [not null]
token text [not null]
indexes {
(identifier, token) [pk]
}
}
table notification_deliveries {
id uuid [pk, not null, default: `gen_random_uuid()`]
notification_id uuid [not null]
channel text [not null]
status text [not null]
provider_message_id text
failed_reason text
sent_at "timestamp with time zone"
created_at "timestamp with time zone" [not null, default: `now()`]
indexes {
notification_id [name: 'idx_deliveries_notification']
channel [name: 'idx_deliveries_channel']
status [name: 'idx_deliveries_status']
}
}
table notifications {
id uuid [pk, not null, default: `gen_random_uuid()`]
user_id text [not null]
workspace_id text
category text [not null]
type text [not null]
title text [not null]
content text [not null]
context text
metadata jsonb
dedupe_key text
action_url text
is_read boolean [not null, default: false]
is_archived boolean [not null, default: false]
created_at "timestamp with time zone" [not null, default: `now()`]
updated_at "timestamp with time zone" [not null, default: `now()`]
indexes {
user_id [name: 'idx_notifications_user']
(user_id, created_at) [name: 'idx_notifications_user_active']
user_id [name: 'idx_notifications_user_unread']
(user_id, dedupe_key) [name: 'idx_notifications_dedupe', unique]
(user_id, workspace_id) [name: 'idx_notifications_user_workspace']
workspace_id [name: 'idx_notifications_workspace_id']
(updated_at, created_at, id) [name: 'idx_notifications_archived_cleanup']
}
}
table oauth_handoffs {
id text [pk, not null]
client varchar(50) [not null]
payload jsonb [not null]
accessed_at "timestamp with time zone" [not null, default: `now()`]
created_at "timestamp with time zone" [not null, default: `now()`]
updated_at "timestamp with time zone" [not null, default: `now()`]
}
table oidc_access_tokens {
id varchar(255) [pk, not null]
data jsonb [not null]
expires_at "timestamp with time zone" [not null]
consumed_at "timestamp with time zone"
user_id text [not null]
client_id varchar(255) [not null]
grant_id varchar(255)
accessed_at "timestamp with time zone" [not null, default: `now()`]
created_at "timestamp with time zone" [not null, default: `now()`]
updated_at "timestamp with time zone" [not null, default: `now()`]
indexes {
user_id [name: 'oidc_access_tokens_user_id_idx']
}
}
table oidc_authorization_codes {
id varchar(255) [pk, not null]
data jsonb [not null]
expires_at "timestamp with time zone" [not null]
consumed_at "timestamp with time zone"
user_id text [not null]
client_id varchar(255) [not null]
grant_id varchar(255)
accessed_at "timestamp with time zone" [not null, default: `now()`]
created_at "timestamp with time zone" [not null, default: `now()`]
updated_at "timestamp with time zone" [not null, default: `now()`]
indexes {
user_id [name: 'oidc_authorization_codes_user_id_idx']
}
}
table oidc_clients {
id varchar(255) [pk, not null]
name text [not null]
description text
client_secret varchar(255)
redirect_uris text[] [not null]
grants text[] [not null]
response_types text[] [not null]
scopes text[] [not null]
token_endpoint_auth_method varchar(20)
application_type varchar(20)
client_uri text
logo_uri text
policy_uri text
tos_uri text
is_first_party boolean [default: false]
user_id text
workspace_id text
enabled boolean
last_used_at "timestamp with time zone"
accessed_at "timestamp with time zone" [not null, default: `now()`]
created_at "timestamp with time zone" [not null, default: `now()`]
updated_at "timestamp with time zone" [not null, default: `now()`]
indexes {
user_id [name: 'oidc_clients_user_id_idx']
workspace_id [name: 'oidc_clients_workspace_id_idx']
}
}
table oidc_consents {
user_id text [not null]
client_id varchar(255) [not null]
scopes text[] [not null]
expires_at "timestamp with time zone"
accessed_at "timestamp with time zone" [not null, default: `now()`]
created_at "timestamp with time zone" [not null, default: `now()`]
updated_at "timestamp with time zone" [not null, default: `now()`]
indexes {
(user_id, client_id) [pk]
}
}
table oidc_device_codes {
id varchar(255) [pk, not null]
data jsonb [not null]
expires_at "timestamp with time zone" [not null]
consumed_at "timestamp with time zone"
user_id text
client_id varchar(255) [not null]
grant_id varchar(255)
user_code varchar(255)
accessed_at "timestamp with time zone" [not null, default: `now()`]
created_at "timestamp with time zone" [not null, default: `now()`]
updated_at "timestamp with time zone" [not null, default: `now()`]
indexes {
user_id [name: 'oidc_device_codes_user_id_idx']
}
}
table oidc_grants {
id varchar(255) [pk, not null]
data jsonb [not null]
expires_at "timestamp with time zone" [not null]
consumed_at "timestamp with time zone"
user_id text [not null]
client_id varchar(255) [not null]
accessed_at "timestamp with time zone" [not null, default: `now()`]
created_at "timestamp with time zone" [not null, default: `now()`]
updated_at "timestamp with time zone" [not null, default: `now()`]
indexes {
user_id [name: 'oidc_grants_user_id_idx']
}
}
table oidc_interactions {
id varchar(255) [pk, not null]
data jsonb [not null]
expires_at "timestamp with time zone" [not null]
accessed_at "timestamp with time zone" [not null, default: `now()`]
created_at "timestamp with time zone" [not null, default: `now()`]
updated_at "timestamp with time zone" [not null, default: `now()`]
}
table oidc_refresh_tokens {
id varchar(255) [pk, not null]
data jsonb [not null]
expires_at "timestamp with time zone" [not null]
consumed_at "timestamp with time zone"
user_id text [not null]
client_id varchar(255) [not null]
grant_id varchar(255)
accessed_at "timestamp with time zone" [not null, default: `now()`]
created_at "timestamp with time zone" [not null, default: `now()`]
updated_at "timestamp with time zone" [not null, default: `now()`]
indexes {
user_id [name: 'oidc_refresh_tokens_user_id_idx']
}
}
table oidc_sessions {
id varchar(255) [pk, not null]
data jsonb [not null]
expires_at "timestamp with time zone" [not null]
user_id text [not null]
accessed_at "timestamp with time zone" [not null, default: `now()`]
created_at "timestamp with time zone" [not null, default: `now()`]
updated_at "timestamp with time zone" [not null, default: `now()`]
indexes {
user_id [name: 'oidc_sessions_user_id_idx']
}
}
table project_agents {
id uuid [pk, not null, default: `gen_random_uuid()`]
project_id text [not null]
agent_id text [not null]
added_by_user_id text
workspace_id text
role text
responsibility text
enabled boolean [not null, default: true]
sort_order integer [not null, default: 0]
accessed_at "timestamp with time zone" [not null, default: `now()`]
created_at "timestamp with time zone" [not null, default: `now()`]
updated_at "timestamp with time zone" [not null, default: `now()`]
indexes {
(project_id, agent_id) [name: 'project_agents_project_id_agent_id_unique', unique]
(project_id, sort_order) [name: 'project_agents_project_id_sort_order_idx']
agent_id [name: 'project_agents_agent_id_idx']
workspace_id [name: 'project_agents_workspace_id_idx']
}
}
table project_chat_groups {
id uuid [pk, not null, default: `gen_random_uuid()`]
project_id text [not null]
chat_group_id text [not null]
added_by_user_id text
workspace_id text
role text
responsibility text
enabled boolean [not null, default: true]
sort_order integer [not null, default: 0]
accessed_at "timestamp with time zone" [not null, default: `now()`]
created_at "timestamp with time zone" [not null, default: `now()`]
updated_at "timestamp with time zone" [not null, default: `now()`]
indexes {
(project_id, chat_group_id) [name: 'project_chat_groups_project_id_chat_group_id_unique', unique]
(project_id, sort_order) [name: 'project_chat_groups_project_id_sort_order_idx']
chat_group_id [name: 'project_chat_groups_chat_group_id_idx']
workspace_id [name: 'project_chat_groups_workspace_id_idx']
}
}
table project_completion_reviews {
id uuid [pk, not null, default: `gen_random_uuid()`]
project_id text [not null]
reviewer_user_id text
workspace_id text
round integer [not null]
decision text [not null]
comment text
accessed_at "timestamp with time zone" [not null, default: `now()`]
created_at "timestamp with time zone" [not null, default: `now()`]
updated_at "timestamp with time zone" [not null, default: `now()`]
indexes {
(project_id, round) [name: 'project_completion_reviews_project_id_round_unique', unique]
(project_id, created_at) [name: 'project_completion_reviews_project_id_created_at_idx']
reviewer_user_id [name: 'project_completion_reviews_reviewer_user_id_idx']
workspace_id [name: 'project_completion_reviews_workspace_id_idx']
}
}
table project_knowledge_bases {
id uuid [pk, not null, default: `gen_random_uuid()`]
project_id text [not null]
knowledge_base_id text [not null]
added_by_user_id text
workspace_id text
enabled boolean [not null, default: true]
sort_order integer [not null, default: 0]
accessed_at "timestamp with time zone" [not null, default: `now()`]
created_at "timestamp with time zone" [not null, default: `now()`]
updated_at "timestamp with time zone" [not null, default: `now()`]
indexes {
(project_id, knowledge_base_id) [name: 'project_knowledge_bases_project_id_knowledge_base_id_unique', unique]
(project_id, sort_order) [name: 'project_knowledge_bases_project_id_sort_order_idx']
knowledge_base_id [name: 'project_knowledge_bases_knowledge_base_id_idx']
workspace_id [name: 'project_knowledge_bases_workspace_id_idx']
}
}
table project_working_directories {
id uuid [pk, not null, default: `gen_random_uuid()`]
project_id text [not null]
device_id uuid
workspace_id text
added_by_user_id text
path text [not null]
name varchar(255) [not null]
permission text [not null, default: 'readWrite']
is_primary boolean [not null, default: false]
sort_order integer [not null, default: 0]
accessed_at "timestamp with time zone" [not null, default: `now()`]
created_at "timestamp with time zone" [not null, default: `now()`]
updated_at "timestamp with time zone" [not null, default: `now()`]
indexes {
(project_id, device_id, path) [name: 'project_working_directories_project_device_path_unique', unique]
project_id [name: 'project_working_directories_project_primary_unique', unique]
(project_id, sort_order) [name: 'project_working_directories_project_sort_order_idx']
device_id [name: 'project_working_directories_device_id_idx']
workspace_id [name: 'project_working_directories_workspace_id_idx']
}
}
table projects {
id text [pk, not null]
slug varchar(100)
identifier varchar(6) [not null]
name varchar(255) [not null]
description text
avatar text
coordinator_agent_id text [not null]
status text [not null, default: 'backlog']
user_id text [not null]
workspace_id text
visibility text [not null, default: 'public']
completed_review_id uuid
started_at "timestamp with time zone"
completed_at "timestamp with time zone"
archived_at "timestamp with time zone"
deleted_at "timestamp with time zone"
is_deleted boolean
accessed_at "timestamp with time zone" [not null, default: `now()`]
created_at "timestamp with time zone" [not null, default: `now()`]
updated_at "timestamp with time zone" [not null, default: `now()`]
indexes {
(slug, user_id) [name: 'projects_slug_user_id_unique', unique]
(workspace_id, slug) [name: 'projects_slug_workspace_id_unique', unique]
(identifier, user_id) [name: 'projects_identifier_user_id_unique', unique]
(workspace_id, identifier) [name: 'projects_identifier_workspace_id_unique', unique]
user_id [name: 'projects_user_id_idx']
workspace_id [name: 'projects_workspace_id_idx']
(workspace_id, visibility, user_id) [name: 'projects_workspace_visibility_idx']
(status, updated_at) [name: 'projects_status_updated_at_idx']
coordinator_agent_id [name: 'projects_coordinator_agent_id_unique', unique]
}
}
table project_environments {
id uuid [pk, not null, default: `gen_random_uuid()`]
project_id text [not null]
environment_id uuid [not null]
workspace_id text
added_by_user_id text
default_instance_id uuid
enabled boolean [not null, default: true]
is_default boolean [not null, default: false]
sort_order integer [not null, default: 0]
accessed_at "timestamp with time zone" [not null, default: `now()`]
created_at "timestamp with time zone" [not null, default: `now()`]
updated_at "timestamp with time zone" [not null, default: `now()`]
indexes {
default_instance_id [name: 'project_environments_default_instance_id_idx']
(project_id, environment_id) [name: 'project_environments_project_environment_unique', unique]
project_id [name: 'project_environments_project_default_unique', unique]
(project_id, sort_order) [name: 'project_environments_project_sort_order_idx']
environment_id [name: 'project_environments_environment_id_idx']
workspace_id [name: 'project_environments_workspace_id_idx']
added_by_user_id [name: 'project_environments_added_by_user_id_idx']
}
}
table project_works {
id uuid [pk, not null, default: `gen_random_uuid()`]
project_id text [not null]
work_id text [not null]
added_by_user_id text
workspace_id text
sort_order integer [not null, default: 0]
accessed_at "timestamp with time zone" [not null, default: `now()`]
created_at "timestamp with time zone" [not null, default: `now()`]
updated_at "timestamp with time zone" [not null, default: `now()`]
indexes {
(project_id, work_id) [name: 'project_works_project_id_work_id_unique', unique]
(project_id, sort_order) [name: 'project_works_project_id_sort_order_idx']
work_id [name: 'project_works_work_id_idx']
workspace_id [name: 'project_works_workspace_id_idx']
}
}
table push_live_activities {
id uuid [pk, not null, default: `gen_random_uuid()`]
user_id text [not null]
device_id text [not null]
activity_key text [not null]
operation_id text [not null]
activity_id text [not null]
push_token text [not null]
apns_environment text [not null]
created_at "timestamp with time zone" [not null, default: `now()`]
last_seen_at "timestamp with time zone" [not null, default: `now()`]
indexes {
(user_id, device_id, activity_key) [name: 'idx_push_live_activities_user_device_activity', unique]
(user_id, activity_key) [name: 'idx_push_live_activities_user_activity']
(user_id, operation_id) [name: 'idx_push_live_activities_user_operation']
last_seen_at [name: 'idx_push_live_activities_last_seen']
}
}
table push_tokens {
id uuid [pk, not null, default: `gen_random_uuid()`]
user_id text [not null]
expo_token text [not null]
device_id text [not null]
platform text [not null]
apns_environment text
app_version text
locale text
live_activity_push_to_start_token text
created_at "timestamp with time zone" [not null, default: `now()`]
last_seen_at "timestamp with time zone" [not null, default: `now()`]
indexes {
(user_id, device_id) [name: 'idx_push_tokens_user_device', unique]
user_id [name: 'idx_push_tokens_user']
last_seen_at [name: 'idx_push_tokens_last_seen']
}
}
table chunks {
id uuid [pk, not null, default: `gen_random_uuid()`]
text text
abstract text
metadata jsonb
index integer
type varchar
client_id text
user_id text
workspace_id text
accessed_at "timestamp with time zone" [not null, default: `now()`]
created_at "timestamp with time zone" [not null, default: `now()`]
updated_at "timestamp with time zone" [not null, default: `now()`]
indexes {
(client_id, user_id) [name: 'chunks_client_id_user_id_unique', unique]
user_id [name: 'chunks_user_id_idx']
workspace_id [name: 'chunks_workspace_id_idx']
}
}
table document_chunks {
document_id varchar(30) [not null]
chunk_id uuid [not null]
page_index integer
user_id text [not null]
workspace_id text
created_at "timestamp with time zone" [not null, default: `now()`]
indexes {
(document_id, chunk_id) [pk]
document_id [name: 'document_chunks_document_id_idx']
chunk_id [name: 'document_chunks_chunk_id_idx']
user_id [name: 'document_chunks_user_id_idx']
workspace_id [name: 'document_chunks_workspace_id_idx']
}
}
table embeddings {
id uuid [pk, not null, default: `gen_random_uuid()`]
chunk_id uuid [unique]
embeddings vector(1024)
model text
client_id text
user_id text
workspace_id text
indexes {
(client_id, user_id) [name: 'embeddings_client_id_user_id_unique', unique]
chunk_id [name: 'embeddings_chunk_id_idx']
user_id [name: 'embeddings_user_id_idx']
workspace_id [name: 'embeddings_workspace_id_idx']
}
}
table unstructured_chunks {
id uuid [pk, not null, default: `gen_random_uuid()`]
text text
metadata jsonb
index integer
type varchar
accessed_at "timestamp with time zone" [not null, default: `now()`]
created_at "timestamp with time zone" [not null, default: `now()`]
updated_at "timestamp with time zone" [not null, default: `now()`]
parent_id varchar
composite_id uuid
client_id text
user_id text
workspace_id text
file_id varchar
indexes {
(client_id, user_id) [name: 'unstructured_chunks_client_id_user_id_unique', unique]
user_id [name: 'unstructured_chunks_user_id_idx']
composite_id [name: 'unstructured_chunks_composite_id_idx']
file_id [name: 'unstructured_chunks_file_id_idx']
workspace_id [name: 'unstructured_chunks_workspace_id_idx']
}
}
table rag_eval_dataset_records {
id text [pk, not null]
dataset_id text [not null]
ideal text
question text
reference_files text[]
metadata jsonb
user_id text
workspace_id text
accessed_at "timestamp with time zone" [not null, default: `now()`]
created_at "timestamp with time zone" [not null, default: `now()`]
updated_at "timestamp with time zone" [not null, default: `now()`]
indexes {
user_id [name: 'rag_eval_dataset_records_user_id_idx']
workspace_id [name: 'rag_eval_dataset_records_workspace_id_idx']
}
}
table rag_eval_datasets {
id text [pk, not null]
description text
name text [not null]
knowledge_base_id text
user_id text
workspace_id text
accessed_at "timestamp with time zone" [not null, default: `now()`]
created_at "timestamp with time zone" [not null, default: `now()`]
updated_at "timestamp with time zone" [not null, default: `now()`]
indexes {
user_id [name: 'rag_eval_datasets_user_id_idx']
workspace_id [name: 'rag_eval_datasets_workspace_id_idx']
}
}
table rag_eval_evaluations {
id text [pk, not null]
name text [not null]
description text
eval_records_url text
status text
error jsonb
dataset_id text [not null]
knowledge_base_id text
language_model text
embedding_model text
user_id text
workspace_id text
accessed_at "timestamp with time zone" [not null, default: `now()`]
created_at "timestamp with time zone" [not null, default: `now()`]
updated_at "timestamp with time zone" [not null, default: `now()`]
indexes {
user_id [name: 'rag_eval_evaluations_user_id_idx']
workspace_id [name: 'rag_eval_evaluations_workspace_id_idx']
}
}
table rag_eval_evaluation_records {
id text [pk, not null]
question text [not null]
answer text
context text[]
ideal text
status text
error jsonb
language_model text
embedding_model text
question_embedding_id uuid
duration integer
dataset_record_id text [not null]
evaluation_id text [not null]
user_id text
workspace_id text
accessed_at "timestamp with time zone" [not null, default: `now()`]
created_at "timestamp with time zone" [not null, default: `now()`]
updated_at "timestamp with time zone" [not null, default: `now()`]
indexes {
user_id [name: 'rag_eval_evaluation_records_user_id_idx']
workspace_id [name: 'rag_eval_evaluation_records_workspace_id_idx']
}
}
table rbac_permissions {
id text [pk, not null]
code text [not null, unique]
name text [not null]
description text
category text [not null]
is_active boolean [not null, default: true]
accessed_at "timestamp with time zone" [not null, default: `now()`]
created_at "timestamp with time zone" [not null, default: `now()`]
updated_at "timestamp with time zone" [not null, default: `now()`]
}
table rbac_role_permissions {
role_id text [not null]
permission_id text [not null]
created_at "timestamp with time zone" [not null, default: `now()`]
indexes {
(role_id, permission_id) [pk]
role_id [name: 'rbac_role_permissions_role_id_idx']
permission_id [name: 'rbac_role_permissions_permission_id_idx']
}
}
table rbac_roles {
id text [pk, not null]
name text [not null]
display_name text [not null]
description text
is_system boolean [not null, default: false]
is_active boolean [not null, default: true]
metadata jsonb [default: `{}`]
workspace_id text
accessed_at "timestamp with time zone" [not null, default: `now()`]
created_at "timestamp with time zone" [not null, default: `now()`]
updated_at "timestamp with time zone" [not null, default: `now()`]
indexes {
workspace_id [name: 'rbac_roles_workspace_id_idx']
(name, workspace_id) [name: 'rbac_roles_name_workspace_unique', unique]
}
}
table rbac_user_roles {
id uuid [pk, not null, default: `gen_random_uuid()`]
user_id text [not null]
role_id text [not null]
workspace_id text
created_at "timestamp with time zone" [not null, default: `now()`]
expires_at "timestamp with time zone"
indexes {
(user_id, role_id, workspace_id) [name: 'rbac_user_roles_user_role_scope_unique', unique]
user_id [name: 'rbac_user_roles_user_id_idx']
role_id [name: 'rbac_user_roles_role_id_idx']
workspace_id [name: 'rbac_user_roles_workspace_id_idx']
}
}
table agents_to_sessions {
agent_id text [not null]
session_id text [not null]
user_id text [not null]
workspace_id text
indexes {
(agent_id, session_id) [pk]
session_id [name: 'agents_to_sessions_session_id_idx']
agent_id [name: 'agents_to_sessions_agent_id_idx']
user_id [name: 'agents_to_sessions_user_id_idx']
workspace_id [name: 'agents_to_sessions_workspace_id_idx']
}
}
table file_chunks {
file_id varchar
chunk_id uuid
created_at "timestamp with time zone" [not null, default: `now()`]
user_id text [not null]
workspace_id text
indexes {
(file_id, chunk_id) [pk]
user_id [name: 'file_chunks_user_id_idx']
workspace_id [name: 'file_chunks_workspace_id_idx']
file_id [name: 'file_chunks_file_id_idx']
chunk_id [name: 'file_chunks_chunk_id_idx']
}
}
table files_to_sessions {
file_id text [not null]
session_id text [not null]
user_id text [not null]
workspace_id text
indexes {
(file_id, session_id) [pk]
user_id [name: 'files_to_sessions_user_id_idx']
workspace_id [name: 'files_to_sessions_workspace_id_idx']
file_id [name: 'files_to_sessions_file_id_idx']
session_id [name: 'files_to_sessions_session_id_idx']
}
}
table resource_permissions {
id uuid [pk, not null, default: `gen_random_uuid()`]
resource_type text [not null]
resource_id text [not null]
workspace_id text [not null]
user_id text
access_level text [not null]
created_by text
accessed_at "timestamp with time zone" [not null, default: `now()`]
created_at "timestamp with time zone" [not null, default: `now()`]
updated_at "timestamp with time zone" [not null, default: `now()`]
indexes {
(workspace_id, resource_type, resource_id) [name: 'resource_permissions_workspace_resource_unique', unique]
(workspace_id, resource_type, resource_id, user_id) [name: 'resource_permissions_workspace_resource_user_id_unique', unique]
(resource_type, resource_id) [name: 'resource_permissions_resource_idx']
workspace_id [name: 'resource_permissions_workspace_idx']
(workspace_id, user_id) [name: 'resource_permissions_workspace_user_idx']
}
}
table resource_transfer_requests {
id uuid [pk, not null, default: `gen_random_uuid()`]
resource_type text [not null]
resource_id text [not null]
workspace_id text [not null]
initiator_id text
recipient_id text
previous_owner_id text
status text [not null, default: 'pending']
options jsonb
expires_at "timestamp with time zone" [not null]
resolved_at "timestamp with time zone"
accessed_at "timestamp with time zone" [not null, default: `now()`]
created_at "timestamp with time zone" [not null, default: `now()`]
updated_at "timestamp with time zone" [not null, default: `now()`]
indexes {
(resource_type, resource_id) [name: 'resource_transfer_requests_pending_resource_unique', unique]
(recipient_id, status) [name: 'resource_transfer_requests_recipient_idx']
workspace_id [name: 'resource_transfer_requests_workspace_idx']
}
}
table session_groups {
id text [pk, not null]
name text [not null]
sort integer
user_id text [not null]
client_id text
workspace_id text
visibility text [not null, default: 'public']
deleted_at "timestamp with time zone"
is_deleted boolean
accessed_at "timestamp with time zone" [not null, default: `now()`]
created_at "timestamp with time zone" [not null, default: `now()`]
updated_at "timestamp with time zone" [not null, default: `now()`]
indexes {
(client_id, user_id) [name: 'session_groups_client_id_user_id_unique', unique]
user_id [name: 'session_groups_user_id_idx']
workspace_id [name: 'session_groups_workspace_id_idx']
(workspace_id, visibility, user_id) [name: 'session_groups_workspace_visibility_idx']
}
}
table sessions {
id text [pk, not null]
slug varchar(100) [not null]
title text
description text
avatar text
background_color text
type text [default: 'agent']
user_id text [not null]
group_id text
client_id text
pinned boolean [default: false]
workspace_id text
accessed_at "timestamp with time zone" [not null, default: `now()`]
created_at "timestamp with time zone" [not null, default: `now()`]
updated_at "timestamp with time zone" [not null, default: `now()`]
indexes {
(slug, user_id) [name: 'slug_user_id_unique', unique]
(client_id, user_id) [name: 'sessions_client_id_user_id_unique', unique]
user_id [name: 'sessions_user_id_idx']
(id, user_id) [name: 'sessions_id_user_id_idx']
(user_id, updated_at) [name: 'sessions_user_id_updated_at_idx']
group_id [name: 'sessions_group_id_idx']
workspace_id [name: 'sessions_workspace_id_idx']
(workspace_id, slug) [name: 'sessions_slug_workspace_id_unique', unique]
}
}
table system_bot_providers {
id uuid [pk, not null, default: `gen_random_uuid()`]
platform varchar(50) [not null]
enabled boolean [not null, default: true]
credentials text [not null]
application_id varchar(255)
settings jsonb [not null, default: `{}`]
connection_mode varchar(20)
accessed_at "timestamp with time zone" [not null, default: `now()`]
created_at "timestamp with time zone" [not null, default: `now()`]
updated_at "timestamp with time zone" [not null, default: `now()`]
indexes {
platform [name: 'system_bot_providers_platform_unique', unique]
}
}
table briefs {
id text [pk, not null]
user_id text [not null]
workspace_id text
task_id text
cron_job_id text
topic_id text
agent_id text
type text [not null]
priority text [default: 'info']
title text [not null]
summary text [not null]
artifacts jsonb
actions jsonb
resolved_action text
resolved_comment text
read_at "timestamp with time zone"
resolved_at "timestamp with time zone"
trigger varchar(255)
metadata jsonb
created_at "timestamp with time zone" [not null, default: `now()`]
indexes {
user_id [name: 'briefs_user_id_idx']
task_id [name: 'briefs_task_id_idx']
cron_job_id [name: 'briefs_cron_job_id_idx']
agent_id [name: 'briefs_agent_id_idx']
type [name: 'briefs_type_idx']
priority [name: 'briefs_priority_idx']
(user_id, resolved_at) [name: 'briefs_unresolved_idx']
trigger [name: 'briefs_trigger_idx']
workspace_id [name: 'briefs_workspace_id_idx']
}
}
table task_activities {
id uuid [pk, not null, default: `gen_random_uuid()`]
task_id text [not null]
user_id text [not null]
workspace_id text
actor_user_id text
actor_agent_id text
type text [not null]
payload jsonb
visibility text [not null, default: 'public']
created_at "timestamp with time zone" [not null, default: `now()`]
indexes {
task_id [name: 'task_activities_task_id_idx']
user_id [name: 'task_activities_user_id_idx']
workspace_id [name: 'task_activities_workspace_id_idx']
(workspace_id, visibility, user_id) [name: 'task_activities_workspace_visibility_idx']
}
}
table task_comments {
id text [pk, not null]
task_id text [not null]
user_id text [not null]
workspace_id text
author_user_id text
author_agent_id text
content text [not null]
editor_data jsonb
brief_id text
topic_id text
visibility text [not null, default: 'public']
accessed_at "timestamp with time zone" [not null, default: `now()`]
created_at "timestamp with time zone" [not null, default: `now()`]
updated_at "timestamp with time zone" [not null, default: `now()`]
indexes {
task_id [name: 'task_comments_task_id_idx']
user_id [name: 'task_comments_user_id_idx']
author_user_id [name: 'task_comments_author_user_id_idx']
author_agent_id [name: 'task_comments_agent_id_idx']
brief_id [name: 'task_comments_brief_id_idx']
topic_id [name: 'task_comments_topic_id_idx']
workspace_id [name: 'task_comments_workspace_id_idx']
(workspace_id, visibility, user_id) [name: 'task_comments_workspace_visibility_idx']
}
}
table task_dependencies {
id uuid [pk, not null, default: `gen_random_uuid()`]
task_id text [not null]
depends_on_id text [not null]
user_id text [not null]
workspace_id text
type text [not null, default: 'blocks']
visibility text [not null, default: 'public']
condition jsonb
created_at "timestamp with time zone" [not null, default: `now()`]
indexes {
(task_id, depends_on_id) [name: 'task_deps_unique_idx', unique]
task_id [name: 'task_deps_task_id_idx']
depends_on_id [name: 'task_deps_depends_on_id_idx']
user_id [name: 'task_deps_user_id_idx']
workspace_id [name: 'task_dependencies_workspace_id_idx']
(workspace_id, visibility, user_id) [name: 'task_deps_workspace_visibility_idx']
}
}
table task_documents {
id uuid [pk, not null, default: `gen_random_uuid()`]
task_id text [not null]
document_id text [not null]
user_id text [not null]
workspace_id text
pinned_by text [not null, default: 'agent']
visibility text [not null, default: 'public']
created_at "timestamp with time zone" [not null, default: `now()`]
indexes {
(task_id, document_id) [name: 'task_docs_unique_idx', unique]
task_id [name: 'task_docs_task_id_idx']
document_id [name: 'task_docs_document_id_idx']
user_id [name: 'task_docs_user_id_idx']
workspace_id [name: 'task_documents_workspace_id_idx']
(workspace_id, visibility, user_id) [name: 'task_docs_workspace_visibility_idx']
}
}
table task_topics {
id uuid [pk, not null, default: `gen_random_uuid()`]
task_id text [not null]
topic_id text
user_id text [not null]
workspace_id text
seq integer [not null]
operation_id text
status text [not null, default: 'running']
trigger text
handoff jsonb
review_passed integer
review_score integer
review_scores jsonb
review_iteration integer
reviewed_at "timestamp with time zone"
visibility text [not null, default: 'public']
accessed_at "timestamp with time zone" [not null, default: `now()`]
created_at "timestamp with time zone" [not null, default: `now()`]
updated_at "timestamp with time zone" [not null, default: `now()`]
indexes {
(task_id, topic_id) [name: 'task_topics_unique_idx', unique]
task_id [name: 'task_topics_task_id_idx']
topic_id [name: 'task_topics_topic_id_idx']
user_id [name: 'task_topics_user_id_idx']
(task_id, status) [name: 'task_topics_status_idx']
workspace_id [name: 'task_topics_workspace_id_idx']
(workspace_id, visibility, user_id) [name: 'task_topics_workspace_visibility_idx']
}
}
table tasks {
id text [pk, not null]
identifier text [not null]
seq integer [not null]
created_by_user_id text [not null]
workspace_id text
project_id text
created_by_agent_id text
assignee_user_id text
assignee_agent_id text
parent_task_id text
name text
description varchar(255)
instruction text [not null]
editor_data jsonb
status text [not null, default: 'backlog']
priority integer [default: 0]
sort_order integer [default: 0]
automation_mode text
heartbeat_interval integer
heartbeat_timeout integer
last_heartbeat_at "timestamp with time zone"
schedule_pattern text
schedule_timezone text [default: 'UTC']
total_topics integer [default: 0]
max_topics integer
current_topic_id text
context jsonb [default: `{}`]
config jsonb [default: `{}`]
error text
visibility text [not null, default: 'public']
started_at "timestamp with time zone"
completed_at "timestamp with time zone"
deleted_at "timestamp with time zone"
is_deleted boolean
accessed_at "timestamp with time zone" [not null, default: `now()`]
created_at "timestamp with time zone" [not null, default: `now()`]
updated_at "timestamp with time zone" [not null, default: `now()`]
indexes {
(identifier, created_by_user_id) [name: 'tasks_identifier_idx', unique]
created_by_user_id [name: 'tasks_created_by_user_id_idx']
created_by_agent_id [name: 'tasks_created_by_agent_id_idx']
assignee_user_id [name: 'tasks_assignee_user_id_idx']
assignee_agent_id [name: 'tasks_assignee_agent_id_idx']
parent_task_id [name: 'tasks_parent_task_id_idx']
status [name: 'tasks_status_idx']
priority [name: 'tasks_priority_idx']
automation_mode [name: 'tasks_automation_mode_idx']
(status, last_heartbeat_at) [name: 'tasks_heartbeat_idx']
workspace_id [name: 'tasks_workspace_id_idx']
(project_id, status) [name: 'tasks_project_id_status_idx']
(workspace_id, visibility, created_by_user_id) [name: 'tasks_workspace_visibility_idx']
(workspace_id, identifier) [name: 'tasks_identifier_workspace_id_unique', unique]
}
}
table threads {
id text [pk, not null]
title text
content text
editor_data jsonb
type text [not null]
status text
topic_id text [not null]
source_message_id text
parent_thread_id text
client_id text
agent_id text
group_id text
metadata jsonb
user_id text [not null]
last_active_at "timestamp with time zone" [default: `now()`]
workspace_id text
deleted_at "timestamp with time zone"
is_deleted boolean
accessed_at "timestamp with time zone" [not null, default: `now()`]
created_at "timestamp with time zone" [not null, default: `now()`]
updated_at "timestamp with time zone" [not null, default: `now()`]
indexes {
(client_id, user_id) [name: 'threads_client_id_user_id_unique', unique]
user_id [name: 'threads_user_id_idx']
topic_id [name: 'threads_topic_id_idx']
type [name: 'threads_type_idx']
agent_id [name: 'threads_agent_id_idx']
group_id [name: 'threads_group_id_idx']
parent_thread_id [name: 'threads_parent_thread_id_idx']
workspace_id [name: 'threads_workspace_id_idx']
}
}
table topic_documents {
document_id text [not null]
topic_id text [not null]
user_id text [not null]
workspace_id text
created_at "timestamp with time zone" [not null, default: `now()`]
indexes {
(document_id, topic_id) [pk]
user_id [name: 'topic_documents_user_id_idx']
topic_id [name: 'topic_documents_topic_id_idx']
document_id [name: 'topic_documents_document_id_idx']
workspace_id [name: 'topic_documents_workspace_id_idx']
}
}
table topic_shares {
id text [pk, not null]
topic_id text [not null]
user_id text [not null]
workspace_id text
visibility text [not null, default: 'private']
page_view_count integer [not null, default: 0]
accessed_at "timestamp with time zone" [not null, default: `now()`]
created_at "timestamp with time zone" [not null, default: `now()`]
updated_at "timestamp with time zone" [not null, default: `now()`]
indexes {
topic_id [name: 'topic_shares_topic_id_unique', unique]
user_id [name: 'topic_shares_user_id_idx']
workspace_id [name: 'topic_shares_workspace_id_idx']
}
}
table topics {
id text [pk, not null]
title text
favorite boolean [default: false]
session_id text
content text
editor_data jsonb
agent_id text
group_id text
project_id text
project_working_directory_id uuid
user_id text [not null]
client_id text
description text
history_summary text
metadata jsonb
trigger text
mode text
status text
completed_at "timestamp with time zone"
total_cost "numeric(20, 6)"
total_input_tokens integer
total_output_tokens integer
total_tokens integer
cost jsonb
usage jsonb
model text
provider text
sender_id text
workspace_id text
deleted_at "timestamp with time zone"
is_deleted boolean
accessed_at "timestamp with time zone" [not null, default: `now()`]
created_at "timestamp with time zone" [not null, default: `now()`]
updated_at "timestamp with time zone" [not null, default: `now()`]
indexes {
(client_id, user_id) [name: 'topics_client_id_user_id_unique', unique]
created_at [name: 'topics_created_at_idx']
user_id [name: 'topics_user_id_idx']
(id, user_id) [name: 'topics_id_user_id_idx']
session_id [name: 'topics_session_id_idx']
group_id [name: 'topics_group_id_idx']
agent_id [name: 'topics_agent_id_idx']
project_id [name: 'topics_project_id_idx']
project_working_directory_id [name: 'topics_project_working_directory_id_idx']
trigger [name: 'topics_trigger_idx']
status [name: 'topics_status_idx']
model [name: 'topics_model_idx']
provider [name: 'topics_provider_idx']
(user_id, completed_at) [name: 'topics_user_id_completed_at_idx']
sender_id [name: 'topics_sender_id_idx']
workspace_id [name: 'topics_workspace_id_idx']
() [name: 'topics_extract_status_gin_idx']
}
}
table topic_comment_mentions {
id uuid [pk, not null, default: `gen_random_uuid()`]
comment_id text [not null]
mentioned_user_id text [not null]
workspace_id text [not null]
created_at "timestamp with time zone" [not null, default: `now()`]
indexes {
(comment_id, mentioned_user_id) [name: 'topic_comment_mentions_comment_id_mentioned_user_id_unique', unique]
(mentioned_user_id, created_at) [name: 'topic_comment_mentions_mentioned_user_id_created_at_idx']
workspace_id [name: 'topic_comment_mentions_workspace_id_idx']
}
}
table topic_comments {
id text [pk, not null]
topic_id text [not null]
message_id text
parent_comment_id text
author_user_id text
workspace_id text [not null]
content text [not null]
editor_data jsonb
client_id text [not null]
anchor_preview jsonb
deleted_at "timestamp with time zone"
moderated_at "timestamp with time zone"
moderated_by_user_id text
moderation_expires_at "timestamp with time zone"
created_at "timestamp with time zone" [not null, default: `now()`]
updated_at "timestamp with time zone" [not null, default: `now()`]
indexes {
(topic_id, author_user_id, client_id) [name: 'topic_comments_topic_id_author_user_id_client_id_unique', unique]
(parent_comment_id, created_at, id) [name: 'topic_comments_parent_comment_id_created_at_id_idx']
(topic_id, created_at, id) [name: 'topic_comments_topic_id_created_at_id_idx']
(topic_id, message_id) [name: 'topic_comments_topic_id_message_id_idx']
message_id [name: 'topic_comments_message_id_idx']
author_user_id [name: 'topic_comments_author_user_id_idx']
moderation_expires_at [name: 'topic_comments_moderation_expires_at_idx']
moderated_by_user_id [name: 'topic_comments_moderated_by_user_id_idx']
workspace_id [name: 'topic_comments_workspace_id_idx']
}
}
table trash_items {
id uuid [pk, not null, default: `gen_random_uuid()`]
resource_type text [not null]
resource_id text [not null]
title text
meta jsonb
root_id uuid
user_id text [not null]
workspace_id text
deleted_by_user_id text
deleted_at "timestamp with time zone" [not null, default: `now()`]
expires_at "timestamp with time zone" [not null]
created_at "timestamp with time zone" [not null, default: `now()`]
indexes {
(resource_type, resource_id) [name: 'trash_items_resource_unique', unique]
(user_id, deleted_at) [name: 'trash_items_personal_listing_idx']
(workspace_id, deleted_at) [name: 'trash_items_workspace_listing_idx']
expires_at [name: 'trash_items_expires_at_idx']
root_id [name: 'trash_items_root_id_idx']
}
}
table user_settings {
id text [pk, not null]
tts jsonb
hotkey jsonb
key_vaults text
general jsonb
language_model jsonb
system_agent jsonb
default_agent jsonb
market jsonb
memory jsonb
tool jsonb
image jsonb
notification jsonb
}
table users {
id text [pk, not null]
username text [unique]
email text [unique]
normalized_email text [unique]
avatar text
phone text [unique]
first_name text
last_name text
full_name text
interests "varchar(64)[]"
is_onboarded boolean [default: false]
agent_onboarding jsonb
onboarding jsonb
clerk_created_at "timestamp with time zone"
email_verified boolean [not null, default: false]
email_verified_at "timestamp with time zone"
preference jsonb
role text
banned boolean [default: false]
ban_reason text
ban_expires "timestamp with time zone"
two_factor_enabled boolean [default: false]
phone_number_verified boolean
last_active_at "timestamp with time zone" [not null, default: `now()`]
accessed_at "timestamp with time zone" [not null, default: `now()`]
created_at "timestamp with time zone" [not null, default: `now()`]
updated_at "timestamp with time zone" [not null, default: `now()`]
indexes {
email [name: 'users_email_idx']
username [name: 'users_username_idx']
created_at [name: 'users_created_at_idx']
created_at [name: 'users_banned_true_created_at_idx']
}
}
table user_memories {
id varchar(255) [pk, not null]
user_id text
memory_category varchar(255)
memory_layer varchar(255)
memory_type varchar(255)
metadata jsonb
tags text[]
title varchar(255)
summary text
summary_vector_1024 vector(1024)
details text
details_vector_1024 vector(1024)
status varchar(255)
accessed_count bigint [default: 0]
last_accessed_at "timestamp with time zone" [not null]
captured_at "timestamp with time zone" [not null, default: `now()`]
deleted_at "timestamp with time zone"
is_deleted boolean
accessed_at "timestamp with time zone" [not null, default: `now()`]
created_at "timestamp with time zone" [not null, default: `now()`]
updated_at "timestamp with time zone" [not null, default: `now()`]
indexes {
summary_vector_1024 [name: 'user_memories_summary_vector_1024_index']
details_vector_1024 [name: 'user_memories_details_vector_1024_index']
user_id [name: 'user_memories_user_id_index']
}
}
table user_memories_activities {
id varchar(255) [pk, not null]
user_id text
user_memory_id varchar(255)
metadata jsonb
tags text[]
type varchar(255) [not null]
status varchar(255) [not null, default: 'pending']
timezone varchar(255)
starts_at "timestamp with time zone"
ends_at "timestamp with time zone"
associated_objects jsonb
associated_subjects jsonb
associated_locations jsonb
notes text
narrative text
narrative_vector vector(1024)
feedback text
feedback_vector vector(1024)
captured_at "timestamp with time zone" [not null, default: `now()`]
accessed_at "timestamp with time zone" [not null, default: `now()`]
created_at "timestamp with time zone" [not null, default: `now()`]
updated_at "timestamp with time zone" [not null, default: `now()`]
indexes {
narrative_vector [name: 'user_memories_activities_narrative_vector_index']
feedback_vector [name: 'user_memories_activities_feedback_vector_index']
type [name: 'user_memories_activities_type_index']
user_id [name: 'user_memories_activities_user_id_index']
user_memory_id [name: 'user_memories_activities_user_memory_id_index']
status [name: 'user_memories_activities_status_index']
}
}
table user_memories_contexts {
id varchar(255) [pk, not null]
user_id text
user_memory_ids jsonb
metadata jsonb
tags text[]
associated_objects jsonb
associated_subjects jsonb
title text
description text
description_vector vector(1024)
type varchar(255)
current_status text
score_impact numeric [default: 0]
score_urgency numeric [default: 0]
captured_at "timestamp with time zone" [not null, default: `now()`]
accessed_at "timestamp with time zone" [not null, default: `now()`]
created_at "timestamp with time zone" [not null, default: `now()`]
updated_at "timestamp with time zone" [not null, default: `now()`]
indexes {
description_vector [name: 'user_memories_contexts_description_vector_index']
type [name: 'user_memories_contexts_type_index']
user_id [name: 'user_memories_contexts_user_id_index']
user_memory_ids [name: 'user_memories_contexts_user_memory_ids_gin_idx']
}
}
table user_memories_experiences {
id varchar(255) [pk, not null]
user_id text
user_memory_id varchar(255)
metadata jsonb
tags text[]
type varchar(255)
situation text
situation_vector vector(1024)
reasoning text
possible_outcome text
action text
action_vector vector(1024)
key_learning text
key_learning_vector vector(1024)
score_confidence real [default: 0]
captured_at "timestamp with time zone" [not null, default: `now()`]
accessed_at "timestamp with time zone" [not null, default: `now()`]
created_at "timestamp with time zone" [not null, default: `now()`]
updated_at "timestamp with time zone" [not null, default: `now()`]
indexes {
situation_vector [name: 'user_memories_experiences_situation_vector_index']
action_vector [name: 'user_memories_experiences_action_vector_index']
key_learning_vector [name: 'user_memories_experiences_key_learning_vector_index']
type [name: 'user_memories_experiences_type_index']
user_id [name: 'user_memories_experiences_user_id_index']
user_memory_id [name: 'user_memories_experiences_user_memory_id_index']
}
}
table user_memories_identities {
id varchar(255) [pk, not null]
user_id text
user_memory_id varchar(255)
metadata jsonb
tags text[]
type varchar(255)
description text
description_vector vector(1024)
episodic_date "timestamp with time zone"
relationship varchar(255)
role text
captured_at "timestamp with time zone" [not null, default: `now()`]
accessed_at "timestamp with time zone" [not null, default: `now()`]
created_at "timestamp with time zone" [not null, default: `now()`]
updated_at "timestamp with time zone" [not null, default: `now()`]
indexes {
description_vector [name: 'user_memories_identities_description_vector_index']
type [name: 'user_memories_identities_type_index']
user_id [name: 'user_memories_identities_user_id_index']
user_memory_id [name: 'user_memories_identities_user_memory_id_index']
}
}
table user_memories_preferences {
id varchar(255) [pk, not null]
user_id text
user_memory_id varchar(255)
metadata jsonb
tags text[]
conclusion_directives text
conclusion_directives_vector vector(1024)
type varchar(255)
suggestions text
score_priority numeric [default: 0]
captured_at "timestamp with time zone" [not null, default: `now()`]
accessed_at "timestamp with time zone" [not null, default: `now()`]
created_at "timestamp with time zone" [not null, default: `now()`]
updated_at "timestamp with time zone" [not null, default: `now()`]
indexes {
conclusion_directives_vector [name: 'user_memories_preferences_conclusion_directives_vector_index']
user_id [name: 'user_memories_preferences_user_id_index']
user_memory_id [name: 'user_memories_preferences_user_memory_id_index']
}
}
table user_memory_persona_document_histories {
id varchar(255) [pk, not null]
user_id text
persona_id varchar(255)
profile varchar(255) [not null, default: 'default']
snapshot_persona text
snapshot_tagline text
reasoning text
diff_persona text
diff_tagline text
snapshot text
summary text
edited_by varchar(255) [default: 'agent']
memory_ids jsonb
source_ids jsonb
metadata jsonb
previous_version integer
next_version integer
captured_at "timestamp with time zone" [not null, default: `now()`]
accessed_at "timestamp with time zone" [not null, default: `now()`]
created_at "timestamp with time zone" [not null, default: `now()`]
updated_at "timestamp with time zone" [not null, default: `now()`]
indexes {
persona_id [name: 'user_persona_document_histories_persona_id_index']
user_id [name: 'user_persona_document_histories_user_id_index']
profile [name: 'user_persona_document_histories_profile_index']
}
}
table user_memory_persona_documents {
id varchar(255) [pk, not null]
user_id text
profile varchar(255) [not null, default: 'default']
tagline text
persona text
memory_ids jsonb
source_ids jsonb
metadata jsonb
version integer [not null, default: 1]
captured_at "timestamp with time zone" [not null, default: `now()`]
accessed_at "timestamp with time zone" [not null, default: `now()`]
created_at "timestamp with time zone" [not null, default: `now()`]
updated_at "timestamp with time zone" [not null, default: `now()`]
indexes {
(user_id, profile) [name: 'user_persona_documents_user_id_profile_unique', unique]
user_id [name: 'user_persona_documents_user_id_index']
}
}
table acceptances {
id uuid [pk, not null, default: `gen_random_uuid()`]
user_id text [not null]
workspace_id text
project_id text
subject_type text [not null]
subject_id text [not null]
status text [not null, default: 'pending']
visibility text [not null, default: 'public']
requirement text
config jsonb [default: `{}`]
visual_render jsonb
metadata jsonb
completed_at "timestamp with time zone"
accessed_at "timestamp with time zone" [not null, default: `now()`]
created_at "timestamp with time zone" [not null, default: `now()`]
updated_at "timestamp with time zone" [not null, default: `now()`]
indexes {
user_id [name: 'acceptances_user_id_idx']
workspace_id [name: 'acceptances_workspace_id_idx']
project_id [name: 'acceptances_project_id_idx']
(subject_type, subject_id) [name: 'acceptances_subject_idx']
status [name: 'acceptances_status_idx']
(workspace_id, visibility, user_id) [name: 'acceptances_workspace_visibility_idx']
(user_id, subject_type, subject_id) [name: 'acceptances_personal_subject_unique', unique]
(workspace_id, subject_type, subject_id) [name: 'acceptances_workspace_subject_unique', unique]
}
}
table verify_check_results {
id uuid [pk, not null, default: `gen_random_uuid()`]
verify_run_id uuid
operation_id text
user_id text [not null]
workspace_id text
check_item_id text [not null]
source_criterion_id uuid
check_item_title text
required boolean [not null, default: true]
check_item_index integer
verifier_type text [not null]
verifier_config_hash text
verifier_operation_id text
verifier_tracing_id uuid
status text [not null, default: 'pending']
verdict text
confidence "numeric(3, 2)"
toulmin jsonb
metadata jsonb
suggestion text
user_decision text
user_decision_detail jsonb
is_false_positive boolean
is_false_negative boolean
repair_operation_id text
started_at "timestamp with time zone"
completed_at "timestamp with time zone"
created_at "timestamp with time zone" [not null, default: `now()`]
indexes {
(source_criterion_id, created_at) [name: 'verify_check_results_criterion_created_idx']
verify_run_id [name: 'verify_check_results_verify_run_id_idx']
operation_id [name: 'verify_check_results_operation_id_idx']
user_id [name: 'verify_check_results_user_id_idx']
(verify_run_id, check_item_id) [name: 'verify_check_results_verify_run_id_check_item_id_unique', unique]
verifier_type [name: 'verify_check_results_verifier_type_idx']
verifier_operation_id [name: 'verify_check_results_verifier_operation_id_idx']
verifier_tracing_id [name: 'verify_check_results_verifier_tracing_id_idx']
status [name: 'verify_check_results_status_idx']
verdict [name: 'verify_check_results_verdict_idx']
repair_operation_id [name: 'verify_check_results_repair_operation_id_idx']
workspace_id [name: 'verify_check_results_workspace_id_idx']
}
}
table verify_criteria {
id uuid [pk, not null, default: `gen_random_uuid()`]
user_id text [not null]
title text [not null]
description text
definition jsonb
tags text[] [not null, default: `[]`]
archived_at "timestamp with time zone"
required boolean [not null, default: true]
verifier_type text [not null]
verifier_config jsonb [default: `{}`]
on_fail text [not null, default: 'manual']
document_id varchar(255)
workspace_id text
accessed_at "timestamp with time zone" [not null, default: `now()`]
created_at "timestamp with time zone" [not null, default: `now()`]
updated_at "timestamp with time zone" [not null, default: `now()`]
indexes {
user_id [name: 'verify_criteria_user_id_idx']
verifier_type [name: 'verify_criteria_verifier_type_idx']
document_id [name: 'verify_criteria_document_id_idx']
workspace_id [name: 'verify_criteria_workspace_id_idx']
}
}
table verify_evidence {
id uuid [pk, not null, default: `gen_random_uuid()`]
description text
check_result_id uuid [not null]
type text [not null]
content text
document_id text
file_id text
metadata jsonb
captured_by text
captured_at "timestamp with time zone"
user_id text [not null]
workspace_id text
created_at "timestamp with time zone" [not null, default: `now()`]
indexes {
check_result_id [name: 'verify_evidence_check_result_id_idx']
document_id [name: 'verify_evidence_document_id_idx']
file_id [name: 'verify_evidence_file_id_idx']
user_id [name: 'verify_evidence_user_id_idx']
workspace_id [name: 'verify_evidence_workspace_id_idx']
}
}
table verify_reports {
id uuid [pk, not null, default: `gen_random_uuid()`]
verify_run_id uuid
operation_id text
user_id text [not null]
workspace_id text
verdict text
overall_confidence "numeric(3, 2)"
total_checks integer
passed_checks integer
failed_checks integer
uncertain_checks integer
summary text
content text
reviewed_by_user boolean [default: false]
generated_by text [default: 'system']
generated_at "timestamp with time zone" [not null, default: `now()`]
created_at "timestamp with time zone" [not null, default: `now()`]
indexes {
verify_run_id [name: 'verify_reports_verify_run_id_unique', unique]
operation_id [name: 'verify_reports_operation_id_idx']
user_id [name: 'verify_reports_user_id_idx']
workspace_id [name: 'verify_reports_workspace_id_idx']
}
}
table verify_review_predictions {
id uuid [pk, not null, default: `gen_random_uuid()`]
check_result_id uuid [not null]
user_id text [not null]
workspace_id text
provider text [not null]
model text [not null]
prompt_version text [not null]
status text [not null]
action text
status_reason text
confidence "numeric(3, 2)"
comment text
rationale text
annotations jsonb
adjudication text
adjudication_edit text
adjudicated_at "timestamp with time zone"
latency_ms integer
prompt_tokens integer
completion_tokens integer
created_at "timestamp with time zone" [not null, default: `now()`]
indexes {
check_result_id [name: 'verify_review_predictions_check_result_id_idx']
user_id [name: 'verify_review_predictions_user_id_idx']
workspace_id [name: 'verify_review_predictions_workspace_id_idx']
(provider, model) [name: 'verify_review_predictions_model_idx']
(check_result_id, provider, model, prompt_version) [name: 'verify_review_predictions_result_model_prompt_unique', unique]
}
}
table verify_rubric_criteria {
rubric_id uuid [not null]
criterion_id uuid [not null]
user_id text [not null]
workspace_id text
sort_order integer
created_at "timestamp with time zone" [not null, default: `now()`]
indexes {
(rubric_id, criterion_id) [pk]
criterion_id [name: 'verify_rubric_criteria_criterion_id_idx']
user_id [name: 'verify_rubric_criteria_user_id_idx']
workspace_id [name: 'verify_rubric_criteria_workspace_id_idx']
}
}
table verify_rubrics {
id uuid [pk, not null, default: `gen_random_uuid()`]
user_id text [not null]
title text [not null]
description text
config jsonb [default: `{}`]
workspace_id text
accessed_at "timestamp with time zone" [not null, default: `now()`]
created_at "timestamp with time zone" [not null, default: `now()`]
updated_at "timestamp with time zone" [not null, default: `now()`]
indexes {
user_id [name: 'verify_rubrics_user_id_idx']
workspace_id [name: 'verify_rubrics_workspace_id_idx']
}
}
table verify_runs {
id uuid [pk, not null, default: `gen_random_uuid()`]
user_id text [not null]
workspace_id text
acceptance_id uuid
round_index integer
operation_id text
source text [not null, default: 'agent']
visibility text [not null, default: 'public']
scenario text
title text
goal text
context jsonb
metadata jsonb
plan jsonb
flow_snapshots jsonb
plan_confirmed_at "timestamp with time zone"
status text
user_decision text
decision_detail jsonb
accessed_at "timestamp with time zone" [not null, default: `now()`]
created_at "timestamp with time zone" [not null, default: `now()`]
updated_at "timestamp with time zone" [not null, default: `now()`]
indexes {
user_id [name: 'verify_runs_user_id_idx']
workspace_id [name: 'verify_runs_workspace_id_idx']
acceptance_id [name: 'verify_runs_acceptance_id_idx']
(acceptance_id, round_index) [name: 'verify_runs_acceptance_round_unique', unique]
operation_id [name: 'verify_runs_operation_id_unique', unique]
source [name: 'verify_runs_source_idx']
user_decision [name: 'verify_runs_user_decision_idx']
}
}
table work_versions {
id uuid [pk, not null, default: `gen_random_uuid()`]
work_id text [not null]
version integer [not null]
title text
description text
content text
identifier text
status text
url text
change_type text [not null]
tool_name text [not null]
tool_identifier text [not null]
topic_id text
thread_id text
message_id text
root_operation_id text
tool_call_id text
agent_id text
metadata jsonb
cumulative_cost "numeric(20, 6)"
cumulative_usage jsonb
created_at "timestamp with time zone" [not null, default: `now()`]
indexes {
(work_id, version) [name: 'work_versions_work_id_version_unique', unique]
(work_id, tool_call_id) [name: 'work_versions_work_id_tool_call_id_unique', unique]
thread_id [name: 'work_versions_thread_id_idx']
message_id [name: 'work_versions_message_id_idx']
agent_id [name: 'work_versions_agent_id_idx']
(root_operation_id, created_at) [name: 'work_versions_root_operation_created_at_idx']
(topic_id, created_at) [name: 'work_versions_topic_created_at_idx']
(topic_id, thread_id, created_at) [name: 'work_versions_topic_thread_created_at_idx']
}
}
table works {
id text [pk, not null]
type text [not null]
current_version_id uuid
resource_type text [not null]
resource_id text
title text
description text
identifier text
status text
url text
tool_name text [not null]
tool_identifier text [not null]
origin_topic_id text
origin_thread_id text
origin_agent_id text
user_id text [not null]
workspace_id text
visibility text [not null]
deleted_at "timestamp with time zone"
is_deleted boolean
created_at "timestamp with time zone" [not null, default: `now()`]
updated_at "timestamp with time zone" [not null, default: `now()`]
indexes {
(resource_type, resource_id, user_id) [name: 'works_resource_user_unique', unique]
(workspace_id, resource_type, resource_id) [name: 'works_resource_workspace_unique', unique]
user_id [name: 'works_user_id_idx']
workspace_id [name: 'works_workspace_id_idx']
(workspace_id, visibility, user_id) [name: 'works_workspace_visibility_idx']
(user_id, updated_at, id) [name: 'works_user_updated_at_id_idx']
(workspace_id, updated_at, id) [name: 'works_workspace_updated_at_id_idx']
origin_topic_id [name: 'works_origin_topic_id_idx']
origin_thread_id [name: 'works_origin_thread_id_idx']
origin_agent_id [name: 'works_origin_agent_id_idx']
}
}
table workspace_audit_logs {
id text [pk, not null]
workspace_id text [not null]
user_id text
action text [not null]
resource_type text
resource_id text
metadata jsonb [default: `{}`]
ip_address text
created_at "timestamp with time zone" [not null, default: `now()`]
indexes {
workspace_id [name: 'workspace_audit_logs_workspace_id_idx']
action [name: 'workspace_audit_logs_action_idx']
created_at [name: 'workspace_audit_logs_created_at_idx']
}
}
table workspace_invitations {
id text [pk, not null]
workspace_id text [not null]
inviter_id text [not null]
email text
role text [not null, default: 'member']
token text [not null, unique]
status text [not null, default: 'pending']
expires_at "timestamp with time zone" [not null]
created_at "timestamp with time zone" [not null, default: `now()`]
updated_at "timestamp with time zone" [not null, default: `now()`]
indexes {
workspace_id [name: 'workspace_invitations_workspace_id_idx']
email [name: 'workspace_invitations_email_idx']
token [name: 'workspace_invitations_token_idx']
}
}
table workspace_members {
workspace_id text [not null]
user_id text [not null]
role text [not null, default: 'member']
joined_at "timestamp with time zone" [not null, default: `now()`]
updated_at "timestamp with time zone" [not null, default: `now()`]
deleted_at "timestamp with time zone"
indexes {
(workspace_id, user_id) [pk]
user_id [name: 'workspace_members_user_id_idx']
workspace_id [name: 'workspace_members_unique_active_owner_idx', unique]
}
}
table workspace_user_settings {
id uuid [pk, not null, default: `gen_random_uuid()`]
workspace_id text [not null]
user_id text [not null]
preference jsonb [not null, default: `{}`]
created_at "timestamp with time zone" [not null, default: `now()`]
updated_at "timestamp with time zone" [not null, default: `now()`]
indexes {
(workspace_id, user_id) [name: 'workspace_user_settings_workspace_id_user_id_unique', unique]
user_id [name: 'workspace_user_settings_user_id_idx']
}
}
table workspaces {
id text [pk, not null]
slug varchar(100) [not null]
name varchar(255) [not null]
description varchar(1000)
avatar text
primary_owner_id text [not null]
settings jsonb [default: `{}`]
frozen boolean [default: false]
frozen_reason text
frozen_at "timestamp with time zone"
created_at "timestamp with time zone" [not null, default: `now()`]
updated_at "timestamp with time zone" [not null, default: `now()`]
indexes {
slug [name: 'workspaces_slug_idx', unique]
primary_owner_id [name: 'workspaces_primary_owner_id_idx']
}
}
ref: agent_skills.user_id - users.id
ref: agent_skills.zip_file_hash - global_files.hash_id
ref: accounts.user_id > users.id
ref: passkey.userId > users.id
ref: auth_sessions.user_id > users.id
ref: two_factor.user_id > users.id
ref: agent_eval_datasets.benchmark_id > agent_eval_benchmarks.id
ref: agent_eval_datasets.user_id - users.id
ref: agent_eval_run_topics.run_id > agent_eval_runs.id
ref: agent_eval_run_topics.topic_id - topics.id
ref: agent_eval_run_topics.test_case_id > agent_eval_test_cases.id
ref: agent_eval_runs.dataset_id > agent_eval_datasets.id
ref: agent_eval_runs.target_agent_id - agents.id
ref: agent_eval_runs.user_id - users.id
ref: agent_eval_test_cases.dataset_id > agent_eval_datasets.id
ref: agents_files.file_id > files.id
ref: agents_files.agent_id > agents.id
ref: agents_knowledge_bases.knowledge_base_id - knowledge_bases.id
ref: agents_knowledge_bases.agent_id > agents.id
ref: agents.id - agent_shares.agent_id
ref: agents_to_sessions.session_id > sessions.id
ref: agents_to_sessions.agent_id > agents.id
ref: chat_groups_agents.chat_group_id > chat_groups.id
ref: chat_groups_agents.agent_id > agents.id
ref: chat_groups_agents.user_id - users.id
ref: chat_groups.user_id - users.id
ref: unstructured_chunks.file_id - files.id
ref: document_chunks.document_id > documents.id
ref: document_comment_mentions.comment_id > document_comments.id
ref: document_comment_mentions.mentioned_user_id - users.id
ref: document_comment_mentions.workspace_id - workspaces.id
ref: document_comments.author_user_id - users.id
ref: document_comments.document_id > documents.id
ref: document_comments.workspace_id - workspaces.id
ref: document_histories.document_id > documents.id
ref: document_histories.user_id - users.id
ref: document_likes.document_id > documents.id
ref: document_likes.user_id - users.id
ref: document_likes.workspace_id - workspaces.id
ref: documents.file_id > files.id
ref: file_chunks.file_id - files.id
ref: file_chunks.chunk_id - chunks.id
ref: generations.file_id - files.id
ref: files.embedding_task_id - async_tasks.id
ref: files_to_sessions.file_id > files.id
ref: files_to_sessions.session_id > sessions.id
ref: generation_batches.user_id - users.id
ref: generation_batches.generation_topic_id > generation_topics.id
ref: generation_topics.user_id - users.id
ref: generations.user_id - users.id
ref: generations.generation_batch_id > generation_batches.id
ref: generations.async_task_id - async_tasks.id
ref: message_groups.user_id - users.id
ref: message_groups.topic_id - topics.id
ref: message_groups.parent_group_id > message_groups.id
ref: messages_files.file_id > files.id
ref: messages_files.message_id > messages.id
ref: messages.id - message_translates.id
ref: messages.session_id - sessions.id
ref: messages.parent_id - messages.id
ref: messages.topic_id - topics.id
ref: threads.source_message_id - messages.id
ref: messages.message_group_id > message_groups.id
ref: sessions.group_id - session_groups.id
ref: topic_comment_mentions.comment_id > topic_comments.id
ref: topic_comment_mentions.mentioned_user_id - users.id
ref: topic_comments.topic_id > topics.id
ref: topic_comments.message_id - messages.id
ref: topic_comments.author_user_id - users.id
ref: topic_comments.workspace_id - workspaces.id
ref: topic_documents.document_id > documents.id
ref: topic_documents.topic_id > topics.id
ref: topics.session_id - sessions.id