--- layout: qualia title: VibeScript ---
A capability-bounded, typed, deterministic scripting engine for reactive UI cells,
signed agent modules, and Host-family apps (using Cosmic;, using LinearAlgebra;).
vibe-0.1 is the current dialect and may grow when humans need a better form (versioned and documented). The Host catalog grows. Complements JavaScript for ordinary DOM work
while making semantic data, authority, and eligible deterministic execution explicit.
VibeScript is for programs whose data meaning, authority, and replay semantics are part of the product. It does not ask a browser runtime to infer those boundaries from ad-hoc objects, network calls, and framework conventions.
VibeScript (or Vibe) is the native scripting layer of QualiaDB and the Poet creative environment.
It is an interpreted, typed, capability-bounded language engineered with zero heap allocations in hot paths,
first-class RDF 1.2 and SPARQL semantics, verifiable deontic norms, and deterministic execution for eligible programs.
The 0.1 grammar is current and may grow. The Host catalog grows:
more than a thousand live Family.method invoke ids
(Cosmic.*, LinearAlgebra.*, GraphDatabase.*, …)
bind through using Family; and capability.invoke.
Agents repair from vibe::diagnose(src) JSON. JavaScript remains useful for conventional DOM work;
Vibe supplies the semantic and authority-bearing layer beneath a UI.
Pure, high-frequency formulas driving desktop UI manifolds and QApps. Cells form dependency DAGs with bounded evaluation and strict cycle detection. Performance depends on the selected target and workload; the important invariant is that the hot evaluator does not allocate.
Cryptographically signed programs that query and mutate knowledge graphs. Every external capability (graph query, network pulse, sensor feed) requires an explicit lease grant and execution route, allowing a host to deny or diagnose unavailable authority.
Deterministic lifecycle handlers like on pulse:message(...) and on tick().
Prohibitions and obligations can be checked against the QualiaDB logic surface; host effects remain explicit rather than being silently substituted in a standalone browser target.
Vibe is not a universal replacement for JavaScript, Python, Lua, or embedded Rust interpreters. Its advantage appears when a program needs a typed semantic graph, declared authority, Q42 portability, or an auditable execution boundary.
| Dimension | VibeScript (vibe-0.1) | JavaScript / Node.js | Python (CPython) | Lua / LuaJIT | Rhai / WASM Lite |
|---|---|---|---|---|---|
| Security & Sandboxing | Capability-Bounded Strict compile-time leases; no ambient I/O |
Host-Defined Web and Node hosts expose different permission and sandbox models |
Open Ambient Full OS/filesystem reach; monkey-patchable |
Manual Sandbox Requires table-stripping; easily bypassed |
Engine Bounded Host bindings, but lacks deontic norm leases |
| Hot-Path Allocation | Tier-1 Zero Heap Fixed stack buffers & 42MB Sentinel arena |
Managed Heap Excellent general-purpose tooling; allocation is not the Vibe hot-path contract |
Heavy Heap Reference counting + cyclic GC pauses |
Incremental GC Lightweight, but non-zero heap allocation |
Heap Allocations Extensive Box/Vec/String usage |
| Graph & RDF Native | Native RDF 1.2 & SPARQL 48-byte Super-Quins, <<( s p o )>>, graph? |
Libraries available Flexible RDF tooling, with graph semantics chosen by the application |
rdflib / networkx Extremely slow Python object graphs |
None No native semantic data structures |
None Generic map/arrays only |
| Determinism & Audit | Eligible programs replay Pure evaluation and canonical representations are deterministic; host effects are declared separately |
Application-defined Determinism is achievable, but framework scheduling and host APIs are application choices |
Application-defined Determinism is achievable, but clock, I/O, and dependency choices remain external |
Partially Deterministic Hash table order nondeterminism |
Varies Depends on host engine configuration |
| Modal & Deontic Logic | Built-In Modalitiesobligate, permit, knows, always |
Libraries / services Can integrate solvers, but has no equivalent language-level QualiaDB modality surface |
None External SAT/Z3 solver bindings only |
None No formal verification support |
None Basic conditional control flow only |
| AI / LLM Generation | GBNF & EBNF Constrained Strict grammar decode guarantees valid code |
Grammar Ambiguous Vulnerable to runtime syntax & type hallucinations |
Indentation Fragile Whitespace errors frequently break generation |
Small Grammar Clean syntax, but runtime fails silently |
Medium Custom syntax not widely trained into LLMs |
| Physical & Temporal Types | First-Class Quantities400ms, oklch(...), 500nm with checked units |
Raw Numbers No built-in unit dimension algebra |
Pint / astropy Heavyweight external dependencies |
Raw Doubles No unit or color space abstractions |
Primitive Types Requires custom Rust type registration |
| Runtime Footprint | Target-dependent WASM Small standalone modules are possible; portal, science, and model profiles deliberately differ |
30 MB – 100 MB+ V8 engine binary footprint |
20 MB – 50 MB CPython standard library footprint |
~300 KB Minimal C runtime |
~1 MB – 3 MB Rust interpreter bundle |
Human-friendly syntax using Animation; with clean method calls like Animation.orbit_spin(t). Unleased method paths fail closed at check-time.
Native bind slider <-> volume using Clamp[0.0, 1.0] resolve latest; keeps reactive states synchronised across UI widgets.
First-class interpolation with 0.0 ~ 10.0 over 400ms ease linear and dynamic physics dampening via spring(stiffness, damping).
Lightweight |x| expr pipelines for transformation like [1, 2, 3].map(|x| x * 2).filter(|x| x > 2) with zero closure escape overhead.
Load domain ontologies (SNOMED, QUDT) as tree-shaken .n3 dependency chunks. Canonical IRIs are preserved with zero string table bloat.
Colour and pose are first-class values: oklch(0.72, 0.12, 230.0) plus Animation.orbit_spin, returned from main as a record the host can present.
Support for Chinese (locale zh;), Cyrillic, and Arabic identifiers. Golden CBOR-AST hashing guarantees identical execution across all locales.
First-class obligate, permit, and forbid operators evaluate against the verified deontic engine, securing autonomous agent actions.
VBC1 stack-based bytecode compiler and VM with 41 opcodes for instant zero-copy serialization and deterministic sandboxed execution.
Agent loop is vibe::diagnose(src) → error_code, byte span, suggested_fix. Codes E001–E800. Invalid source is never executed.
Live catalog ids such as Cosmic.geodetic_to_ecef and LinearAlgebra.matmul sit on the same four-op host ABI (vibe-host-0.1). Browser LocalHost runs Cosmic kernels in-process; daemon-backed families fail closed with E300.
Explore real VibeScript programs demonstrating reactive graphics, two-way bindings, clinical vocab, and Cosmic geodesy:
using Animation, HID; // Reactive cells stepping on live temporal ticks effect cell t := time.now(); cell pose := Animation.orbit_spin(1.0); cell glow := oklch(0.72, 0.12, 230.0); // Declarative visual surface present block present lamp { color: glow pose: pose }
let mut volume = 0.2; let mut slider = 0.2; // Two-way reactive bind with bounding clamp bind slider <-> volume using Clamp[0.0, 1.0] resolve latest; fn main() -> f64 { // Temporal tween easing return 0.0 ~ 10.0 over 400ms ease linear; }
prefix snomed: <http://snomed.info/id/>; using GraphDatabase; // Tree-shaken vocabulary query resolved against bounded clinic chunk pure fn get_diagnosis() -> Iri { return snomed:386661006; // Fever (finding) } fn main() -> Iri { return get_diagnosis(); }
using Cosmic; effect fn main() -> Record { return Cosmic.geodetic_to_ecef({ lat_deg: -37.8, lon_deg: 144.9, alt_m: 0.0 }); }
The VibeScript developer ecosystem is distributed across standalone tooling crates and extensions. Tooling validates a selected execution profile before a native-only call reaches a browser-only target: