lmcode skill

Use the lmcode specification to author schema-bound _lmcode_ blocks, validate DSLB v6 bytecode, and verify cross-runtime conformance.

Purpose

Define the exact language syntax, dsl.schema: 2 contract, DSLB v6 binary layout, lmcode_std_v3 226-signature catalog, REST/CLI stdio protocol, and conformance vectors shared by all lmcode runtimes.

When to use it

Use lmcode when designing a new host schema, writing _lmcode_ programs with rule entries or REST/CLI endpoints, implementing a new language runtime SDK, or auditing cross-runtime conformance.

Install

Clone lmctl-ai/lmcode and install @lmctl-ai/lmctl (0.2.444 or newer; CI pins a newer compiler in scripts/ci/compiler-version) with Node.js and Python 3 to run the grammar and conformance checks. Released hosts may still ship the 206-signature catalog without the REST/CLI interfaces.

Commands

git clone https://github.com/lmctl-ai/lmcode.git
cd lmcode
python3 tests/grammar/tree_sitter_differential.py --json /tmp/tree-sitter-diff.json

Inputs and outputs

Safety rules

Worked examples

# Check both Tree-sitter grammars against the pinned compiler
python3 tests/grammar/tree_sitter_differential.py --json /tmp/tree-sitter-diff.json
# List the REST/CLI fragment declarations (20 signatures + 10 interfaces)
python3 -m json.tool std/rest/lmcode-rest.schema.json

Errors and exit codes

CodePhaseExitCondition
LOAD_BAD_BYTECODEload3Malformed DSLB v6 header, bad magic or version, truncated section, invalid opcode, or stack depth violation
LOAD_BAD_SCHEMAload3Host schema JSON fails dsl.schema 2 validation or declares an invalid result contract
LOAD_SCHEMA_MISMATCHload332-byte SHA-256 schema hash in DSLB v6 header does not match exact host schema bytes
LOAD_UNBOUNDload3Bytecode imports a context, function, or method signature not registered in the host Registry
RUN_ERRORrun3VM division or remainder by zero, or loop-free operand stack underflow
RUN_HOSTrun3Host callback failure, invalid encoding, expired collection handle, or REST route validation failure
APP_FAILapp4Post-run application domain validation failure or output stream write failure

How to verify

python3 tests/grammar/tree_sitter_differential.py --json /tmp/tree-sitter-diff.json