Skip to content

Data models ​

These pages list every SQLAlchemy model in backend/app/models/. Concrete models inherit from BaseModel, which provides id, created_at and updated_at. The schema is managed by Alembic (backend/migrations/), and migrations/env.py imports app.models to collect the metadata.

Each model is marked with how it is exposed today:

  • API: has REST endpoints under /api/v1 (and the matching MCP tools) and is used by the UI.
  • Schema only, not exposed yet: the table exists, but no router, service or UI reads or writes it.
ModelTableExposure
VaultvaultsAPI: /vaults
TargettargetsAPI: /vaults/{id}/targets
ScanscansAPI: /vaults/{id}/scans, /engines
FindingfindingsAPI: /findings
SignaturesignaturesAPI: /signatures
ProxyFlowproxy_flowsAPI: /vaults/{id}/flows, /vaults/{id}/replay
WsSession, WsFramews_sessions, ws_framesAPI: /vaults/{id}/flows/{flow_id}/frames (WebSocket sessions)
AppSettingapp_settingsIndirect: through /proxy/settings, /proxy/intercept and /proxy/intercept/rules
ResearchAsset, AssetObservation, AssetRelation, AssetEvent, AssetSyncStateresearch_assets, asset_observations, asset_relations, asset_events, asset_sync_statesAPI: /vaults/{id}/assets (Asset Intelligence)
ModulemodulesSchema only, not exposed yet
WorkflowworkflowsSchema only, not exposed yet
Note, NoteFolder, NoteRevision, NoteLinkresearch_notes, note_folders, note_revisions, note_links, note_tagsAPI: /vaults/{id}/notes (Research notes)
VaultFile, FileRevision, FileAttachmentvault_files, file_revisions, file_tags, file_attachmentsAPI: /vaults/{id}/files (Vault files)
ComparisoncomparisonsAPI: /vaults/{id}/comparisons (Comparer)
AgentToken, Agent, AgentAuditagent_tokens, agent_token_vaults, agents, agent_auditAPI: /connections/... (user only; Agent authentication)
Agent Bridge modelsagent_conversations, agent_messages, agent_tasks, agent_approvals, agent_events, workspace_contextsAPI: /bridge/... (agents with bridge grants and the user; Agent Bridge protocol)
SystemConfigsystem_configsNot in the schema: no migration creates the table

Pages ​

PageModels
Vaults, targets, scans and findingsVault, Target, Scan, Finding, Signature
Traffic and settingsProxyFlow, WsSession, WsFrame, AppSetting
Research objectsResearchAsset, AssetObservation, AssetRelation, AssetEvent, AssetSyncState, Module, Workflow, Note, NoteFolder, NoteRevision, NoteLink, VaultFile, FileRevision
Agents and systemAgentToken, Agent, AgentAudit, Agent Bridge models, SystemConfig

BaseModel ​

File: base.py · Abstract: yes

FieldTypeNotes
idIntegerPrimary key, indexed
created_atDateTime (tz)server_default=now() on insert
updated_atDateTime (tz)Set to now() on update; null until the first update

Relationship map ​

Vault ──┬── Target ──┬── Scan ──── Finding
        │            ├── Finding
        │            └── (self: parent / children)
        ├── ProxyFlow
        ├── ResearchAsset ──┬── AssetObservation (source by id, no FK)
        │                   ├── AssetRelation (to asset FK; finding / target by id)
        │                   └── AssetEvent
        ├── AssetSyncState
        ├── Workflow
        ├── NoteFolder ── (self: parent)
        └── Note ──┬── NoteRevision
                   ├── NoteLink (kind + object id, no FK)
                   └── Tag (note_tags)

Module ──── Scan
Signature ── Finding
Finding ──── (self: duplicate_of_id, FK only)
AppSetting   (standalone key/value)
AgentToken ──┬── agent_token_vaults ── Vault
             ├── Agent
             └── AgentAudit (agent, token SET NULL; vault by id)
Vault ──┬── AgentConversation ──┬── AgentMessage (seq per conversation)
        │                       └── (agent SET NULL)
        ├── AgentTask ── (conversation, agents SET NULL)
        ├── AgentApproval ── (task, conversation CASCADE)
        └── WorkspaceContextRecord (one per vault)
AgentEvent   (vault, conversation, agent by id; ordered log)
SystemConfig (standalone, not migrated)

Delete behaviour: deleting a Vault removes its Targets, ProxyFlows, Workflows, Notes and note folders (database CASCADE). Deleting a Vault also removes its assets with their observations, relations, history and sync state, and its Bridge conversations, messages, tasks, approvals and saved context (Bridge events keep plain ids and age out with retention). Deleting a Target removes its Scans and Findings (asset edges to them are dropped at the next sync); notes that reference them keep the reference, which reads as missing. Deleting a Scan keeps its Findings and sets their scan_id to null.