Skip to content

Cairn — a description language for Minecraft builds

A description language for Minecraft builds. Declare intent — walls, roofs, windows, symmetry, redstone — and the compiler resolves the voxels.

Minecraft’s NBT/SNBT is inefficient for AI to handle directly — it’s binary, one-record-per-block, and misaligned with how humans and AI reason about architecture (walls, roofs, symmetry). Cairn is an intermediate language that aligns architectural intent with the voxel world. It is the “eyes and hands” an AI uses to see and build.

The approach is generation-first (lossy): full round-trip fidelity with NBT is given up in favor of letting an AI generate and edit builds accurately. The portable artifact is always the Cairn source; emitted NBT/schematics are per-target build outputs.

Declare intent, not blockstate

Stair facing, door orientation, pane connections, and bed head/foot are derived by the compiler; you only override when the value is the intent.

Phase-ordered evaluation

Write commands flat and order-free; the compiler sorts them into fixed phases — massing, envelope, openings, fixtures, redstone, raw.

CSS-like themes

Structure carries material slots; a theme binds slots and selectors to materials, separating where from what.

Java and Bedrock from one source

Edition is a compile-time target axis; the canonical vocabulary and per-edition backends absorb ID/state differences. Recompile, don’t transcode.

Logical redstone

Describe a signal graph; the compiler synthesizes and place-and-routes the actual dust/repeaters/torches per edition.

Lint as a first-class loop

The compiler is also an architectural linter. Precision is earned through a self-correcting loop, not one-shot generation.

@requires version>=1.20
theme medieval:
slot wall -> @cobblestone
slot roof -> @spruce_stairs
window[class=small] -> frame=@spruce_wood
struct cottage size=9x7
floor mat_slot=floor
walls class=outer mat_slot=wall height=4
door side=front at=center
window class=small side=front offset=2 y=2 size=2x2 sym=true
roof kind=gable mat_slot=roof overhang=1
Terminal window
cairn compile cottage.crn --edition java --target 1.21.4

Cairn is at the design stage, draft 2026.06. The language is being designed in the open and the reference compiler is a skeleton; see the specification for the normative document and Developer Guide for the implementation roadmap.