Schema

The cloud schema mirrors the local SQLite graph. All tables live in the public schema with Row-Level Security enabled on every table.

workspaces

id          uuid          primary key
slug        text unique   URL-safe name (e.g. "acme-corp")
name        text
plan        text          individual | team | company
created_at  timestamptz

workspace_members

workspace_id  uuid   → workspaces
user_id       uuid   → auth.users
role          text   owner | admin | member
joined_at     timestamptz
primary key (workspace_id, user_id)

repos

id            uuid          primary key
workspace_id  uuid          → workspaces
name          text          human label (e.g. "api-service")
root_path     text          abs path on the machine that last scanned
last_scanned  timestamptz
created_at    timestamptz
unique (workspace_id, name)

nodes

id          uuid    primary key
repo_id     uuid    → repos
rel_path    text    relative to repo root, with extension
abs_path    text    last known absolute path (informational)
input_hash  text    sha256 of raw source bytes
scanned_at  timestamptz
unique (repo_id, rel_path)

exports

id         uuid    primary key
node_id    uuid    → nodes
name       text    exported symbol name
kind       text    function | class | variable | type | interface | enum | namespace | reexport | default
signature  text    compact signature from the parsed AST

edges

id             uuid     primary key
from_node_id   uuid     → nodes
to_node_id     uuid     → nodes  (null = external or unresolved)
specifier      text     the literal import string
is_local       boolean  true for intra-repo imports
is_cross_repo  boolean
package_name   text     npm package name for external imports
symbols        jsonb    imported symbol names

summaries

node_id       uuid        primary key → nodes
purpose       text        LLM-generated purpose description
summary_hash  text        sha256(input_hash + model + prompt_version)
model         text        model used for generation
cost_usd      real
tokens_in     integer
tokens_out    integer
generated_at  timestamptz

api_keys

id            uuid    primary key
workspace_id  uuid    → workspaces
key_hash      text    sha256 of the raw key — raw key never stored
label         text
created_by    uuid    → auth.users
created_at    timestamptz
last_used_at  timestamptz
revoked_at    timestamptz