GitHub - etoxin/surface

GitHub

4 min read Original article ↗

Surface is a small KDL format for describing an application without prescribing its implementation. It gives humans and LLMs a shared, checked product specification: data, capabilities, interfaces, screens, technology choices, context, and ordered logic.

It adds just enough syntax to describe an application with the ability to add LLM context to kdl nodes.

Status: experimental · Format: Surface 0.1 · Syntax: KDL 2 · Extension: .kdl

/- kdl-version 2

surface "0.1"

application "todo" {
    purpose "Keep a small list of tasks."

    stack "web" {
        target "browser"
        technology "markup" "html"
        technology "styling" "css"
    }
}

collection "todo" {
    (string)"text"
    (boolean)"completed"
}

(array)value "todos" variable {
    context (collection)"todo" "Contain the current todos."
}

function "createTodo" {
    collection "todoInput" {
        (string)"text"
    }

    input (collection)"todoInput"
    output (collection)"todo"

    logic {
        (collection)"todoInput" "Trim the text and output null if it is empty."
        (collection)"todo" "Otherwise, output a todo with that text and completed set to false."
    }
}

interface "todoList" {
    context (value)"todos" (function)"createTodo" "Render a text input, an Add button, and the current todos."

    logic {
        (value)"todos" "Start with this value empty."
        (function)"createTodo" "When Add is activated, call this function and append its output when it is not null."
        (collection)"todo" "Let the user toggle each todo between complete and incomplete."
    }
}

screen "home" {
    use (interface)"todoList"
}

Install on macOS

Surface currently builds locally from source. Install mise, then build and install the CLI for your user:

git clone https://github.com/etoxin/surface.git
cd surface
mise install
mise run build
install -d "$HOME/.local/bin"
install -m 755 build/surf "$HOME/.local/bin/surf"

Make sure your ~/.zshrc contains:

export PATH="$HOME/.local/bin:$PATH"

Open a new terminal and confirm the installation:

This installation path currently supports macOS only.

Start a Project

Enter a directory containing a surface.kdl file, then run:

Select Codex, Claude Code, or both. The command installs their project-local Surface skills and adds /build/ to .gitignore. Use surf init --codex, surf init --claude, or both flags for a non-interactive setup.

To have an LLM create the specification as well as the application, follow Create a Specification with an LLM.

Start with Getting started to write and implement your own specification. Surface is experimental, so keep the .kdl source in version control and review generated applications before using them.

Documentation

Guide Purpose
Writing Surface Documentation overview and language shape
Getting started Install, write, validate, and implement a first app
Generating applications Give a Surface specification to an LLM reproducibly
Testing and reporting Test implementations and report useful evidence
Surface 0.1 grammar Complete authoritative language reference
Starting a Surface file File marker and format version
Application Application identity and purpose
Technology stacks Targets, technologies, versions, and design systems
Portable types Language-neutral type annotations
Values and enums Constants, variables, and enum values
Collections Typed data shapes
Functions Inputs, outputs, private collections, and capabilities
Interfaces Intent-driven user interfaces
Screens Interface placement and navigation intent
Context Prompt guidance and checked references
Logic Ordered normative instructions

Examples

Five examples cover the workflow from first use through platform-scale tests:

Online Checkout and Multi-tenant Project Tracker pin Pico CSS 2.1.1 in their application stacks and test the frozen grammar at platform scale.

Each example is its own agent workspace. Enter one and initialize it with the installed CLI:

cd examples/todo-list
surf init

Select Codex, Claude Code, or both, then open that agent in the example directory. Run $surf-build in Codex or /surf:build in Claude Code. Both build surface.kdl into build/; generated build directories are ignored by Git.

CLI

surf init [--codex] [--claude]
surf parse <file.kdl>
surf check <file.kdl>
surf format <file.kdl>
surf reference <file.kdl> <selector|--list>

reference --list discovers selectors and typed reference literals. Passing a selector prints its complete KDL declaration for focused human or LLM context.

For repository development, run mise tasks to see the available tasks. The complete repository check is mise run verify.

Surface 0.1 is frozen. Bug fixes, diagnostics, formatting, documentation, and tooling may improve, but new valid syntax belongs to a later format version.