LM lmscript.io v0.2.38 · DSLB v6
LMScript (.lms) + LMCode (_lmcode_ · DSLB v6)

Agentic Workflows Meet
Statically Verified Host Bytecode

LMScript is a strict, deterministic scripting language for files, argv processes, structured data blocks, explicit rerun entry points, and multi-agent AI teams. Inside any .lms script, LMCode (_lmcode_) compiles strongly typed domain chunks into DSLB v6 bytecode verified at load time by native C++, Rust, Go, Java, C#, JS, and Python hosts.

Outer Language · .lms

LMScript — The Workflow & Agent Engine

Designed so humans and AI coding agents never fight bash quoting, `undefined` silent bugs, or shell word-splitting. Every script supports --check, --lint, --dry-run, and --trace before touching files, processes, or cloud APIs.

  • Structured data blocks: _json_, _csv_, _toml_, _props_, _graphql_, _cmd_
  • Batteries-included stdlib: File I/O, Regex, JSON/CSV, XML/HTML trees, expand & reverse templates (template_extract)
  • Reliability: recover { resumepoint NAME: ... }, parallel & parallel_map
  • Unified AI Agents: agent_open / agent_turn / agent_prompt & .lmc teamfiles
Inner Bytecode DSL · _lmcode_

LMCode — Statically Typed Host Chunks

Inside a prog = _lmcode_ cli="HOST"; ... end _lmcode_ block, the compiler queries the host's dsl.schema: 2 contract, merges the 206-signature lmcode_std_v3 catalog, typechecks every call, and emits compact DSLB v6 bytecode.

  • Zero runtime type errors: Static types (int, float, string, bool, Json, host objects & enums), compile-time overload resolution
  • Rich literals: qw(), qi(), qf(), %(k => v) maps, json <<~TAG heredocs
  • Rule callbacks: @rule fn ... implements Interface SAM entries & stdio HTTP/1.1 rest module
  • 7 Runtimes & 20+ Hosts: C++17, Rust, Go, Java 21, C#/.NET 8, JS ESM, Python 3 — powering lmaws, lmcad, lmhtml, lmdraw, and more

How LMScript & LMCode Work Together

An .lms script orchestrates configuration constants, local files, and control flow while delegating domain-specific work to verified _lmcode_ bytecode blocks executed via run_lmcode(prog).

LMScript and LMCode Architecture Diagram

Real dogfooding: This website (lmscript.io) is provisioned and published using an LMScript + lmctl-ai/lmaws script (scripts/setup-lmscript-io.lms) that configures the S3 bucket, ACM TLS certificate in Route 53, CloudFront Origin Access Control (OAC) & distribution, Route 53 alias records, and SHA-256 verified static asset uploads:

scripts/setup-lmscript-io.lms (excerpt)
const DOMAIN     = "lmscript.io";
const RUN_ID     = "a1b2c3d4";
const STATE_PATH = ".lmweblab-local/lmscript-io-a1b2c3d4.json";

stack_prog = _lmcode_ cli="lmaws" install="github:lmctl-ai/lmaws@v0.1.34";
  let cloud = aws.region("us-east-1");
  let pol   = cloud.policy("lmaws_lmscript_io")
                   .static_site_stack("lmaws", "lmaws_test", ${DOMAIN}, "us-east-1");

  let web = cloud.web_stack(${RUN_ID}, ${DOMAIN}, ${STATE_PATH});
  web.step("bucket",       "{\"force_destroy\":false}");
  web.step("certificate",  "{}");   # ACM cert + Route 53 DNS validation in lmscript.io zone
  web.step("distribution", "{}");   # CloudFront OAC + distribution + S3 bucket policy
  web.step("dns_site",     "{}");   # Route 53 Alias A record -> CloudFront domain
  web.step("https",        "{}");   # Enforce redirect-to-https
  web.step("cache",        "{\"default_ttl\":300,\"max_ttl\":3600}");
  web.step("invalidate",   "{}");   # CloudFront /* invalidation

  lmcode_return_put("policy_lint", json_parse(pol.lint().json()));
  lmcode_return_put("status",      json_parse(web.status().json()));
end _lmcode_

r = run_lmcode(stack_prog);
require(r.ok, "lmaws web_stack failed");
println(json_stringify(r.result, 2));

An _lmcode_ block uses host context objects (shop, ledger), operator overloading (Money + Money), implicit conversions (int -> Money), quote-lists (qw, qi), map literals (%(...)), and annotated SAM rule callbacks (@vip fn ... implements Adjuster):

shop_rules.lms
const DISCOUNT_CENTS = 250;

prog = _lmcode_ schema="host.schema.json";
  let skus   = qw(keyboard monitor cable);
  let prices = %(keyboard => 12000, monitor => 35000, cable => 1500);

  @vip
  fn apply_discount(price: Money, tier: int) -> Money implements Adjuster {
    let out = price;
    if (tier >= 2) {
      out = price - ${DISCOUNT_CENTS};    # int converts to Money via schema conversion
    }
    return out;                           # return must be the final top-level statement
  }

  for (sku in skus) {
    let base = money(prices.get(sku));
    shop.add(sku, base);
  }
  ledger.record(shop.total());
  lmcode_return_put("sku_count", skus.len());
  lmcode_return_put("status", str(Currency.USD));
end _lmcode_

println("Compiled block type: " + type(prog));

Outer LMScript gives you typed blocks (_csv_, _json_, _toml_), forward expand(...) templates, and inverse template_extract_text(...) parsing in a few lines:

data_pipeline.lms
rows = _csv_;
service,latency_ms,ok
auth,18,true
billing,42,true
search,115,false
end _csv_
rows = rows.value();

slow = filter_by(rows, "ok", false);
line = expand("[ALERT] service=${service} latency=${latency_ms}ms", slow[0]);
println(line);                                          # [ALERT] service=search latency=115ms

parsed = template_extract_text("[ALERT] service=${service} latency=${latency_ms}ms", line);
println(json_stringify(parsed));

Orchestrate multi-turn sessions across Claude, Codex, Gemini, and Kimi using the unified agent_* API or declarative .lmc teamfiles:

review_crew.lms
reviewer = agent_open({
  provider: "claude",
  model: "sonnet"
});
require(reviewer != null, "Agent session unavailable");

res = agent_turn(reviewer, "Inspect scripts/setup-lmscript-io.lms for IAM least-privilege compliance.");
if (res.status == "ok") {
  println(res.reply);
}
agent_close(reviewer);

Quickstart & CLI Execution Modes

Normal execution statically checks each .lms script and then runs it once; lint and dry-run are separate, explicit modes. _lmcode_ blocks are compiled and schema-checked during lmscript --check.

Install & Verify CLI
# Check installed version
lmscript --version

# 1. Syntax & _lmcode_ static type/schema check (no effects run)
lmscript --check scripts/setup-lmscript-io.lms

# 2. Static lint analysis (unused vars, unreachable code, shadowing)
lmscript --lint scripts/setup-lmscript-io.lms

# 3. Dry-run preview (ordinary effects off; reached LMCode hosts get dry metadata)
lmscript --dry-run scripts/setup-lmscript-io.lms

# 4. Run in safe offline preview mode (default)
lmscript scripts/setup-lmscript-io.lms
Inspect LMCode Schemas & Host Binaries
# Install a pinned LMCode host binary from GitHub Releases
lmscript install "github:lmctl-ai/lmaws@v0.1.34"

# Query a host's raw dsl.schema: 2 JSON contract
lmaws --lmcode-schema --json

# List canonical signatures (host + merged 206-sig lmcode_std_v3)
lmscript --lmcode-signatures host.schema.json

# List only host-declared signatures (excluding implicit std)
lmscript --lmcode-signatures host.schema.json --without-std

Complete Documentation Map

LMScript

Language & CLI Reference

Variables, block-owned scoping, 0-based indexing, strings (r"...", f"...", """..."""), path"..." literals, functions, data blocks, PROPS, recover, and parallel.

LMScript

Standard Library Reference

Selected signature reference for File I/O, Strings, Regex, Lists/Maps, XML/HTML trees, Unified agent_*, llm_*, and run_lmcode.

LMScript

10-Part Examples Book

The 58 core runnable book examples, plus a separate XML example, organized from basic syntax through bytecode DSL hosts and explicit rerun entry points.

LMScript

Agentic & Team Workflows

8 production agent patterns (Triage Router, Sequential Crew, Hierarchical Manager, Tool Agent, Fan-Out Judge) + .lmc teamfiles.

LMScript

Language Comparisons

Side-by-side comparisons of LMScript against JavaScript, Python, Perl, and Lua across string handling, processes, and embedded DSLs.

Quick Reference

LMScript & LMCode Cheat Sheet

Single-page reference covering syntax, operators, data blocks, CLI flags, and _lmcode_ literals & types.

LMCode

Writing LMCode Tutorial

Step-by-step author guide: _lmcode_ blocks, run_lmcode, load_schema, literals, ${} splices, rules, and error diagnostics.

LMCode Spec

Language, Schema & DSLB v6 Spec

Formal EBNF grammar, static type system, dsl.schema: 2 rules, 38-byte DSLB v6 header, opcodes 0x01..0x36, and verifier invariants.

LMCode SDKs

Building & Embedding Hosts

Implement an LMCode host in C++17, Rust, Go, Java 21, C#/.NET 8, JS ESM, or Python 3, including LMCODE_RETURN envelopes.

LMCode Std

206-Signature Standard Catalog & REST

Full reference for lmcode_std_v3 (strings, math, codecs, Json, lists/maps, stacks/queues/PQs, return sink) and lmcode_std_rest_v1.

Ecosystem

Domain Hosts & Cloud Emulators

Explore lmaws/awssim, lmgcp, lmazure, lmoci, lmhtml, lmcad, lmdraw, lmvideo, lmplot, lmcurl, lmmock, and lmok.

AWS Dogfooding

How lmscript.io Is Built & Deployed

Inspect the lmaws S3 + CloudFront + ACM + Route 53 provisioning script and static site deployer powering lmscript.io.