Built for machines. Audited by humans. v0.7.3

Your AI spends less. You ship more.

A compact language designed for models to generate. It compiles to the readable JavaScript and TypeScript your team already runs, reviews and trusts.

72%fewer output tokens
94%tasks solved
JS/TSwhat you ship
LIVE / COMPILER ONLINE
api.ks 0 TOKENS
api.js 0 TOKENS
import { Hono } from "hono";
import { openDb, defineTable, dbAll, dbAdd } from "./server.js";

const env = readEnv(["PORT", "DATABASE_URL"]);
const db = openDb(env.DATABASE_URL);
const users = defineTable(db, "users", {
  columns: [{ name: "name", type: "str" },
    { name: "email", type: "str", unique: true }]
});
const app = new Hono();
app.get("/users", async (c) => reply(c, ok(dbAll(users))));
app.post("/users", async (c) => {
  const body = await readBody(c, { name: "str", email: "str" });
  if (!body.ok) return c.json({ error: "invalid body" }, 400);
  return reply(c, ok(dbAdd(users, body.value)));
});
serve(app, env.PORT);
01 / PROOF

Measured, not marketed

The same tasks. The same models. A wildly different outcome.

We asked leading models to solve the same coding tasks in JavaScript and KernScript, then ran every result. No vibes. No cherry-picking. Just programs that work, or do not.

DATA / MODEL SPLIT

Claude Opus
96%
71%
Claude Sonnet
96%
71%
Gemini
78%
65%
Real-world tasks
100%
20%
Claude Opus
92%
67%
Claude Sonnet
83%
67%
Gemini
61%
43%
Real-world tasks
100%
20%
Claude Opus
22973
48760
Claude Sonnet
22477
56107
Gemini
5001
18912
Real-world tasks
11196
38487
KernScript JavaScript

Real runs across six analyses. Every program was checked by actually running it. The gap is widest on full backends and agents, where a smaller language gives models far less surface area to get wrong.

02 / CODE LAB

What the model writes

A whole application. Almost no ceremony.

Relations, validation, auth, transactions and tools are first-class forms. KernScript compiles them to idiomatic JavaScript your team can inspect and ship.

4 PROGRAMS READY
OUTPUT TARGETJavaScript / TypeScript
Relations, value validation, pagination, API-key auth and an atomic stock transaction.374 tokens · 22 lines
commerce.ks
(env PORT DATABASE_URL API_KEY)
(server shop :port PORT
  (db categories {name: str unique})
  (db products {name: str nonempty, price: (num :min 0),
                stock: num, category: ref categories})
  (db orders {product: ref products, qty: (num :min 1)})
  (auth :apikey)
  (route GET "/products" :public
    (ok (db.all products :order price)))
  (route POST "/orders" {product qty}
    (let p (db.get products product))
    (if (not p) (err 404 "no product")
      (if (< p.stock qty) (err 400 "insufficient stock")
        (ok (tx
          (db.set products product {stock: (- p.stock qty)})
          (db.add orders {product qty})))))))
Fetch, group, average, partition, rank and paginate. The entire pipeline reads top to bottom.246 tokens · 15 lines
pipeline.ks
(env FEED_URL)
(let people (fetch FEED_URL))
(let adults (filter people (fn [p] (>= p.age 18))))
(let byCity (groupBy adults (fn [p] p.city)))
(let rows (map (entries byCity) (fn [e]
  (let ps (at e 1))
  (let total (reduce ps (fn [s p] (+ s p.age)) 0))
  {city: (at e 0), count: (len ps),
   avg: (toFixed (/ total (len ps)) 1)})))
(let ranked (sort rows (fn [r] (- 0 r.count))))
(for r ranked
  (print "{r.city}: {r.count} people, avg {r.avg}"))
A tool-using agent with schemas, retries, timeouts and memory that survives restarts.185 tokens · 9 lines
agent.ks
(tool add (desc "add a and b")
  (in {a: num, b: num}) (out {sum: num})
  {sum: (+ a b)})
(tool lookup (desc "count feed records")
  (in {q: str}) (out {n: num}) (retry 2) (timeout 5000)
  (let d (fetch FEED_URL {q})) {n: (len d)})
(agent helper (model "claude-sonnet-4-6")
  (system "You are a helpful assistant.")
  (tools [add lookup])
  (memory chat :max 30 :persist "agent-mem.db")
  (permission [:net]))
(let answer (ask helper "Find and summarize the records"))
(print answer.text)
Related resources, JWT on writes, validation, nested comments and live counts.280 tokens · 14 lines
blog.ks
(env PORT DATABASE_URL JWT_SECRET)
(server blog :port PORT
  (db authors {name: str, email: (str :email) unique})
  (db posts {title: (str :len 1 100), body: str,
             author: ref authors, published: bool})
  (db comments {post: ref posts, text: str})
  (auth :jwt)
  (route GET "/posts" :public (ok (db.all posts)))
  (route POST "/posts" {title body author published}
    (ok (db.add posts {title body author published})))
  (route POST "/posts/:id/comments" {text}
    (ok (db.add comments {post: id, text})))
  (route GET "/stats" :public
    (ok {posts: (db.count posts),
         comments: (db.count comments)})))
03 / WHY IT WINS

Smaller surface. Bigger outcomes.

Less code is not the goal. More correct code is.

Models are astonishing pattern machines. KernScript gives them fewer patterns to choose from and makes every one count.

01

More reliable

A small, regular grammar leaves the model far less surface area to get wrong.

02

Self-repairing

One-line compiler diagnostics guide the next correction instead of another full rewrite.

03

Less reasoning

Uniform forms reduce the choices the model must make before it can solve the actual problem.

04

You ship plain JS

Readable JavaScript or strict TypeScript. Your runtime, your review process, your stack.

ONE SHAPEINFERRED ASYNCREAL TYPESSERVER + DBAGENTS + MCP
( )

Uniform syntax

Everything has one shape: (form args). Almost nothing to memorize, very little to hallucinate.

Async, inferred

The compiler awaits what suspends. You never write await, then or Promise.all.

Real type system

Inference, records, unions and diagnostics designed for fast model repair.

Server, DB and auth

Routes, validation, relations, transactions and auth without the glue.

Agents and MCP

Tools, retries, timeouts and persistent memory across leading providers.

04 / START BUILDING

Ready when your model is

Install it. Brief your AI. Ship something impossible.

The language reference fits in a few thousand tokens. Put it in context and your model can write KernScript immediately.

terminal
$ git clone https://github.com/kernscript/kernscript
$ cd kernscript && npm install
$ npx ks run examples/hello.ks

✓ Hello, world!
OPEN SOURCE / AGPL-3.0 Start on GitHub
Node 20+JavaScript / TypeScriptAI-native