lmdebug
lmdebug is a Linux network, system, process, packet-capture, and detection introspection CLI and LMScript host in one self-contained executable. It emits structured JSON on the command line, exposes typed domain contexts (lmdebug, net, sys, proc, detect, shark), and enforces an audited dry-run-by-default mutation framework.
Quick reference
npm install -g @lmctl-ai/lmctl@latest
lmdebug --version
lmdebug caps
lmdebug --lmcode-schema
lmdebug --lmcode-signatures
lmdebug pcap --lmcode-signatures
| Interface or flag | Signature or syntax | Purpose |
|---|---|---|
| CLI capabilities and metadata | lmdebug caps | --lmcode-schema [--json] | --lmcode-signatures | Inspect platform capabilities, effective privileges, supported commands, embedded schema JSON, and canonical signatures. |
| CLI host bytecode and dry-run | lmdebug [--dry-run] [--plan-format json|text] --lmcode prog.dslb | Execute compiled LMScript bytecode or emit an lmscript.host_plan.v1 effect plan without mutating host state. |
| CLI network diagnostics | lmdebug dns|dig|ifaddrs|link|ethtool|route|rule|neigh|counters|sockets|trace|mtr|arping|scan|pipe|ping|iperf3 | Query rtnetlink interfaces, routes, rules, neighbors, /proc socket tables, DNS records, TCP scans, and active probes as JSON. |
| CLI system, process, detection | lmdebug sys cpu|mem|disk|top|set | proc [list]|show|kill | detect scan|autoruns|hashes|quarantine|restore | Sample CPU, memory, disk, and process tables, scan files with static libyara or hash databases, and plan audited mutations. |
| context lmdebug: Meta | lmdebug.caps_json() | lmdebug.apply_enabled() | lmdebug.force_enabled() | lmdebug.changes_remaining() | Query host capability JSON, mutation apply/force state, and remaining change budget inside _lmcode_ scripts. |
| context net: Net | net.dns_lookup(host) | net.interfaces() | net.links() | net.routes() | net.sockets(proto, listen) | net.scan(host, ports) | Perform DNS resolution, rtnetlink device and routing queries, socket ownership attribution, TCP port scans, and active probes. |
| context sys: Sys / proc: Proc | sys.cpu() | sys.mem() | sys.disk() | sys.top() | sys.set(k, v) | proc.list() | proc.show(pid) | proc.kill(pid, sig) | Inspect kernel performance counters and /proc process descriptors, or generate dry-run sysctl and pidfd signal plans. |
| context detect: Detect | detect.scan(path) | detect.autoruns() | detect.hash_import(path) | detect.hashes_scan(path) | detect.quarantine(path) | Run embedded YARA scans, enumerate Linux persistence locations, query LMHASH01 stores, and plan file quarantine or restore actions. |
| context shark: Shark | lmdebug pcap --lmcode prog.dslb (shark.interfaces(), packet builders, dissectors, flows, display/cBPF filters) | Synthesize, read, filter, dissect, and export pcap/pcapng traces or enumerate libpcap capture interfaces. |
| Standard REST and CLI | RestGet..RestOptions, RestHandler, CliCommand, CliOption | Expose _lmcode_ functions as HTTP routes (:param) or stateless CLI flags and commands via rest_serve and rest_cli. |
p = _lmcode_ cli="lmdebug" install="github:lmctl-ai/lmdebug@latest";
let ifs = net.interfaces();
assert(ifs.len() > 0);
let s = net.socket_summary("tcp");
@"/sockets/listening"
fn get_listening(x: RestExchange) -> void implements RestGet {
let sum = net.socket_summary("tcp");
x.json("{\"listening\":" + str(sum.listening()) + "}");
}
rest_config("session", "global");
let out = rest_cli(str_split("/sockets/listening", " "));
lmcode_return_put("listening_tcp", s.listening());
lmcode_return_put("rest_out", out);
end _lmcode_
res = run_lmcode(p);
require(res.ok, json_stringify(res));
Documentation pages
- Skill — agent authoring rules, commands, capability and dry-run safety boundaries, exit codes, and verification steps.
- Guide — architecture across net, sys, proc, detect, and shark domains, audited mutation workflow, cross-tool segment correlation, and standard REST and CLI interfaces.
- Reference — complete CLI subcommands and flags, domain contexts and methods, standard lmcode_std_v3 interfaces, and exit codes.