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.
| Item | Value |
|---|---|
| Version | 0.3.0 |
| Branch | master |
| Commit | 3953bb3 |
| Fetched | 2026-11-11T09:37:53-08:00 |
| Notation | documents/10-rule-notation.md |
| Round-trip record | documents/11-round-trip.md |
| Feature | prompts/features/04-browser-demo.md |