Janus
The Paradox Engine – fusing low-level control with high-level ergonomics for sovereign computing.
Janus is Libertaria’s application-tier programming language. It has achieved Go-lang parity and is the standard for all new application code in the ecosystem.
Why Janus
Section titled “Why Janus”- Sovereign by design – capabilities gate every effect (IO, network, allocation)
- Zero ambient authority – nothing is implicit, everything is auditable
- Profile system – same language, different power levels for different contexts
- Bridge pattern – seamlessly orchestrates Zig, C, and system-level code
Language Profiles
Section titled “Language Profiles”| Profile | Analogy | Use Case | Status |
|---|---|---|---|
:core | The Monastery | Types, control flow, structs, enums, traits, generics, closures | Complete |
:service | The Bazaar | Channels, select, nursery, spawn, row polymorphism | Functionally Complete |
:sovereign | The Citadel | Capabilities, pledges, distributed identity | In Development |
Proven at Scale: LTP
Section titled “Proven at Scale: LTP”The Libertaria Transport Protocol (LTP) is the largest Janus :service application – 19 demos proving real networked systems:
What LTP Demonstrates
Section titled “What LTP Demonstrates”| Capability | Demo | What It Proves |
|---|---|---|
| Structured Concurrency | Nursery/spawn/channels | Real OS threads with CSP messaging |
| Multi-Bridge Loading | 5 Zig bridges simultaneously | 95+ C-exported functions loaded |
| Encrypted Transport | Noise XX + XChaCha20-Poly1305 | Session-encrypted L0 frames |
| Encrypted Relay | 2-hop DMP relay | Hop-by-hop encryption across TCP links |
| Pub/Sub Messaging | DMP broker over TCP | MQTT-style wildcards, retained values |
| Will-Messages | Clean vs unclean disconnect | Last Will and Testament pattern |
| Mesh Networking | 5-node ring topology | Shortest-path routing + connection promotion |
| DID-Bound Crypto | SBI identity + Noise XX | Identity-authenticated handshake with DID verification |
| CBOR Envelopes | Signed structured messages | RFC 8949 encoding with Ed25519 signatures |
| Dynamic Ports | Port 0 + getsockname | Zero port conflicts between concurrent runs |
The Bridge Pattern
Section titled “The Bridge Pattern”Janus orchestrates Zig through C-exported handle-based APIs:
use lib.tcpuse lib.l0use lib.sbi
// Create sovereign identitylet alice = sbi_create(seed)?
// Noise XX handshake with DID-bound keyslet hs = l0_noise_handshake_init(0, alice.sbi_x25519_sk_ptr(), alice.sbi_x25519_pk_ptr())// ... 3-message exchange ...let channel = l0_noise_finish(hs)
// Verify peer DID post-handshakelet ok = l0_noise_verify_peer_did(channel, peer_ed25519_ptr, expected_did_ptr)
// Send encrypted framelet frame = l0_new(16, SERVICE_TYPE_DMP)?frame.l0_set_payload("sovereign data!", 15)frame.l0_noise_encrypt(channel)conn.tcp_write_framed(frame.l0_get_encode_ptr(), frame.l0_encode())All values are i64 at the FFI boundary. Handle pools are fixed-size with spinlock mutexes. No garbage collection. No hidden allocations.
Concurrency Model
Section titled “Concurrency Model”Janus :service provides structured concurrency:
nursery do spawn server_task(ready_ch) spawn client_task(ready_ch)end// All tasks complete before nursery exits- Nursery – structured concurrency boundary (all spawned tasks must complete)
- Spawn – real OS threads (not green threads)
- Channels – CSP-style buffered message passing
- Blocking I/O – safe with real threads (no cooperative scheduling needed)
Tooling
Section titled “Tooling”Janus is one tool – compiler, runner, tester, and package manager:
| Command | Purpose |
|---|---|
janus build src/app.jan binary | Compile to native binary |
janus test | Run test suite |
janus --profile=service build ... | Compile with :service features |
Capsule System
Section titled “Capsule System”Libraries in Janus are Capsules – atomic units containing source, tests, and capability manifests:
lib/sbi.jan (Sovereign Index – public API)lib/sbi/types.jan (Type definitions)lib/sbi/identity.jan (Identity operations)lib/sbi/cbor.jan (CBOR encode/decode)lib/sbi/janus.kdl (Capsule manifest)Every capsule follows the Panopticum Architecture – one feature, one folder, one index. An AI agent with limited context can enter a single folder and understand the entire feature.
Ecosystem Integration
Section titled “Ecosystem Integration”| Tool | Role | Status |
|---|---|---|
| Hinge | Package manager (capsule registry) | In Development |
| Graf | Version control (sovereign VCS) | Active |
| Nexus OS | Operating system (L1 kernel in Nim) | In Development |