Clad logo

Fewer tokens. One form.
Built for models.

Clad is a programming language designed for LLM code generation — every construct chosen by benchmark on the real Claude tokenizer, not by taste. Claude-first, works with any model.

−15.1%tokens vs Python over 35 tasks, measured on the real Claude tokenizer
35/35tasks solved first-try by a model that had never seen the language
1canonical form — clad fmt makes every diff semantic

Taste

fn fib(n:int) -> int
  expect n >= 0
  if n < 2: ret n
  ret fib(n - 1) + fib(n - 2)

range(10) |> filter(x -> x % 2 == 0) |> map(x -> x * x) |> says()

No commas, no semicolons, no braces. Pipelines, contracts (expect / ensure), Python-habit operators, and a dense standard library that covers what Python needs imports for.

Playground

This is the real interpreter — the same code that ships in the npm package — running in your browser.

Ctrl+Enter to run


  

Why fewer tokens

Generated code is paid for by the token, every time. Clad attacks the bill twice: syntax with no separator ceremony, and a standard library dense enough that common data work is one call (freq, group, runs, scan, chunks, maxby…). Token cost of the same 35 tasks, Clad vs Python, real Claude tokenizer:

word count
−45%
running max
−35%
list max
−34%
gcd
−33%
dedupe
−31%
flatten
−28%
all 35 tasks
−15.1%

Methodology and per-version history live in bench/ — both solutions must print identical output, Python is idiomatic and unhandicapped.

Built for self-repair

err E005 line 1 col 8
  expected: a space between items
  got: ','
  fix: remove the comma — Clad separates list items, arguments and parameters with spaces

Stable error codes, expected / got / fix fields, call-chain tracebacks. In the iterations benchmark, a model writing Clad from the spec alone fixed every mistake in exactly one round. Formatting is never a debate: clad fmt rewrites to the single canonical form, --check guards CI.

Install

npm install -g clad-lang
clad run hello.clad
clad fmt --check hello.clad

Docs

Language referenceSPEC.md
Error codesdocs/errors.md
Benchmarksbench/
ChangelogCHANGELOG.md
Packagenpmjs.com/package/clad-lang
Sourcegithub.com/cladlang/clad · MIT
Updatesx.com/cladlang