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 is 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

The compiler derives stair facing, half, and shape, and is to derive door orientation, pane connections, and bed head/foot the same way. You override only 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 each slot to a material, 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. Experimental for now: the routed circuit does not reach the built structure yet.

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 floor -> @oak_planks
slot wall -> @cobblestone
slot roof -> @spruce_stairs
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

The specification is draft 2026.06. The language is being designed in the open, and the reference compiler already builds Java and Bedrock structure files from one source; what it does not cover yet, the spec marks as not implemented. See the specification for the normative document and the roadmap for what lands when.