|
| 1 | +# VeriSimDB — LLM Context (Developer) |
| 2 | + |
| 3 | +## Identity |
| 4 | + |
| 5 | +VeriSimDB (Veridical Simulacrum Database) — 8-modality entity consistency |
| 6 | +engine with drift detection, self-normalisation, and formally verified queries. |
| 7 | +Part of the nextgen-databases monorepo. License: PMPL-1.0-or-later. |
| 8 | +Author: Jonathan D.A. Jewell. |
| 9 | + |
| 10 | +## Architecture (Marr's Three Levels) |
| 11 | + |
| 12 | +**Computational**: Maintain cross-modal consistency across 8 representations. |
| 13 | +**Algorithmic**: Octad entities, drift detection with thresholds, OTP supervision. |
| 14 | +**Implementational**: Rust stores + Elixir coordination + VQL queries. |
| 15 | + |
| 16 | +``` |
| 17 | +Elixir OTP: EntityServer, DriftMonitor, QueryRouter, SchemaRegistry |
| 18 | + ↓ HTTP |
| 19 | +Rust Core: graph, vector, tensor, semantic, document, temporal, |
| 20 | + provenance, spatial, octad, drift, normalizer, api |
| 21 | +``` |
| 22 | + |
| 23 | +## Rust Workspace (`Cargo.toml`) |
| 24 | + |
| 25 | +10 library crates + 1 binary crate (verisim-api). Workspace at root. |
| 26 | +Build: `OPENSSL_NO_VENDOR=1 cargo build --release` |
| 27 | +oxrocksdb-sys eliminated (redb pure-Rust backend). protoc eliminated |
| 28 | +(pre-generated). No C++ deps. |
| 29 | + |
| 30 | +## Elixir Layer (`elixir-orchestration/`) |
| 31 | + |
| 32 | +OTP app with supervision tree. GenServer per entity. |
| 33 | +Hypatia integration: ScanIngester, PatternQuery, DispatchBridge (37 tests). |
| 34 | +Built-in VQL parser (no external runtime needed). |
| 35 | +Product telemetry: opt-in ETS collector + JSON reporter. |
| 36 | + |
| 37 | +## Key Subsystems |
| 38 | + |
| 39 | +### Drift Detection |
| 40 | +6 drift types: semantic_vector, graph_document, temporal_consistency, |
| 41 | +tensor, schema, quality. Configurable thresholds gate normalisation. |
| 42 | + |
| 43 | +### Self-Normalisation |
| 44 | +1. Identify most authoritative modality |
| 45 | +2. Regenerate drifted modalities |
| 46 | +3. Validate consistency |
| 47 | +4. Atomic update |
| 48 | + |
| 49 | +### Federation |
| 50 | +10 adapters: MongoDB, Redis, Neo4j, ClickHouse, SurrealDB, SQLite, |
| 51 | +DuckDB, VectorDB, InfluxDB, ObjectStorage. |
| 52 | +Integration tests: 105 tests across 7 adapters (need test-infra stack). |
| 53 | + |
| 54 | +### VQL (VeriSim Query Language) |
| 55 | +Type system: VQL-DT. 11 proof types. Multi-proof parsing. |
| 56 | +Modality compatibility validation. ReScript playground wired to backend. |
| 57 | + |
| 58 | +### Hypatia Pipeline |
| 59 | +``` |
| 60 | +panic-attack assail → ScanIngester → octads → PatternQuery → DispatchBridge → gitbot-fleet |
| 61 | +``` |
| 62 | +954 patterns tracked across 298 repos. Fleet dispatch logged (JSONL), |
| 63 | +live execution needs GitHub PAT. |
| 64 | + |
| 65 | +## Client SDKs (`connectors/clients/`) |
| 66 | + |
| 67 | +6 SDKs: Rust, V, Elixir, ReScript, Julia, Gleam. |
| 68 | +Shared: JSON Schema, OpenAPI, protobuf (`connectors/shared/`). |
| 69 | + |
| 70 | +## ABI/FFI (`src/abi/`, `ffi/zig/`) |
| 71 | + |
| 72 | +Idris2 ABI definitions (formal proofs). Zig FFI C-ABI bridge. |
| 73 | +Generated C headers in `generated/abi/`. |
| 74 | + |
| 75 | +## Container Stack |
| 76 | + |
| 77 | +Podman (never Docker). Chainguard base images. |
| 78 | +- `container/Containerfile` — main build |
| 79 | +- `container/compose.toml` — selur-compose (3 services) |
| 80 | +- `container/.gatekeeper.yaml` — svalinn edge gateway |
| 81 | +- `container/manifest.toml` — cerro-torre signing |
| 82 | +- `container/ct-build.sh` — build/sign/verify pipeline |
| 83 | + |
| 84 | +Test infra: `connectors/test-infra/compose.toml` — 7 databases. |
| 85 | + |
| 86 | +## Instance Policy (CRITICAL) |
| 87 | + |
| 88 | +This repo = source code + examples ONLY. Each consumer runs own instance: |
| 89 | +- IDApTIK: port 8090, volume idaptik-verisimdb-data |
| 90 | +- Burble: port 8091, volume burble-verisimdb-data |
| 91 | +- Hypatia: port 8092, volume hypatia-verisimdb-data |
| 92 | + |
| 93 | +Never store app data here. Never point at localhost:8080. |
| 94 | + |
| 95 | +## Commands |
| 96 | + |
| 97 | +```bash |
| 98 | +just build / build-all / build-elixir / build-abi / build-ffi |
| 99 | +just test / test-elixir / test-integration / test-all |
| 100 | +just serve / serve-otp |
| 101 | +just fmt / lint / fmt-elixir |
| 102 | +just container-build / container-run / deploy / deploy-stop |
| 103 | +just panic-scan / hypatia-scan / license-check / check-scm |
| 104 | +just doctor / heal / tour / help-me |
| 105 | +``` |
| 106 | + |
| 107 | +## Language Policy |
| 108 | + |
| 109 | +Allowed: Rust, Elixir, ReScript, VQL, Idris2, Zig. |
| 110 | +Banned: Python, Go, Node.js. |
| 111 | + |
| 112 | +## Code Patterns |
| 113 | + |
| 114 | +### Octad creation (Rust) |
| 115 | +```rust |
| 116 | +let octad = OctadBuilder::new() |
| 117 | + .with_document("Title", "Body") |
| 118 | + .with_embedding(vec![0.1, 0.2]) |
| 119 | + .with_types(vec!["http://example.org/Doc"]) |
| 120 | + .build(); |
| 121 | +``` |
| 122 | + |
| 123 | +### Entity server (Elixir) |
| 124 | +```elixir |
| 125 | +{:ok, _} = VeriSim.EntityServer.start_link("eid") |
| 126 | +{:ok, state} = VeriSim.EntityServer.get("eid") |
| 127 | +``` |
| 128 | + |
| 129 | +## Known Issues |
| 130 | + |
| 131 | +All 25 historical issues resolved. See KNOWN-ISSUES.adoc. |
| 132 | + |
| 133 | +## File Map |
| 134 | + |
| 135 | +| Path | What | |
| 136 | +|------|------| |
| 137 | +| `Cargo.toml` | Workspace root | |
| 138 | +| `rust-core/verisim-*/` | 10 modality crates | |
| 139 | +| `elixir-orchestration/lib/verisim/` | OTP modules | |
| 140 | +| `elixir-orchestration/lib/verisim/hypatia/` | Hypatia integration | |
| 141 | +| `connectors/clients/` | 6 SDKs | |
| 142 | +| `connectors/test-infra/` | Integration test databases | |
| 143 | +| `container/` | Containerfiles + compose | |
| 144 | +| `playground/` | VQL playground (ReScript) | |
| 145 | +| `src/abi/` | Idris2 ABI | |
| 146 | +| `ffi/zig/` | Zig FFI | |
| 147 | +| `spec/` | Grammar EBNF | |
| 148 | +| `verification/` | Verification gateway | |
| 149 | +| `docs/` | Documentation | |
| 150 | +| `verisimdb-data/` | Git-backed flat-file data | |
| 151 | +| `.machine_readable/` | STATE.scm, META.scm, ECOSYSTEM.scm | |
| 152 | +| `.claude/CLAUDE.md` | Full AI instructions | |
| 153 | +| `0-AI-MANIFEST.a2ml` | Universal AI entry point | |
0 commit comments