Quick Start
Get running with mlld in 5 minutes.
mlld validatetakes one file, not a folder.
Install
npm install -g mlld
To build from source instead:
git clone https://github.com/mlld-lang/mlld.git
cd mlld
make install # builds with cargo; installs mlld to ~/.cargo/bin
Building needs Rust (cargo) 1.88 or newer; the repository pins the exact toolchain, which rustup fetches. make install puts mlld and mlld-cli in ~/.cargo/bin, which must be on your PATH; make install BINDIR=/usr/local/bin installs them somewhere else.
Upgrading from 2.1? The 2.2.0 migration guide lists every change to how mlld is written, and mlld migrate rewrites most of them for you (see mlld migrate --help).
Set Up Your Tools
Install the mlld skill so your LLM coding assistant can help you write mlld. Run it from your own project:
cd /path/to/your/project
mlld skill install
The skills go to your home directory. For Codex, Pi and OpenCode it also writes hook files into the git checkout you run it from, so run it from a project rather than the mlld clone. To add the hook files to another project later, run mlld skill install --project from that project.
This gives Claude Code (and other supported tools) the ability to understand mlld syntax, generate scripts, and help you debug.
Two other commands you'll use constantly:
mlld howto <keyword> # Search docs by keyword (fuzzy matches titles, tags, content)
mlld validate <file> # Instant syntax check — catches errors before you run
mlld howto is your go-to reference. Try mlld howto import, mlld howto for, mlld howto security — it covers everything.
Your First Script
Create hello.mld:
const @name = "World"
show `Hello, ${@name}!`
Run it:
mlld hello.mld
Output:
Hello, World!
That's it. const creates a value (names always start with @), backticks fill in anything inside ${...}, show prints output. Plain "..." quotes never fill anything in.
Load Files
Angle brackets load file contents:
const @readme = <README.md>
const @config = <package.json>
show `Project: ${@config.name}`
Globs load multiple files:
const @docs = <src/**/*.ts>
show `Found ${@docs.length()} files`
Call an LLM
This is what mlld is for. Import the @mlld/multi-harness module and call it:
import { @agent } from @mlld/multi-harness
const @code = <src/app.ts>
const @review = @agent(`Review this code for bugs:\n\n${@code}`)
show @review
@agent is a callable function. You pass it a prompt, it returns the response. It runs on a supported coding-agent CLI (claude, codex, pi or opencode), installed and signed in; with no harness in its config it uses the first one it finds. mlld fetches the module the first time a script imports it.
Functions
Define reusable functions with exe:
exe @greet(name) = `Hello, ${@name}!`
exe @add(a, b) = js { return a + b }
show @greet("World")
show @add(2, 3)
Define functions that call an LLM with llm instead of exe. Every llm call is recorded on the run tape, so mlld run <script> --resume continues an interrupted run without repeating the calls that already finished:
import { @agent } from @mlld/multi-harness
llm @summarize(file) = @agent(`Summarize in one sentence:\n\n${@file}`)
Control Flow
Iterate with for, branch with if:
const @names = ["Alice", "Bob", "Charlie"]
for @name in @names => show `Hello, ${@name}!`
const @score = 85
if @score >= 90 => show "Excellent!"
if @score >= 70 => show "Good job!"
if @score < 70 => show "Keep trying!"
Run Shell Commands
Execute shell commands and capture results:
const @branch = run cmd {git branch --show-current}
show `On branch: ${@branch}`
policy @allow_sh = { * { capabilities: { sh: true } } }
run sh {
npm test && echo "Tests passed!" || echo "Tests failed!"
}
cmd for simple pipe-safe commands, sh for full shell scripts. sh is off by default, because policy rules can't see inside it; the policy line switches it on. Prefer cmd where it will do. Also js, node, and py for other languages.
A Real Example
Put it together — summarize every TypeScript file in a project:
import { @agent } from @mlld/multi-harness
llm @summarize(file) = @agent(`Summarize in one sentence:\n\n${@file}`)
const @files = <src/*.ts>
const @summaries = for @f in @files [
let @summary = @summarize(@f)
=> `- **${@f.mx.filename}**: ${@summary}`
]
show @summaries.join("\n")
This loads every .ts file, sends each to an LLM, and collects the results. Because @summarize is defined with llm, an interrupted run picks up where it stopped with mlld run <script> --resume. A plain rerun calls the model again.
Next Steps
You know enough to start building. When you need more:
mlld howto <keyword> # Search any topic
mlld howto import # Modules and imports
mlld howto security # Prompt injection defense
mlld howto mcp # MCP tool integration
mlld howto # Browse all topics
mlld validate <file> # Check a script before you run it
Run mlld qs anytime to see a condensed syntax reference.