@@ -7,77 +7,67 @@ 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
29- == VeriSimDB's Octad: Eight Modalities
38+ == The Octad: Eight Concerns
3039
31- Each entity in VeriSimDB exists simultaneously across up to 8 representations:
40+ Every entity in a verisimiser-augmented database is observable along up
41+ to eight concerns. Two are inherent to the target database (always on);
42+ the remaining six are added by sidecars.
3243
33- [cols="1,2,1 ,1"]
44+ [cols="1,3,2 ,1"]
3445|===
35- | Modality | Purpose | Storage | VeriSimiser Tier
36-
37- | **Graph ** | RDF triples and property graph edges | Pure Rust | Tier 2
38- | **Vector ** | Embeddings for similarity search | HNSW | Tier 2
39- | **Tensor ** | Multi-dimensional numeric data | ndarray/Burn | Tier 2
40- | **Semantic ** | Type annotations and CBOR proof blobs | CBOR | Tier 2
41- | **Document ** | Full-text searchable content | Tantivy | Tier 2
42- | **Temporal ** | Version history and time-series | chrono | Tier 1 ✓
43- | **Provenance ** | Origin tracking and transformation chain | SHA-256 hash-chain | Tier 1 ✓
44- | **Spatial ** | Geospatial coordinates and geometries | R-tree | Tier 2
46+ | Concern | Purpose | Sidecar storage | Tier
47+
48+ | **Data ** | The original entity as stored in the target DB | (target DB itself) | inherent
49+ | **Metadata ** | Schema and type information extracted from the target DB | `verisimdb_metadata` | inherent
50+ | **Provenance ** | SHA-256 hash-chain of who did what and when | `verisimdb_provenance_log` | Tier 1 ✓
51+ | **Lineage ** | Directed-edge graph of data derivation (intended DAG; see ADR future) | `verisimdb_lineage_graph` | Tier 1
52+ | **Constraints ** | Cross-dimensional invariants and drift between Data + Metadata + overlays | (rules + observers, not a table) | Tier 1
53+ | **AccessControl ** | Row/column-level access policies evaluated at query time | `verisimdb_access_policies` | Tier 1
54+ | **Temporal ** | Version history with point-in-time queries and rollback | `verisimdb_temporal_versions` | Tier 1 ✓
55+ | **Simulation ** | What-if branching and sandbox query execution | `verisimdb_simulation_branches` + `_deltas` | Tier 2
4556|===
4657
58+ The codebase commits to this ontology in
59+ `src/abi/mod.rs::OctadDimension`, `src/manifest/mod.rs::OctadConfig`,
60+ and the codegen tables. See `docs/decisions/ADR-0001-octad-ontology.adoc`
61+ for why "concerns" was chosen over the alternative "modalities" framing.
62+
4763== Tier 1: True Piggybacks
4864
4965These work like PostGIS — they add capability without replacing anything.
5066
51- === Cross-Modal Drift Detection
52-
53- The jewel of VeriSimDB. Drift detection monitors whether representations
54- of the same entity stay consistent across modalities. VeriSimiser can
55- overlay drift detection onto any database:
56-
57- * Your database stores the primary data (unchanged)
58- * VeriSimiser maintains a lightweight **drift index** alongside it
59- * Queries pass through to your database normally
60- * VeriSimiser intercepts results and checks for cross-modal inconsistencies
61- * Alerts when representations drift apart
62-
63- This is a **read-path augmentation** — it observes query results, it doesn't
64- modify them. Safe to add, safe to remove, no data dependency.
65-
66- VeriSimDB detects eight categories of cross-modal drift:
67-
68- 1. Structural drift — schema changes not reflected across modalities
69- 2. Semantic drift — meaning divergence between representations
70- 3. Temporal drift — version skew between modalities
71- 4. Statistical drift — distribution shift in vector/tensor spaces
72- 5. Referential drift — broken links between graph and document modalities
73- 6. Provenance drift — transformation chain inconsistencies
74- 7. Spatial drift — coordinates inconsistent with other modalities
75- 8. Embedding drift — vector embeddings stale relative to source documents
76-
7767=== Provenance Tracking
7868
7969Hash-chain verified origin tracking for every piece of data. VeriSimiser
80- can add provenance to any database as a sidecar:
70+ adds provenance to any database as a sidecar:
8171
8272* Every write is intercepted and a provenance record created
8373* SHA-256 hash chain links provenance records in order
@@ -90,75 +80,103 @@ change what happened. The provenance chain is stored in a separate sidecar
9080
9181=== Temporal Versioning
9282
93- Automatic version history for entities. VeriSimiser can maintain a temporal
83+ Automatic version history for entities. VeriSimiser maintains a temporal
9484sidecar that records every state change:
9585
9686* Point-in-time queries: "what did this entity look like at time T?"
9787* Diff queries: "what changed between T1 and T2?"
9888* Rollback capability: restore any entity to a previous state
9989* Retention policies: auto-prune history older than N days
10090
101- This piggybacks onto write events (triggers, CDC, or application-level hooks)
102- and stores version history in a separate sidecar.
91+ This piggybacks onto write events (triggers, CDC, or application-level
92+ hooks) and stores version history in a separate sidecar.
93+
94+ === Constraints & Drift Detection
95+
96+ The Constraints concern enforces cross-dimensional invariants and
97+ observes *drift* — places where Data, Metadata, and any active Tier 2
98+ overlays disagree. Drift detection is a **read-path observer**: it
99+ inspects query results, never modifies them.
100+
101+ VeriSimiser tracks eight symptomatic categories (mapped onto the
102+ Constraints concern):
103+
104+ . **Structural drift** — schema changes not reflected across active overlays
105+ . **Semantic drift** — meaning divergence between overlays
106+ . **Temporal drift** — version skew between overlays
107+ . **Statistical drift** — distribution shift in vector/tensor overlays
108+ . **Referential drift** — broken links between the graph overlay and Data
109+ . **Provenance drift** — transformation-chain inconsistencies
110+ . **Spatial drift** — coordinates inconsistent with other overlays
111+ . **Embedding drift** — vector embeddings stale relative to source documents
112+
113+ (Each category needs a computable definition before it can be detected;
114+ this is on the roadmap, not implemented yet.)
115+
116+ === Lineage
117+
118+ Directed-edge graph of data derivation: which entity was derived from
119+ which other entity, and by what transformation. Intended as a DAG (cycle
120+ prevention enforcement is a future ADR).
121+
122+ === Access Control
123+
124+ Row-level and column-level policies evaluated at query time. Independent
125+ of any backend-native role system; verisimiser interprets policies and
126+ filters/redacts results.
103127
104128== Tier 2: Augmentation Layer
105129
106130These capabilities require additional storage alongside your database.
107- They're honest about being "VeriSimDB modalities with your database as the
108- document/primary store." This is still valuable — it's how you get octad
109- capabilities incrementally — but it's not a bolt-on .
131+ They are honest about being "VeriSimDB modalities with your database as
132+ the document/primary store." This is still valuable — it's how you get
133+ extra modality projections incrementally — but it's not invisible .
110134
111- * **Graph overlay**: Add RDF triples and property graph edges to entities
135+ * **Graph overlay**: Add RDF triples and property- graph edges to entities
112136 in your relational database. Stored in a separate graph index.
113- * **Vector overlay**: Add embeddings for similarity search. Stored in HNSW
114- index alongside your database.
137+ * **Vector overlay**: Add embeddings for similarity search. Stored in
138+ HNSW index alongside your database.
115139* **Tensor overlay**: Add multi-dimensional numeric data. Stored in
116140 ndarray-backed sidecar.
117141* **Semantic overlay**: Add type annotations and proof blobs. Stored in
118142 CBOR sidecar.
143+ * **Document overlay**: Add full-text search over text columns.
144+ Stored in a Tantivy index.
119145* **Spatial overlay**: Add geospatial coordinates. Stored in R-tree sidecar.
146+ * **Simulation**: Branched copies of data for what-if analysis. Stored
147+ in `verisimdb_simulation_branches` + `_deltas`.
120148
121- Each Tier 2 modality has its own storage and can be enabled independently.
122- Your primary database remains the source of truth for its native data.
149+ Each Tier 2 overlay has its own storage and can be enabled
150+ independently. Your primary database remains the source of truth for
151+ its native data.
123152
124153== The Manifest
125154
126155[source,toml]
127156----
128- [verisimiser ]
157+ [project ]
129158name = "my-augmented-db"
159+ version = "0.1.0"
130160
131161[database]
132- target-db = "postgresql"
133- connection-string = "postgres://localhost/mydb"
134-
135- # Tier 1: true piggybacks (no additional storage in your database)
136- [tier1]
137- drift-detection = true # cross-modal drift monitoring
138- provenance = true # SHA-256 hash-chain audit trail
139- temporal-versioning = true # automatic version history
140-
141- [tier1.provenance]
142- sidecar = "sqlite" # sqlite | file | verisim
143- sidecar-path = ".verisimiser/provenance.db"
144-
145- [tier1.temporal]
146- sidecar = "sqlite"
147- retention-days = 90
148-
149- # Tier 2: augmentation layer (additional storage alongside your database)
150- [tier2]
151- graph = false # RDF/property graph overlay
152- vector = false # embedding similarity search
153- tensor = false # multi-dimensional numeric
154- semantic = false # type annotations + proof blobs
155- spatial = false # geospatial coordinates
156-
157- [tier2.vector]
158- # model = "sentence-transformers/all-MiniLM-L6-v2"
159- # dimensions = 384
162+ backend = "sqlite" # sqlite | postgresql | mongodb
163+ connection-string-env = "DATABASE_URL" # env var; never the literal secret
164+ schema-source = "schema.sql" # optional; SQL DDL describing target schema
165+
166+ [octad]
167+ enable-provenance = true
168+ enable-lineage = true
169+ enable-temporal = true
170+ enable-access-control = true
171+ enable-simulation = false # Tier 2: branching/sandboxing
172+
173+ [sidecar]
174+ storage = "sqlite" # sqlite (default) | json
175+ path = ".verisim/sidecar.db"
160176----
161177
178+ Run `verisimiser init --database sqlite` to generate a starter manifest.
179+
162180== Architecture
163181
164182[source]
@@ -167,53 +185,74 @@ Your Application
167185 │
168186 ├──── writes ────► Your Database (unchanged)
169187 │ │
170- │ VeriSimiser intercepts
188+ │ VeriSimiser intercepts (write-path observer)
171189 │ │
172190 │ ┌─────────────┼──────────────┐
173191 │ │ │ │
174- │ Drift Index Provenance Temporal
175- │ (Tier 1) Sidecar Sidecar
176- │ (Tier 1) (Tier 1)
192+ │ Provenance Temporal Lineage / AccessControl /
193+ │ sidecar sidecar Constraints sidecars (Tier 1)
177194 │
178- └──── optional ──► Tier 2 Sidecars
179- (Graph, Vector, Tensor,
180- Semantic , Spatial)
195+ └──── optional ──► Tier 2 modality overlays
196+ (Graph, Vector, Tensor, Semantic,
197+ Document , Spatial, Simulation )
181198----
182199
183- **Interception methods** (configurable per database):
200+ **Interception methods** (configurable per database — most are still
201+ roadmap items, see `ROADMAP.adoc`):
184202
185203* **PostgreSQL**: logical replication / `pg_notify` / triggers
186204* **MySQL**: binlog CDC / triggers
187205* **SQLite**: `sqlite3_update_hook` / WAL monitoring
188206* **MongoDB**: change streams
189207* **Application-level**: middleware / ORM hooks
190208
209+ == ABI
210+
211+ The Application Binary Interface for the augmentation layer is declared
212+ in two languages:
213+
214+ * `src/interface/abi/` — Idris2 type definitions
215+ (`Types.idr`, `Layout.idr`, `Foreign.idr`). These are the canonical
216+ shapes; formal proofs of correctness against them are future work
217+ (see `docs/decisions/ADR-0002-verification-tree.adoc`).
218+ * `src/interface/ffi/` — Zig C-compatible FFI implementing the Idris2
219+ ABI for use from native code.
220+
221+ The Rust `src/abi/mod.rs` mirrors the Idris2 types as plain structs
222+ used directly by the CLI and codegen.
223+
191224== Relationship to VeriSimDB
192225
193226VeriSimiser is NOT a replacement for VeriSimDB. It's a gateway drug.
194227
195- * **VeriSimiser Tier 1** gives you drift detection, provenance, and temporal
196- versioning on your existing database. Zero commitment.
197- * **VeriSimiser Tier 2** gives you individual octad modalities as sidecars.
198- Incremental adoption.
199- * **Full VeriSimDB** gives you the complete octad with native cross-modal
200- querying, VCL, and built-in drift normalisation. Full commitment.
228+ * **VeriSimiser Tier 1** gives you provenance, temporal, lineage,
229+ access control, and constraints/drift detection on your existing
230+ database. Zero commitment.
231+ * **VeriSimiser Tier 2** gives you individual modality overlays
232+ (graph/vector/tensor/semantic/document/spatial) and simulation as
233+ sidecars. Incremental adoption.
234+ * **Full VeriSimDB** gives you the complete model with native
235+ cross-modal querying, VCL, and built-in drift normalisation. Full
236+ commitment.
201237
202- The migration path is: Tier 1 → Tier 2 → full VeriSimDB (if you want it).
203- Most users will be happy at Tier 1 or Tier 2.
238+ The migration path is: Tier 1 → Tier 2 → full VeriSimDB (if you want
239+ it). Most users will be happy at Tier 1 or Tier 2.
204240
205241== Integration with TypedQLiser
206242
207- VeriSimiser works alongside https://github.com/hyperpolymath/typedqliser[TypedQLiser]:
243+ VeriSimiser works alongside
244+ https://github.com/hyperpolymath/typedqliser[TypedQLiser]:
208245
209246* TypedQLiser type-checks your queries (compile-time, no runtime cost)
210- * VeriSimiser augments your database with octad capabilities (runtime)
247+ * VeriSimiser augments your database with octad concerns (runtime)
211248* Together: formally verified queries against an augmented database
212249
213250== Status
214251
215- **Pre-alpha.** Architecture defined, tier system designed. Tier 1 (drift
216- detection, provenance, temporal versioning) is the priority implementation.
252+ **Pre-alpha.** Architecture defined, octad ontology pinned (ADR-0001),
253+ codegen scaffolding in place. The next implementation milestone is V-L1-C1:
254+ end-to-end SQLite Tier 1 piggyback (`sqlite3_update_hook` →
255+ `verisimdb_provenance_log` sidecar). See `ROADMAP.adoc`.
217256
218257Part of the https://github.com/hyperpolymath/iseriser[-iser family].
219258**#3 priority** (after TypedQLiser and Chapeliser).
0 commit comments