Extract a lumped-RC parasitic-annotated netlist from a routed layout (`klt
extract --parasitics`), re-run one or more `klt sim` testbench requests
against it per corner, and report a per-corner, per-spec-row schematic-vs-
extracted delta -- Phase 1a of Epic #709. Each testbench's `netlist` file must
`.include`/`.inc` its schematic DUT (the same convention docs/cli/extract.md's
'Verified compatible with klt sim's netlist convention' documents); the
extracted-side run re-points only that one line at the freshly-extracted
netlist, reusing `klt sim`'s existing `netlist_source` field. For a spec row
no single `.meas` card can express, --measure-command replaces the testbench
set with a caller-supplied command run once per side (issue #2478). See
docs/cli/pex.md for the request/response contract.

positional arguments:
  layout path to a GDSII or OASIS layout file (required unless --attach is given alone)
  testbenches one or more `klt sim` request JSON files, each `.include`ing the same schematic DUT netlist -- reused completely unmodified for the schematic-side run, and with only their `.include`/`.inc` DUT reference re- pointed for the extracted-side run. Required unless --measure-command is given (the two are mutually exclusive).

options:
  -h, --help show this help message and exit
  --tie-declared-pins passed through to `klt extract --tie-declared-pins` (issue #4383): declared pins that extraction joins into one net (e.g. ground and body) are tied back to every declared name so the extracted .SUBCKT keeps the schematic's pin count. Requires --pins. Off by default -- byte-identical to today's behavior. Echoed as `extraction.tie_declared_pins`.
  --measure-command COMMAND measure both legs with this command instead of with `klt sim` testbenches (issue #2478). Split into an argv list with shell quoting rules and run TWICE -- once with --reference-netlist, once with the netlist this run extracted -- never through a shell. Each invocation gets the netlist path as its final argument plus $KLT_PEX_SIDE/$KLT_PEX_NETLIST/$KLT_PEX_ARTIFACTS_DIR in its environment (plus $KLT_PEX_BACKEND and $KLT_SIM_BACKEND when --backend is given), and must print a measurement document on stdout: {"corners": [{"corner_id": ..., "measurements": [{"name": ..., "value": ..., "status": ...}]}]}. Use it for a spec row no single `.meas` card can express (a threshold- crossing search, a cross-Monte-Carlo statistic, a measurement on a derived/loop-broken netlist, an injection-based estimator). klt pex still drives extraction, still picks both netlists, and still computes every delta[] row itself. Requires --reference-netlist. Mutually exclusive with <testbench>. See docs/cli/pex.md's "Measuring with a caller-supplied command" section.
  --reference-netlist PATH the schematic DUT netlist the schematic-side measurement is taken on, and the `reference_netlist` this run reports (issue #2478). Required with --measure-command; also accepted with --extract-only (issue #5477), where it measures nothing and buys only the model_mismatch device-set comparison -- the one signal that names a device family the resolved deck declares no class for, which extraction.unsupported_devices cannot see when the family has no drawn marker layer. Rejected in testbench mode -- there the schematic DUT is whatever every testbench `.include`s, which is an observation rather than a caller's claim.
  --measure-timeout-s SECONDS wall-clock cap on ONE --measure-command invocation (there are two per run, one per side) -- default 1800s, the same cap `klt signoff` puts on a command- backed evidence entry. Requires --measure-command.
  --flatten-schematic flatten the schematic DUT to PDK leaf devices before the schematic-side run (issue #2889): every subcircuit the DUT netlist defines is inlined (instance-path- prefixed device/node names, parameter and m= overrides propagated, .global nets kept), written to <outdir>/schematic-dut.flat.spice, and each testbench's DUT .include is re-pointed at it -- so a hierarchical schematic compares like with like against the always-flat extraction and model_mismatch stops firing on hierarchy alone. A cycle, an X-call pin- count mismatch or a card the flattener cannot rename safely is an error (error.code schematic_flatten_*), never a partial flatten. Off by default -- byte- identical to today's behavior. Reported as `flatten_schematic` plus the `schematic_flatten` block (path, sha256, inlining summary). The klt pex counterpart of klt lvs's options.flatten_reference.
  --device-only-leg also measure a parasitic-free third leg (issue #3298): the same layout extracted again without parasitics (same devices and AS/AD/PS/PD, no R/C cards or star nodes), written beside the extracted netlist as <name>.device-only<ext>, and every testbench re-run against it. Each delta[] row then also carries device_only_value, representation_delta_pct (device- only vs schematic) and parasitic_delta_pct (extracted vs device-only), splitting device-representation effects from parasitics. With --measure-command the command is run a third time on the parasitic-free netlist ($KLT_PEX_SIDE=device-only). Off by default -- byte-identical to today's behavior.
  --extract-only extract and report without any measurement leg (issue #3739): no testbench or --measure-command is needed, so no placeholder measurement lands in delta[]. The response carries extraction/body_bias/provenance as usual, testbenches and delta are empty, measurement.mode is "extract-only" and status is not_checked (exit 4). Cannot be combined with testbenches, --measure-command, --measure-timeout-s, --device-only-leg or --flatten-schematic. May be combined with --reference-netlist (issue #5477) to compute model_mismatch -- a device-set comparison over both netlists' text, which needs no measurement leg -- so an extraction missing a whole device family is named rather than silently absent; status and the exit code are unchanged by it. Off by default.
  --deck DECK extraction deck to run (currently: asap7, gf180mcu, sg13cmos5l, sg13g2, sky130), passed through to `klt extract --parasitics`. Required unless --attach is given alone (issue #4692).
  -o, --output OUTPUT path to write the extracted SPICE netlist (default: <layout> with its extension replaced by .spice)
  --top TOP top cell to extract when the stream has more than one (required in that case; optional otherwise)
  --pdk PDK PDK variant to resolve (e.g. sky130A); overrides $PDK. Optional -- extraction runs from --deck alone when omitted.
  --pdk-root PDK_ROOT explicit PDK install root; overrides $PDK_ROOT and the search order
  --outdir OUTDIR override where this command writes its own generated artifacts (the extracted-side testbench body/request copies, and each `klt sim` call's own `options.keep_artifacts` output, namespaced per testbench and per side) -- default: a `.klt/pex/` directory next to <layout>
  --backend BACKEND execution backend passed through to every `klt sim` call (schematic and extracted side, every testbench) -- see docs/cli/sim.md's 'Execution backends'. Defaults to `local` (or each testbench request's own `backend` field).
  --max-units-per-job MAX_UNITS_PER_JOB backend `batch`: split each side's expanded corner/Monte-Carlo unit list into batch jobs of at most this many units (applied to the schematic and the extracted `klt sim` call of every testbench separately), so no job outruns the fleet's whole-job ceiling (default: each request's `batch.max_units_per_job`, else no split). Same as `klt sim --max-units-per-job`.
  --max-concurrent-jobs MAX_CONCURRENT_JOBS backend `batch`, sharded runs: keep at most this many shard jobs in flight at once per `klt sim` call (default: each request's `batch.max_concurrent_jobs`, else every shard is submitted at once). Same as `klt sim --max-concurrent-jobs`.
  --hosts HOSTS backend `batch`: shard each side's expanded corner/Monte-Carlo unit list across this many hosts (applied to the schematic and the extracted `klt sim` call of every testbench separately); each leg records its shard job ids in its own `batch-shards.json` so `--resume` can re-attach. Same as `klt sim --hosts` (default: each request's `remote.hosts`).
  --wait-for-capacity SECONDS with --backend batch, wait up to SECONDS (>= 0) for fleet capacity when the launch is refused (batch_no_capacity / batch_concurrency_cap), re- launching the same job with jittered backoff; overrides the request's `batch.capacity_wait_s`. 0 means one attempt. Applied to every `klt sim` call of the run.
  --resume re-run after an interrupted batch run: every `klt sim` call re-attaches to the shard jobs recorded in its own leg directory instead of re-submitting. Same semantics as `klt sim --resume`. For a non-blocking run use `--submit-only` / `--attach` (see docs/cli/pex.md).
  --submit-only backend `batch`: extract, submit every testbench's schematic and extracted `klt sim` leg without polling, write `<outdir>/pex-submit.json` (rewritten after each leg; re-run the same command to finish an interrupted submit without new jobs for recorded legs) and exit 0 with a `submitted` status. Collect later with `--attach`. Refused with `--attach`, `--resume`, `--measure-command`, `--extract-only`, `--device-only- leg` or a non-batch backend (issue #4619).
  --attach MANIFEST collect a `--submit-only` run: re-run the same `klt pex` command with this `pex-submit.json`; each leg attaches to its recorded job(s) and the normal pex report is produced. A manifest recorded for different inputs is refused (`resume_fingerprint_mismatch`), as is an incomplete one (`pex_manifest_incomplete`) (issue #4619). Given alone -- no layout, --deck or testbenches -- the request a schema-2 `--submit-only` run recorded in the manifest is reused (issue #4692); an older manifest is refused (`pex_manifest_no_request`).
  --envelope-out PATH also write the JSON envelope (the success/`submitted` report, or the error envelope) to PATH, whatever --format is. `-o` is unchanged: it receives the extracted netlist, never the envelope (issue #4692).
  --dry-run validate the invocation and print its expansion (resolved deck, top cell, deck options, declared pins, planned legs, and one nested `klt sim --dry-run` per testbench) without extracting or simulating anything (issue #5464); exits 1 on any validation failure. Writes nothing: no netlist at -o, no --outdir tree, no --envelope-out file, and the output directory is not locked. What a dry run cannot see is named in the report's `not_checked` list. See docs/cli/pex.md. Refused with --submit-only / --attach, as `klt sim --dry-run` refuses the same pair.
  --deck-option KEY=VALUE select a caller-visible flavour of a deck's shared- geometry device family (issue #1558), as KEY=VALUE; repeatable, passed through verbatim to `klt extract --deck-option`. Today's recognised keys are gf180mcu's `poly_res` (values `1k` (default), `2k`, `3k`) and `mim_cap` (values `cap_mim_1f0_m4m5_noshield`, `cap_mim_1f5_m4m5_noshield`, `cap_mim_2f0_m4m5_noshield` (default)) and `mim_option` (`B` (default), `A`; MIM option A is the Metal2/Metal3 stack). Without this flag `klt pex` extracts against whatever the deck's own default flavour is, which is not necessarily the one the design uses -- and reports a delta computed from the wrong parasitics. An unrecognised key or value is an error, not a silently-kept default. Omitted by default, which resolves every deck exactly as before this flag existed. The resolved mapping is echoed in the JSON response's `provenance.deck.options`. See docs/cli/extract.md's 'Selecting a shared-geometry resistor flavour' section.
  --pins PINS comma-separated declared pin set (e.g. 'A,B,VDD,VSS'), passed through to `klt extract --pins` (issue #1558). Every named net not in this set keeps its name but is demoted to an internal node instead of being promoted to a top-level pin -- use it when flat extraction would otherwise promote more pins than the schematic DUT declares (the `pin_count_mismatch` shape below). Off by default -- every named net still promotes to a pin, byte-identical to today's behavior. See docs/cli/extract.md.
  --rename-declared-pins passed through to `klt extract --rename-declared-pins` (issue #2854): each surviving promoted pin net whose component labels contain exactly one --pins name is renamed to it, so the extracted DUT's .SUBCKT header carries the declared names the schematic DUT declares (required whenever a boundary net carries extra drawn labels and its declared name is only one component of KLayout's joined net name). Requires --pins. Off by default -- byte-identical to today's behavior. The effective value is echoed in the JSON response's `extraction.rename_declared_pins`.
  --label-layer ROLE=LAYER/DATATYPE read net/pin name text for one label ROLE from the given GDS layer/datatype instead of the one this --deck's curated default picked (issue #2686), as ROLE=LAYER/DATATYPE; repeatable, passed through to `klt extract --label-layer`. ROLE is `well`, `poly`, or `metal<i>` (0-based); the value `none` reads no label layer for that role. A later entry for the same ROLE wins. Use it when the layout's names sit on a text purpose the deck does not read (e.g. IHP `Metal1.text` 8/25 under `sg13cmos5l`, which reads `Metal1.pin` 8/2) -- otherwise extraction promotes no top-level pins and the extracted DUT cannot bind. An unknown ROLE is an error. Omitted by default -- byte- identical to today's behavior. The applied mapping is echoed in the JSON response's `extraction.label_layers`. See docs/cli/pex.md.
  --tie-net EXTRACTED_NET=SCHEMATIC_NET merge one reported-unbiased well/body net of the extracted netlist into a schematic net (issue #4245), as EXTRACTED_NET=SCHEMATIC_NET, before the extracted leg is simulated; repeatable. EXTRACTED_NET must be one of the report's `body_bias.unbiased_nets` (anonymous names such as `\$5`, valid for one extraction only); any other name is an error that lists the valid ones. Each tie is stated in `body_bias.tied[]` with `source: "declared"`, and a run whose every unbiased net is tied reports `body_bias.status: "tied"` (never `biased`). Omitted by default -- byte-identical to today's behavior. See docs/cli/pex.md.
  --device-model CLASS=SUBCKT write the bipolar device CLASS as an `X` call to the named PDK subcircuit SUBCKT (issue #4234), repeatable, passed through to `klt extract --device-model`. Needed under --pdk for a deck whose recognised bipolar has no curated PDK binding (gf180mcu's `bjt`), which otherwise stays a bare `Q` card ngspice cannot load. A CLASS the deck does not declare, or that already has a curated binding, is an error. Omitted by default -- byte-identical to today's behavior. The applied mapping is echoed in the JSON response's `extraction.device_models`. See docs/cli/pex.md.
  --critical-net NET scope the lateral (same-layer, sidewall) coupling- capacitance pass onto this net (issue #976, Epic #709 Phase 2a), passed through to `klt extract --critical- net`; repeatable. Off by default -- byte-identical to today's behavior. See docs/cli/extract.md's '-- critical-net' section.
  --critical-net-pattern GLOB glob form of --critical-net (issue #2974), passed through to `klt extract --critical-net-pattern`; repeatable.
  --critical-net-all every labelled net is --critical-net (issue #2974), passed through to `klt extract --critical-net-all`.
  --critical-net-exclude GLOB glob of nets left out of --critical-net-all (issue #2974), passed through to `klt extract --critical-net- exclude`; repeatable.
  --distributed-rc model every --critical-net-named net's parasitic R/C as a distributed, multi-segment ladder instead of a single lumped star (issue #977, Epic #709 Phase 2b), passed through to `klt extract --distributed-rc`; requires --critical-net. Off by default -- byte- identical to today's behavior. See docs/cli/extract.md's '--distributed-rc' section.
  --resistance-graph pass `klt extract --resistance-graph` through and write each net's terminal-aware `selected_resistance_ohm` as its lumped R in the extracted netlist where `resistance_source` is `graph` (issue #4037); other nets keep the legacy scalar. Echoed under `extraction.resistance_graph`. Cannot be combined with --distributed-rc. Off by default -- byte-identical to today's behavior. See docs/cli/pex.md.
  --resistance-graph-r-cut OHM per-cut via/contact resistance for --resistance-graph, passed through to `klt extract --resistance-graph-r- cut`; must be >= 0. Requires --resistance-graph.
  --parasitic-variant VARIANT drop parasitic elements at injection time (issue #3056); repeatable and composable. One of drop-r:NET|* (short the net's star legs into its hub -- no series R), drop-c-ground:NET|* (omit the net's ground C), or drop-c-coupling (omit every Ccc_* card). Requires --parasitics. Anything else is a usage error; a NET matching no net is reported in `warnings`. Off by default -- byte-identical to today's behavior. See docs/cli/extract.md's '--parasitic-variant' section.
  --substrate-tie-ohms OHM resistance of the substrate DC-reference tie (default 1e12, substrate floating in transient; 0 = hard tie), passed through to `klt extract --substrate-tie-ohms` (issue #3089). Must be >= 0. See docs/cli/extract.md's 'Substrate tie value' section.
  --mom-rlc-net NET substitute a caller-supplied R/L/C for this one net's Phase 1/2 lumped-RC ground model -- e.g. from a separate `klt mom` (Method-of-Moments, Epic #701) run against this net's real geometry (issue #988, Epic #709 Phase 3a), passed through to `klt extract --mom- rlc-net`. Requires at least one of --mom-rlc- resistance-ohm/--mom-rlc-capacitance-ff/--mom-rlc- inductance-nh. Off by default -- byte-identical to today's behavior. See docs/cli/extract.md's '--mom- rlc-net' section.
  --mom-rlc-resistance-ohm OHM the --mom-rlc-net net's substituted total series resistance, ohms. Requires --mom-rlc-net.
  --mom-rlc-capacitance-ff FF the --mom-rlc-net net's substituted total ground capacitance, femtofarads. Requires --mom-rlc-net.
  --mom-rlc-inductance-nh NH add one series inductor between the --mom-rlc-net net's hub and its ground capacitor, nanohenries. Purely additive. Requires --mom-rlc-net.
  --format {text,json} output format (default: text)
