Data models: research objects
Assets, notes, and the module and workflow tables reserved for later milestones. Part of the data model reference.
ResearchAsset, AssetObservation, AssetRelation, AssetEvent, AssetSyncState
Files: research_asset.py, asset_graph.py · Tables:research_assets, asset_observations, asset_relations, asset_events, asset_sync_states · Exposure: REST /vaults/{id}/assets and MCP asset_* (interface in progress) · Migration: b7e5c3a9d2f8 (additive). Full contract in Asset Intelligence.
| Model | Key fields |
|---|---|
ResearchAsset | vault_id (FK, cascade), asset_type, key (unique per vault and type), value, host, review (discovered / accepted / ignored), scope (in / out / unknown, computed), active, first_seen_at, last_seen_at, reviewed_at, observation_count, confidence, sources JSON, attributes JSON, custom_fields JSON, origin, actor |
AssetObservation | asset_id (cascade), vault_id, source_kind, source_ref (unique per asset and kind), source_id, observed_at, confidence, details |
AssetRelation | source_asset_id / target_asset_id (cascade), relation, peer_kind (asset / finding / target), peer_id (unique per source, relation, peer), origin, sources, confidence, observation_count, first / last seen, details |
AssetEvent | asset_id (cascade), kind, actor, details; newest 100 per asset kept |
AssetSyncState | vault_id (unique), flow_watermark, synced_at, rebuilt_at, stats |
Types, states, sources and relations are plain strings (enums in app/core/assets/types.py), so no database enum type exists.
Retired assets table. The earlier target-scoped Asset model (AssetType, AssetStatus, global SHA-256 asset_hash) was schema only and never written. Its table stays in existing databases, unmapped and ignored by alembic check (RETIRED_TABLES); the migration copied its rows of known types into research_assets.
Module
File: module.py · Table: modules · Exposure: schema only, not exposed yet
A reusable scanner module, meant to be loaded dynamically by python_class. Scans run through the engine registry (GET /api/v1/engines) and do not create Module rows today, so Scan.module_id stays null.
| Field | Type | Notes |
|---|---|---|
name | String(255) | Not null, unique, indexed |
display_name | String(255) | Not null |
module_type | Enum ModuleType | Not null |
version | String(50) | Not null |
description | Text | Nullable |
author | String(100) | Nullable |
icon | String(50) | Nullable |
python_class | String(255) | Not null, dotted path to the implementation |
default_config | JSON | Default {} |
required_config | JSON | Default [] |
outputs | JSON | Default [] |
dependencies | JSON | Default [] |
tags | JSON | Default [] |
is_active | Boolean | Default True |
status | Enum ModuleStatus | Nullable, default ACTIVE |
execution_count | Integer | Default 0 |
average_duration | Integer | Default 0 |
success_rate | Integer | Not null, default 100, range 0 to 100 |
documentation_url | String(500) | Nullable |
Relationships: scans (backref from Scan.module).
Methods: increment_execution(), activate(), deactivate(), record_execution(duration, success), which updates the running average duration and moves success_rate up or down by 1 (clamped to 0 to 100).
ModuleType
RECONNAISSANCE, VULNERABILITY, EXPLOITATION, INTELLIGENCE, NETWORK, UTILITY, CUSTOM, WEB
ModuleStatus
ACTIVE, INACTIVE, DEPRECATED, TESTING
Workflow
File: workflow.py · Table: workflows · Exposure: schema only, not exposed yet
Automated scan chains, for example Subdomain Enum → DNS Resolution → Port Scan → Vuln Scan.
| Field | Type | Notes |
|---|---|---|
name | String(255) | Not null, unique |
description | Text | Nullable |
vault_id | FK → vaults.id | Nullable, ON DELETE CASCADE |
steps | JSON | Not null, step definitions |
triggers | JSON | Default [] |
schedule | String(100) | Nullable |
is_active | Boolean | Default True |
status | Enum WorkflowStatus | Nullable, default DRAFT |
execution_count | Integer | Default 0 |
last_executed_at | DateTime | Nullable |
Relationships: vault (backref Vault.workflows).
WorkflowStatus
DRAFT, ACTIVE, PAUSED, ARCHIVED
Note, NoteFolder, NoteRevision, NoteLink
File: notes.py · Tables: research_notes, note_folders, note_revisions, note_links, note_tags · Exposure: API (Research notes)
The research notebook. A Note (research_notes) belongs to a vault (ON DELETE CASCADE) and optionally a NoteFolder (ON DELETE SET NULL).
| Field | Type | Notes |
|---|---|---|
vault_id | FK → vaults.id | Not null, ON DELETE CASCADE |
folder_id | FK → note_folders.id | Nullable, ON DELETE SET NULL |
title | String(200) | Not null |
body | Text | Not null, Markdown up to 1 MiB |
size, tasks_total, tasks_done | Integer | Read from the body on save |
pinned | Boolean | Default False |
template | String(16) | Nullable: journal, hypothesis, checklist, timeline, finding |
actor | String(8) | user or agent (last writer) |
archived_at | DateTime (tz) | Nullable |
Relationships: tags (many-to-many with Tag through note_tags, both sides ON DELETE CASCADE).
NoteFolder (note_folders): vault_id (CASCADE), parent_id (self, SET NULL), name String(100). NoteRevision (note_revisions): note_id (CASCADE), title, body, size, actor, created_at, updated_at. NoteLink (note_links): primary key (note_id, kind, object_id), vault_id; no foreign key to the referenced object, so deleting an object never touches a note.
The initial schema's notes table (fields title, content, note_type, note_tags, is_pinned, vault_id, target_id) was an early draft that nothing used. It stays in existing databases, is no longer mapped, and is ignored by alembic check (RETIRED_TABLES in migrations/env.py).
VaultFile, FileRevision
File: vault_file.py · Tables: vault_files, file_revisions, file_tags · Exposure: API (Vault files)
A VaultFile (vault_files) is the metadata of one file of a vault; contents live in the managed storage outside the database (File storage).
| Field | Type | Notes |
|---|---|---|
vault_id | FK → vaults.id | Not null, ON DELETE CASCADE |
folder_id | FK → note_folders.id | Nullable, ON DELETE SET NULL; the folder tree shared with notes |
note_id | FK → research_notes.id | Nullable, unique, ON DELETE CASCADE; set for Markdown files that are notes |
name, name_key | String(255) | NFC name; case-folded key for the per-folder uniqueness check |
extension | String(32) | Lower case, without the dot |
mime, kind | String(127), String(16) | Read from the bytes; kind markdown, text, image, pdf, archive, executable, binary |
size | BigInteger | Bytes of the current content |
sha256 | String(64) | Checksum of the current content |
storage_ref | String(96) | local:v<vault>/<sha256>; null for note-backed files |
revision, version | Integer | Current revision number; change counter for optimistic concurrency |
flags | JSON | executable, script, active_content, mime_mismatch |
quarantined | Boolean | Never read as text or sent to agents |
source, origin | String(16), String(255) | upload, created, duplicate; uploaded name or file:<id> |
pinned | Boolean | Bookmark (a note-backed file uses the note's) |
actor, agent_id | String(8), FK → agents.id | Last writer, SET NULL |
creator, creator_agent_id | String(8), FK → agents.id | First writer, SET NULL |
archived_at, trashed_at | DateTime (tz) | Nullable |
Relationships: tags (many-to-many with Tag through file_tags, both sides ON DELETE CASCADE).
FileRevision (file_revisions): file_id (CASCADE), vault_id (CASCADE), number (unique per file), size, sha256, storage_ref, mime, message, actor, agent_id (SET NULL), created_at. Revisions are immutable and reference content-addressed bytes; stored contents are removed only when no revision references them.
FileAttachment (file_attachments, file_attachment.py): vault_id (CASCADE), file_id (SET NULL, so evidence outlives a purged file), object_kind (finding or report), object_id (no foreign key; removed with the object), revision (pinned; null for a note's file), name, size, sha256, mime as attached, note, actor, agent_id (SET NULL), created_at, updated_at. Unique per file and object.