lminspect
lminspect is a pure-Go HTTP/HTTPS proxy, dynamic TLS MITM interceptor, flow recorder, and LMScript host modeled on mitmproxy. It runs bytecode-compiled _lmcode_ addons inside the proxy pipeline, enforces mandatory credential sanitization on all outputs, and supports standard REST and CLI interfaces.
Quick reference
npm install -g @lmctl-ai/lmctl@latest
lminspect --version
lminspect --lmcode-schema
lminspect --lmcode-signatures
| Interface or flag | Signature or syntax | Purpose |
|---|---|---|
| CLI host bytecode | lminspect --lmcode prog.dslb [--save out.dslb] | Execute compiled LMScript bytecode offline or validate and save an addon bytecode artifact. |
| CLI schema and signatures | lminspect --lmcode-schema [--json] | --lmcode-signatures | Print embedded JSON schema or all canonical host and lmcode_std_v3 signatures (also accepts --dsl-* aliases). |
| CLI proxy daemon | lminspect run [--listen ADDR] [--mode MODE] [--ssl-bump] [--tap] [--record FILE] [--script FILE.dslb] | Start a forward, reverse (reverse:URL), or transparent HTTP/HTTPS proxy with optional TLS MITM, JSONL recording, and DSL addons. |
| CLI declarative rules | lminspect run [--redirect pat=url] [--route pat=host:port] [--header pat=k:v] [--mock pat=code:body] | Apply pattern-matched redirects, upstream route overrides, header injections, or synthetic responses without writing a script. |
| CLI certgen and replay | lminspect certgen [--cert ca.crt] [--key ca.key] | lminspect replay --client flows.jsonl [--target host:port] | Mint a local Root CA for dynamic SSL-Bump leaf certificates or replay recorded JSONL flows against a target endpoint. |
| context inspect: Inspector | inspect.new_flow(method, url) | inspect.parse_flow(json) -> Flow | Construct synthetic HTTP flows or reconstitute serialized flows inside _lmcode_ scripts. |
| RequestHook / ResponseHook / FlowHook | @request fn h(f: Flow) -> void implements RequestHook | Intercept and mutate live HTTP requests and responses or return synthetic responses via Flow.respond. |
| Flow / Request / Response | f.request().set_header(k, v) | f.respond(code, body, ctype) | f.kill() | Read and rewrite methods, URLs, query parameters, headers, and bodies, or short-circuit and drop flows. |
| 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="lminspect" install="github:lmctl-ai/lminspect@latest";
@request
fn on_req(f: Flow) -> void implements RequestHook {
f.request().set_header("X-Proxy-By", "lminspect");
}
@"/flow/:seg"
fn get_flow(x: RestExchange) -> void implements RestGet {
let f = inspect.new_flow("POST", "https://api.internal/" + x.param("seg"));
f.respond(201, "{\"seg\":\"" + x.param("seg") + "\"}", "application/json");
x.json("{\"status\":" + str(f.response().status_code()) + ",\"path\":\"" + f.request().path() + "\"}");
}
rest_config("session", "global");
let out = rest_cli(str_split("/flow/orders", " "));
assert(out == "{\"status\":201,\"path\":\"/orders\"}", "unexpected rest_cli output");
end _lmcode_
res = run_lmcode(p);
require(res.ok, json_stringify(res));
Documentation pages
- Skill — agent authoring rules, proxy and replay commands, mandatory credential sanitization rules, exit codes, and verification steps.
- Guide — proxy architecture, dynamic SSL-Bump TLS decryption, Flow hook lifecycle, credential-safe JSONL capture format, and standard REST and CLI interfaces.
- Reference — complete CLI subcommands and flags, Inspector/Flow/Request/Response methods, standard lmcode_std_v3 interfaces, and exit codes.