Mix — manual
The reference manual for the Mix language, one page per topic. The canonical
home of these pages is
docs/_man/ in the public
markc/mix repo; add a page by dropping TOPIC.md
there. The same files render everywhere:
- Terminal —
mix man TOPIC(mix manalone prints this index). mix man— reads cosmix.dev/mix, a mirror of this directory in thecosmixrepo ($COSMIX/mix/). It is kept in step automatically: the mix repo's post-commit hook runs$COSMIX/build/sync-man.mixwhenever a page here is committed (copy, prune, regenerate HTML stubs, commit, push). Ifmix manlooks stale, run that script by hand and check~/.cache/cosmix/man/(24 h cache).- Web — markc.github.io/mix serves the manual in the site's left-hand Manual pane; any page deep-links as
#_man/PAGE.md. - GitHub — browse
docs/_man/directly; this file doubles as the directory README. - Local clone — plain markdown with relative links; any editor or viewer works.
Start here
- overview — what Mix is, why it exists, where it came from.
- invocation & CLI —
mix file,-c,-,-i, login shell,--serve, flags. - the mix command —
mix help/man/builtins/what/status/trace/… meta-commands. - syntax & the classifier — tokens, the newline rule, shell-vs-Mix dispatch.
The language
- variables, sigils & scope —
$sigils,${...}, function-local binding. - strings —
'raw'vs"interp",..concat, codepoint/byte/grapheme ops. - numbers — f64, radix literals, ordering, coercion.
- operators — arithmetic, comparison,
and/or/not,..,?:,??. - control flow —
if/while/for/loop, if-as-expression,break/continue. - functions, lambdas & modules —
fn, closures, the pass-in/return/reassign triad. - modules — require/include/source —
require()isolated module loading vs the splice loaders. - lists & maps — literals, indexing,
push/pop, the base footguns. - higher-order functions —
map/filter/reduce/sort_by/group_by/… - errors & exit handling —
try/catch/die/panic,run_rc().rc, timeouts.
Builtins & I/O
- math — rounding, powers, logs, trig,
min/max/clamp, constants. - files & I/O —
read_file/write_file/glob/stat/chmod/walk/… - processes & system —
run/run_rc/run_stream/spawn/env/exit/… - data & serialization — JSON, TOML,
jq,data_encode, strict-data.mix. - byte buffers —
buffer/buffer_push/freeze, the one reference-semantic type. - regular expressions —
re_match/re_find/re_replace/re_split/grep_lines(subject first). - dates & time —
time/date_format/now_iso/duration_format. - http —
http_get/http_post/http_request, deadlines. - datastar —
ds_*SSE event framing.
Mesh & runtime
- Bus messaging —
send/emit/address/on,$result/$rcbands, the mesh. - serving as a citizen —
mix --serve service.mix, the supervised runtime. - remote execution (ssh) —
ssh_run/ssh_must/ssh_mix, env transports. - capabilities & embedding — the capability classes + sandbox model.
Reference
- builtin index — every builtin by category.
- reserved words — the keyword set, keywords-as-names.
- shell-dispatch mode — pipes,
&&, brace expansion,$(...), redirects. - usage statistics — runtime modes, report windows, persistence, kill switch, static coverage.
Design docs & specs
Design docs, background rationale, and the formal specs (04 language reference, 18 citizen runtime) all live in the operator control repo since 2026-07-23; this manual is the complete public reference.
See also
mix help the full categorized builtin reference
mix builtins [CAT] list builtins, optionally by category
mix what NAME one-line description of a builtin or keyword
mix man TOPIC read any of the pages above in the terminal
For AI agents: AGENTS.md at
the repo root is a short orientation sheet whose canonical reference is this
manual.