lmscript is a small scripting language and CLI for file operations, structured data, subprocesses, agent workflows and typed _lmcode_ programs that native lmcode hosts execute. This page is the quick reference; scripts run with the operator's full local authority (no sandbox), so run only trusted scripts.
Install and run
lmscript ships in the @lmctl-ai/lmctl npm package, which also installs lmctl.
Runs one program or one sealed builder in a single host process. Single result {ok, result}; builder result {ok, result: [...], parts}. Options: args, command.
REST endpoint and stateless CLI interfaces of the standard catalog.
Minimal _lmcode_ example
A complete script: the block is compiled against the lmhtml host schema at check time, and run_lmcode executes it in the host and returns the result envelope.
check = _lmcode_ cli="lmhtml" install="github:lmctl-ai/lmhtml@latest";
let pages = html.load_dir("site");
for (i in range(0, pages.len())) {
let page = pages.at(i);
let links = page.links();
for (j in range(0, links.len())) {
let url = links.at(j);
if (!html.link_exists(page, url)) {
report.add("broken-link", page.path(), 0, url + " not found");
}
}
}
report.write_text("broken.txt");
end _lmcode_
r = run_lmcode(check);
require(r.ok, "host failed");
println(r.result);
lmscript --check links.lms
lmscript links.lms
Documentation
Skill: what an LLM agent needs to write correct lmscript.
User guide: language, CLI, lmcode blocks and the standard catalog.