lminspect guide

Overview

lminspect brings mitmproxy-style HTTP and HTTPS traffic interception, on-the-fly TLS certificate minting, JSONL flow recording and replay, and the 226-signature lmcode_std_v3 standard library into a single zero-dependency Go executable. Addon scripts written in LMScript compile to compact .dslb bytecode and run inside the proxy pipeline with sub-10-millisecond startup overhead.

Proxy architecture and TLS interception modes

The proxy engine supports multiple deployment topologies and interception stages:

Mandatory credential sanitization boundary

Every diagnostic and persistence sink in lminspect — including --record JSONL files, flow.to_json() serialization, --tap stderr streams, replay and route error logs, and _lmcode_ println output — passes through a single mandatory sanitization barrier (proxy.SanitizeOutput):

Standard lmcode_std_v3 REST and CLI interfaces

Alongside RequestHook, ResponseHook, and FlowHook, lminspect embeds the full 226-signature lmcode_std_v3 standard library via github.com/lmctl-ai/lmcode-go. Scripts can expose custom control planes, flow generators, or test harnesses through the 10 standard interfaces:

p = _lmcode_ cli="lminspect" install="github:lmctl-ai/lminspect@latest";
@"--target"
fn opt_target(x: RestExchange) -> void implements CliOption {
  x.set("target", x.query("target"));
}

@"simulate"
fn cmd_simulate(x: RestExchange) -> void implements CliCommand {
  let f = inspect.new_flow("GET", "https://" + x.get("target") + "/api/items");
  f.request().set_query("limit", "10");
  f.respond(200, "{\"items\":[]}", "application/json");
  x.send(f.request().url() + " -> " + str(f.response().status_code()));
}

rest_config("session", "global");
let res_str = rest_cli(str_split("--target=shop.internal simulate", " "));
assert(res_str == "https://shop.internal/api/items?limit=10 -> 200", "simulation mismatch");
end _lmcode_

Combining lminspect with lmmock and lmcurl

In end-to-end testing pipelines, lminspect often runs as a recording reverse proxy (--mode reverse:$LMMOCK_URL --record flows.jsonl) between a client driven by lmcurl and an upstream service or lmmock instance. Because lminspect and lmmock share the <redacted:credential> placeholder convention and JSONL flow schema, traffic recorded by lminspect can be imported directly into lmmock for deterministic offline regression testing.