Language Krank

krank is a minimal production-rules engine whose notation a model can emit, with a prose round-trip renderer that checks a translation against the original rules.

The round trip

A human writes intent in prose. A model compiles the prose into a rule set: facts, and rules whose conditions and actions are JSON. The engine evaluates the rule set deterministically and forward. The renderer turns the rules back into prose, and a reader compares that prose with the original. That comparison is the evidence that the compilation kept the meaning.

The aim is to shrink what the model must hold. In a later iteration it receives the compiled rules and calls the engine to prove conformance, instead of re-reading the full prose.

The round-trip example walks one translation: the original prose, the compiled rules, the rules rendered back, the comparison, and the result. The playground edits a rule set and runs it.

The engine

A fact is a JSON object. A rule has an id, a when conjunction, a then list of actions, and an optional numeric priority. A condition matches by equality, by binding a value to a $variable, or by an operator object: eq, ne, lt, lte, gt, gte, in. A negated condition may reference a bound variable but may not bind a new one. An action asserts, retracts, or emits; a rule binding fires once. A ruleset_session keeps working memory and refraction across runs.

The library and renderer are browser-safe ES modules with no dependencies; the command-line tool is Node-only. The package is @bannister.us/krank.

Status

Active. Tests cover the engine, the renderer, the package surface, the round-trip fixture, and these pages.

ItemValue
Version0.3.0
Branchmaster
Commit3953bb3
Fetched2026-11-11T09:37:53-08:00
Notationdocuments/10-rule-notation.md
Round-trip recorddocuments/11-round-trip.md
Featureprompts/features/04-browser-demo.md