Kilat Try it live
Web · CLIlive

Units and types are checked before the program runs.

Kilat is a small programming language for engineering calculations and safe scripts. 2 m + 3 kg is refused instead of printing a number.

Web · CLI · Rust
kilat · live demolive demo
Kilat screenshot
2platforms: Web, CLI
20/20seeded mistakes refused before running
1.3 MBone program, no dependencies
3.06×CPython 3.13 CPU time, 10 benchmarks
Why it exists

A wrong unit stops the program before it starts.

The whole language is one program of 1.3 MB with no dependencies.

It is not better than Python overall.

In short

Where a small checked language fits.

01

Engineering calculations

Stress, bolt joints and unit conversions. kilat eval "print(90 km/h in mph)" prints 55.9234073014.

02

Code written by an AI model

Let the model write Kilat, run it in the WebAssembly engine with a fuel and memory limit, and send any type or unit error back to the model.

03

Your own app's functions

A program can only reach the outside through one function, host(name, payload), which the app supplies. That is where an app adds http_get, ask_ai or anything else it wants to allow.

How it works

Three steps to a first result.

  1. 1

    Open the playground

    Go to juw12.github.io/kilat.

  2. 2

    Run a calculation

    Set force to 1200 N and area to 58 mm^2, then print force / area in MPa.

  3. 3

    Break it on purpose

    Add a length to a mass. Kilat refuses before running: unit mismatch: cannot add m and kg.

What's inside

What Kilat checks, limits and reports.

Units are part of the value

Write 1200 N divided by 58 mm^2 and print it in MPa: stress = 20.7 MPa. Adding metres to kilograms is an error that points at the line and the column.

Mistakes found before the run

On 20 small programs with one realistic mistake each, Kilat refused all 20 before running. mypy --strict caught 14 and CPython alone caught 0. The author of Kilat wrote the programs, so read it as a demonstration, not an independent benchmark.

Numbers without surprises

round_to(2.675, 2) gives 2.68. Division by zero, the square root of a negative number and integer overflow stop the program with an error. A misspelt name gets a "did you mean" hint.

One small program

The kilat program is 1,271,808 bytes and needs only files that are part of Windows. Start-up costs 5 ms of CPU.

Safe to run

Files can only be read with --allow-read and written with --allow-write. A fuel limit and a memory limit stop a runaway program. The WebAssembly engine has 0 imports, so it cannot reach anything the page does not hand it.

Runs in a web page

Copy kilat.js and kilat.wasm next to your page, load the engine and call kilat.run() on the program text.

Runs inside Python

Copy kilat.py and the built library next to your script. kilat.run() returns the output and kilat.check() returns the unit or type error.

Results inside Cairn notes

Install the plugin from juw12/kilat and a code block marked kilat shows its result under the code. It was tested in the Cairn web app in a headless browser (8 of 8 checks). The in-app install from GitHub and the desktop build were not tested.

Working today

Measured, losses included.

Run it yourself

Run a calculation.

From the README’s “Run a calculation” section. Full options, requirements and troubleshooting are there too.

Open the README
text
$ kilat --version                         prints kilat 0.2.0
$ kilat run examples\hello.kilat
$ kilat check examples\bolt_joint.kilat
$ kilat eval "print(90 km/h in mph)"      prints 55.9234073014
Your data

Limited by default.

  • Files can only be read with --allow-read and written with --allow-write.
  • The WebAssembly engine has 0 imports, so it cannot reach anything the page does not hand it.
  • A program can only reach the outside through host(name, payload), which the app supplies.
Good to know

Honest limits.

Straight from the README, so you know what you're getting before you try it.

  • No packages and no library ecosystem.
  • No classes, traits, async or threads.
  • New and unproven: version 0.2, one author, tested on one Windows PC.
  • The bug set and the fuzz test were written by the author.
  • Fuel counts work, not seconds, so an app that needs a time limit must add a clock.
Under the hood

How it's built.

Built with

Language
PythonRustJavaScriptHTML/CSS
Testing
Automated tests

143 files in the repo · last updated 11 Nov 2026.

Browse the code

Recently shipped

  1. Install.cmd: point to the release download when kilat.exe is missing

  2. 0.2.0 work: pool allocator, faster maps, mean/median/stddev, worker mode

  3. Initial release: Kilat language, CLI, sandbox, WebAssembly playground and Cairn plugin

Full history on GitHub
Questions

Good questions.

What does it run on?

Web, CLI. You can try it in the browser with nothing to install.

How do I get it running?

The commands in the “Run a calculation” box above come straight from the README. Paste them into a terminal; the README covers options and troubleshooting.

Where does my data go?

Files can only be read with --allow-read and written with --allow-write. The WebAssembly engine has 0 imports, so it cannot reach anything the page does not hand it.

Is it better than Python?

Not overall. Python has the libraries, the tools and the community, and Kilat has none of that.

How fast is it?

Over 10 benchmarks the geometric mean is 3.06 times faster than CPython 3.13 for the whole process and 2.62 with start-up taken out.

Can I use it in my own app?

The same engine runs in a web page, inside Python and as a Cairn plugin.

What doesn't it do yet?

No packages and no library ecosystem. No classes, traits, async or threads.

Is it finished?

Not yet: it's marked “live” and still changing. The README always has the current state.

Keep exploring

More from the same workbench.

Write the calculation. Kilat checks the units.

Units and types are checked before the program runs.