kilat
Built Kilat: a small statically typed scripting language with units of measure and a fuel-and-memory sandbox, written from scratch in Rust with zero dependencies; it runs as a CLI, as a WebAssembly playground in the browser and as a Cairn plugin, refused 20 of 20 seeded bugs before running, and version 0.2.3 measured 3.06x CPython 3.13's speed on CPU time across 10 benchmarks on one Windows PC (2.49x with start-up taken out, 5x target not met)
Kilat - a small typed scripting language with units and a sandbox ("kilat" is Malay for lightning)
- Repo: https://github.com/juw12/kilat (public, MIT)
- Live: https://juw12.github.io/kilat/ (playground: edit the code, press Run)
- Guide: https://github.com/juw12/kilat/blob/main/docs/LANGUAGE.md
- Results: https://github.com/juw12/kilat/blob/main/RESULTS.md
What it is
A small language for calculations and safe scripting. Types and units are checked, so a mistake such as adding metres to seconds is refused instead of printing a wrong number. Programs run inside a sandbox with a step budget (fuel) and a memory limit, so an endless loop or a runaway allocation is stopped.
Measured (judge script, run 2 of 2)
- Speed (version 0.2.0): 3.06x CPython 3.13 on CPU time over 10 benchmarks, 2.62x net of start-up. The 5x target was not met. Net of start-up it is faster on 9 of 10 and about level on
strings; none is slower. (Version 0.1 measured 2.82x and 2.43x and was slower onstringsandmap_count.) - Fuzz and differential test: 11,607 cases, 0 failures, 0 worker restarts (test and its Python reference written by the same author as the language).
- Bugs refused before running: Kilat 20/20, mypy --strict 14/20, plain CPython 0/20 (author-written bug set).
- Run 2 passed every check. Run 1 failed one page-freeze timing check (526 ms against a 500 ms limit) while the PC was going to sleep.
Where it fits
- Cairn: a plugin that renders
kilatcode blocks with their results. Install: Plugins, "Install from GitHub or a link", typejuw12/kilat. Tested in the real Cairn web app (demo brain, headless Edge): 8 of 8 checks, twice. Catalogue pull request: https://github.com/juw12/cairn/pull/35 (open). The in-app install from GitHub and the desktop build are not tested. - Glow: run model-written Kilat in the WebAssembly sandbox with fuel and memory limits, and feed type and unit errors back to the model.
host(name, payload)is the gate where an app adds its own functions. GlowCode page (a person or a model writes Kilat, the checker gates it before it runs): https://github.com/juw12/projects/pull/53 (open; tested with a stand-in model only). - Other projects:
kilat.run(source)from Python,loadKilat()from JavaScript,kilat runon the command line.
Limits
- Not better than Python overall: no package ecosystem, no debugger or editor support. The release files are unsigned.
- Known fault: a fuel stop can report the wrong place for an empty
while true { }loop (the program is still stopped). - Nobody else has written a bug set or repeated the measurements.
- Floating point overflow gives
infandnan, as in other languages.
Next
- ☑ List the Kilat plugin in Cairn's catalogue and try it inside the real app (2026-11-12: pull request 35 open; 8 of 8 in the web app)
- ☑ GitHub release with a prebuilt kilat.exe (2026-11-12: https://github.com/juw12/kilat/releases/tag/v0.2.0, download checked)
- ☑ Faster strings and maps (2026-11-12:
strings1.04x andmap_count1.06x net of start-up, were below 1) - ☐ Merge the Cairn and GlowCode pull requests after CI
- ☐ Fix the fuel-stop location fault (needs a rebuild)
- ☐ A bug set and a rerun of the measurements by someone else
- Portfolio card: https://juwenlie.pages.dev/ (live 2026-11-11)
- Landing page: https://juw12.github.io/p/kilat/ (live 2026-11-11 22:38, juw12.github.io
300270c; gates 1/1, DNA 1/1; card style changed from flat to outline after a visual check)
Hone 2026-11-12
- Release 0.2.0: https://github.com/juw12/kilat/releases/tag/v0.2.0 (kilat.exe 1,271,808 bytes, download checked by hash and run).
- Speed against CPython 3.13.2 over 10 benchmarks: 3.06x whole process, 2.62x net of start-up; no program slower net of start-up,
stringsandmap_countabout level. The 5x target was not met. - Fuzz and differential test: 11,607 cases, 0 failures (seed 20261112; reference written by the same author).
- Pull requests, both open: Cairn catalogue https://github.com/juw12/cairn/pull/35 and GlowCode https://github.com/juw12/projects/pull/53.
- Hone score with the frozen rubric kilat-r2: v0 5.15 -> v1 7.05, gates 5/5, judged by self (the council run for v1 hung twice and was killed; the council had scored v0 5.15). v1 kept; stopped below 8.5 because the remaining gaps need an engine rebuild or other people.
- Sync commits: landing page
80ad196, profileffa5b63, portfolio catalogue text5dda6f7and syncc90b42a, vow card artad8ed7c, Kilat repod7c2e2aanddfdcf4f(run log closed).
Round 2 (2026-11-12 morning): 0.2.1 local, not published
- Fuel-stop location fault fixed, with a regression test (4 of 4). Version 0.2.1 built.
- judge.py with 0.2.1: every check passed. Speed 3.11x whole process, 2.79x net of start-up, 10 of 10 faster (3x net and 5x not reached). Fuzz: 11,607 cases, 0 failures.
- CI workflow written, not run. Release 0.2.1, both pull request merges and the page syncs are not done.
- Local commits
6f1da96,9ec1d71; GitHub main stilldfdcf4f. git push is refused by the network proxy (it asks for a sign-in); waiting for Juwen. - Hone v2 7.24 (self-judged), kept locally.
Round 2 published (2026-11-12 midday): 0.2.1 released, both pull requests merged
- Kilat 0.2.1 is published. Release https://github.com/juw12/kilat/releases/tag/v0.2.1 ; the download was checked by hash and by running it. A real install with
install.cmdwas not run; the files are unsigned. - The checks now rerun on GitHub's Windows and Linux machines on every push; both passed (bugs refused 20 of 20, fuzz 11,607 cases, 0 failures; speed there 2.76x and 2.80x net of start-up). Same script and same author, so this is a second machine, not a second person.
- Speed on this PC is unchanged: 3.11x CPython whole process, 2.79x net of start-up, 10 of 10 faster, closest 1.12x (
strings,map_count). The 3x net target and the 5x goal were not met. - GlowCode pull request 53 merged (
juw12/projectsd2e3976); live at https://juw12.github.io/projects/glow/code/ with files identical to the merged branch. Not re-run in a browser after the merge; still the 0.2.0 web engine. - Cairn pull request 35 merged (
juw12/cairn82bc778); the live catalogue lists Kilat 0.2.0. Cairn's red check is the same three e2e tests that already fail on main (compared in local runs; the test names in GitHub's own run could not be read). Install from the catalogue inside Cairn was not tested. - Synced: Kilat repo
466e2ebplus the run-log commit, landing page9d6091c(live page shows 3.11 and 0.2.1), profile0bad631, portfolio text3b51d7f. - Publishing: the network proxy sometimes refuses git. Pushes used plain git when it was let through; the GitHub API was used only for what git cannot do and only while git was being let through. No sign-in to the proxy with the Windows account.
- Hone (rubric kilat-r2, judged by self): v2 7.24 -> v3 7.61. Stopped below 8.5; more needs deeper engine work or other people.
- Next, if wanted: web engine at 0.2.1 for GlowCode, bump the Cairn catalogue entry, test Cairn's in-app install, fix Cairn's three failing e2e tests.
Round 3 follow-ups (2026-11-12 afternoon)
- All four "not verified" items and all four "next" items from round 2 are done. Kilat is still 0.2.1; nothing in the language changed.
- Real install:
install.cmd /quietwas run on this PC. The installedkilat.exehas the same SHA-256 as the release download, one folder was added to the user PATH (16 to 17 entries), a second install changes nothing,kilat versionprintskilat 0.2.1. It is really installed now; to remove it, delete the Kilat folder under the local programs folder and its PATH entry. - GlowCode: web engine 0.2.1 is live (
juw12/projectspull request 54, 4 of 4 checks green, merged as0105a60). Livekilat.wasmis 722,723 bytes and matches the local build by hash. Headless browser on local copies: 11 of 11 with the old and with the new engine. The six model-conversation cases were not rerun. - Cairn: catalogue lists Kilat 0.2.1 live (
juw12/cairnpull request 36, merged asce2fae0). Install from the live catalogue inside the app: 19 of 19 checks (headless browser on a local server). - Cairn tests on GitHub, Python 3.13: 362 tests, failures 4 -> 1, on the pull request and again on main after the merge. The three e2e sidebar tests were out of date (Chat in the sidebar is intended), so the tests were changed, not the app.
- Cairn main is still red. Left for me to decide: (1) the relay token test fails off Windows because the token is only sealed on Windows: make that check Windows-only, or add real protection elsewhere; (2) on Python 3.10,
cairn vibe log --progress N textis refused (twotest_progresserrors, hidden before because the 3.10 job on main is always cancelled): fix the option order, or drop 3.10. - Merged pull request 36 although the run was red: it lowers failures, changes a version string and test expectations only, and the 3.10 errors are not from the branch.
- Security note: a scratch helper for reading run logs followed GitHub's redirect and sent the GitHub token to GitHub's own log storage host (two rejected requests, most likely one earlier). Fixed: the header is dropped on redirects to another host. Low risk; regenerate the token to be strict.
- Publishing: plain git when the network proxy let it through; GitHub API only for what git cannot do and only while git was being let through. No sign-in to the proxy with the Windows account. Browser checks ran on a local server with live bytes fetched beforehand.
- Speed and hone score unchanged: 3.11x CPython whole process, 2.79x net of start-up (3x net and 5x not met); hone 7.61 self-judged, below 8.5.
- Still not verified: six model-conversation cases in GlowCode, live pages in a real browser session, Cairn desktop build, the two 3.10 errors on main itself.
Round 4 (2026-11-12 afternoon): Cairn tests green, both decisions done
- Both of my decisions are in Cairn (
juw12/cairnpull request 37, https://github.com/juw12/cairn/pull/37, merged asf0f7c42): the relay sealing check runs on Windows only (the round trip is still checked everywhere), and the tests run on the latest Python only (3.x, which was 3.15.2). Python 3.10 is no longer tested; its two errors were not fixed. - One more test fix in the same pull request: another change on main (
ec335ad) made the app fetch notes with GraphQL, the GitHub stand-in used by the tests did not answer that, and 13 sign-in tests failed. The stand-in now answers it. No check was loosened, no app code changed. - Cairn's test run is green, on the pull request and again on main after the merge: 362 tests, OK, 2 skipped. Before: 1 failure on
ce2fae0, 14 onec335ad. - GlowCode's six model-conversation cases: 6 of 6 on Kilat 0.2.1, with scripted model replies on a local copy.
- Cairn desktop server (the real server code on a temporary brain, headless browser): install Kilat, run a kilat block, save the note to a real file, reload. First run 18 of 19 (the reload timed out after 30 s); second run with extra logging 21 of 21 (reload 0.8 s, no open requests, no dialogs). The timeout was not reproduced and its cause is not proven; the PC was busy.
- Still for me to check by hand: GlowCode and the catalogue in a real browser; the Cairn app window itself with Kilat installed.
- Open point: Cairn's
pyproject.toml,README.mdanddocs/install.ps1still say Python 3.10+, and nothing tests that any more. - Kilat itself did not change: still 0.2.1, 3.11x CPython whole process, 2.79x net of start-up (3x net and 5x not met), hone 7.61 self-judged, below 8.5. Log in
juw12/kilatat463e062.
Round 5 (2026-11-12 evening): the "not verified" items, checked for real
- Cairn's stated minimum Python is now 3.13 (
juw12/cairnpull request 38, https://github.com/juw12/cairn/pull/38, merged asd1e8d87):pyproject.toml,README.mdanddocs/install.ps1, 8 lines. GitHub run green on the pull request and on main. Local run on Python 3.13.2: 352 of 362 while my other browser jobs were running (10 browser wait timeouts, 0 failures), then those 10 alone 10 of 10. - Live pages in a real browser (Edge 157 headless, through a local forwarder with no sign-in): 14 of 14 on GlowCode and the Cairn catalogue, 14 of 14 on the playground and the live Cairn web app. GlowCode says "Kilat 0.2.1 is ready"; the live Cairn web app installs Kilat 0.2.1 with one real download.
- A real model wrote Kilat in GlowCode, 4 of 4 tasks: rod stress 53.1 MPa, resistor 25.5 mA and 306.4 mW, box volume 9.00 L (second try, the checker refused the first), shaft torque 49.4 N*m. Providers failed six times on the way (three "payment required", one "too many requests", two aborted); the page moved on each time.
- Kilat in Cairn's real window engine (pywebview with WebView2): 23 of 23. A separate copy of the app on a temporary brain, window hidden: install from the catalogue, a kilat block gives 20.8 MPa, metres plus kilograms is refused, the note is saved to a real file, a reload keeps the install. My real settings files were not changed.
- Still for me by hand: in my installed Cairn, Plugins, turn on community plugins, Install Kilat (about 30 s). That one was not touched.
- Still not verified: no single clean run of all Cairn tests on 3.13 (GitHub tests the latest Python only); the test count was not read from the GitHub logs this round; models were tried on 4 tasks, once each.
- My installed Cairn updates itself from main and will restart once, because
pyproject.tomlchanged. - Kilat itself did not change: still 0.2.1, 3.11x CPython whole process, 2.79x net of start-up (3x net and 5x not met), hone 7.61 self-judged, below 8.5. Log in
juw12/kilatat7eba964.
Round 6 (2026-11-12)
- Cairn main
d4b7a12(PR 39 merged): CI green, 362 tests, 2 skipped, on CPython 3.13.18 and 3.15.2. - Model sample on the live GlowCode page (Kilat 0.2.1, 10 engineering tasks x 3 repeats, free models):
- spaced run (45 s gap): 24 of 30 correct, 1 ran but wrong, 5 refused by the checker, 0 with no model answer.
- fast run (4 s gap): 16 of 30 correct, 7 wrong, 1 refused, 6 with no model answer (provider rate limits from my own pace).
- Shaft torque and spring were 0 of 3 each. The round-5 "4 of 4" does not hold on a larger sample.
- Three usability defects I found in Kilat:
rpmis silently an angular speed, so models convert twice (rpm * 2 * pi / 60). One wrong number got through: 471.7 where 49.39 was expected.expr in Jseems to give a bare number, then{energy:J.3}is refused.{x}without a unit prints base SI plus its label, so models add a second unit ("96 N N").
- Plan for 0.2.2 (not started): checker hint for the rpm double conversion plus a prompt line; make
in <unit>work with a unit placeholder or refuse with a clear hint; refuse a unit word right after a unit-less placeholder. Then rerun the spaced sample. - Kilat is not installed in my own Cairn yet. I had Cairn open, so the automated restart was skipped. Manual: Cairn -> Plugins -> turn on community plugins -> Install on the Kilat card.
- Still not verified: block rendering in my real Cairn, full suite on Windows Python 3.13.2, speed goals (3.11x whole process, 2.79x net of start-up), hone score 7.61 self-judged.
- kilat commit
f3fd709.
Round 7 (2026-11-13)
- Kilat 0.2.2 released (commit
371b9bf, https://github.com/juw12/kilat/releases/tag/v0.2.2). Three checker hints: rpm times2 * pi / 60is refused,"{force} N"is refused when the placeholder already prints a unit, clearer message for{energy:J}afterin J. - Download check passed:
kilat.exe1,282,048 bytes, zip 635,718 bytes with 10 files.install.cmdwas not rerun for 0.2.2. - Judge on my PC (CPython 3.13.2, PC in use): 3.02x whole process, 2.54x net of start-up. Faster net on 9 of 10,
stringsis slower net (0.90). 20 of 20 bugs refused, mypy 14. 0.2.1 was 3.11x / 2.79x and 10 of 10, so no speed gain this round. - CI on
371b9bfgreen: Windows 2.63x / 2.55x net, Linux 2.80x / 2.74x net, none slower, fuzz 11,607 cases with 0 failures. - Cairn PR 40 merged (catalogue 0.2.1 -> 0.2.2). GlowCode PR 55 merged as
efb9522. My first push failed the Glow checks because I forgot the pinned wasm hash, fixed inb64e87c. - Live GlowCode page shows "Kilat 0.2.2 is ready",
kilat.wasm728,823 bytes matches the pinned hash. - Model sample on the live page (Kilat 0.2.2, same 10 tasks x 3 repeats):
- 27 of 30 correct (25 first try), 2 ran but wrong, 1 test rig error (Run click timed out). Round 6 was 24 of 30.
- Shaft torque and spring went from 0 of 3 to 3 of 3 each.
- Held-out tasks the prompt never saw: 4 of 4 (3 first try).
- Caveat 1: many runs were replays, only 15 distinct programs in 30 runs.
- Caveat 2: the prompt line contains the test number (1450 rpm), and I never saw the new checker messages fire. The gain may come from the prompt line, not the checker.
- New defect: a unit-less placeholder prints base SI.
{largest}gave0.0024 mwhere 2.4 mm was wanted. Value right, display wrong. That is both "ran but wrong" results. apps/fade/tests/verify_api.pyin juw12/projects is flaky (409, thenKeyError: 'booking'). It fails the same on unmodified main on my PC and passed on main CI. Not touched, my call.- Kilat is still not installed in my own Cairn. Cairn window was open, so nothing was changed. Manual: Cairn -> Plugins -> turn on community plugins -> Install on the Kilat card.
- Still not verified:
install.cmdon 0.2.2, full Cairn suite on Windows Python 3.13.2, speed goals (3x net, 5x whole), hone score 7.61 self-judged against 8.5 with an outside judge, model samples are not independent. - Next (0.2.3, not started): show the entered unit for a unit-less placeholder or give a hint, record refusal messages in the sample, make the Run click robust, bigger held-out set.
- kilat commit
94690f4, CI green.
Round 8 (2026-11-13 to 2026-11-16)
- Kilat 0.2.3 released and installed on my PC (0.2.1 -> 0.2.3). A value with a unit is shown only in a unit the program names (breaking change). Unit hints 75 of 75.
- Cairn PR 42 and GlowCode PR 80 merged. Live GlowCode files are byte-identical to the committed ones. App checks on GitHub: live page 9 of 9 three times, Cairn plugin on Windows 8 of 8 three times, on Ubuntu 8 of 8 once after two failures.
- Speed against CPython 3.13.2: my PC 3.06x whole and 2.49x net of start-up. GitHub, 18 reports: whole 2.78x to 3.19x, net 2.70x to 3.13x, 11 of 18 reached 3x. No real gain over 0.2.2 except
map_count. - Model sample: main 30 of 30, held-out 39 of 42. 39 of 72 answers came back in under 3 s (replays), and the check reads numbers only.
- Hone council 7.34 (v0 5.15, target 8.5 not reached), gates 5 of 5.
- Kilat is still not installed in my own Cairn. Manual: Cairn -> Plugins -> turn on community plugins -> Install on the Kilat card.
- Still not verified: full Cairn suite on Windows on my PC, clean-PC install and browser download, a bug set and a repeat by another person, speed goals (3x net, 5x), independent model answers, causes of the low Linux report, the low
sievefigure and the redverify_review.pyrun. - Kilat has not been shown to beat Python overall.
- Next: install in my Cairn, independent evidence, clean-PC install, speed to 3x net, checker messages that name the line, model sample with fresh answers.
- kilat commit
ff77abf(log only, CI skipped), last CI-checked commit0fc6052.
Round 8 sync (2026-11-16)
- The profile, the portfolio card and the landing page still said 0.2.1 (the sync had been skipped for 0.2.2 and 0.2.3). All three now say 0.2.3.
- Profile: https://github.com/juw12/juw12/commit/82247a75050c3cba7db0065c54273a2364214842
- Card: catalogue https://github.com/juw12/projects/commit/6ff2ef92396d75d16c2c132ca25c7a17371f915b, card commit
06aff894cbin juw12/portfolio. Live at https://juwenlie.pages.dev/ and https://juw12.github.io/portfolio/ (both 200, new text shown, no "0.2.1"). - Landing: https://github.com/juw12/juw12.github.io/commit/7f58b0487c088b3684025dbb551704e010631643 and https://github.com/juw12/juw12.github.io/commit/e0a31b73b6b390328af1735a7013f4a05c56099c. Live at https://juw12.github.io/p/kilat/ (200, equal byte for byte to the landing tool's build).
- Landing tool data updated for Kilat only, backups kept. Details: 2026-11-16 2018 kilat round 8.
- The
claim:line of this note now carries the 0.2.3 numbers. - kilat commit
cc57282(log only, CI skipped) is now the last commit; 31 commits.