lmcode-go

lmcode-go is a standard-library-only Go 1.26+ SDK (package lmcode) for verifying and executing lmcode DSLB v6 bytecode in static Go binaries. It builds cleanly with CGO_ENABLED=0 and provides the 226-signature lmcode_std_v3 catalog, rest.Controller controller, dry-mode callbacks, and LMCODE_RETURN framing.

Quick reference

git clone https://github.com/lmctl-ai/lmcode-go.git
cd lmcode-go
CGO_ENABLED=0 go test ./...
go run ./cmd/conformance conformance/vectors
ItemSignature / ValueRole
lmcode.NewRegistry()*lmcode.RegistryCreate a registry preloaded with all 226 canonical lmcode_std_v3 signatures
lmcode.NewRegistryWithoutStd()*lmcode.RegistryCreate an empty registry without the standard catalog
lmcode.Load(bc, schema, reg)(*lmcode.Program, error)Verify DSLB v6 header, SHA-256 schema hash, imports, and control-flow stack depths
prog.Run(ctx, reg)errorRun the verified bytecode body with a per-run Context
prog.Call(entryIdx, ctx, reg, args)(lmcode.Value, error)Call an R49 rule entry by index with typed lmcode.Value arguments
rest.Register(reg, rest.Options{})(*rest.Controller, error)Bind the 20 REST/CLI std signatures to a configured HTTP/1.1 stdio and CLI server
lmcode.InvocationResultsFromCommand(files)(*lmcode.InvocationResults, error)Manage multi-part ResultSinks, dry mode, and LMCODE_RETURN_BEGIN/END output
package main

import (
	"os"
	lmcode "github.com/lmctl-ai/lmcode-go"
	"github.com/lmctl-ai/lmcode-go/rest"
)

func main() {
	reg := lmcode.NewRegistry()
	srv, _ := rest.Register(reg, rest.Options{MaxBodyBytes: 1 << 20})
	bc, _ := os.ReadFile(os.Args[1])
	schema, _ := os.ReadFile(os.Args[2])
	prog, err := lmcode.Load(bc, schema, reg)
	lmcode.ExitIfError("load", err)
	err = srv.Run(prog, lmcode.NewContext())
	lmcode.ExitIfError("run", err)
}

Documentation pages

Source repository and releases