lmcode

lmcode is the specification, DSLB v6 bytecode contract, 226-signature standard catalog, and conformance suite for schema-bound host programs. It defines the grammar, schema format, verifier rules, standard REST and CLI interfaces, invocation result protocol, and cross-runtime test vectors.

Quick reference

git clone https://github.com/lmctl-ai/lmcode.git
cd lmcode
npm install -g @lmctl-ai/lmctl
python3 tests/grammar/tree_sitter_differential.py --json /tmp/tree-sitter-diff.json
ItemSignature / ValueRole
Bytecode formatDSLB v6Schema-hash bound bytecode with typed imports, line table, and R49 entry table
Schema versiondsl.schema: 2Declares host types, methods, functions, contexts, enums, operators, interfaces, and result contract
Standard cataloglmcode_std_v3 (226 signatures)Strings, byte codecs, math, files, collections, containers, strict JSON, templates, returns, and REST/CLI
Standard interfaces10 interfacesRestGet..RestOptions, RestHandler, CliCommand, and CliOption on RestExchange
Return protocolLMCODE_RETURN_BEGIN / ENDSingle-shot compact UTF-8 JSON result envelope after body, entries, and app checks
Host CLI flags--lmcode, --lmcode-schema, --lmcode-signaturesStandard discovery and execution flags with exit codes 0, 2, 3, and 4
program = _lmcode_ schema="host.schema.json";

@"/users/:id"
fn get_user(x: RestExchange) -> void implements RestGet {
  x.json("{\"id\":\"" + x.param("id") + "\"}");
}

@"status"
fn cli_status(x: RestExchange) -> void implements CliCommand {
  x.send("ok:" + x.param("arg0"));
}

rest_config("prefix", "/api");
$return.preview = rest_cli(qw/status ready/);
rest_serve();
end _lmcode_

Documentation pages

Source repository and releases