Explicit by design

Built for the way software is written today.

Working with agents is all about clear contracts. Silk exists to give you that. Every effect function states what it returns, how it can fail and what it touches, down to the allocator. Every variable has a lifetime, so nothing is left to luck.

hello.silk
import silk.core.effect { Effect }
import silk.io.logger { LogError }
import silk.io.logger_native { StdoutLogger }

pub effect fn main() -> ()
  ! LogError {
  let mut logger = StdoutLogger.make()

  run Effect.log("Hello, world!\n", &.{})
    |> Effect.provideMut(&mut logger)
}
$ curl -fsSL https://raw.githubusercontent.com/silk-lang/silk/main/install.sh | sh

One program, annotated.

01 — How it reads

Effect<A ! E ? R>

Awhat it returns
!Ehow it can fail
?Rwhat it needs
  1. 01 · Service

    Declare the need

    A service names a capability without saying how it’s provided.

    pub service Random {
    effect fn next(self: &mut Self) -> u32
    }
  2. 02 · Signature

    Failures and needs

    ! says how it can fail, ? what it needs. Leave a need unprovided and it won’t compile.

    effect fn program() -> ()
    ! LogError
    ? &mut Random | &mut Logger {
  3. 03 · Run

    Every effect is marked

    An effect is a value until run executes it, so you can see where things happen.

    run Effect.log("Random number: {number}", &.{number: run Random.next()})
  4. 04 · Implementation

    Many providers

    Always 42 in tests, a real generator in production. program doesn’t change.

    impl Random for Always42Random {
    effect fn next(self: &mut Self) -> u32 {
    return 42
    }
    }
  5. 05 · Provide

    Provide at the edge

    main picks the logger and the random source. Nothing deeper decides.

    run program()
    |> Effect.provideMut(&mut loggerProvider)
    |> Effect.provideMut(&mut randomProvider)

Where Silk comes from.

02 — Acknowledgments

Typed effects · Services

Effect

Silk started with Effect. It showed how far typed errors, services and effects can carry a codebase as it grows. Silk exists because that kind of scalability shouldn’t be limited to high-level languages.

Ownership · Borrowing

Rust

Rust designed the memory model today’s software needs, years before anyone expected agents to write code in our lifetime. Every value has an owner and every borrow has a lifetime.

Explicit resources · Fast builds

Zig

Zig showed how valuable it is to be explicit about system resources. It also showed that incremental compilation and a fast compiler are essential to any loop, especially one measured in tokens per second.

03 — In the box

Batteries included.

TLS 1.3, HTTP/2, zstd and SIMD vectors are written in Silk, under the same allocator, failure and service rules as your code. So is memcpy. An HTTPS client needs one dependency: the toolchain.

261

Modules in the standard library

tls · 16 modules

TLS 1.3 without OpenSSL

Handshake, record layer, X.509 path validation and trust anchors, on crypto from AES-GCM to Ed25519. All Silk.

http · 32 modules

HTTP/1.1, HTTP/2, WebSocket

Clients and servers with HPACK, connection pools, redirects, proxies and gzip or zstd bodies, on native sockets or WASI.

platform · 24 modules

Linux with no libc

Direct system calls and a static entry point, for executables that link no C library at all. WASI Preview 1 and 2 too.

simd · 30 modules

Typed SIMD vectors

Lanes from u8x16 to f64x4, with masks and CPU feature checks, in portable code.

compress · 12 modules

Compression in fixed memory

Deflate, gzip, zstd, xz and LZMA2, decoded in steps with limits you set.

system · 14 modules

Every effect has a stand-in

Files, processes, clocks, randomness and sockets are services. Tests swap in memory transports and seeded randomness.

Standards implemented in Silk

  • RFC 8446 TLS 1.3
  • RFC 9113 HTTP/2
  • RFC 7541 HPACK
  • RFC 6455 WebSocket
  • RFC 8878 Zstandard
  • RFC 8439 ChaCha20-Poly1305
  • SP 800-38D AES-GCM
  • RFC 8032 Ed25519
  • RFC 7748 X25519
  • FIPS 202 SHA-3
  • RFC 7693 BLAKE2b
  • RFC 5869 HKDF
  • RFC 2104 HMAC
  • RFC 6125 server identity
  • RFC 3986 URI
  • RFC 4648 Base64
  • RFC 9562 UUID v1–v8
  • Unicode 17.0 NFC · NFD
  • WASI Preview 1 · 2
  • IEEE 754 f32 · f64
  • TOML JSON

Every module · 22 areas

encoding2

Show all 22 areas

Cross-compile to every target.

04 — Cross-compilation

Silk compiles to macOS, Linux with or without libc, Windows and WebAssembly, and any host can build for all of them.

Host → targetmacOSLinuxLinux, no libcWindowsWASI
macOSmacOS builds for macOSmacOS builds for LinuxmacOS builds for Linux, no libcmacOS builds for WindowsmacOS builds for WASI
LinuxLinux builds for macOSLinux builds for LinuxLinux builds for Linux, no libcLinux builds for WindowsLinux builds for WASI
WindowsWindows builds for macOSWindows builds for LinuxWindows builds for Linux, no libcWindows builds for WindowsWindows builds for WASI

Incremental by design

<1 s

to rebuild after a typical edit to the 365k‑line Silk compiler*

Compile speed is a core value, not an optimization pass. Every new feature is weighed by what it costs the rebuild, because a slow loop is a slow loop for people and agents alike.

* Measured on a 16-inch MacBook Pro (2021) with an Apple M1 Max and 32 GB of memory.

05 — Before you start

Questions.

Is it hard to learn?
If you know Effect or Rust, half of it will look familiar. The tour walks through the rest: services, providers and run.
Is Silk a language for AI?
It’s built for how code gets written now, and that includes agents. There’s usually one way to write a thing, silk check reports errors without a full build, every error code is documented and the docs publish /llms.txt. That helps whoever reviews the work just as much.

Status: alpha — the compiler already builds itself

This is just the beginning.

The language, the standard library and the tools are moving fast. Try it today, pin your toolchain, and help shape what Silk becomes.