Skip to content

Skein Language

A new programming language that compiles to BEAM bytecode, designed for building cloud services where AI agents are first-class constructs.

Skein is a programming language that compiles to BEAM bytecode and runs on the Erlang VM (OTP). It is co-optimized for two audiences: humans who read and review code, and LLM agents who generate and modify code.

The language sits at the intersection of three ideas:

  1. The BEAM/OTP runtime provides battle-tested concurrency, fault tolerance, and distribution — exactly what long-running agent processes need.
  2. An integrated platform model with trace-driven development and the “service as the unit of work” philosophy.
  3. Agent-writability as a first-class design constraint — a language whose entire spec fits in an LLM context window, with maximally regular syntax and a type system that doubles as a contract language for tool calling.

The full compilation pipeline is operational. You can write .skein files, compile them to BEAM bytecode, and run them — including making real LLM calls to Claude with full tracing.

What works today:

  • A compact construct set — modules, functions, types, enums, agents, tools, supervisors, handlers (HTTP/queue/schedule), tests (plus scenario and golden trace tests), pattern matching, pipes, capabilities
  • Full type system — type checking, type inference (field access resolves types), JSON schema derivation, constraint annotations
  • Capability enforcement — compile-time and runtime checking for both modules and agents across all subsystems (HTTP, store, memory, LLM, tools)
  • Production LLM backend — Anthropic integration with llm.chat, llm.json, and llm.stream, with token-level usage tracking
  • Rich traces — every effect call produces structured trace spans with timing, outcome, and token usage
  • Agent state machines — gen_statem-based agents with compile-time phase transition verification
  • CLI tooling — skein new, compile, build, test, run, and trace, plus agents (AGENTS.md scaffolding), mcp (MCP server for coding agents), lsp, completions, version, and help
  • Editor support — VS Code extension with syntax highlighting, snippets, and full LSP (diagnostics, hover, go-to-definition, completions)

An extensive suite of unit, integration, and property-based tests passes clean across all four apps (compiler, runtime, CLI, LSP).

module Hello {
fn greet(name: String) -> String {
"Hello, ${name}!"
}
fn add(a: Int, b: Int) -> Int {
a + b
}
fn classify(n: Int) -> String {
match n > 0 {
true -> "positive"
false -> "non-positive"
}
}
}

Compile and run — no Erlang or Elixir install required:

Terminal window
skein compile hello.skein
# → Compiled: Skein.User.Hello

Scaffold a full project with tests, build everything, and start a server:

Terminal window
skein new my-service
cd my-service
skein build
skein test
skein run

LLM Demo — Real Claude Calls with Traces

Section titled “LLM Demo — Real Claude Calls with Traces”

Skein modules can declare LLM capabilities and make type-checked, traced calls to Claude:

module Demo {
capability model("anthropic", "claude-opus-4-8")
fn greet(name: String) -> String {
llm.chat("claude-opus-4-8", "You are friendly.", "Say hello to ${name} in one sentence.")!
}
fn classify(text: String) -> String {
llm.chat("claude-opus-4-8", "Answer with one word.", "Classify this as positive or negative: ${text}")!
}
}
Terminal window
skein compile demo.skein
# ...exercise the module (e.g. via skein test or a running service), then:
skein trace --last 2 --kind llm
Traces (2):
[llm] chat (1244ms)
[llm] chat (387ms)

Every LLM call is capability-gated (the module must declare capability model(...)), type-checked, and automatically traced with token usage.