Introduction
KERN is a compact language, compiler, and semantic review toolchain for AI-assisted software. You can write .kern yourself, or ask an LLM to draft it, then compile and review the result.
How it works
KERN is small enough for humans to read and regular enough for LLMs to generate reliably. The same source can describe UI, routes, types, tests, MCP tools, and review intent without forcing the model to emit every framework detail up front.
Describe a SaaS landing page with pricing and dark mode
Writes 40 lines of .kern — layout, styles, data, interactions
Compiles to framework code and keeps the source reviewable
Review, tweak, ship — or tell the AI to iterate
The practical loop is simple: describe the change, inspect the .kern, compile to your target, run review, and iterate with evidence instead of a wall of generated code.
What you get
15 targets, 1 source
The compiler config lists lib, Next.js, Tailwind, web, native, Express, CLI, Terminal, Ink, Vue, Nuxt, FastAPI, MCP, Python, and Go targets.
Smaller review surface
A .kern file keeps the design, data, routes, and effects in a compact structure humans can scan before compiling.
kern review
240 review rule registry entries plus concept extraction, taint analysis, confidence scoring, and MCP security checks.
MCP server
KERN exposes compile, schema, review, validation, parse, decompile, and target-listing tools to compatible agents.
LLM-friendly
Regular indentation, explicit props, and a bounded node vocabulary give models a clearer output target than raw app code.
TS → KERN
kern import converts existing TypeScript to .kern. Reverse-compile your codebase.
Why these docs exist
If the AI writes KERN, why do you need docs? Three reasons:
- Understand what the AI generated — Read the .kern output, know what each node does, verify it's correct.
- Guide the AI better — The more you know about KERN's capabilities, the better prompts you write. "Add a state machine for the checkout flow" beats "make the checkout work."
- Trust the output — Understand the compiler, the review rules, the config options. Ship with confidence.
What KERN looks like
You'll see this in AI output. Each line is a node with props and styles:
page name=Hello
metadata title="Hello World"
col {ai:center,p:80,gap:16}
text value="Hello World" tag=h1 {fs:48,fw:800,c:#fff}
text value="Built with KERN" tag=p {fs:18,c:#a1a1aa}
button text="Get Started" to=start {bg:#f97316,c:#fff,br:8,p:16}The Syntax Reference explains every piece. The point is not to memorize every node; it is to know enough to guide, review, and correct generated .kern.
Get started
npm install -g @kernlang/cliChoose your path
Deep reference
The language surface: UI, backend, routes, tests, MCP, review, and core nodes
Style System30 shorthands — how styling works
Targets15 compile targets — where your code goes
Review240 registry entries — what gets caught before you ship
RAGRetrieval, grounding, and eval contracts as typed language nodes
Native Testing.test.kern — the language tests itself
EvolveSelf-extending IR — teach KERN new nodes from any codebase