@@ -7,24 +7,33 @@ Jonathan D.A. Jewell <j.d.a.jewell@open.ac.uk>
77:icons: font
88:source-highlighter: rouge
99
10+ == Related repos
11+
12+ * https://github.com/hyperpolymath/verisimdb-data[`verisimdb-data`] —
13+ flat-file store for scan results and drift snapshots, and the dogfood
14+ site for the hyperpolymath Idris2 + Zig ABI shared with `proven`,
15+ `burble`, `gossamer`. Verisimiser does not require it.
16+
1017== What Is This?
1118
1219VeriSimiser augments existing databases with capabilities from
13- https://github.com/hyperpolymath/nextgen-databases[VeriSimDB]'s octad model —
14- specifically the capabilities that work as genuine piggybacks without requiring
15- you to replace your database .
20+ https://github.com/hyperpolymath/nextgen-databases[VeriSimDB]'s ** octad
21+ model** — eight concerns layered over any backend without forcing a
22+ schema migration .
1623
1724**Honest framing**: this is not a pure bolt-on like the language -isers.
1825Language -isers generate a separate wrapper alongside your code — one-way
1926dependency, your code untouched. Database augmentation is fundamentally
2027different because it interacts with shared mutable state. VeriSimiser is
2128therefore split into two tiers:
2229
23- * **Tier 1 (true piggyback)** — capabilities that sit alongside or in front
24- of your database, never touching its storage engine. These are safe bolt-ons.
25- * **Tier 2 (augmentation layer)** — capabilities that require additional
26- storage alongside your database. These are honest about being "VeriSimDB
27- with your database as one backend" rather than pretending to be invisible.
30+ * **Tier 1 (true piggyback)** — concerns that sit alongside or in front
31+ of your database, writing only to a sidecar and never touching your
32+ storage engine. Safe bolt-ons.
33+ * **Tier 2 (augmentation layer)** — modality overlays (graph, vector,
34+ tensor, semantic, document, spatial) that require additional storage
35+ alongside your database. Honest about being "VeriSimDB with your
36+ database as one backend" rather than pretending to be invisible.
2837
2938== VeriSimDB's Octad: Eight Concerns
3039
@@ -49,40 +58,19 @@ identity; see "Tier 2" below.)
4958| **Simulation** | "What if we changed this?" — sandbox branches that do not touch the main data. | Tier 2
5059|===
5160
61+ The codebase commits to this ontology in
62+ `src/abi/mod.rs::OctadDimension`, `src/manifest/mod.rs::OctadConfig`,
63+ and the codegen tables. See `docs/decisions/ADR-0001-octad-ontology.adoc`
64+ for why "concerns" was chosen over the alternative "modalities" framing.
65+
5266== Tier 1: True Piggybacks
5367
5468These work like PostGIS — they add capability without replacing anything.
5569
56- === Cross-Modal Drift Detection
57-
58- The jewel of VeriSimDB. Drift detection monitors whether representations
59- of the same entity stay consistent across modalities. VeriSimiser can
60- overlay drift detection onto any database:
61-
62- * Your database stores the primary data (unchanged)
63- * VeriSimiser maintains a lightweight **drift index** alongside it
64- * Queries pass through to your database normally
65- * VeriSimiser intercepts results and checks for cross-modal inconsistencies
66- * Alerts when representations drift apart
67-
68- This is a **read-path augmentation** — it observes query results, it doesn't
69- modify them. Safe to add, safe to remove, no data dependency.
70-
71- VeriSimDB detects eight categories of cross-modal drift:
72-
73- 1. Structural drift — schema changes not reflected across modalities
74- 2. Semantic drift — meaning divergence between representations
75- 3. Temporal drift — version skew between modalities
76- 4. Statistical drift — distribution shift in vector/tensor spaces
77- 5. Referential drift — broken links between graph and document modalities
78- 6. Provenance drift — transformation chain inconsistencies
79- 7. Spatial drift — coordinates inconsistent with other modalities
80- 8. Embedding drift — vector embeddings stale relative to source documents
81-
8270=== Provenance Tracking
8371
8472Hash-chain verified origin tracking for every piece of data. VeriSimiser
85- can add provenance to any database as a sidecar:
73+ adds provenance to any database as a sidecar:
8674
8775* Every write is intercepted and a provenance record created
8876* SHA-256 hash chain links provenance records in order
@@ -95,75 +83,103 @@ change what happened. The provenance chain is stored in a separate sidecar
9583
9684=== Temporal Versioning
9785
98- Automatic version history for entities. VeriSimiser can maintain a temporal
86+ Automatic version history for entities. VeriSimiser maintains a temporal
9987sidecar that records every state change:
10088
10189* Point-in-time queries: "what did this entity look like at time T?"
10290* Diff queries: "what changed between T1 and T2?"
10391* Rollback capability: restore any entity to a previous state
10492* Retention policies: auto-prune history older than N days
10593
106- This piggybacks onto write events (triggers, CDC, or application-level hooks)
107- and stores version history in a separate sidecar.
94+ This piggybacks onto write events (triggers, CDC, or application-level
95+ hooks) and stores version history in a separate sidecar.
96+
97+ === Constraints & Drift Detection
98+
99+ The Constraints concern enforces cross-dimensional invariants and
100+ observes *drift* — places where Data, Metadata, and any active Tier 2
101+ overlays disagree. Drift detection is a **read-path observer**: it
102+ inspects query results, never modifies them.
103+
104+ VeriSimiser tracks eight symptomatic categories (mapped onto the
105+ Constraints concern):
106+
107+ . **Structural drift** — schema changes not reflected across active overlays
108+ . **Semantic drift** — meaning divergence between overlays
109+ . **Temporal drift** — version skew between overlays
110+ . **Statistical drift** — distribution shift in vector/tensor overlays
111+ . **Referential drift** — broken links between the graph overlay and Data
112+ . **Provenance drift** — transformation-chain inconsistencies
113+ . **Spatial drift** — coordinates inconsistent with other overlays
114+ . **Embedding drift** — vector embeddings stale relative to source documents
115+
116+ (Each category needs a computable definition before it can be detected;
117+ this is on the roadmap, not implemented yet.)
118+
119+ === Lineage
120+
121+ Directed-edge graph of data derivation: which entity was derived from
122+ which other entity, and by what transformation. Intended as a DAG (cycle
123+ prevention enforcement is a future ADR).
124+
125+ === Access Control
126+
127+ Row-level and column-level policies evaluated at query time. Independent
128+ of any backend-native role system; verisimiser interprets policies and
129+ filters/redacts results.
108130
109131== Tier 2: Augmentation Layer
110132
111133These capabilities require additional storage alongside your database.
112- They're honest about being "VeriSimDB modalities with your database as the
113- document/primary store." This is still valuable — it's how you get octad
114- capabilities incrementally — but it's not a bolt-on .
134+ They are honest about being "VeriSimDB modalities with your database as
135+ the document/primary store." This is still valuable — it's how you get
136+ extra modality projections incrementally — but it's not invisible .
115137
116- * **Graph overlay**: Add RDF triples and property graph edges to entities
138+ * **Graph overlay**: Add RDF triples and property- graph edges to entities
117139 in your relational database. Stored in a separate graph index.
118- * **Vector overlay**: Add embeddings for similarity search. Stored in HNSW
119- index alongside your database.
140+ * **Vector overlay**: Add embeddings for similarity search. Stored in
141+ HNSW index alongside your database.
120142* **Tensor overlay**: Add multi-dimensional numeric data. Stored in
121143 ndarray-backed sidecar.
122144* **Semantic overlay**: Add type annotations and proof blobs. Stored in
123145 CBOR sidecar.
146+ * **Document overlay**: Add full-text search over text columns.
147+ Stored in a Tantivy index.
124148* **Spatial overlay**: Add geospatial coordinates. Stored in R-tree sidecar.
149+ * **Simulation**: Branched copies of data for what-if analysis. Stored
150+ in `verisimdb_simulation_branches` + `_deltas`.
125151
126- Each Tier 2 modality has its own storage and can be enabled independently.
127- Your primary database remains the source of truth for its native data.
152+ Each Tier 2 overlay has its own storage and can be enabled
153+ independently. Your primary database remains the source of truth for
154+ its native data.
128155
129156== The Manifest
130157
131158[source,toml]
132159----
133- [verisimiser ]
160+ [project ]
134161name = "my-augmented-db"
162+ version = "0.1.0"
135163
136164[database]
137- target-db = "postgresql"
138- connection-string = "postgres://localhost/mydb"
139-
140- # Tier 1: true piggybacks (no additional storage in your database)
141- [tier1]
142- drift-detection = true # cross-modal drift monitoring
143- provenance = true # SHA-256 hash-chain audit trail
144- temporal-versioning = true # automatic version history
145-
146- [tier1.provenance]
147- sidecar = "sqlite" # sqlite | file | verisim
148- sidecar-path = ".verisimiser/provenance.db"
149-
150- [tier1.temporal]
151- sidecar = "sqlite"
152- retention-days = 90
153-
154- # Tier 2: augmentation layer (additional storage alongside your database)
155- [tier2]
156- graph = false # RDF/property graph overlay
157- vector = false # embedding similarity search
158- tensor = false # multi-dimensional numeric
159- semantic = false # type annotations + proof blobs
160- spatial = false # geospatial coordinates
161-
162- [tier2.vector]
163- # model = "sentence-transformers/all-MiniLM-L6-v2"
164- # dimensions = 384
165+ backend = "sqlite" # sqlite | postgresql | mongodb
166+ connection-string-env = "DATABASE_URL" # env var; never the literal secret
167+ schema-source = "schema.sql" # optional; SQL DDL describing target schema
168+
169+ [octad]
170+ enable-provenance = true
171+ enable-lineage = true
172+ enable-temporal = true
173+ enable-access-control = true
174+ enable-simulation = false # Tier 2: branching/sandboxing
175+
176+ [sidecar]
177+ storage = "sqlite" # sqlite (default) | json
178+ path = ".verisim/sidecar.db"
165179----
166180
181+ Run `verisimiser init --database sqlite` to generate a starter manifest.
182+
167183== Architecture
168184
169185[source]
@@ -172,52 +188,73 @@ Your Application
172188 │
173189 ├──── writes ────► Your Database (unchanged)
174190 │ │
175- │ VeriSimiser intercepts
191+ │ VeriSimiser intercepts (write-path observer)
176192 │ │
177193 │ ┌─────────────┼──────────────┐
178194 │ │ │ │
179- │ Drift Index Provenance Temporal
180- │ (Tier 1) Sidecar Sidecar
181- │ (Tier 1) (Tier 1)
195+ │ Provenance Temporal Lineage / AccessControl /
196+ │ sidecar sidecar Constraints sidecars (Tier 1)
182197 │
183- └──── optional ──► Tier 2 Sidecars
184- (Graph, Vector, Tensor,
185- Semantic , Spatial)
198+ └──── optional ──► Tier 2 modality overlays
199+ (Graph, Vector, Tensor, Semantic,
200+ Document , Spatial, Simulation )
186201----
187202
188- **Interception methods** (configurable per database):
203+ **Interception methods** (configurable per database — most are still
204+ roadmap items, see `ROADMAP.adoc`):
189205
190206* **PostgreSQL**: logical replication / `pg_notify` / triggers
191207* **SQLite**: `sqlite3_update_hook` / WAL monitoring
192208* **MongoDB**: change streams
193209* **Application-level**: middleware / ORM hooks
194210
211+ == ABI
212+
213+ The Application Binary Interface for the augmentation layer is declared
214+ in two languages:
215+
216+ * `src/interface/abi/` — Idris2 type definitions
217+ (`Types.idr`, `Layout.idr`, `Foreign.idr`). These are the canonical
218+ shapes; formal proofs of correctness against them are future work
219+ (see `docs/decisions/ADR-0002-verification-tree.adoc`).
220+ * `src/interface/ffi/` — Zig C-compatible FFI implementing the Idris2
221+ ABI for use from native code.
222+
223+ The Rust `src/abi/mod.rs` mirrors the Idris2 types as plain structs
224+ used directly by the CLI and codegen.
225+
195226== Relationship to VeriSimDB
196227
197228VeriSimiser is NOT a replacement for VeriSimDB. It's a gateway drug.
198229
199- * **VeriSimiser Tier 1** gives you drift detection, provenance, and temporal
200- versioning on your existing database. Zero commitment.
201- * **VeriSimiser Tier 2** gives you individual octad modalities as sidecars.
202- Incremental adoption.
203- * **Full VeriSimDB** gives you the complete octad with native cross-modal
204- querying, VCL, and built-in drift normalisation. Full commitment.
230+ * **VeriSimiser Tier 1** gives you provenance, temporal, lineage,
231+ access control, and constraints/drift detection on your existing
232+ database. Zero commitment.
233+ * **VeriSimiser Tier 2** gives you individual modality overlays
234+ (graph/vector/tensor/semantic/document/spatial) and simulation as
235+ sidecars. Incremental adoption.
236+ * **Full VeriSimDB** gives you the complete model with native
237+ cross-modal querying, VCL, and built-in drift normalisation. Full
238+ commitment.
205239
206- The migration path is: Tier 1 → Tier 2 → full VeriSimDB (if you want it).
207- Most users will be happy at Tier 1 or Tier 2.
240+ The migration path is: Tier 1 → Tier 2 → full VeriSimDB (if you want
241+ it). Most users will be happy at Tier 1 or Tier 2.
208242
209243== Integration with TypedQLiser
210244
211- VeriSimiser works alongside https://github.com/hyperpolymath/typedqliser[TypedQLiser]:
245+ VeriSimiser works alongside
246+ https://github.com/hyperpolymath/typedqliser[TypedQLiser]:
212247
213248* TypedQLiser type-checks your queries (compile-time, no runtime cost)
214- * VeriSimiser augments your database with octad capabilities (runtime)
249+ * VeriSimiser augments your database with octad concerns (runtime)
215250* Together: formally verified queries against an augmented database
216251
217252== Status
218253
219- **Pre-alpha.** Architecture defined, tier system designed. Tier 1 (drift
220- detection, provenance, temporal versioning) is the priority implementation.
254+ **Pre-alpha.** Architecture defined, octad ontology pinned (ADR-0001),
255+ codegen scaffolding in place. The next implementation milestone is V-L1-C1:
256+ end-to-end SQLite Tier 1 piggyback (`sqlite3_update_hook` →
257+ `verisimdb_provenance_log` sidecar). See `ROADMAP.adoc`.
221258
222259Part of the https://github.com/hyperpolymath/iseriser[-iser family].
223260**#3 priority** (after TypedQLiser and Chapeliser).
0 commit comments