Open-source language · semantic review · AGPL-3.0

KERN

A smaller language for humans and AI to build from.

KERN is a compact source format, compiler, and semantic review engine for AI-assisted software. Describe the product, let an LLM draft readable .kern, compile it to your stack, then run review rules that understand effects, guards, taint, routes, and framework contracts.

As of v4 it is a typed core language too — classes, enums, closures, and a first-class RAG node family that compile to real TypeScript and Python, with behavior parity enforced by differential conformance, not promised.

SEMANTICKERN IRACTIONEFFECTGUARDCONFREVIEWCOMPILEEVOLVEOne IR, three outputs

What it is

Kern turns AI output into a system you can inspect.

Raw generated code is long, framework-specific, and easy to misunderstand. KERN gives the model a structured language and gives your team a compiler plus review layer around the result.

Write less

Compact .kern source

KERN is indentation-based: nodes, props, style shorthands, handlers, types, routes, machines, and tests in a format that is easy to read and cheap for LLMs to generate.

Compile wider

15 concrete targets

The compiler emits framework-aware code for web, backend, terminal, MCP, Python, Go, and library targets from the same semantic source.

Review deeper

240 registry entries

kern review combines AST rules, concept extraction, taint analysis, confidence scoring, native .kern rules, and MCP security checks.

Why LLMs improve

The model writes the plan. Kern makes the plan executable.

LLMs are strongest when the output format is small, regular, and explicit. KERN keeps layout, routes, types, effects, and review intent in one source tree, so the model has fewer tokens to juggle and humans have a smaller artifact to inspect before compiling.

prompt → .kern → compiled code → review

page name=Checkout
  metadata title="Checkout"
  schema name=Order
    field name=email type=string
  route path="/api/order" method=POST
    validate schema=Order
    handler
      do expr={{ await db.orders.create(input) }}

Compiler sees page, schema, route, validation, and effect boundaries.

Review can flag missing guards, tainted input, route drift, and unsafe side effects.

Before you ship

Review the meaning, not just the syntax.

Kern looks for the bugs that appear when generated code crosses boundaries: database writes, network calls, auth guards, LLM prompts, client/server drift, and MCP tool handlers.

kern review src/ --recursive

! indirect-prompt-injection
  DB result flows into an LLM prompt
  without sanitization

~ unguarded-effect
  write/network effect is not protected
  by an auth or validation guard
240

review rule registry entries in source

12

MCP security rule IDs

TS+PY

concept extraction for TypeScript and Python

conf

confidence scores and suppression metadata

Compiles to

One source, 15 targets.

Next.jsReactVueNuxtExpressFastAPIPythonGoMCPReact NativeCLITerminalInkTailwindLibrary

First-class RAG

Retrieval, grounding, and eval contracts as language nodes.

Your corpus, embedding contract, retriever, grounding policy, and evaluation cases are part of the program — typed, validated, and testable — instead of config scattered across notebooks. Citations, grounding, and eval thresholds become enforceable contracts, evaluated against a deterministic in-memory reference runtime.

Read the RAG docs →
corpus name=Docs
  source name=manuals kind=local uri="./docs/**/*.md"
  chunking strategy=semantic maxTokens=600 overlap=80

retriever name=DocsSearch corpus=Docs topK=8 minScore=0.72

rag name=AnswerDocs retriever=DocsSearch citations=true
  grounding requireCitations=true policy=strict
  ragEval metric=faithfulness threshold=0.85
    ragCase query="How do refunds work?"
      ragAssert kind=sourceGlob value="docs/refunds.md"
      ragAssert kind=citesRequired

Language evolution

When a pattern repeats, Kern can surface it.

The evolve pipeline scans TypeScript, detects recurring patterns, proposes templates or structural nodes, validates them, and stages the approved result. It is a way to turn local conventions into reviewable language constructs.

kern evolve:discover src/

scan
  detect gaps
  analyze patterns
  propose templates
  validate proposals
  stage only approved output

Start here

Build with an LLM. Compile with Kern. Review before deploy.

Install the CLI, ask an LLM for .kern, compile to your target, and run kern review on the generated code.