VALAK / ENGINEERINGDATA ARCHITECTURE · SOURCE REFERENCE

TECHNICAL REFERENCE / 01

One product.
Three persistence layers.

Entity relationships, physical declarations and migration evidence for the Valak data platform and agent runtime.

PostgreSQL + pgvectorClickHouseSQLiteRead-only reference

Download this database reference as one offline HTML file →

Reviewed source: 352e3b2 · work/claude-delivery snapshot · 15 October 2026

Persistence architecture

POSTGRESQL

Context & governance

Equipment, signals, identity, documents, settings, actions and audit workflows. pgvector stores document embeddings here.

CLICKHOUSE

Measurement history

Timestamped readings, quality, event identity, provenance, latest-state projection and publisher observations.

SQLITE

Agent experience

Lifecycle objects, layered plant memory, and separate framework-managed checkpoints and notebook storage.

LOGICAL ENTITY RELATIONSHIPS

Plant context & documents

FK = declared foreign key
PostgreSQL core entity relationship diagramSite has equipment, equipment has tags, documents, failure modes and external keys. Person owns equipment. RAG documents have chunks. Equipment references on RAG documents are application scope rather than a declared foreign key in the initial migration.siteid PK · parent_id FKpersonid PK · nameequipmentid PK · site_id FKowner_id FKtagequipment_id FKrag_docsid PK · org · equipment_idrag_chunksdoc_id FK · vector(1536)document / failure_mode / external_keyequipment_id FK1 : N1 : Nequipment → rag_docs: application scope

Core subset, not all 62 PostgreSQL table names. Solid lines represent declared relationships; equipment-to-RAG association is application scope, not an initial FK.

PHYSICAL STORE / CLICKHOUSE

From readings to current state

Inspect columns →
ClickHouse table and materialized-view data flowIngestion writes tag_values. A materialized view tag_latest_mv updates the tag_latest aggregate projection. tag_meta holds metadata, publisher_state records lifecycle observations, and ai_usage records model usage separately. Shared organization and signal identifiers are application joins, not foreign keys.valak-ingestValidated telemetryDurable journal → committag_valuesorg · tag · ts · event_idvalue · quality · provenanceReplacingMergeTreetag_latest_mvMaterialized viewAggregates inserted rowstag_latestLatest-value aggregateAggregatingMergeTreetag_metaorg + tagUnits · type · descriptionpublisher_stateorg + node + deviceLifecycle · receipt/order timesai_usageorg + endpoint + modelUsage accounting, separate writerShared identifiers support application queries. These are NOT foreign-key links.

History key

(org, tag, ts, event_id)
Monthly partitions by toYYYYMM(ts). ReplacingMergeTree deduplication is merge-based, not a synchronous unique constraint.

Projection variants

Source contains legacy and boot-scoped latest projections. Active shape depends on migration/cutover. The catalog labels its representative variant.

Retention

VALAK_RETENTION_DAYS controls age expiry; zero means no age TTL. A configured minimum floor applies. Verify actual installed TTL and disk capacity.

AGENT STATE / SQLITE

JSON-backed records, not one table per agent

objects

Composite key (kind, id). The data TEXT column stores JSON for agent definitions, runs, findings and audit objects.

memory

Composite key (scope, kind, id). Indexed by agent or equipment and time. JSON stores episodes, profiles and lessons.

Framework storage

LangGraph owns checkpoint/notebook schemas. Their dependency DDL was not inspected for this snapshot; no guessed column definitions are presented.

DATA DICTIONARY / SOURCE DECLARATIONS

Find a table, column or type

Interpretation & verification

Source links point to a pinned private repository revision and may require GitHub access. This page itself works offline.