Tier 1
System Health
API ternlang-api.fly.dev
Runtime BET-VM v1.0 · WASM
Deploy Fly.io · GitHub Actions
Auth X-Ternlang-Key · tier-gated
MCP Smithery · stdio + HTTP
Enter API key for quota
Albert MoE-13
240+
Global Epoch
6.9003
Best Loss
12k+
Grad Steps
Architecture4L × 12E × 256H
QuantisationBitNet 1.58-bit
CorpusKing James Bible
Status● Training · 4L evolved
Training Dashboard
@sparseskip
A50296/2026 · Pending Measured
2.80×
vs dense MoE
3,228
tok/s per M params · 4L
RoutingTop-3 / 12 · 4L
Skip ratio75% experts skipped / tok
Train 3L4:30 / epoch
Train 4L15:18 / epoch
Infer 4Lno regression · 83+ tok/s
GPU proj. 8×H10012.7× vs dense float16
Stack
Languageternlang · .tern
Arithmetic{−1, 0, +1}
RuntimeBET-VM v1.0 · WASM
MCP tools34 · smithery.ai
Stdlibcore · math · agents · ml
TransportJSON-RPC 2.0 · SSE
Throughput83+ tok/s · 4L
Compute0.157 GF/tok · 4L
BET-VM Playground ⚡ WASM
Execution Log
No executions this session
Resources
ternlang.com ternary-intelligence-stack MCP · smithery.ai/server/ternlang Documentation
Patent
@sparseskip · A50296/2026 · Pending
SPRIND Challenge
KI-Zuverlässigkeit · Stage 1
Quick Actions
Key
No key — anonymous access
Tier 1
Plan Features
Endpoint: https://ternlang.com
GET /health VM health check
POST /api/run Execute .tern code
GET /api/usage Key quota
// Click Try to test an endpoint
Trit Builtins
truth()→ trit(+1)Affirm signal
hold()→ trit(0)Neutral / hold
conflict()→ trit(-1)Reject signal
invert(t)→ tritNegate trit (-1↔+1)
consensus(a,b)→ tritTernary AND merge (max signal)
Math Builtins
abs(x)→ int/floatAbsolute value
min(a, b)→ int/floatMinimum of two values
max(a, b)→ int/floatMaximum of two values
pow(base, exp)→ intInteger exponentiation
len(t)→ intLength of tensor or string
length(t)→ intPrimary dimension of tensor
I/O Builtins
print(v)Print value (no newline)
println(v)Print value + newline
opent(path)→ intOpen file, returns handle
readt(handle)→ stringRead file contents
writet(handle, s)→ tritWrite string to file
Types
trit-1 / 0 / 1Balanced ternary value
inti6464-bit integer
floatf6464-bit floating point
stringUTF-8Text value
booltrue/falseBoolean (coerced to trit)
trit[]dynamicDynamic trit array / buffer
trittensor<N>N×1Fixed-size trit tensor
trittensor<N,M>N×M2D trit tensor
int[N]fixedFixed-size integer array
float[N]fixedFixed-size float array
agentrefrefHandle to a spawned agent
Control Flow
if ? cond { A } tend { B } reject { C }Ternary branch (+1/0/-1)
if cond { A } else { B }Binary branch
while ? cond { body }Ternary loop (runs on +1)
for x in tensor { body }Iterate over tensor elements
match x { 1 => {} 0 => {} _ => {} }Pattern match (int/trit/float)
return val;Return from function
break; / continue;Loop control
val?Early exit on -1 (returns conflict())
Agent Keywords
agent Foo { fn run(...) -> trit { } }Declare agent type
spawn Foo→ agentrefCreate agent instance
send msg to refPush message to mailbox
await ref→ tritRun agent, get result
nodeid→ stringCurrent node address
spawn remote "addr" Foo→ agentrefSpawn on remote node
Directives
@sparseskipSkip zero-signal weights (inference optimization)
VM Error Codes
BET-001StackUnderflowPop on empty stack — add missing return
BET-007TypeMismatchWrong type for op — check trit vs int vs float
BET-008TensorIndexOOBIndex beyond tensor size
BET-010DivByZeroDivision or modulo by zero
BET-013CallStackOverflowDeep recursion or unresolved import
BET-014AgentIdInvalidsend/await on invalid agent ref
BET-015AgentTypeNotRegisteredspawn without agent definition
PARSE-001UnexpectedTokenSyntax error — check grammar
PARSE-002ExpectedTokenMissing token (often ; or })
MOD-004FileNotFoundImport path not found
Literals
1, 0, -1int / tritIntegers; coerce to trit where needed
3.14floatDecimal float
0xFF, 0b1010intHex and binary integer literals
"hello"stringString literal
true / falsebool→intBoolean literals (1 / 0)
hold / tendtritZero-state trit keyword
Known Limitations
VM-STRUCT-001Returning structs from functions not stable — use intermediate vars
COMP-TENSOR-001Tensor size max 65535 elements (16-bit immediate)
MOD-004Named imports require all dependencies imported explicitly
float[] / int[]Array literals/params limited — use individual vars or trit[]
Double-click or press / to add a node
Or drag from the library — wire nodes by dragging ● output → ● input
100%
Execution Inspector
MULTIVERSE TIMELINE
TIME: 0.00s
Node Properties
Select a node to configure
Drag ● output → ● input to wire
TernWiki — technical reference for balanced ternary intelligence
Examples Quickstart Stdlib GitHub
Language Fundamentals

Syntax Guide

Functions
fn add(a: int, b: int) -> int {
  return a + b;
}
Control Flow
match signal {
  affirm => { println("YES"); }
  tend   => { println("HOLD"); }
  reject => { println("NO"); }
}
Agents
agent Sensor {
  handle(s: trit) {
    spawn Consensus(s);
  }
}
Logical Operations

Truth Tables

Input A Input B Consensus
+1 (Affirm) +1 (Affirm) +1
+1 (Affirm) 0 (Tend) 0
+1 (Affirm) -1 (Reject) -1
0 (Tend) 0 (Tend) 0
0 (Tend) -1 (Reject) -1
-1 (Reject) -1 (Reject) -1
Did you know?
The Consensus operator is the ternary equivalent of a logical AND. It resolves to the minimum value of its inputs: consensus(A, B) = min(A, B) where +1 > 0 > -1.
Graph Mechanics & Routing

Node Properties (The Workers)

Nodes are the individual brains of your AI. They evaluate data and make a decision: +1 (True), 0 (Uncertain), or -1 (False). You use this panel to set their rules, ensuring they do not get stuck thinking forever.

Edge Properties (The Smart Pipes)

Edges connect your nodes, but they also filter the traffic. They decide which decisions are allowed to travel to the next worker.

Activation Logic (The Bouncer)

This is how you filter. If you want a strict system, use +1 so only perfect matches pass. If you want a flexible system, use != -1. This allows 0 (Uncertainty) to pass through, letting the AI continue working even if it is not 100 percent sure.

Handling Failures (On Fail)

When a signal fails your logic check, you have choices.

Drop
Silently kills the execution branch to save computer power.
Fallback
Routes the failure to a designated secondary recovery path.
Hold (0)
Converts the failure into a neutral state. This is the magic of ternary computing: a failure does not have to break the machine; it can just mean 'pending'.

The Feedback Loop (Thinking Twice)

Normally, an AI just spits out an answer and stops. Checking this box allows the AI to loop its thoughts backwards and re-evaluate its own work. It is a safety feature that gives the AI permission to think iteratively until it is sure.

● Idle
hello_trit.tern
Ln 1, Col 1
Checking…
WASM…
Free
Runs 0 0 0
ternlang-api.fly.dev
🧠 ALBERT CLI F6
Albert CLI — canvas co-pilot mode
Local agent integration coming soon.
This panel will let you prompt Albert directly from the canvas — create nodes, wire flows, and iterate from a single prompt.