lmgallery guide

lmgallery demonstrates how multiple domain-specific LMScript hosts collaborate inside a single script to compute quantitative results and turn them into plots, 3D renders, diagrams, office documents, and PDF reports.

Overview

Each native host in the lmctl ecosystem focuses on one computational or visual domain and embeds its own schema. An LMScript program can declare multiple _lmcode_ blocks bound to different hosts, execute each block in turn with run_lmcode, and pass intermediate files from simulation hosts to rendering or document hosts.

Multi-host composition architecture

Every script in examples/ follows a strict zero-setup contract so it can execute via lmctl from an empty working directory without cloning the repository:

# 1. Compute trajectory in lmspace
orb = _lmcode_ cli="lmspace" install="github:lmctl-ai/lmspace@latest";
let earth = space.body("earth", 398600.4418);
let sat = space.body("sat", 0.000000000001, 7000.0, 0.0, 0.0, 0.0, 8.8, 0.0);
let out = space.system().add(earth).add(sat).propagate(20000.0, 801, 5.0, "rk45", 0.000000000001);
out.save_csv("orbit.csv");
end _lmcode_
r1 = run_lmcode(orb);
require(r1.ok, "orbit propagation failed");

# 2. Plot the satellite path (columns 8 and 9 are x and y in km) in lmplot
fig = _lmcode_ cli="lmplot" install="github:lmctl-ai/lmplot@latest";
plot.png("images/orbit.png", 900, 600);
plot.cmd("set datafile separator ','");
plot.cmd("plot 'orbit.csv' using 8:9 with lines lw 2 title 'Orbit'");
end _lmcode_
r2 = run_lmcode(fig);
require(r2.ok, "orbit plot failed");

Cross-host data handoff conventions

Because each host writes tabular output in its native format, compositions must configure downstream readers to match the upstream producer:

When plotting mixed whitespace and comma-separated files in lmplot, remember that gnuplot's set datafile separator ',' applies to subsequent plot commands until reset.

Document and report pipelines

Most compositions from 26 through 50 extend the compute-and-visualize pattern to document-as-code workflows. A domain host such as lmnum, lmfinance, lmweather, lmphysics, lmspace, lmssl, lmhtml, or lmcloud computes metrics and writes structured tables; lmvideo renders high-resolution charts, terminal snapshots, or 3D figures; lmoffice assembles Word documents (.docx), Excel workbooks (.xlsx), or PowerPoint decks (.pptx); and lmpdf renders publication-grade PDFs and page previews.

Manifests and repository maintenance

The gallery is driven by two JSON manifests in the repository root:

After editing catalog.json or showcases.json, run python3 scripts/build-readme.py to regenerate README.md, examples/README.md, and docs/ATTRIBUTION.md. Run ./examples/render-all.sh to re-execute the compositions and update docs/images/.