Agent-first programming language
The programming language built for agents.
Your coding agent writes the code. Each function's signature says what it may touch and how it can fail, and the compiler holds every change to it. Sakura compiles to JavaScript and WebAssembly.
$ npm i -g sakuralang·agents: GET /llms.txt
Why would I use it?
Your agent can't quietly do more than the signature says.
Three things you would otherwise catch in code review. The compiler checks them on every change.
01
Every function says what it touches.
signup may use the database, the clock and randomness, and can fail with SignupError. Nothing else. When an agent adds a network call, sakura check stops it with V3001. Allowing the call means changing the signature, and that is for a person to approve; here the agent removes the call instead.
error V3001 src/users.sak:13:11
function signup performs Http and Fail<HttpError | RateLimited>, which its signature does not allow.
- interface_changeadd them to the signature: suggested, needs review
- agentremoves the call instead← keeps the promise
02
Bad values don't compile.
Cents is an Int that is never negative. Writing -5 where Cents is expected won't compile, and an unchecked Int only becomes Cents through a check: Cents.from or Cents.validate.
03
Tests give the same result every run.
Under sakura test the clock is fixed, randomness is seeded and output is captured. A test can't reach the network by accident: it has to supply a fake.
| Effect | sakura run | sakura test |
|---|---|---|
| Clock | ||
| Random | ||
| Env | ||
| Console | ||
| Http |
How does it work with my coding agent?
One command connects your agent to the compiler.
Claude Code, Codex and Cursor get the compiler as an MCP server, plus a skill that teaches them the language. From then on the agent asks the compiler instead of guessing. Agent docs
sakura setup --client all --apply create .claude/skills/sakura/SKILL.md create .mcp.json create .codex/config.toml create .cursor/mcp.json …sakura check --json{"kind":"diagnostic","code":"V1004","message":"cannot find `list`; `List` exists but names differ in case …", "fixes":[{"title":"Use `List`","applicability":"machine_applicable","impact":"local", …}]}sakura fixf:db8db68ac7c828f3.0 V1004 src/count.sak:1:34 Use `List` [machine_applicable, local] appliedsakura test1 passed, 0 failed, 0 skipped (seed 0)sakura newwritesAGENTS.mdand aCLAUDE.mdthat imports it.Every docs page is also plain Markdown, listed in
/llms.txt.sakura fixapplies the safe ones. A fix that changes a contract or what code may do waits for a person.Tests can't use the network. Recorded HTTP and LLM replies play back from files, so every run matches.
What does the code look like?
Read the signature. The compiler reads the body.
One file that compiles today. You review the three highlighted lines; check, test and verify make sure the body keeps to them. Language tour
- 01
Takes. An
AccountandCents: anIntthat is never negative. - 02
May do.
Ledger, and fail withOverdrawn. No network, files or clock. - 03
Requires.
amount > 0. Breaking it is the caller's bug, reported asD020. - 04
Ensures. The new balance, checked on every return;
sakura verifyproves it ahead of time. - 05
Tests. Live beside the code and bring their own fake
Ledger.
type Cents = Int where it >= 0type Account = { id: String, balance: Cents }error Overdrawn(balance: Cents) effect Ledger { fn record(acct: Account) -> Unit} fn withdraw(acct: Account, amount: Cents) -> Account ! {Ledger, Fail<Overdrawn>} requires positive: amount > 0 ensures result.balance == acct.balance - amount{ if amount > acct.balance { fail Overdrawn { balance: acct.balance } } let next = Account { id: acct.id, balance: Cents.from(acct.balance - amount) } Ledger.record(next) next} fn ignore_ledger() -> Handler<Ledger> { handler Ledger { fn record(acct) { () } }} test "withdraw never overdraws" { let acct = Account { id: "a1", balance: 500 } with ignore_ledger() { expect_eq(withdraw(acct, 200).balance, 300) expect_fail(fn() { withdraw(acct, 900) }, Overdrawn { balance: 500 }) }}$ sakura test account.saktest withdraw never overdraws ... ok1 passed, 0 failed, 0 skipped (seed 0)$ sakura verify account.sakproved main::account::withdraw overflow t%21 = acct.balance - amount at account.sak:14:57proved main::account::withdraw where Cents at account.sak:14:46proved main::account::withdraw ensures withdraw at account.sak:11:113 proved, 0 disproved, 0 unknown, 0 unsupported (0 reused) (profile js, z3 5.3.1, rlimit 10000000)Is it fast?
Native Sakura, counted against C, Rust, Go, OCaml and Koka.
The same programs in six languages, each one's work counted on one machine. For the typical program native Sakura does 45× the work of C. Its closest and furthest results are both below. Every number
vs C
45×
the work, for the typical program
Within 1.94× of C on
binary_trees. Furthest: 2,107× oncountdown.vs Rust
15×
the work, for the typical program
6.30× less work than Rust on
tokenizer. Furthest: 351× onhandled_reentry.vs Go
8.56×
the work, for the typical program
23× less work than Go on
tokenizer. Furthest: 211× onhandled_reentry.vs OCaml
5.43×
the work, for the typical program
1.93× less work than OCaml on
handled_d16. Furthest: 76× onawfy_permute.vs Koka
2.76×
the work, for the typical program
7.92× less work than Koka on
awfy_mandelbrot. Furthest: 31× onawfy_cd.
Why native Sakura is fast
Cranelift machine code
--target native compiles straight to machine code. Typed numbers stay plain machine numbers.
Memory reused in place
When nothing else holds a value, an update rewrites it where it is instead of copying it (Perceus).
Borrowing, not copying
A function that only reads its argument borrows it, so the call does no reference-counting work.
No collector pauses
Reference counting frees memory the moment it is last used: there is no garbage collector to stop the program.
The JavaScript and WebAssembly builds
Against the same programs written by hand in JavaScript, the typical one does 2.34× the work on Node. Where Sakura is ahead:
- 3.67×less work than the same program in hand-written JavaScriptSakura82.5 MJavaScript303 M
pipeline, map, filter and sum over a list, on Node - 6.02×less work than tsc to type-check a 10,084-line projectSakura1.09 Gtsc6.58 G
sakura check, TypeScript 7.0.2; about even at 100,804 lines - 59 msto build a 10,084-line project, in 19 of 20 runsSakura59 msbudget500 ms
sakura build, 8.49× under its budget - 2.40×less memory than the same program in hand-written JavaScriptSakura66.5 MiBJavaScript159.5 MiB
shapes, updating many small records, built to WebAssembly
Work means CPU instructions per call, counted on an Apple M4 Pro: unlike seconds, a count repeats from run to run. Baseline 70c64513, 2026-10-22. Wall time on a GitHub runner: run 39810593780.
Is it ready?
1.0 is out.
v1.0.0 is the first stable release. The language, standard library, CLI, JSON output and runtime ABI keep working across 1.x; breaking changes wait for 2.0. Native, packages and workers are experimental.
How do I start?
Install it, then check a project.
Binaries for macOS, Linux and Windows. Platforms · Quickstart · For agents
npm i -g sakuralangneeds Node 26
brew tap icantcodefyi/sakuralangbrew trust --tap icantcodefyi/sakuralangbrew install sakuralang
installs Node with it
curl -fsSLO \https://github.com/icantcodefyi/sakuralang/releases/download/v1.0.0/install.shsh install.sh --version 1.0.0
checks SHA256SUMS; verifies attestations when gh is installed
- 1sakura new cli hello && cd helloscaffolds src/main.sak, AGENTS.md, CLAUDE.md
- 2sakura checkno problems
- 3sakura test1 passed, 0 failed, 0 skipped (seed 0)
- 4sakura runhello, world