An AI-first, secure-by-construction programming language and hardened runtime, compiled to WebAssembly
Project description
Stratum
An AI-first, secure-by-construction programming language that compiles to a single self-contained WebAssembly module.
Stratum is a statically typed, actor-based language designed so that whole classes of failure are prevented by the execution model rather than caught after the fact. Actors are isolated with no shared mutable state, effects are capability-narrowed on every operation, and an anomaly detector is built in. The same program runs bit-for-bit identically on a reference engine and a WebAssembly engine, so what you test is what you ship.
Because the whole language is described in one context pack (see LLM_CONTEXT_PACK.md), you can paste that pack into any capable LLM and have it write correct Stratum with no prior training on the language. That is the point: AI-generated code you can trust because the runtime, not the model, enforces the guarantees.
This package is Stratum Basic — the free, open-source (MIT) tier. It contains the full language, both execution engines (AST reference + WebAssembly), the capability security model, and the open-core anomaly detector.
Install
pip install stratum-lang
One install works on Windows, macOS, and Linux (pure Python + wasmtime).
Your first program
Save this as hello.st:
module hello;
fn main() -> Unit effects [console] do
let a = 5;
let b = 3;
print("Sum:", a + b);
()
end fn
Run it:
stratum --grant console hello.st
Run on either engine
The same source runs byte-identically on the AST reference engine and the WebAssembly engine:
stratum --grant console --engine=ast hello.st
stratum --grant console --engine=wasm hello.st
Capabilities
Stratum has no ambient authority. A program can only do what you grant it on the command line with --grant, and every function must declare the effects it uses.
| Capability | Unlocks |
|---|---|
console |
print |
clock |
now, sleep_ms |
randomness |
random_float, random_gauss, random_seed |
entropic |
monitor (feed the anomaly detector) |
self_heal |
flush, mailbox_size, snapshot, revert |
concurrency |
spawn, send |
introspect |
describe, internal_health |
A secure actor with anomaly detection
module sensor_demo;
actor Sensor do
state count: Int = 0;
state alarmed: Bool = false;
quarantine on alarmed; // while `alarmed`, non-privileged msgs drop
handle Reading(v: Float) effects [entropic] do
count = count + 1;
monitor(v); // feed the value to the anomaly detector
end handle
privileged handle OnPhaseTransition(event: PhaseEvent) effects [console, self_heal] do
if event.phase == "red" do
print("anomaly at reading", count);
let dropped = flush(); // neutralize the message flood
alarmed = true; // quarantine self
end if
end handle
end actor
fn main() -> Unit effects [console, entropic, randomness, self_heal, concurrency] do
random_seed(7);
let s = spawn Sensor;
let i = 0;
while i < 60 do
s.Reading(1.0 + random_gauss(0.0, 0.05)); // steady
i = i + 1;
end while
let j = 0;
while j < 120 do
s.Reading(50.0 + random_gauss(0.0, 3.0)); // anomaly burst
j = j + 1;
end while
()
end fn
stratum --grant console,entropic,randomness,self_heal,concurrency sensor_demo.st
The language in one screen
- Every block closes with a labeled terminator:
end fn,end actor,end handle,end if,end while,end match. - Static types;
IntandFloatnever mix implicitly (to_float/to_intto convert). - No null: use
Optional<T>withSome(v)/None, read only bymatch. - Functions declare their effects:
fn f(x: Int) -> Int effects [console] do ... end fn. - Contracts:
requires/ensuresruntime-checked pre/postconditions. - Pattern matching with
match/when, and cross-file modules with a capability ceiling.
Full grammar and more examples are in GRAMMAR.md and the examples/ directory. There is also a self-contained context pack you can paste into any capable LLM so it writes correct Stratum without training data.
Compile to a standalone .wasm
stratum --emit-wasm=myprog.wasm myprog.st
This writes a standalone WebAssembly module plus a sidecar manifest describing the host-import contract and memory layout, so you can embed the module in any host language.
Editions and support
Stratum Basic is free, MIT-licensed, and the complete language, not a crippled demo. Commercial licensing, support, and editions for production use are available at fsmelogic.ca.
Stratum is built and maintained by a solo founder (FSME Logic). It is early and under active development. Issues and questions are welcome; please be patient with response times.
License
MIT. See LICENSE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file stratum_lang-1.0.1.tar.gz.
File metadata
- Download URL: stratum_lang-1.0.1.tar.gz
- Upload date:
- Size: 181.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fd34766809de1e00bdf0519b78fbdc48e9b0a69b55e20a905640d31ff0431058
|
|
| MD5 |
407d9ac0c30ae42ae888349c37ae4642
|
|
| BLAKE2b-256 |
8d251e99e589ff64db821a6186556c96c69519a4551bfe50ea4de3da2af57362
|
File details
Details for the file stratum_lang-1.0.1-py3-none-any.whl.
File metadata
- Download URL: stratum_lang-1.0.1-py3-none-any.whl
- Upload date:
- Size: 181.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d0b5d2e982c7f191b059448b5a9868b0809945ce3c57b5367f8ad2179f03fedc
|
|
| MD5 |
4d13601360625b64289587f4e3c012b5
|
|
| BLAKE2b-256 |
35bbca8deb56150fb4d22d4617a8d2b63c880adb5f47aeaedf6b7bd9ced210fe
|